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 sendMail(obj){
	
	if (!checkKeyboardCharacters(obj.myName, 'Name',10)){
		return;
	}
	
	if (obj.myCompany.value != ""){
		if (!checkKeyboardCharacters(obj.myCompany, 'Company',10)){
			return;
		}
	}

	if (obj.myEmail.value != ""){
		if (!checkEmail(obj.myEmail)){
			return;
		}
	}
	else{
		alert("Email may not be blank");
		obj.myEmail.focus();
		obj.myEmail.select();
		return;
	}
	
	if (!checkStandard(obj.myPhone,'Phone Number',4)){
		return;
	}
	
	if (!checkAllCharacters(obj.Message,'Message',4)){
		return;
	}
	
	obj.action="ThankYou.asp";
	obj.submit();

}

function stdRollover(obj,myColor){
	obj.style.color = myColor
}

function stdRollout(obj,myColor){
	obj.style.color = myColor
}

function myRollOver(obj,bgColor){
	obj.style.backgroundColor=String(bgColor)
	obj.style.color='#FFFFFF'
	obj.style.bordertop = 'solid 2px #FFFFFF'
	obj.style.borderleft = 'solid 2px #FFFFFF'	
}

function myRollOut(obj,bgColor){
	obj.style.backgroundColor=String(bgColor)
	obj.style.color='#FFFFFF'
	obj.style.bordertop = 'solid 2px #CCCCFF'
	obj.style.borderleft = 'solid 2px #9999FF'	
}
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.backgroundImage = 'url(/Images/Mgt/GButtBack_d.jpg)'
	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.backgroundImage = 'url(/Images/Mgt/GButtBack_n.jpg)'
	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 myGrEngineRollOver(obj){
	obj.style.backgroundColor = "#F48602"
	obj.style.backgroundImage = 'url(/Images/Mgt/OButtBack_d.jpg)'
	obj.style.color = '#FFFFFF'
	obj.style.bordertop = 'solid 2px #4E0004'
	obj.style.borderleft = 'solid 2px #4E0004'	
	obj.style.borderright = 'solid 1px #F6E7A1'
	obj.style.borderbottom = 'solid 1px #F6E7A1'	
}

function myGrEngineRollOut(obj){
	obj.style.backgroundColor = "#F6E7A1"
	obj.style.backgroundImage = 'url(/Images/Mgt/OButtBack_n.jpg)'
	obj.style.color = '#4E0004'
	obj.style.bordertop = 'solid 2px #F6E7A1'
	obj.style.borderleft = 'solid 2px #F6E7A1'	
	obj.style.borderright = 'solid 1px #4E0004'
	obj.style.borderbottom = 'solid 1px #4E0004'	
}

function myBlEngineRollOver(obj){
	obj.style.backgroundColor = "#8889A5"
	obj.style.backgroundImage = 'url(/Images/Mgt/GButtBack_d.jpg)'
	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 myBlEngineRollOut(obj){
	obj.style.backgroundColor = "#FFFFFF"
	obj.style.backgroundImage = 'url(/Images/Mgt/GButtBack_n.jpg)'
	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 myRedEngineRollOver(obj){
	obj.style.backgroundColor = "#990000"
	obj.style.backgroundImage = 'url(/Images/Mgt/RButtBack_d.jpg)'
	obj.style.color = '#FFFFFF'
	obj.style.bordertop = 'solid 1px #5B0505'
	obj.style.borderleft = 'solid 1px #5B0505'	
	obj.style.borderright = 'solid 1px #FFCECE'
	obj.style.borderbottom = 'solid 1px #FFCECE'	
}

function myRedEngineRollOut(obj){
	obj.style.backgroundColor = "#FF4646"
	obj.style.backgroundImage = 'url(/Images/Mgt/RButtBack_n.jpg)'
	obj.style.color = '#FFF17D'
	obj.style.bordertop = 'solid 1px #FFCECE'
	obj.style.borderleft = 'solid 1px #FFCECE'	
	obj.style.borderright = 'solid 1px #5B0505'
	obj.style.borderbottom = 'solid 1px #5B0505'	
}

function myPRollOver(obj){
	obj.style.backgroundImage = 'url(/Images/Buttons/Print_r.jpg)'	
}

function myPRollOut(obj){
	obj.style.backgroundImage = 'url(/Images/Buttons/Print_n.jpg)'
}

function myPRollDown(obj){
	obj.style.backgroundImage = 'url(/Images/Buttons/Print_d.jpg)'
}

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 vcMenuOver(obj){
	obj.style.borderTop = 'solid 1px #FFCCCC'
	obj.style.borderLeft = 'solid 1px #FFCCCC'
	obj.style.borderRight = 'solid 1px #000000'
	obj.style.borderBottom = 'solid 1px #000000'
	obj.style.backgroundColor = '#FF0000'
	obj.style.color = '#FFFFCC'
	obj.style.fontSize = '14px'
}

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

function vcMenuDown(obj){
	obj.style.borderTop = 'solid 1px #000000'
	obj.style.borderLeft = 'solid 1px #000000'
	obj.style.borderRight = 'solid 1px #FFCCCC'
	obj.style.borderBottom = 'solid 1px #FFCCCC'
	obj.style.color = '#990000'
}

function stdMenuOver(obj){
	obj.style.borderTop = 'solid 1px #FFCCCC'
	obj.style.borderLeft = 'solid 1px #FFCCCC'
	obj.style.borderRight = 'solid 1px #000000'
	obj.style.borderBottom = 'solid 1px #000000'
	obj.style.backgroundColor = '#FF0000'
	obj.style.color = '#FFFFCC'
}

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

function stdMenuDown(obj){
	obj.style.borderTop = 'solid 1px #000000'
	obj.style.borderLeft = 'solid 1px #000000'
	obj.style.borderRight = 'solid 1px #FFCCCC'
	obj.style.borderBottom = 'solid 1px #FFCCCC'
	obj.style.color = '#990000'
}

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;
}
