


function xDOM(objectID, wS) {
	return wS ? document.getElementById(objectID).style:document.getElementById(objectID);
}


function setObjVis(objectID,vis) {
	var objs = xDOM(objectID,1); 
	objs.visibility = vis;
}


function moveObjTo(objectID,x,y) {
	var objs = document.getElementById(objectID).style; 
	x=x + 'px';y=y + 'px';
	objs.left = x; objs.top = y;
}



function objTop(objectID) {
	var objs = xDOM(objectID,1); 
	return objs.top;
}



function darken(objectID) {	
	document.getElementById(objectID).style.color = 'rgb(0,0,0)';
}


// For Test Readouts
function jreadout(objectID,textstring) {  
	document.getElementById(objectID).innerHTML = textstring;
}


function popup(url,winName,w,h,t,l){
	var popupWindow = null;
	settings = 'height='+h+',width='+w+',top='+t+',left='+l;
	popupWindow = window.open(url,winName,settings);
}


function fadeOut(objectID) {
	var objs = document.getElementById(objectID).style;
	var r = 240; var g = 240; var b = 240;
	objs.color ='rgb('+r+','+g+','+b+')';
	objs.visibility="visible";
	function step() {
		r -= 20; g -= 20; b -= 20;
		if (r > 0) {
			objs.color ='rgb('+r+','+g+','+b+')';
			setTimeout(step,100);
		}
	}
	step();
}



function fadeIn(objectID,inc) {
	var objs = document.getElementById(objectID).style;
	var r = 20; var g = 20; var b = 20;
	objs.color ='rgb('+r+','+g+','+b+')';
	objs.visibility="visible";
	function step() {
		r += inc; g += inc; b += inc;
		if (r < 255) {
			objs.color ='rgb('+r+','+g+','+b+')';
			setTimeout(step,100);
		}
	}
	step();
}

function fadeinFast(objectID) {
	var objs = document.getElementById(objectID).style;
	var r = 20; var g = 20; var b = 20;
	objs.color ='rgb('+r+','+g+','+b+')';
	objs.visibility="visible";
	function step() {
		r += inc; g += inc; b += inc;
		if (r < 255) {
			objs.color ='rgb('+r+','+g+','+b+')';
			setTimeout(step,10);
		}
	}
	step();
}

	
function fadein(objectID) {
	var objs = document.getElementById(objectID).style;
	var r = 20; var g = 20; var b = 20;
	objs.color ='rgb('+r+','+g+','+b+')';
	objs.visibility="visible";
	function step() {
		r += 20; g += 20; b += 20;
		if (r<201) {
			objs.color ='rgb('+r+','+g+','+b+')';
			setTimeout(step,100);
		}
	}
	step();
}

function fadeblkfrombkg(objectID) {
	var objs = document.getElementById(objectID).style;
	var r = 192; var g = 192; var b = 224;
	objs.color ='rgb('+r+','+g+','+b+')';
	objs.visibility="visible";
	function step() {
		r -= 10; g -= 10; b -= 10;
		if (r<0) {
			r = 0;
		}
		if (g<0) {
			g = 0;
		}
		if (b<0) {
			b = 0;
		}
		objs.color ='rgb('+r+','+g+','+b+')';

		if ((r+b+g)>0) {
			setTimeout(step,100);
		}
	}
	
	step();//first executable statement
}

function faderedfrombkg(objectID) {
	var objs = document.getElementById(objectID).style;
	var r = 192; var g = 192; var b = 224;
	objs.color ='rgb('+r+','+g+','+b+')';
	objs.visibility="visible";
	function step() {
		r += 5; g -= 10; b -= 10;
		if (r>255) {
			r = 255;
		}
		if (g<0) {
			g = 0;
		}
		if (b<0) {
			b = 0;
		}
		objs.color ='rgb('+r+','+g+','+b+')';

		if ((b+g)>0) {
			setTimeout(step,100);
		}
	}
	
	step();//first executable statement
}


function floatLR(objectID) {
	var objs = document.getElementById(objectID).style;
	//var y = objs.left;
	var y = -600;
	function step() {
		y += 8;
		if (y < 380) {
			objs.left = y;
			setTimeout(step,20);
		}
	}
	step();
}

//moves object RLD to x1,y1 to x2,y2
//irregardless of where css has it initially positioned
//t is time increment, p is x-pixel increment
//this is a straight-line move, so y pixel increment will have to be scaled to x increment
function floatObject(objectID,x1,y1,x2,y2,t,p) {
	var objs = document.getElementById(objectID).style;
	moveObjTo(objectID,x1,y1);
	setObjVis(objectID,'visible');
	var x=x1;//start position
	var y=y1;
	var xd=x2-x1;//xdelta  change in x   may + or -
	var yd=y2-y1;
	var sfyx=Math.abs(yd/xd);
	var px=p;//x-axis pixels per move
	var py=p*sfyx;
	
	function step() {
		x += px;
		y += py;// round y before using !
				
			//to be continued .....

		setTimeout(step,t);

	}
	step();
}	



//this function makes a crummy arc
function arcRLD(objectID) {
	var objs = document.getElementById(objectID).style;
	//var y = objs.left;
	var x =  100;
	var y = 1000;
	var z;
	function step() {
		if (x <= 350) {
			z = parseInt(x/100);
			switch (z) {
			case 0 :
				x += 1;
				break;
			case 1 :
				x += 1;
				break;
			case 2 :
				x += 2;
				break;
			case 3 :
				x += 3;
				break;
			default :
				x += 3;
			}
			objs.top = x;
		}
		if (y >= 505) {
			z = parseInt(y/100);
			switch (z) {
			case 10 :
				y -= 2;
				break;
			case 9 :
				y -= 2;
				break;
			case 8 :
				y -= 3;
				break;
			case 7 :
				y -= 3;
				break;
			case 6 :
				y -= 3;
				break;
			default :
				y -= 4;
			}
			objs.left = y;
		}
		if (y > 505 || x < 350) {
		setTimeout(step,20);
		}
	}
	step();
}



setTimeout(function() {fadeblkfrombkg('newsR1');},1000);
setTimeout(function() {fadeblkfrombkg('newsR2');},5000);
setTimeout(function() {fadeblkfrombkg('newsR3');},9000);


//setTimeout(function() {setObjVis('news1','visible');},2000);

//setTimeout(function() {setObjVis('news2','visible');}  ,3000);
//setTimeout(function() {floatLR    ('news2'          );},3000);

//setTimeout(function() {setObjVis('timetable','visible');},6000);

//setTimeout(function() {faderedfrombkg('flat1');}, 9000);
//setTimeout(function() {fadeblkfrombkg('flat2');},12500);
//setTimeout(function() {fadeblkfrombkg('flat3');},16000);
//setTimeout(function() {fadeblkfrombkg('flat4');},19500);

//setTimeout(function() {setObjVis('pv1','visible');} ,25000);
//setTimeout(function() {arcRLD    ('pv1'          );},25000);

//setTimeout(function() {fadeblkfrombkg('pvtext');}  ,30000);

//setTimeout(function() {setObjVis('pvtext','hidden');}       ,35000);
//setTimeout(function() {setObjVis('fourampstext','visible');},35000);

//setTimeout(function() {moveObjTo('fouramps',500,350);}  ,34000);
//setTimeout(function() {setObjVis('fouramps','visible');},35000);
//setTimeout(function() {setObjVis('pv1','hidden');}      ,36000);





