// convert all characters to lowercase to simplify testing
var agt=navigator.userAgent.toLowerCase();

// *** BROWSER VERSION ***
// Note: On IE5, these return 4, so use is_ie5up to detect IE5.
var is_major = parseInt(navigator.appVersion);
var is_minor = parseFloat(navigator.appVersion);


// Note: Opera and WebTV spoof Navigator.  We do strict client detection.
// If you want to allow spoofing, take out the tests for opera and webtv.
var is_moz  = ((agt.indexOf('mozilla')!=-1) && (agt.indexOf('spoofer')==-1) && (agt.indexOf('compatible') == -1) && (agt.indexOf('opera')==-1) && (agt.indexOf('webtv')==-1) && (agt.indexOf('hotjava')==-1));
var is_ie   = ((agt.indexOf("msie") != -1) && (agt.indexOf("opera") == -1));

// Highlight the element pointed by "this" and make the cursor a hand
function Colorize(element){
	element.style.background = '#7C9CC4';
	element.style.color = '#FFFFFF';
	if (is_moz){
		document.body.style.cursor = 'pointer';
	} else {
		document.body.style.cursor = 'hand';
	}
}

// Reverse the colorize
function DeColorize(element){
	element.style.background = 'none';
	element.style.color = '#4B4B4B';
	document.body.style.cursor = '';

}

function WinOpen(url,a,b){

	random_name_value = Math.floor(Math.random()*100000);

	properties = 'history=no,toolbar=0,location=0,directories=0,scrollbars=yes,status=0,menubar=0,width=' + a + ',height=' + b + '';
	window.open(url,'win_'+random_name_value,properties) ;
}

function WinOpenNamed(url,name,a,b){
	properties = 'history=no,toolbar=0,location=0,directories=0,scrollbars=yes,status=0,menubar=0,width=' + a + ',height=' + b + '';
	window.open(url,name,properties) ;
}

var hideLayerFlag = true;

function ChangeHideLayerFlag(){
	hideLayerFlag = !hideLayerFlag;
}

function showlayerfrontend(left){
	mylayer = document.getElementById('statuslayer');
	mylayer.style.left = (screen.width/2)-left;
	mylayer.style.visibility = 'visible';
}

function hidelayerfrontend(closeFlag){

	if (closeFlag){
		hideLayerFlag = true;
	}

	if (hideLayerFlag){
		mylayer = document.getElementById('statuslayer');
		mylayer.style.visibility = 'hidden';
	}

}

function showlayer(myy,mydate,mynote,left){
	//alert(document.body.scrollTop);
	//alert(myy);
	mylayer = document.getElementById('statuslayer');
	if (left){
		mylayer.style.left = left;
	} else {
		mylayer.style.left = (screen.width/2)-120;
	}

	if (document.all){
		mylayer.style.top = Number(document.body.scrollTop) + Number(myy) + 10;
	} else {
		mylayer.style.top = Number(myy) + 15;
	}
	/*
	mylayer.innerHTML = '	<table width="300" cellpadding="0" cellspacing="0" border="0" align="center">\
								<tr>\
									<td valign="top" width="240"><h6>'+mynote+'</td>\
								</tr>\
							</table>';
	*/
	mylayer.innerHTML = mynote;
	mylayer.style.visibility = 'visible';
}

function hidelayer(closeFlag){

	if (closeFlag){
		hideLayerFlag = true;
	}

	if (hideLayerFlag){
		mylayer = document.getElementById('statuslayer');
		mylayer.style.left = 0;
		mylayer.style.top = 0;
		mylayer.innerHTML = '';
		mylayer.style.visibility = 'hidden';
	}

}

