function findPosX(obj)
{
  var curleft = 0;
  if(obj.offsetParent)
      while(1) 
      {
        curleft += obj.offsetLeft;
        if(!obj.offsetParent)
          break;
        obj = obj.offsetParent;
      }
   else if(obj.x)
      curleft += obj.x;
   return curleft;
}
function findPosY(obj)
{
  var curtop = 0;
  if(obj.offsetParent)
      while(1) 
      {
        curtop += obj.offsetTop;
        if(!obj.offsetParent)
          break;
        obj = obj.offsetParent;
      }
   else if(obj.x)
      curtop += obj.x;
   return curtop;
}
var timerId;
function showLinks( num,element ) {
	
	clearTimeout(timerId);
	
	menuElement='submenu_'+num;
	menuBlock = document.getElementById(menuElement);
	
	hideLinks(0);
	menuBlock.style.display='block';
	menuBlock.style.position='absolute';
	menuBlock.style.left=(findPosX(element)-1)+"px";
	elementHeight=element.offsetHeight;
	menuBlock.style.top=(findPosY(element)+elementHeight+1)+"px";
}
function stayOpen() {
	clearTimeout(timerId);
}
function hideLinks(time) {
	if (time!=0 || time==undefined) {
		timedHide(2000);
	} else {
		instantHide();
	}
}
function timedHide(time) {
	clearTimeout(timerId);
	timerId=setTimeout('instantHide()',time);
}
function instantHide() {
	innerDivs = document.getElementById('mainMenu').getElementsByTagName('div');
	i=0
	while (i<innerDivs.length) {
		thisMenu = innerDivs[i];
		thisMenu.style.display='none';
		i++;
	}	
}
function colourAltLines( tableID,col1,col2 ) {
	if (tableID!="") {
		var table = document.getElementById(tableID);
		var trs = table.getElementsByTagName('tr');
		var output = "";
		for (i=0;i<trs.length;i++) {
			oddCheck = i%2;
			if (oddCheck) {
				trs[i].bgColor=col1;
			} else {
				trs[i].bgColor=col2;
			}
		}
	}
	return output;
}

var scrl = 0;
var speed = 100;

function startScrolling() {
	var theScrollBox = document.getElementById('scrollerBox');
	var scrlHt = theScrollBox.scrollHeight;
	if (theScrollBox.offsetHeight<scrlHt) {
	scrl++;
	theScrollBox.scrollTop=scrl;
	if (scrl<=scrlHt-100) {
		setTimeout('startScrolling()',speed);
	} else {
		scrl=0;
		startScrolling();
	}
	}
}

function stripHTML(oldString) {

   var newString = "";
   var inTag = false;
   for(var i = 0; i < oldString.length; i++) {
   
        if(oldString.charAt(i) == '<') inTag = true;
        if(oldString.charAt(i) == '>') {
              inTag = false;
              i++;
        }
   
        if(!inTag) newString += oldString.charAt(i);

   }

   return newString;
}

function getTickerText(serverPage,objID) {
		
	//Create a boolean variable to check for a valid Internet Explorer instance.
	var xmlhttp = false;
	
	//Check if we are using IE.
	try {
		//If the Javascript version is greater than 5.
		xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
	} catch (e) {
		//If not, then use the older active x object.
		try {
			//If we are using MS.
			xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
		} catch (e) {
			//Else we must be using a non-IE browser.
			xmlhttp = false;
		}
	}
	
	//If we are using a non-IE browser, create a javascript instance of the object.
	if (!xmlhttp && typeof XMLHttpRequest != 'undefined') {
		xmlhttp = new XMLHttpRequest();
	}
	
	
	/*
	var xmlhttp;
	
	//If, the activexobject is available, we must be using IE.
	if (window.ActiveXObject){
		xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
	} else {
		//Else, we can use the native Javascript handler.
		xmlhttp = new XMLHttpRequest();
	}
	*/
		
	var obj = document.getElementById(objID);
	xmlhttp.open("GET", serverPage);
	xmlhttp.onreadystatechange = function() {
		if (xmlhttp.readyState == 4 && xmlhttp.status == 200) {
			obj.innerHTML = xmlhttp.responseText;
		}
	}
	xmlhttp.send(null);
}