if(navigator.userAgent.indexOf('Win') == -1) {
        platform = 'MAC';
} else {
        platform = 'WIN';
}

if ((navigator.appName == "Netscape")||(navigator.appName == "Opera")){	// Netscape
	if (parseInt(navigator.appVersion) <= 4){
		myStyles = "";
		myAll = ".";
		myBrowser = "NS";
	}
	else{
		myStyles = "').style";
		myAll = ".getElementById('";
		myBrowser = "NS6";
	}
}
else if (document.all){		//IE
	myStyles = ".style";
	myAll = ".all.";
	myBrowser = "IE";
}

function buttonImageSwap(event,obj,imageName){
	if (event == 1){
		obj.src = ('/images/' + imageName + '_n.jpg');
	}
	if (event == 2){
		obj.src = ('/images/' + imageName + '_r.jpg');
	}
	if (event == 3){
		obj.src = ('/images/' + imageName + '_d.jpg');
	}
	if (event == 4){
		obj.src = ('/images/' + imageName + '_n.jpg');
	}
}

function stdRollover(obj, myColor) {
    obj.style.color = myColor;
    //obj.style.textDecoration = "underline";
}

function stdRollout(obj,myColor){
    obj.style.color = myColor
    //obj.style.textDecoration = "none";
}

var myWin
function openNewWindow(winWidth,winHeight,pageRef,myTitle,sb,tb,sc,rs,mu){

	if (navigator.appName == "Netscape"){ // Netscape
		if (parseInt(navigator.appVersion) <= 4){
			myWidth = (screen.width - winWidth) / 2;
			myHeight = (screen.height - winHeight) / 2;
			myBrowser2 = "NS";
		}
		else{
			myWidth = (screen.width - winWidth) / 2;
			myHeight = (screen.height - winHeight) / 2;
			myBrowser2 = "NS6";
		}
	}
	else if (document.all){ //IE
		myWidth = (screen.width - winWidth) / 2;
		myHeight = (screen.height - winHeight) / 2;
		myBrowser2 = "IE";
	}
	myParams = "width=" + winWidth + ",height=" + winHeight + ",status=" + sb + ",toolbar=" + tb + ",scrollbars=" + sc + ",resizable=" + rs + ",menubar=" + mu

 	myWin = window.open("",String(myTitle),String(myParams))
	myWin.moveTo(myWidth,myHeight)
	myWin.focus()
 	myWin.document.location = pageRef

}

function stdEngineRollover(obj){
	obj.style.color = "#FF0000"
}

function stdEngineRollout(obj){
	obj.style.color = "#0000CC"
}

function myEngineRollOver(obj){
	obj.style.backgroundColor = "#8889A5"
	obj.style.color = '#FFFFFF'
	obj.style.bordertop = 'solid 1px #272939'
	obj.style.borderleft = 'solid 1px #383A4C'
	obj.style.borderright = 'solid 1px #E4E7FF'
	obj.style.borderbottom = 'solid 1px #E4E7FF'
}

function myEngineRollOut(obj){
	obj.style.backgroundColor = "#FFFFFF"
	obj.style.color = '#000000'
	obj.style.bordertop = 'solid 1px #E4E7FF'
	obj.style.borderleft = 'solid 1px #E4E7FF'
	obj.style.borderright = 'solid 1px #383A4C'
	obj.style.borderbottom = 'solid 1px #272939'
}

function myGaEngineRollOver(obj) {
    obj.style.backgroundColor = "#3366FF"
    obj.style.color = '#FFFFFF'
    obj.style.borderTop = 'solid 1px #9999FF'
    obj.style.borderLeft = 'solid 1px #9999FF'
    obj.style.borderRight = 'solid 1px #000066'
    obj.style.borderBottom = 'solid 1px #000066'
}

function myGaEngineRollOut(obj) {
    obj.style.backgroundColor = "#D4D3E3"
    obj.style.color = '#000000'
    obj.style.borderTop = 'solid 2px #D4D3E3'
    obj.style.borderLeft = 'solid 2px #D4D3E3'
    obj.style.borderRight = 'solid 1px #575668'
    obj.style.borderBottom = 'solid 1px #575668'
}

function myGaEngineRollDown(obj) {
    obj.style.backgroundColor = "#3366FF"
    obj.style.color = '#99CCFF'
    obj.style.borderTop = 'solid 1px #000066'
    obj.style.borderLeft = 'solid 1px #000066'
    obj.style.borderRight = 'solid 1px #9999FF'
    obj.style.borderBottom = 'solid 1px #9999FF'
}

function myGrEngineRollOver(obj){
	obj.style.backgroundColor = "#00CC00"
	obj.style.color = '#FFFFFF'
	obj.style.borderTop = 'solid 2px #99FF99'
	obj.style.borderLeft = 'solid 2px #99FF99'
	obj.style.borderRight = 'solid 1px #003300'
	obj.style.borderBottom = 'solid 1px #003300'
}

function myGrEngineRollOut(obj){
	obj.style.backgroundColor = "#00CC00"
	obj.style.color = '#003300'
	obj.style.borderTop = 'solid 2px #99FF99'
	obj.style.borderLeft = 'solid 2px #99FF99'
	obj.style.borderRight = 'solid 1px #003300'
	obj.style.borderBottom = 'solid 1px #003300'
}

function myGrEngineRollDown(obj){
	obj.style.backgroundColor = "#00CC00"
	obj.style.color = '#003300'
	obj.style.borderTop = 'solid 2px #003300'
	obj.style.borderLeft = 'solid 2px #003300'
	obj.style.borderRight = 'solid 1px #99FF99'
	obj.style.borderBottom = 'solid 1px #99FF99'
}

function myBlEngineRollOver(obj){
	obj.style.backgroundColor = "#3366FF"
	obj.style.color = '#FFFFFF'
	obj.style.borderTop = 'solid 1px #9999FF'
	obj.style.borderLeft = 'solid 1px #9999FF'
	obj.style.borderRight = 'solid 1px #000066'
	obj.style.borderBottom = 'solid 1px #000066'
}

function myBlEngineRollDown(obj){
	obj.style.backgroundColor = "#3366FF"
	obj.style.color = '#99CCFF'
	obj.style.borderTop = 'solid 1px #000066'
	obj.style.borderLeft = 'solid 1px #000066'
	obj.style.borderRight = 'solid 1px #9999FF'
	obj.style.borderBottom = 'solid 1px #9999FF'
}

function myBlEngineRollOut(obj){
	obj.style.backgroundColor = "#FFFFFF"
	obj.style.color = '#000000'
	obj.style.borderTop = 'solid 1px #FFFFFF'
	obj.style.borderLeft = 'solid 1px #FFFFFF'
	obj.style.borderRight = 'solid 1px #CCCCCC'
	obj.style.borderBottom = 'solid 1px #CCCCCC'
}

function myRedEngineRollOver(obj){
	obj.style.backgroundColor = "#FF0000"
	obj.style.color = '#FFFFFF'
	obj.style.borderTop = 'solid 1px #FF9999'
	obj.style.borderLeft = 'solid 1px #FF9999'
	obj.style.borderRight = 'solid 1px #660000'
	obj.style.borderBottom = 'solid 1px #660000'
}

function myRedEngineRollOut(obj){
	obj.style.backgroundColor = "#FF4646"
	obj.style.color = '#FFF17D'
	obj.style.borderTop = 'solid 1px #FF9999'
	obj.style.borderLeft = 'solid 1px #FF9999'
	obj.style.borderRight = 'solid 1px #660000'
	obj.style.borderBottom = 'solid 1px #660000'
}

function myRedEngineRollDown(obj){
	obj.style.backgroundColor = "#FF4646"
	obj.style.color = '#FFF17D'
	obj.style.borderTop = 'solid 1px #660000'
	obj.style.borderLeft = 'solid 1px #660000'
	obj.style.borderRight = 'solid 1px #FF9999'
	obj.style.borderBottom = 'solid 1px #FF9999'
}

function format(expr, decplaces){

	var str = "" + Math.round(eval(expr) * Math.pow(10,decplaces))
	while (str.length <= decplaces){
		str = "0" + str
	}
	var decpoint = str.length - decplaces
	return str.substring(0,decpoint) + "." + str.substring(decpoint,str.length)
}

function displayLink(url){
	if (url != "#"){
		if (url.indexOf("http") == -1){
			window.open("/Images/Links/" + url)
		}
		else{
			window.open(url)
		}
	}
}

function galleryImageUpdate(iRef, iName){
	imgRef = iRef
	sImage.src = "/Images/Gallery/" + imgRef
	if (iName == "0"){
		iName = "&nbsp;"
		sImage.alt = ""
	}
	else{
		sImage.alt = iName
	}
	document.getElementById('first2').innerHTML = iName
}

function showPage(pRef){
	if (pRef != "MGT"){
		document.location = pRef
	}
	else{
		window.open("/Mgt/Index.aspx")
	}
}

var fSize
fSize = 0

function upDateFontSize(val) {
	if (val == '0'){
		if (fSize < 0){
			val = fSize * -1
		}
		else if (fSize > 0){
			val = 0 - fSize
		}
	}
	fSize = parseInt(fSize) + parseInt(val)
	var s = document.styleSheets[0].cssRules || document.styleSheets[0].rules;

	for(var i=0, n=s.length; i<n; i++) {
		var z = s[i].selectorText;
		if (s[i].style.cursor == ""){
			if (s[i].style.fontSize != ""){
				s[i].style.fontSize = (parseInt(s[i].style.fontSize) + parseInt(val)) + "pt"
			}
		}
	}
	getElementsByClassName(document,"td", val)
}

function getElementsByClassName(oElm, strTagName, val){
	var arrElements = (strTagName == "*" && oElm.all)? oElm.all : oElm.getElementsByTagName(strTagName);
	var arrReturnElements = new Array();
	var oElement;
	for(var i=0; i<arrElements.length; i++){
		oElement = arrElements[i];
		arrReturnElements.push(oElement);
	}

	for(i=0;i<arrReturnElements.length;i++){
		if (arrReturnElements[i].style.cursor == ""){
			if (arrReturnElements[i].style.fontSize != ""){
				arrReturnElements[i].style.fontSize = (parseInt(arrReturnElements[i].style.fontSize) + parseInt(val)) + "pt"
			}
		}
	}

}

function showGalleryPage(catId){
	document.galleryFrm.pId.value = document.mMenu.pId.value
	document.galleryFrm.cId.value = catId
	document.galleryFrm.submit()
}

function scrollChange(){
	if (String(eval("document" + myAll + "overlay")) != "undefined"){
		if (eval("document" + myAll + "overlay" + myStyles + ".visibility") == "visible"){
			getPageSizeWithScroll()
		}
	}
}
function getPageSizeWithScroll(){

	if (window.innerHeight && window.scrollMaxY) {// Firefox
		yWithScroll = window.innerHeight + window.scrollMaxY;
		xWithScroll = window.innerWidth + window.scrollMaxX;
	}
	else if (document.body.scrollHeight > document.body.offsetHeight){ // all but Explorer Mac
		yWithScroll = document.body.scrollHeight;
		xWithScroll = document.body.scrollWidth;
	}
	else { // works in Explorer 6 Strict, Mozilla (not FF) and Safari
		yWithScroll = document.body.offsetHeight;
		xWithScroll = document.body.offsetWidth;
	}
	eval("document" + myAll + "overlay" + myStyles + ".height='" + yWithScroll + "'")
	eval("document" + myAll + "overlay" + myStyles + ".width='" + xWithScroll + "'")

	arrayPageSizeWithScroll = new Array(xWithScroll,yWithScroll);

    	return arrayPageSizeWithScroll;
}
 
function showMenuLayer(mId){
	hideMenuLayers()
	if (document.getElementById("menuLyr" + mId) != null){
		eval("document" + myAll + "menuLyr" + mId + myStyles + ".visibility='visible'")
	}
}
 
function showSMenuLayer(mId){
	if (document.getElementById("menuLyr" + mId) != null){
		eval("document" + myAll + "menuLyr" + mId + myStyles + ".visibility='visible'")
	}
}
 
function hideMenuLayers(){
	var inputs = document.getElementsByTagName("div");
	for (var i=0; i < inputs.length; i++) {
		if (inputs[i].id.indexOf("menuLyr") != -1){
			eval("document" + myAll + inputs[i].id + myStyles + ".visibility='hidden'")
		}
	}
} 

function hideSubMenuLayers(){
	var inputs = document.getElementsByTagName("div");
	for (var i=0; i < inputs.length; i++) {
		if (inputs[i].id.indexOf("menuLyrs") != -1){
			eval("document" + myAll + inputs[i].id + myStyles + ".visibility='hidden'")
		}
	}
}

function doNothing(){
}

function showMgtPage(pageName){
	document.location = "/Mgt/" + pageName;	
}

function showSidePanel(nameRef){
	document.getElementById("newsContent").style.display = 'none';
	document.getElementById("newsContent").style.visibility = 'hidden';
	
	document.getElementById("eventContent").style.display = 'none';
	document.getElementById("eventContent").style.visibility = 'hidden';
          
	if (nameRef == "N") {
		document.getElementById("newsContent").style.display = '';
		document.getElementById("newsContent").style.visibility = 'visible';
		document.events.src = ('/images/buttons/events_n.jpg');
	}          
	if (nameRef == "E") {
		document.getElementById("eventContent").style.display = '';
		document.getElementById("eventContent").style.visibility = 'visible';
		document.news.src = ('/images/buttons/news_n.jpg');
	}
}
