
function MM_reloadPage(init)
{  //reloads the window if Nav4 resized
	if (init==true)	with (navigator)
	{
		if ((appName=="Netscape")&&(parseInt(appVersion)==4))
		{
		    document.MM_pgW=innerWidth; document.MM_pgH=innerHeight; onresize=MM_reloadPage;
		}
	}
	else if (innerWidth!=document.MM_pgW || innerHeight!=document.MM_pgH) location.reload();
}
MM_reloadPage(true);
function change_background(val){
	document.getElementById('tr'+val).style.backgroundColor="#DDDDDD";
}
function reset_bg(val,orig_col)
{
	document.getElementById('tr'+val).style.backgroundColor=orig_col;	
}
function random_generator(no_of_args){
    var rand_no= Math.round(Math.random()*no_of_args);
    return rand_no;
}

var spans_fromleft = new Array();
var spans_fromtop = new Array();
var forms_position = new Array();
var extra_left;
var extra_top;
var offset;
var offset;
function posn_init() {
	spans = document.getElementsByTagName('span');
	forms = document.getElementsByTagName('form');
	var i=0;
    for (si=0; si<spans.length; si++) {
        thisSpan = spans[si]; 
		if (((' '+thisSpan.id+' ').indexOf("from_left") != -1) && (thisSpan.id)) { //alert(i + '  '+ thisSpan.id);
			spans_fromleft[i] = thisSpan;
			i++;
		}
	}
	i=0;
    for (si=0; si<spans.length; si++) {
        thisSpan = spans[si]; 
		if (((' '+thisSpan.id+' ').indexOf("from_top") != -1) && (thisSpan.id)) { //alert(i + '  '+ thisSpan.id);
			spans_fromtop[i] = thisSpan;
			i++;
		}
	}
	i=0;
    for (fi=0; fi<forms.length; fi++) {
        thisForm = forms[fi]; 
		if (((' '+thisForm.id+' ').indexOf("adpositions") != -1) && (thisForm.id)) { //alert(i + '  '+ thisForm.id);
			forms_position[i] = thisForm;
			i++;
		}
	}
	mapObject = document.getElementById('map');
	extra_top = getY(mapObject); //alert('from top: '+extra_top);
	extra_left = getX(mapObject); //alert('from left: '+extra_left);
	if (window.ActiveXObject) {
		offset = 2; //In IE if the user clicks on the image, the ad is placed slightly below the click (around 2px).
	} else {
		offset = 0;
	}
}
//Y position of an element(absolute)
function getY( oElement ){
	var iReturnValue = 0;
	while( oElement != null ) {
		iReturnValue += oElement.offsetTop;
		oElement = oElement.offsetParent;
	}
	return iReturnValue;
}
//X position of an element(absolute)
function getX( oElement ){
	var iReturnValue = 0;
	while( oElement != null ) {
		iReturnValue += oElement.offsetLeft;
		oElement = oElement.offsetParent;
	}
	return iReturnValue;
}
function display_location(ePass,extra_left,extra_top){
	fromtop = mouseY(ePass) - extra_top - offset;
	fromleft = mouseX(ePass) - extra_left - offset;
	for(var si=0; si<spans_fromtop.length; si++) {
		spans_fromtop[si].innerHTML = fromtop;
	}
	for(var si=0; si<spans_fromleft.length; si++) {
		spans_fromleft[si].innerHTML = fromleft;
	}
	window.status = "Top: "+fromtop+"  Left: "+fromleft;
}
function hide_location() {
	window.status = "";
	for(var si=0; si<spans_fromtop.length; si++) {
		spans_fromtop[si].innerHTML = '0';
	}
	for(var si=0; si<spans_fromleft.length; si++) {
		spans_fromleft[si].innerHTML = '0';
	}
}
function doMouseMove(ePass,textObj) {
	var leftspace = mouseX(ePass) + 10;
	var topspace = mouseY(ePass) + 20;
	textObj.style.visibility ="visible";
	textObj.style.zindex = +50;
	textObj.style.left = leftspace + 'px';
	textObj.style.top= topspace + 'px';
}
function mouseX(evt){
	if (evt.pageX)
		return evt.pageX;
	else if (evt.clientX)
		return evt.clientX + (document.documentElement.scrollLeft ?
			   document.documentElement.scrollLeft :
			   document.body.scrollLeft);
	else
		return null;
}
function mouseY(evt){
	if (evt.pageY)
		return evt.pageY;
	else if (evt.clientY)
		return evt.clientY + (document.documentElement.scrollTop ?
			   document.documentElement.scrollTop :
			   document.body.scrollTop);
	else
		return null;
}
function disappear(ePass,obj) {	
	obj.style.visibility="hidden";
}
function addLoadEvent(func) {
  var oldonload = window.onload;
  if (typeof window.onload != 'function') {
    window.onload = func;
  } else {
    window.onload = function() {
      oldonload();
      func();
    }
  }
}

		
function hide_object(obj_id) { 
//alert('hide object called ' + obj_id);
	var MyObj = document.getElementById(obj_id);
	if(MyObj) {
		MyObj.style.visibility = 'hidden';	
	}
}
function show_object(obj_id) { //alert('show object called ' + obj_id);
	var MyObj = document.getElementById(obj_id);
	if(MyObj) {
		MyObj.style.visibility = 'visible';	
	}
}
// Not needed function

function CheckIsIE()
{
	if (navigator.appName.toUpperCase() == 'MICROSOFT INTERNET EXPLORER') { //alert('ie');
		return true;
	} else { //alert('not ie');
		return false; 
	}
} 
