function getElementId(id) {
	var returnVar = null;
	if (document.getElementById) {
		returnVar = document.getElementById(id);
	}
	else if (document.all) {
		returnVar = document.all[id];
	}
	else if (document.layers) {
		returnVar = document.layers[id];
	}
	return returnVar;
}

function popUpMap()
{
	day = new Date();
	id = day.getTime();
	eval("page" + id + " = window.open('/map.html', '" + id + "', 'toolbar=0,scrollbars=0,location=0,statusbar=0,menubar=0,resizable=0,width=576,height=500,left = 352,top = 262');");
}

function loadWindow(target,file)
{
	target.window.location.href = domainprefix+file;
	window.self.close();
}

function substr_count(haystack, needle, offset, length)
{
	// Returns the number of times a substring occurs in the string 
	// *	 example 1: substr_count('John Fallis', 'John');
	// *	 returns 1: 3
	// *	 example 2: substr_count('John Fallis', 'John', 'J', 1);
	// *	 returns 2: 0
	// *	 example 3: substr_count('John Fallis', 'John', 'F', 0, 6);
	// *	 returns 3: false
	var pos = 0, cnt = 0;
 
	haystack += '';
	needle += '';
	if(isNaN(offset)) offset = 0;
	if(isNaN(length)) length = 0;
	offset--;
 
	while( (offset = haystack.indexOf(needle, offset+1)) != -1 ){
		if(length > 0 && (offset+needle.length) > length){
			return false;
		} else{
			cnt++;
		}
	}
 
	return cnt;
}

function print_selected_area(area)
{
	var DocumentContainer = document.getElementById(area);
	var WindowObject = window.open('', "TrackHistoryData", 
								"width=550,height=325,top=200,left=250,toolbars=no,scrollbars=yes,status=no,resizable=no");
	WindowObject.document.writeln(DocumentContainer.innerHTML);
	WindowObject.document.close();
	WindowObject.focus();
	WindowObject.print();
	WindowObject.close();
}

function doBlink()
{
	// IE Fix for blinking text
	var blink = document.all.tags("BLINK")
	for (var i=0; i<blink.length; i++)
		blink[i].style.visibility = blink[i].style.visibility == "" ? "hidden" : "" 
}

function startBlink()
{
	if (document.all)
		setInterval("doBlink()",1000)
}
window.onload = startBlink;
