// ###############################
// Page setup and layout
// ###############################

function setmyCSize() { alert("call to removed function"); }
var myOffsetW = 990;
var idealWidth = 990;
var myOffsetH = 900;
var minTop = 0;
var minLeft = 0;
var theX = 0;
var theY = 0;
var theMiddle = 0;
var minCH = 200;
var TheLeftEdge = minLeft;
var theTopEdge = minTop;
// var mapOn = 0;
var isContent=0;
var theContent = '';
var adBoxOfS = "";
var thisPadder = "0px";
var topCoffset = 185;
var bannerHeight = 256;
var mapStatus = 0;
var flashSize = 400;
var widthOffset = 990;
var bottomOffset = 40;
var topOffset = 62;
var TheLeftEdge 
var TheRightEdge
// if (document.getElementById('bannerBody')) { 	swfobject.registerObject("bannerBody", "9.0.115", "expressInstall.swf"); 	}
// if (document.getElementById('imgBox')) { 		swfobject.registerObject("imgBox", "9.0.115", "expressInstall.swf"); 		}

var flashvars = {};
var params = {};
	params.wmode = "transparent";
	params.allowscriptaccess = "sameDomain";
var attributes = {};
// swfobject.embedSWF("untitled.swf", "flaContainer", "800", "600", "9.0.0", "expressInstall.swf", flashvars, params, attributes);
			
// ################################################################
//  Preload timers and page set up 
// ################################################################
function preLoad() { 	// I load the page.
	// swfobject.embedSWF("landyachtz8.swf", "bannerBody", "531", "72", "9.0.115", "expressInstall.swf", flashvars, params, attributes);
	doContent();
	reBox();
	window.onresize = reBox;
	doAlphaChange(document.getElementById('topBanner'),0,100,20,10,1);
	time1a = setTimeout("doAlphaChange(document.getElementById('NavBackground'),0,100,20,10,1);",100);
	// time1a = setTimeout("doAlphaChange(document.getElementById('newsletter'),0,100,20,10,1);",1000);
	time2 = setTimeout("reBox();",3000);
//	time2 = setTimeout("doAlphaChange(document.getElementById('bg_Top_Left'),0,100,50,10,1);",10);
//	time3 = setTimeout("doAlphaChange(document.getElementById('bg_Top_Right'),0,100,50,10,1);",200);
//	time4 = setTimeout("doAlphaChange(document.getElementById('bg_Bottom_Left'),0,100,50,10,1);",400);
//	time5 = setTimeout("doAlphaChange(document.getElementById('bg_Bottom_Right'),0,100,50,10,1);",600);
	time6 = setTimeout("doAlphaChange(document.getElementById('bottomBar'),0,100,50,10,1);",2000);
/*	time7a = setTimeout("colorFlash();",750);
	time7b = setTimeout("colorFlash();",1500);
	time8 = setTimeout("colorFlash();",2500);
	time9 = setTimeout("colorFlash();",3500);
	time10 = setTimeout("colorFlash();",4500);
	time11 = setTimeout("colorFlash();",5500);
	time12 = setTimeout("colorFlash();",6500);
	time12 = setTimeout("colorFlash();",7500);
	time12 = setTimeout("colorFlash();",8500);
	time12 = setTimeout("colorFlash();",9500);
	time12 = setTimeout("colorFlash();",10500);
	time12 = setTimeout("colorFlash();",11500); */
	if (document.getElementById('makeMeMap'))	{ loadMap(); }
}
function loadMap() {
	map = "";
	var botRight = new GControlPosition(G_ANCHOR_BOTTOM_RIGHT, new GSize(10,10));
	var marker = new GMarker(new GPoint(-123.081465 , 49.273881 ));
		map = new GMap(document.getElementById("makeMeMap"));
		map.addControl(new GSmallMapControl(), botRight);	
		map.centerAndZoom(new GPoint(-123.081465 , 49.273881 ), 2);
		map.addOverlay(marker);
}
// ################################################################
//  color change functions for various elements
// ################################################################
function getFlashMovie(movieName) {
	var isIEx = navigator.appName.indexOf("Microsoft") != -1;
	return (isIEx) ? window[movieName] : document[movieName];
}
 function colorFlash() { /*
 	var obj = swfobject.getObjectById("bannerBody");
	if (obj && typeof obj.logoColor != "undefined") {
		obj.logoColor('0x'+darkColor);
	} else {
		// swfobject.embedSWF("landyachtz2.swf", "bannerBody", "531", "72", "9.0.115", "expressInstall.swf", flashvars, params, attributes);
    	swfobject.registerObject("bannerBody", "9.0.115", "expressInstall.swf");
		swfobject.embedSWF("landyachtz8.swf", "bannerBody", "531", "72", "9.0.115", "expressInstall.swf", flashvars, params, attributes);
		// document.getElementById('banner').innerHTML=document.getElementById('banner').innerHTML+'I could not find the flash - so I attempted to reregister the object...<br>';
		// swfobject.getObjectById("bannerBody").logoColor('0x'+darkColor);
	} */ 
}
function changecss(theClass,element,value) {
	 var cssRules;
	 if (document.all) { cssRules = 'rules'; }
	 else if (document.getElementById) { cssRules = 'cssRules'; }
	 var added = false;
	 for (var S = 0; S < document.styleSheets.length; S++){
	  for (var R = 0; R < document.styleSheets[S][cssRules].length; R++) {
	   if (document.styleSheets[S][cssRules][R].selectorText == theClass) {
	    if(document.styleSheets[S][cssRules][R].style[element]){
	    document.styleSheets[S][cssRules][R].style[element] = value;
	    added=true;
		break;
	    }
	   }
	  }
	/*
	if(!added){
		if(document.styleSheets[S].insertRule){
			document.styleSheets[S].insertRule(theClass+' { '+element+': '+value+'; }',document.styleSheets[S][cssRules].length);
		} else if (document.styleSheets[S].addRule) {
			document.styleSheets[S].addRule(theClass,element+': '+value+';');
		}
	  }
	  */
	 }
}

function changeColor(newDColor,newLColor) { 
	darkColor = newDColor;
	liteColor = newLColor;
	time7 = setTimeout("colorFlash();",2000);
	// drawBanner();
	reBox();
	changecss('.LColor','backgroundColor','#'+liteColor);
	changecss('.DColor','backgroundColor','#'+darkColor);
	changecss('.DCTitle','color','#'+darkColor);
	changecss('.LCTitle','color','#'+liteColor);
	changecss('.DCMain','color','#'+darkColor);
	changecss('.LCMain','color','#'+liteColor);
	changecss('.DCLine','borderTop','1px solid #'+darkColor);
	changecss('.DCBorder','border','1px solid #'+darkColor)
	changecss('.LCBorder','border','1px solid #'+liteColor)
}


// ################################################################
//  Draw main flash banner
// ################################################################
function drawBanner() {
	swfobject.embedSWF("LYbanner.swf", "imgBox", "990", flashSize, "9.0.115", "expressInstall.swf", flashvars, params, attributes);
}
 
// ################################################################
//  Page set up and div positions
// ################################################################

function navLeft(){ return TheLeftEdge; }

function reBox() {
	var TheCheat = document.getElementById('cheater');
	var TheCBox = document.getElementById('contentbox');
	var RealSizeH = TheCheat.offsetHeight;
	var RealSizeW = TheCheat.offsetWidth;
	var RealCSizeH = TheCBox.offsetHeight;
	var RealCSizeW = TheCBox.offsetWidth;
	var TheMiddle = Math.round((RealSizeW / 2)-1.4);
		TheLeftEdge = (TheMiddle - (990 / 2));
		TheRightEdge = (TheMiddle + (990 / 2));
	var TheContentHeight = (RealSizeH - bottomOffset - topOffset - 30 - 5); 
	if (TheLeftEdge <= minLeft) {
		TheLeftEdge = minLeft;
		TheRightEdge = widthOffset;
		TheMiddle = widthOffset / 2;
		
		document.getElementById('NavBackground').style.width = widthOffset+"px";
		document.getElementById('topBanner').style.width = 1366+widthOffset+"px";
	} else {
		document.getElementById('NavBackground').style.width = RealSizeW+"px";
		document.getElementById('topBanner').style.width = 1366-TheLeftEdge+RealSizeW+"px";
	}
	
	document.getElementById('bannerBody').style.left = TheRightEdge-140+"px";
	document.getElementById('topBar').style.left = TheLeftEdge+"px";
	document.getElementById('bottomBar').style.left = TheLeftEdge+"px";
	document.getElementById('contentbox').style.left = TheLeftEdge+"px";
	document.getElementById('contentbox').style.width = widthOffset+"px";
	document.getElementById('contentbox').style.top = topOffset+15+13+"px";
	document.getElementById('topBanner').style.left = TheLeftEdge-1366+"px";
	document.getElementById('NavBackground').style.top = topOffset+"px";
	document.getElementById('newsletter').style.left = TheRightEdge-284+"px";
	document.getElementById('newsletter').style.top = topOffset+"px";
	
	if ((TheLeftEdge - 441) > 1 ) {
		document.getElementById('bgLeft').style.left = 1 +"px";
	} else {
		document.getElementById('bgLeft').style.left = TheLeftEdge - 441 +"px";
	}
	if ((TheRightEdge + 10 + 441) < RealSizeW ) {
		document.getElementById('bgRight').style.left = (RealSizeW - 445)+"px";
	} else {
		document.getElementById('bgRight').style.left = TheRightEdge + 10 +"px";
	}
	
	
	if (RealCSizeH > TheContentHeight) { 
		document.getElementById('bottomBar').style.top = (RealCSizeH + 90 )+"px";
		document.getElementById('bgLeft').style.height = (RealCSizeH + 55 )+"px";
		document.getElementById('bgRight').style.height = (RealCSizeH + 55 )+"px";
		document.getElementById('bgHolder').style.height = (RealCSizeH) + 155+"px";
	}
	else { 
		document.getElementById('bottomBar').style.top = (RealSizeH - bottomOffset)-5+"px";
		document.getElementById('bgLeft').style.height = (RealSizeH - 95 )-2+"px";
		document.getElementById('bgRight').style.height = (RealSizeH - 95 )-2+"px";
		document.getElementById('bgHolder').style.height = (RealSizeH)+"px";
		
	}
	/*
	if (RealSizeW  > widthOffset) {
		document.getElementById('bgRight').style.left = (RealSizeW - 445)+"px";
	}
	else {
		document.getElementById('bgRight').style.left = (widthOffset - 445)+"px";
	}
	*/
}

function doPItem(item) {
	document.getElementById('blok_'+item).style.background='#'+darkColor;
	document.getElementById('pName_'+item).style.background='#'+darkColor;
	document.getElementById('pLImg').innerHTML=document.getElementById('pHolderA_'+item).innerHTML;
	document.getElementById('BoardCost').innerHTML=document.getElementById('dHolderA_'+item).innerHTML;
	// document.getElementById('pDesc').innerHTML=document.getElementById('pHolderB_'+item).innerHTML;
}
function undoPItem(item) {
	document.getElementById('blok_'+item).style.background='#FFFFFF';
	document.getElementById('pName_'+item).style.background='#FFFFFF';
	document.getElementById('pLImg').innerHTML="";
	document.getElementById('BoardCost').innerHTML="";
	// document.getElementById('pDesc').innerHTML="";
}


function clearEM() { if (document.getElementById('newsSign').value == " enter email") { document.getElementById('newsSign').value = ""; } }
function checkEM() { if (document.getElementById('newsSign').value == "") { document.getElementById('newsSign').value = " enter email"; } }

// ###############################
// initial load of content
// ###############################
function doContent() { 

	origText = document.getElementById("truC").innerHTML;
	document.getElementById("truC").innerHTML = ""
	thisPadder = "0px";
	if ( origText.indexOf('<!-- IR HTML -->') == -1 ){
	if ( origText.indexOf('<!-- split -->') != -1 ) {
		theSplit = origText.split('<!-- split -->');		
		if (theSplit.length == 4) {
			// document.getElementById('banner').innerHTML=theSplit[1];
			document.getElementById('imgBox').innerHTML=theSplit[2];
			theContent = theSplit[3];
			wipeContentA('up');
		} else if (theSplit.length == 8) {
				// document.getElementById('banner').innerHTML=theSplit[1];
				if ( theSplit[2]*1 > 10) {flashSize=theSplit[2]*1+10;} else {flashSize=theSplit[2];}
				document.getElementById('imgBox').style.height = flashSize+'px';
				changeColor(theSplit[3],theSplit[4]);
				theContent = theSplit[7];
				if (theSplit[0].indexOf('style1') != -1 ) { 
					preCount = theSplit[6].split('<!-- count -->'); document.getElementById('imgBox').innerHTML=preCount[0]; if (preCount[1]*1 > 1) {slideshow(1,preCount[1],8000);} } 
				else if (theSplit[0].indexOf('style2') != -1) { 
					preCount = theSplit[6].split('<!-- count -->'); document.getElementById('imgBox').innerHTML=preCount[0]; if (preCount[1]*1 > 1) {slideshow(1,preCount[1],8000);}
					drawBanner(); }
				else { alert(theSplit[0]);}
				wipeContentA('up');
		} else { alert(theSplit.length);
			document.getElementById('banner').innerHTML="Error!";
			theContent = "an error occured with the request, please retry. If this problem persists, please contact a site administrator<br><br><hr>"+M_contentJax.responseText;
			wipeContentA('up');
		}	
	} else {
	document.getElementById('banner').innerHTML="Error!";
	theContent = "an error occured with the request, please retry. If this problem persists, please contact a site administrator<br><br><hr>"+M_contentJax.responseText;
	wipeContentA('up');
	}
	} else { // HTML for Greg feature
		document.getElementById('imgBox').style.height = "1px"
		//theSplit = origText.split('<!-- split -->');
		theContent = origText
		wipeContentA('up');
	}
	// alert("loaded content");
}
// ###############################
// AJAX interactivity
// ###############################
function doM_Content(DocID) {  // engine for pulling Documents
	closeContent();
	M_contentJax=GetXmlHttpObject();
	var url="CMS/apps/_content.cfm";
	url=url+"?docid="+DocID;
	url=url+"&randInt="+Math.random();
	M_contentJax.onreadystatechange=doContentView;
	M_contentJax.open("GET",url,true);
	M_contentJax.send(null);
}
function doUpContent(DocID) {  // engine for pulling Documents from within Documents
	closeContent();
	M_contentJax=GetXmlHttpObject();
	var url="_content.cfm";
	url=url+"?docid="+DocID;
	url=url+"&randInt="+Math.random();
	M_contentJax.onreadystatechange=doContentView;
	M_contentJax.open("GET",url,true);
	M_contentJax.send(null);
}
function doM_FContent(FID) { // engine for pulling Folders
	closeContent();
	M_contentJax=GetXmlHttpObject();
	var url="CMS/apps/_content.cfm";
	url=url+"?fid="+FID;
	url=url+"&randInt="+Math.random();
	M_contentJax.onreadystatechange=doContentView;
	M_contentJax.open("GET",url,true);
	M_contentJax.send(null);
}
function doM_PContent(PID) { // engine for pulling Places
	closeContent();
	M_contentJax=GetXmlHttpObject();
	var url="CMS/apps/_content.cfm";
	url=url+"?pid="+PID;
	url=url+"&randInt="+Math.random();
	M_contentJax.onreadystatechange=doContentView;
	M_contentJax.open("GET",url,true);
	M_contentJax.send(null);
}
function doM_JSContent(theJS) { // engine for pulling Places
	closeContent();
	M_contentJax=GetXmlHttpObject();
	var url="CMS/apps/_content.cfm";
	url=url+"?"+theJS;
	url=url+"&randInt="+Math.random();
	M_contentJax.onreadystatechange=doContentView;
	M_contentJax.open("GET",url,true);
	M_contentJax.send(null);
}
 function doF_Content(DocID) { // engine for pulling a path from anywhere to the main content window.
	closeContent();
	M_contentJax=GetXmlHttpObject();
	if (DocID.indexOf('?') == -1){	var url=DocID+"?randInt="+Math.random(); } else { var url=DocID+"&randInt="+Math.random(); }
	M_contentJax.onreadystatechange=doContentView;
	M_contentJax.open("GET",url,true);
	M_contentJax.send(null);
}
// check that AJAX is possible and define an AJAX object. 
function GetXmlHttpObject() {
	var MyAjax=null;
	try {
  		// Firefox, Opera 8.0+, Safari
  		MyAjax=new XMLHttpRequest();
  	}
	catch (e) {
  		// Internet Explorer
  		try { MyAjax=new ActiveXObject("Msxml2.XMLHTTP"); }
  		catch (e) { MyAjax=new ActiveXObject("Microsoft.XMLHTTP"); }
  	}
	return MyAjax;
} 
// ###############################
// After Ajax request load of content
// ###############################
function doContentView() { // alert("zoinks");
	if (M_contentJax.readyState < 4) { document.getElementById('banner').innerHTML="loading...";
	} else if (M_contentJax.readyState == 4) { 
		// document.getElementById('banner').innerHTML="loaded"
		thisPadder = "0px";
		if ( M_contentJax.responseText.indexOf('<!-- split -->') != -1 ) {
			theSplit = M_contentJax.responseText.split('<!-- split -->');
			if (theSplit.length == 4) {
				document.getElementById('banner').innerHTML=theSplit[1];
				document.getElementById('imgBox').innerHTML=theSplit[2];
				theContent = theSplit[3];
				// drawBanner();
				wipeContentA('up');
			} else if (theSplit.length == 8) {
				// document.getElementById('banner').innerHTML=theSplit[1];
				if ( theSplit[2]*1 > 10) {flashSize=theSplit[2]*1+10;} else {flashSize=theSplit[2];}
				document.getElementById('imgBox').style.height = flashSize+'px';
				changeColor(theSplit[3],theSplit[4]);
				theContent = theSplit[7];
				if (theSplit[0] == 1) { preCount = theSplit[6].split('<!-- count -->'); document.getElementById('imgBox').innerHTML=preCount[0]; if (preCount[1]*1 > 1) {slideshow(1,preCount[1],8000);} } 
				else if (theSplit[0] == 0) { /* drawBanner(); */ }
				reBox();
				wipeContentA('up');
			} else {  alert(theSplit.length); //  +'___'+M_contentJax.responseText
				document.getElementById('banner').innerHTML="Error!";
				theContent = "an error occured with the request, please retry. If this problem persists, please contact a site administrator<br><br><hr>"+M_contentJax.responseText;
				wipeContentA('up');
			}	
		} else {
			document.getElementById('banner').innerHTML="Error!";
			theContent = "an error occured with the request, please retry. If this problem persists, please contact a site administrator<br><br><hr>"+M_contentJax.responseText;
			wipeContentA('up');
		}
	}
}
// ##############################
// Main & Content Frame Animation Calls
// ##############################
function closeContent() {
	if (isContent=="A") {		wipeContentA();
	} else if (isContent=="B") { wipeContentA(); // fadeContentB();
	} else if (isContent=="C") { makeGalleryC();
	} // else {alert('no fadeout');} 
}
function startContent(move) {
	isContent="A";
	elem = document.getElementById('truC');
	elem.style.zIndex=10;
	document.getElementById('RightC').innerHTML="<div id='truC' style='margin: "+thisPadder+"'>"+theContent+"</div>";
	//elem.innerHTML="";
		fromHeight=1; 
	if (move == 'up') { 
		toHeight = 483; 
	} else { 
		isContent="0";
		toHeight = 1; 
	}	
	doHeightChange(document.getElementById("truC"),fromHeight,toHeight,30,10,1);
	//contentTimer = setTimeout("showContentA()",2100);
}

function wipeContentA(move) {
	isContent="A";
	document.getElementById('RightC').innerHTML="<div id='truC' style='margin: "+thisPadder+"'>"+theContent+"</div>";
	elem = document.getElementById('truC');
	// elem.style.zIndex=10;
	// elem.innerHTML="";
	if (move == 'up') { 
		fromHeight= document.getElementById('RightC').offsetHeight; 
		toHeight = document.getElementById('truC').offsetHeight+50; 
		// alert(fromHeight+" ,"+toHeight);
	} else { 
		isContent="0";
		fromHeight=elem.offsetHeight; 
		toHeight = 1; 
	}	
	doHeightChange(document.getElementById("RightC"),fromHeight,toHeight,50,10,1);
	contentTimerA = setTimeout("reBox()",3000);
	contentTimerB = setTimeout("reBox()",4000);
	// contentTimer = setTimeout("showContentA()",2100);
}
function showContentA() {
	document.getElementById('truC').innerHTML="<div id='truC' style='margin: "+thisPadder+"'>"+theContent+"</div>";
}
function fadeContentB(move) {
	isContent="B";
	elem = document.getElementById('RightC');
	elem.innerHTML="<div id='truC' style='margin: "+thisPadder+"'>"+theContent+"</div>";
	if (move == 'up') { // alert('fade up');
		elem.currentAlpha = 0;
		toAlpha = 100; 
		fromAlpha=40; 
		elem.style.filter = "alpha(opacity=0"+fromAlpha+")";
		elem.style.KHTMLOpacity = fromAlpha/100;
		elem.style.MozOpacity = fromAlpha/100;
		elem.style.opacity = fromAlpha/100;
	} else { // alert('fade oot');
		isContent="0";
		toAlpha = 0; 
		fromAlpha=80;
	}	
	doAlphaChange(document.getElementById("contentbox"),fromAlpha,toAlpha,30,10,5);
}
function showContentB() {
	document.getElementById('contentHom').innerHTML="<div id='truC'>"+theContent+"</div>";
}
function makeGalleryC(move) {
	isContent="C";
	elem = document.getElementById('photoCon');
	elem.innerHTML= theContent ;
	
	elem.style.zIndex=10;
	if (move == 'up') { 
		elem.currentAlpha = 0;
		toAlpha = 99; 
		fromAlpha=0; 
		elem.style.filter = "alpha(opacity=0"+fromAlpha+")";
		elem.style.KHTMLOpacity = fromAlpha/100;
		elem.style.MozOpacity = fromAlpha/100;
		elem.style.opacity = fromAlpha/100;
	} else { 
		isContent="0";
		toAlpha = 0; 
		fromAlpha=99;
	}	
	doAlphaChange(document.getElementById("photoCon"),fromAlpha,toAlpha,70,10,1);
}

// ##############################
// SlideShow
//###############################

function slideshow(start,last,interval) {
  var frame = start;
  var nextframe = start+1;
  Effect.Appear('img1',{duration:.5,from:0.0,to:1.0});
    setInterval(function() {
    Effect.Fade('img'+frame,{duration:.5,from:1.0,to:0.0,afterFinish:function(){
    $('img'+frame).hide();
    Effect.Appear('img'+nextframe,{duration:.5,from:0.0,to:1.0});
    frame = nextframe;
    nextframe = (frame == last) ? start : nextframe+1;
    }});
 },interval);
 return;
};
// ##############################
// general Animation scripts
//###############################
function doAlphaChange(elem,startAlpha,endAlpha,steps,intervals,powr) {
	if (elem.alphaChangeInt) window.clearInterval(elem.alphaChangeInt);
	var actStep = 0;
	elem.alphaChangeInt = window.setInterval(
		function() {
			elem.currentAlpha = easeInOut(startAlpha,endAlpha,steps,actStep,powr);
			elem.style.filter = "alpha(opacity="+elem.currentAlpha+")";
			elem.style.KHTMLOpacity = elem.currentAlpha/100;
			elem.style.MozOpacity = elem.currentAlpha/100;
			elem.style.opacity = elem.currentAlpha/100;
			//elem.style.alpha = elem.currentAlpha+"px";
			actStep++;
			if (actStep > steps) { window.clearInterval(elem.alphaChangeInt); reBox();}
		},intervals)
}
function doHeightChange(elem,startHeight,endHeight,steps,intervals,powr) {
	if (elem.heightChangeInt) window.clearInterval(elem.heightChangeInt);
	var actStep = 0;
	elem.heightChangeInt = window.setInterval(
		function() {
			elem.currentHeight = easeInOut(startHeight,endHeight,steps,actStep,powr);
			elem.style.height = elem.currentHeight+"px";
			actStep++;
			if (actStep > steps) { window.clearInterval(elem.heightChangeInt); }
		},intervals)
}
function doWidthChange(elem,startHeight,endHeight,steps,intervals,powr) {
	if (elem.widthChangeInt) window.clearInterval(elem.widthChangeInt);
	var actStep = 0;
	elem.widthChangeInt = window.setInterval(
		function() {
			elem.currentWidth = easeInOut(startWidth,endWidth,steps,actStep,powr);
			elem.style.width = elem.currentWidth+"px";
			actStep++;
			if (actStep > steps) { window.clearInterval(elem.widthChangeInt); }
		},intervals)
}
function easeInOut(minValue,maxValue,totalSteps,actualStep,powr) {
	var delta = maxValue - minValue;
	var stepp = minValue+(Math.pow(((1 / totalSteps)*actualStep),powr)*delta);
	return Math.ceil(stepp)
}
// ###############################
// FORM VALIDATION - IntelligentLiveForms (ILF) v1.1 by rudy@digifx.tv
// vType Legend (validationType~MinChars~maxChars~mustMatchID
// IF you use this script, please leave my credit intact. 
// ###############################
function mustMatch(me,you){
	if (me.value != document.getElementById(you).value){
	me.value="";
	borderThis(me,1);
	borderThis(document.getElementById(you),1);
	document.getElementById(you).value="";
	document.getElementById(you).focus();
	}

}
function borderThis(theObj,mode){
//alert(theObj.id);
	if (mode == 0) { 
		theObj.style.border = "1px #000000 solid";
		theObj.style.background = "#FFFFFF";
	} else if (mode == 1){ 
		theObj.style.border = "1px #ff0033 solid";
		theObj.style.background = "#fee9e9";
	} else if (mode == 2){ 
		theObj.style.border = "1px #33cc33 solid";
		theObj.style.background = "#eeffd9";
	} else if (mode == 3){ 										// USED AS BOX HIGHLIGHT
		theObj.style.border = "1px #ff0033 solid";
	} else if (mode == 4){ 										// USED AS BOX UN HIGHLIGHT
		theObj.style.border = "0px #ffffff solid";
	} //repeat as required.
}
function getIndex(theObj) {
	var index = -1, i = 0, found = false;
	while (i < theObj.form.length && index == -1) {
		if (theObj.form[i] == theObj) { index = i; } else { i++; }
	}
	return index;
}
function checkField(theObj) {
	var reAlpha = /[^A-Za-z]/;
	var reEmail = /[^A-Za-z@._0-9\-]/;
	var reNumba = /[^0-9\.]/;
	var reAlphaNum = /[^A-Za-z0-9]/;
	var reAlphaNumS = /[^A-Za-z\ 0-9\,\.\?\!]/;
	var rePostalA = /[^A-Za-z]/;
	var rePostal1 = /[^0-9]/;
	//var reSelect = /[^A-Za-z0-9 ]/;	
	var preChkStr = theObj.className.split(" ");
	var chkStr = preChkStr[1].split("~"); 	
	var elemVal = theObj.value;
	var q = 0, f = 0;
	if(elemVal.length >= chkStr[2]) { theObj.value = elemVal.slice(0, chkStr[2]); theObj.form[(getIndex(theObj)+1) % theObj.form.length].focus(); } // TOO LONG alert(theObj.id);
	if (elemVal.length < chkStr[1]){ borderThis(theObj,1);  q=q+1;} // TOO SHORT 
	if (chkStr[0] == 'numba') { if ( reNumba.exec(elemVal) != null) { theObj.value = elemVal.slice(0, elemVal.indexOf(reNumba.exec(elemVal))); q=q+1;}
	} else if (chkStr[0] == 'email') { 
			if ( reEmail.exec(elemVal) != null) { theObj.value = elemVal.slice(0, elemVal.indexOf(reEmail.exec(elemVal))); q=q+1;}
			if ((elemVal.indexOf('.') == -1) || (elemVal.indexOf('@') == -1)) { q=q+1;
			} else if (elemVal.split("@").length > 2){ theObj.value = elemVal.slice(0, elemVal.indexOf("@")); q=q+1;
			} else { if (elemVal.split("@").length == 2) { tVarA=elemVal.split("@");
							if (tVarA[1].split(".").length != -1) { tVarB=tVarA[1].split(".");
								if ((tVarB[1].length < 2) || (tVarB[1].length > 6)) { q=q+1; }
							} else { q=q+1;}
					} else { q=q+1;}
			}
	} else if (chkStr[0] == 'alpha') { if ( reAlpha.exec(elemVal) != null) { theObj.value = elemVal.slice(0, elemVal.indexOf(reAlpha.exec(elemVal))); q=q+1;}
	} else if (chkStr[0] == 'alphaNum') { if ( reAlphaNum.exec(elemVal) != null) { theObj.value = elemVal.slice(0, elemVal.indexOf(reAlphaNum.exec(elemVal))); q=q+1;}
	} else if (chkStr[0] == 'alphaNumS') { if ( reAlphaNumS.exec(elemVal) != null) { theObj.value = elemVal.slice(0, elemVal.indexOf(reAlphaNumS.exec(elemVal))); q=q+1;}
	} else if (chkStr[0] == 'postalA') { if (elemVal.split("").length == 3) { tVarA=elemVal.split(""); if ( rePostalA.exec(tVarA[0])+rePostal1.exec(tVarA[1])+rePostalA.exec(tVarA[2]) != 0){q=q+1;}}
	} else if (chkStr[0] == 'postalB') { if (elemVal.split("").length == 3) { tVarA=elemVal.split(""); if ( rePostal1.exec(tVarA[0])+rePostalA.exec(tVarA[1])+rePostal1.exec(tVarA[2]) != 0){q=q+1;}}
	} else if (chkStr[0] == 'select') { /* if ( reSelect.exec(elemVal) != null) { theObj.value = elemVal.slice(0, elemVal.indexOf(reSelect.exec(elemVal))); q=q+1;} */
	} else { // borderThis(theObj,0); alert("did nothing");		alert("q="+q+"f="+f+"objName="+theObj.id);
	} 
	if (q > 0){ borderThis(theObj,1); if (f < 0){ alert("f was 0");	document.getElementById(theObjid).focus(); f=1;} return 'no'; } else { borderThis(theObj,2); return 'ok';}
}
function formCheck(obj,goesTo,showsIn) {
	var getstr = "";
	var myOkStr = "";
	var thisBox = "";
	var thisBoxOK = "";
	
	for (i=0; i<obj.form.length; i++) {
		if (obj.form[i].tagName == "INPUT") {
			if (obj.form[i].type == "text") {  //ok
				myOkStr = myOkStr+checkField(obj.form[i])+",";
				getstr += "&"+obj.form[i].id + "=" + escape(obj.form[i].value);
			}	
			if (obj.form[i].type == "password") { //ok
				myOkStr = myOkStr+checkField(obj.form[i])+",";
				getstr += "&"+obj.form[i].id + "=" + obj.form[i].value;
			}			
			
			if ((obj.form[i].type == "checkbox") || (obj.form[i].type == "radio")) { 
				if ((thisBox != obj.form[i].id) && (thisBox != "")) { //  alert('ido '+thisBox); 		// Dumps the last checkbox.... hmm... need to do this again at post to clear out the last obj.
					if (thisBoxOK == 1) {		
						myOkStr = myOkStr+"ok,";
						borderThis(document.getElementById(thisBox+'Box'),4);
						thisBoxOK = 0; thisBox = "";
					} else { // alert('this was bad...');
						 myOkStr = myOkStr+"no,";
						borderThis(document.getElementById(thisBox+'Box'),3); 
					}
				}		
				thisBox =  obj.form[i].id;
				if (obj.form[i].checked) {
					if (thisBoxOK == 1) { getstr += ","+obj.form[i].value; } else {getstr += "&"+obj.form[i].id + "=" + obj.form[i].value;}
					
					thisBoxOK = 1;
				}
			}
			
			if (obj.form[i].type == "hidden") {
				getstr += "&"+obj.form[i].id + "=" + obj.form[i].value;
				if (thisBox != "") { 			// 		alert('ido '+thisBox);			attempt redo of select box for end of form carry var..
					if (thisBoxOK == 1) {		
						myOkStr = myOkStr+"ok,";
						borderThis(document.getElementById(thisBox+'Box'),4);
						thisBoxOK = 0; thisBox = "";
					} else { 
						myOkStr = myOkStr+"no,";
						borderThis(document.getElementById(thisBox+'Box'),3); 
					}	
				}	
			}
		}		 
		if (obj.form[i].tagName == "SELECT") {
			myOkStr = myOkStr+checkField(obj.form[i])+",";
			var sel = obj.form[i];
			getstr += "&"+sel.id + "=" + sel.options[sel.selectedIndex].value;
		}   
		if (obj.form[i].tagName == "TEXTAREA") {
			myOkStr = myOkStr+checkField(obj.form[i])+",";
			getstr += "&"+obj.form[i].id + "=" + obj.form[i].value;
			
		}         
	}//     alert(chkStr); 		// alert(myOkStr);	// alert(getstr);	//	postRequest(goesTo, getstr); 
	if (myOkStr.indexOf('no') == -1){ 
	getData(goesTo, showsIn, getstr); // this calls the form submission method
	} else {
		if (document.getElementById('myspan')) {
		document.getElementById('myspan').innerHTML = "An error occurred with your request.<br>Please ensure that no fields are highlighted red."; 
		document.getElementById('myspan').focus();
		} else {alert("An error occurred with your request. Please ensure that no fields are highlighted red.");} 
		reBox(); // doTop();
	}
	return false
}
var formJax
   function getData(goesTo, showsIn, postStr) {
 		formJax=GetXmlHttpObject();
		var postStr  = postStr+"randy="+Math.random();
		// alert("going to send:"+postStr);
		formJax.open("POST",goesTo,true);
		formJax.setRequestHeader('Content-Type','application/x-www-form-urlencoded');
		formJax.onreadystatechange = function() {
			if (formJax.readyState == 4 && formJax.status == 200) { //	alert("i changed state");
			// document.getElementById(showsIn).innerHTML = formJax.responseText;
			if (document.getElementById(showsIn)){
				if (formJax.responseText.indexOf('<!-- ok -->') != -1){  document.getElementById(showsIn).innerHTML = formJax.responseText; 
				} else { document.getElementById('myspan').innerHTML = formJax.responseText; document.getElementById('myspan').focus();
				}
			} else if (document.getElementById('newsSign')) { 
				document.getElementById('newsSign').value = formJax.responseText;
			} reBox();
			} else if( formJax.readyState == 4 && formJax.status != 200){
			 alert(formJax.responseText);
				document.getElementById('myspan').innerHTML = "an internal error has occured, please retry your request.<br>If this problem persists, please contact a system administrator."; 
				document.getElementById('myspan').focus();
				// formJax.responseText;
			}
         }
       formJax.send(postStr);
     }
/* old code from products */

		function checkOptions() {
		missinginfo = "";
		if (document.addform.color.value == "0") {
		missinginfo += "\n     -  Color of Item";
		}
		if (document.addform.size.value == "0") {
		missinginfo += "\n     -  Size of Item";
		}
		if (missinginfo != "") {
		missinginfo ="_____________________________\n" +
		"Please don't forget to select your:\n" +
		missinginfo + "\n_____________________________" +
		"\nPlease re-enter and submit again!";
		alert(missinginfo);
		return false;
		}
		else return true;
		}
/* Image preview script  */		
function zxcMse(zxcevt){
 if(!zxcevt) var zxcevt=window.event;
 if (document.all) return [zxcevt.clientX+zxcDocS()[0],zxcevt.clientY+zxcDocS()[1]];
 return [zxcevt.pageX,zxcevt.pageY];
}

function zxcDocS(){
 if (!document.body.scrollTop) return [document.documentElement.scrollLeft,document.documentElement.scrollTop];
 return [document.body.scrollLeft,document.body.scrollTop];
}

function zxcEventAdd(zxco,zxct,zxcf) {
 if ( zxco.addEventListener ){ zxco.addEventListener(zxct, function(e){ zxco[zxcf](e);}, false); }
 else if ( zxco.attachEvent ){ zxco.attachEvent('on'+zxct,function(e){ zxco[zxcf](e); }); }
 else {
  var zxcPrev=zxco["on" + zxct];
  if (zxcPrev){ zxco['on'+zxct]=function(e){ zxcPrev(e); zxco[zxcf](e); }; }
  else { zxco['on'+zxct]=zxco[zxcf]; }
 }
}

function zxcAddEvt(zxcobj,zxcfun,zxcevt){
 if (zxcobj['zxcadd'+zxcfun+zxcevt]) return;
 zxcobj['zxcadd'+zxcfun+zxcevt]=window[zxcfun];
 zxcEventAdd(zxcobj,zxcevt,'zxcadd'+zxcfun+zxcevt);
}

function zxcES(zxcele,zxcstyle,zxcp,zxctxt){
 if (typeof(zxcele)=='string'){ zxcele=document.createElement(zxcele); }
 for (key in zxcstyle){ zxcele.style[key]=zxcstyle[key]; }
 if (zxcp){ zxcp.appendChild(zxcele); }
 if (zxctxt){ zxcele.appendChild(document.createTextNode(zxctxt)); }
 return zxcele;
}

function zxcIntPreview(zxcobj,zxcimg,zxcwidth,zxcheight,zxctxt){
 if (typeof(zxcobj)=='string') zxcobj=document.getElementById(zxcobj);
 if (zxcobj.preview) return;
 zxcobj.img=[zxcimg,zxcwidth,zxcheight];
 zxcobj.preview=zxcES('DIV',{position:'absolute',overflow:'hidden',visibility:'hidden'},document.getElementsByTagName('BODY')[0]); //,width:zxcwidth+'px',height:zxcheight+'px'
 zxcobj.preview.className='PreviewDiv';
 zxcES('DIV',{},zxcobj.preview,zxctxt||'').className='PreviewTxt';
 zxcAddEvt(zxcobj,'zxcPreview','mouseover');
 zxcAddEvt(zxcobj,'zxcPreview','mouseout');
 zxcAddEvt(zxcobj,'zxcMseMove','mousemove');
}

function zxcPreview(zxcevt){
 if (zxcevt.type=='mouseover') zxcMseMove(zxcevt,this);
 else zxcES(this.preview,{visibility:'hidden'});
 if (!this.imgobj){
  this.imgobj=zxcES('IMG',{position:'relative',left:'0px',top:'0px'},this.preview); // ,width:this.img[1]+'px'
  this.imgobj.src=this.img[0];
  zxcES(this.preview.getElementsByTagName('DIV')[0],{},this.preview);
 }
 if (window['zxcAddIFrame']) zxcAddIFrame(this.preview);
}

function zxcMseMove(zxcevt,zxcobj){
 if (!zxcobj) zxcobj=this;
 zxcES(zxcobj.preview,{visibility:'visible',left:zxcMse(zxcevt)[0]+5+'px',top:zxcMse(zxcevt)[1]-zxcobj.img[2]-5+'px'});
 if (window['zxcAddIFrame']) zxcAddIFrame(this.preview);
}

function zxcAddIFrame(zxcobj){
 if (!document.all){ return; }
 if  (typeof(zxcobj)=='string'){ zxcobj=document.getElementById(zxcid); }
 if (!zxcobj){ return; }
 if (!zxcobj.ifr){
  zxcES(zxcobj,{zIndex:zxcGetStyle(zxcobj,'z-Index')||'200'});
  zxcobj.ifr=zxcES('IFRAME',{position:'absolute',overflow:'hidden',zIndex:(parseInt(zxcGetStyle(zxcobj,'zIndex'))-1),visibility:'visible'});
  zxcobj.parentNode.appendChild(zxcobj.ifr);
 }
 zxcES(zxcobj.ifr,{zIndex:(parseInt(zxcGetStyle(zxcobj,'zIndex'))-1),visibility:'hidden',left:zxcobj.offsetLeft+'px',top:zxcobj.offsetTop+'px', width:zxcGetStyle(zxcobj,'width'),height:zxcGetStyle(zxcobj,'height')});// zxcGetStyle(zxcobj,'visibility')||
}

function zxcGetStyle(zxcel,zxcs){
 if (zxcel.style[zxcs]){ return zxcel.style[zxcs]; }
 if (zxcel.currentStyle){ return zxcel.currentStyle[zxcs]; }
 if (window.getComputedStyle){ return document.defaultView.getComputedStyle(zxcel,null).getPropertyValue(zxcs); }
 return false;
}

function zxcStyleValue(zxcobj,zxcp){ //  pass object and property, returns property value
 if (zxcobj.style[zxcp.replace('-','')]) return zxcobj.style[zxcp.replace('-','')];
 if (zxcobj.currentStyle) return zxcobj.currentStyle[zxcp.replace('-','')];
 return document.defaultView.getComputedStyle(zxcobj,null).getPropertyValue(zxcp.toLowerCase());
}

	
/* CASCADING POPUP MENUS v5.2 RC (c) 2001-2006 Angus Turnbull, http://www.twinhelix.com Altering this notice or redistributing this file is prohibited. */
var isDOM=document.getElementById?1:0,isIE=document.all?1:0,isNS4=navigator.appName=='Netscape'&&!isDOM?1:0,isIE4=isIE&&!isDOM?1:0,isOp=self.opera?1:0,isDyn=isDOM||isIE||isNS4;function getRef(i,p){p=!p?document:p.navigator?p.document:p;return isIE?p.all[i]:isDOM?(p.getElementById?p:p.ownerDocument).getElementById(i):isNS4?p.layers[i]:null};function getSty(i,p){var r=getRef(i,p);return r?isNS4?r:r.style:null};if(!self.LayerObj)var LayerObj=new Function('i','p','this.ref=getRef(i,p);this.sty=getSty(i,p);return this');function getLyr(i,p){return new LayerObj(i,p)};function LyrFn(n,f){LayerObj.prototype[n]=new Function('var a=arguments,p=a[0],px=isNS4||isOp?0:"px";with(this){'+f+'}')};LyrFn('x','if(!isNaN(p))sty.left=p+px;else return parseInt(sty.left)');LyrFn('y','if(!isNaN(p))sty.top=p+px;else return parseInt(sty.top)');LyrFn('vis','sty.visibility=p');LyrFn('bgColor','if(isNS4)sty.bgColor=p?p:null;else sty.background=p?p:"transparent"');LyrFn('bgImage','if(isNS4)sty.background.src=p?p:null;else sty.background=p?"url("+p+")":"transparent"');LyrFn('clip','if(isNS4)with(sty.clip){left=a[0];top=a[1];right=a[2];bottom=a[3]}else sty.clip="rect("+a[1]+"px "+a[2]+"px "+a[3]+"px "+a[0]+"px)" ');LyrFn('write','if(isNS4)with(ref.document){write(p);close()}else ref.innerHTML=p');LyrFn('alpha','var f=ref.filters,d=(p==null),o=d?"inherit":p/100;if(f){if(!d&&sty.filter.indexOf("alpha")==-1)sty.filter+=" alpha(opacity="+p+")";else if(f.length&&f.alpha)with(f.alpha){if(d)enabled=false;else{opacity=p;enabled=true}}}else if(isDOM)sty.opacity=sty.MozOpacity=o');function setLyr(v,dw,p){if(!setLyr.seq)setLyr.seq=0;if(!dw)dw=0;var o=!p?isNS4?self:document.body:!isNS4&&p.navigator?p.document.body:p,IA='insertAdjacentHTML',AC='appendChild',id='_sl_'+setLyr.seq++;if(o[IA])o[IA]('beforeEnd','<div id="'+id+'" style="position:absolute"></div>');else if(o[AC]){var n=document.createElement('div');o[AC](n);n.id=id;n.style.position='absolute'}else if(isNS4){var n=new Layer(dw,o);id=n.id}var l=getLyr(id,p);with(l)if(ref){vis(v);x(0);y(0);sty.width=dw+(isNS4?0:'px')}return l};if(!self.page)var page={win:self,minW:0,minH:0,MS:isIE&&!isOp};page.db=function(p){with(this.win.document)return(isDOM?documentElement[p]:0)||body[p]||0};page.winW=function(){with(this)return Math.max(minW,MS?db('clientWidth'):win.innerWidth)};page.winH=function(){with(this)return Math.max(minH,MS?db('clientHeight'):win.innerHeight)};page.scrollX=function(){with(this)return MS?db('scrollLeft'):win.pageXOffset};page.scrollY=function(){with(this)return MS?db('scrollTop'):win.pageYOffset};function addProps(obj,data,names,addNull){for(var i=0;i<names.length;i++)if(i<data.length||addNull)obj[names[i]]=data[i]};function PopupMenu(myName){this.myName=myName;this.showTimer=this.hideTimer=this.showDelay=0;this.hideDelay=500;this.menu={};this.litNow={};this.litOld={};this.overM='';this.overI=0;this.hideDocClick=0;this.actMenu=null;PopupMenu.list[myName]=this};PopupMenu.list={};var PmPt=PopupMenu.prototype;PmPt.callEvt=function(mN,iN,evt){var i=this.menu[mN][iN],r1=this[evt]?this[evt](mN,iN):0,r2;if(i[evt]){if(i[evt].substr)i[evt]=new Function('mN','iN',i[evt]);r2=i[evt](mN,iN)}return typeof r2=='boolean'?r2:r1};PmPt.over=function(mN,iN){with(this){clearTimeout(hideTimer);overM=mN;overI=iN;var evtRtn=iN?callEvt(mN,iN,'onmouseover'):0,rtn=evtRtn||false;litOld=litNow;litNow={};var litM=mN,litI=iN;if(mN)do{litNow[litM]=litI;litI=menu[litM][0].parentItem;litM=menu[litM][0].parentMenu}while(litM);var same=1;for(var z in menu)same&=(litNow[z]==litOld[z]);if(same)return rtn;clearTimeout(showTimer);for(var thisM in menu)with(menu[thisM][0]){if(!lyr)continue;lI=litNow[thisM];oI=litOld[thisM];if(lI!=oI){if(lI)changeCol(thisM,lI);if(oI)changeCol(thisM,oI)}if(!lI)clickDone=0;if(isRoot)continue;if(lI&&!visNow)doVis(thisM,1);if(!lI&&visNow)doVis(thisM,0)}nextMenu='';if(menu[mN]&&menu[mN][iN].sm&&(evtRtn+''!='false')){var m=menu[mN],t=m[iN].sm;if(!menu[t])return rtn;if(m[0].clickSubs&&!m[0].clickDone)return rtn;nextMenu=t;if(showDelay)showTimer=setTimeout(myName+'.doVis("'+t+'",1)',showDelay);else doVis(t,1)}return rtn}};PmPt.out=function(mN,iN){with(this){if(mN!=overM||iN!=overI)return;var thisI=menu[mN][iN],evtRtn=iN?callEvt(mN,iN,'onmouseout'):0;if(thisI.sm!=nextMenu){clearTimeout(showTimer);nextMenu=''}if(hideDelay&&(evtRtn+''!='false')){var delay=menu[mN][0].isRoot&&!thisI.sm?50:hideDelay;hideTimer=setTimeout(myName+'.over("",0)',delay)}overM='';overI=0}};PmPt.click=function(mN,iN){with(this){var m=menu[mN],evtRtn=callEvt(mN,iN,'onclick'),hm=1;if(evtRtn+''=='false')return false;with(m[iN]){if(type=='js:')eval(href);else{if(sm&&m[0].clickSubs){m[0].clickDone=1;doVis(sm,1);hm=0}if(href){type=type||'window';eval(type+'.location.href="'+href+'"')}}}if(hm)over('',0);return evtRtn||false}};PmPt.changeCol=function(mN,iN,fc){with(this.menu[mN][iN]){if(!lyr||!lyr.ref)return;var bgFn=outCol!=overCol?(outCol.indexOf('.')==-1?'bgColor':'bgImage'):0;var ovr=(this.litNow[mN]==iN)?1:0,doFX=(!fc&&this.litNow[mN]!=this.litOld[mN]);var col=ovr?overCol:outCol;if(fade[0]){clearTimeout(timer);col='#';count=Math.max(0,Math.min(count+(2*ovr-1)*parseInt(fade[ovr][0]),100));var oc,nc,hexD='0123456789ABCDEF';for(var i=1;i<4;i++){oc=parseInt('0x'+fade[0][i]);nc=parseInt(oc+(parseInt('0x'+fade[1][i])-oc)*(count/100));col+=hexD.charAt(Math.floor(nc/16)).toString()+hexD.charAt(nc%16)}if(count%100>0)timer=setTimeout(this.myName+'.changeCol("'+mN+'",'+iN+',1)',50)}if(bgFn&&isNS4)lyr[bgFn](col);var reCSS=(overClass!=outClass||outBorder!=overBorder);if(doFX)with(lyr){if(!this.noRW&&(overText||overInd||isNS4&&reCSS))write(this.getHTML(mN,iN,ovr));if(!isNS4&&reCSS){ref.className=(ovr?overBorder:outBorder);var chl=(isDOM?ref.childNodes:ref.children);if(chl&&!overText)for(var i=0;i<chl.length;i++)chl[i].className=ovr?overClass:outClass}}if(bgFn&&!isNS4)lyr[bgFn](col);if(doFX&&outAlpha!=overAlpha)lyr.alpha(ovr?overAlpha:outAlpha)}};PmPt.position=function(posMN){with(this){for(mN in menu)if(!posMN||posMN==mN)with(menu[mN][0]){if(!lyr||!lyr.ref||!visNow)continue;var pM,pI,newX=eval(offX),newY=eval(offY);if(!isRoot){pM=menu[parentMenu];pI=pM[parentItem].lyr;if(!pI)continue}var eP=eval(par),pW=(eP&&eP.navigator?eP:window);with(pW.page)var sX=scrollX(),wX=sX+winW()||9999,sY=scrollY(),wY=winH()+sY||9999;var sb=page.MS?5:20;if(pM&&typeof(offX)=='number')newX=Math.max(sX,Math.min(newX+pM[0].lyr.x()+pI.x(),wX-menuW-sb));if(pM&&typeof(offY)=='number')newY=Math.max(sY,Math.min(newY+pM[0].lyr.y()+pI.y(),wY-menuH-sb));lyr.x(newX);lyr.y(newY)}}};PmPt.doVis=function(mN,show){with(this){var m=menu[mN],sh=(show?'show':'hide'),mA=sh+'Menu',mE='on'+sh;m[0].visNow=show;if(m&&m[0].lyr&&m[0].lyr.ref){if(show)position(mN);var p=m[0].parentMenu;if(p)m[0].lyr.sty.zIndex=m[0].zIndex=menu[p][0].zIndex+2;if(this[mE])this[mE](mN);if(this[mA])this[mA](mN);else m[0].lyr.vis(show?'visible':'hidden')}}};function ItemStyle(){var names=['len','spacing','popInd','popPos','pad','outCol','overCol','outClass','overClass','outBorder','overBorder','outAlpha','overAlpha','normCursor','nullCursor'];addProps(this,arguments,names,1)};PmPt.startMenu=function(mName){with(this){if(!menu[mName])menu[mName]=[{}];actMenu=menu[mName];aM=actMenu[0];actMenu.length=1;var names=['name','isVert','offX','offY','width','itemSty','par','clickSubs','clickDone','visNow','parentMenu','parentItem','oncreate','isRoot'];addProps(aM,arguments,names,1);aM.extraHTML='';aM.menuW=aM.menuH=0;aM.zIndex=50;if(!aM.lyr)aM.lyr=null;if(mName.substring(0,4)=='root'){aM.isRoot=1;aM.oncreate=new Function('obj','this.visNow=1;obj.position("'+mName+'");this.lyr.vis("visible")')}return aM}};PmPt.addItem=function(){with(this)with(actMenu[0]){var aI=actMenu[actMenu.length]={};var names=['text','href','type','itemSty','len','spacing','popInd','popPos','pad','outCol','overCol','outClass','overClass','outBorder','overBorder','outAlpha','overAlpha','normCursor','nullCursor','iX','iY','iW','iH','fW','fH','overText','overInd','sm','lyr','onclick','onmouseover','onmouseout'];addProps(aI,arguments,names,1);var iSty=arguments[3]?arguments[3]:actMenu[0].itemSty;for(prop in iSty)if(aI[prop]+''=='undefined')aI[prop]=iSty[prop];if(aI.type=='sm:'){aI.sm=aI.href;aI.href=''}var r=RegExp,re=/^SWAP:(.*)\^(.*)$/;if(aI.text.match(re)){aI.text=r.$1;aI.overText=r.$2}if(aI.popInd.match(re)){aI.popInd=r.$1;aI.overInd=r.$2}aI.timer=aI.count=0;aI.fade=[];for(var i=0;i<2;i++){var oC=i?'overCol':'outCol';if(aI[oC].match(/^(\d+)\#(..)(..)(..)$/)){aI[oC]='#'+r.$2+r.$3+r.$4;aI.fade[i]=[r.$1,r.$2,r.$3,r.$4]}}if(aI.outBorder&&isNS4)aI.pad++;if(!isIE){if(aI.normCursor=='hand')aI.normCursor='pointer';if(aI.nullCursor=='hand')aI.nullCursor='pointer'}aI.iW=isVert?width:aI.len;aI.iH=isVert?aI.len:width;var lastGap=actMenu.length>2?actMenu[actMenu.length-2].spacing:0;var spc=aI.outBorder&&actMenu.length>2?1:0;if(isVert){menuH+=lastGap-spc;aI.iX=0;aI.iY=menuH;menuW=width;menuH+=aI.iH}else{menuW+=lastGap-spc;aI.iX=menuW;aI.iY=0;menuW+=aI.iW;menuH=width}return aI}};PmPt.getHTML=function(mN,iN,isOver){with(this){var itemStr='';with(menu[mN][iN]){var tC=isOver?overClass:outClass,txt=isOver&&overText?overText:text,popI=isOver&&overInd?overInd:popInd,ln='<a href="'+(href&&type!='js:'?href:'#')+'" onclick="return false" onfocus="this.blur()" class="'+tC+(isNS4?'" onmouseover="'+myName+'.over(\''+mN+'\','+iN+')"':'"');if(popI&&sm){if(isNS4)itemStr+='<layer class="'+tC+'" left="'+((popPos+fW)%fW)+'" top="'+pad+'" height="'+(fH-2*pad)+'">'+popI+'</layer>';else itemStr+='<div class="'+tC+'" style="position:absolute;left:'+((popPos+fW)%fW)+'px;top:'+pad+'px;height:'+(fH-2*pad)+'px">'+popI+'</div>'}if(isNS4)itemStr+=(outBorder?'<span class="'+(isOver?overBorder:outBorder)+'"><spacer type="block" width="'+(fW-8)+'" height="'+(fH-8)+'"></span>':'')+'<layer left="'+pad+'" top="'+pad+'" width="'+(fW-2*pad)+'" height="'+(fH-2*pad)+'">'+ln+'>'+txt+'</a></layer>';else{itemStr+=(isIE4?'<div class="'+tC+'" ':ln)+' style="position:absolute;left:'+pad+'px;top:'+pad+'px;width:'+(fW-2*pad)+'px;height:'+(fH-2*pad)+'px;cursor:'+(href?normCursor:nullCursor)+'">'+txt+(isIE4?'</div>':'</a>')}}return itemStr}};PmPt.update=function(docWrite,upMN){with(this){if(!isDyn)return;for(mN in menu)with(menu[mN][0]){if(upMN&&upMN!=mN)continue;var str='',eP=eval(par);with(eP&&eP.navigator?eP:self)var dC=document.compatMode,dT=document.doctype;dFix=(dC&&dC.indexOf('CSS')>-1||isOp&&!dC||dT&&dT.name.indexOf('.dtd')>-1||isDOM&&!isIE)?2:0;for(var iN=1;iN<menu[mN].length;iN++)with(menu[mN][iN]){var tM=menu[sm],itemID=myName+'-'+mN+'-'+iN;if(sm&&tM){tM[0].parentMenu=mN;tM[0].parentItem=iN}if(outBorder){fW=iW-dFix;fH=iH-dFix}else{fW=iW;fH=iH}var isImg=(outCol.indexOf('.')!=-1);if(isDOM||isIE4){str+='<div id="'+itemID+'" '+(outBorder?'class="'+outBorder+'" ':'')+'style="position:absolute;left:'+iX+'px;top:'+iY+'px;width:'+fW+'px;height:'+fH+'px;z-index:'+zIndex+';'+(outCol?'background:'+(isImg?'url('+outCol+')':outCol):'')+(typeof(outAlpha)=='number'?';filter:alpha(opacity='+outAlpha+');-moz-opacity:'+outAlpha+'%;opacity:'+(outAlpha/100):'')+';cursor:'+(href?normCursor:nullCursor)+'" '}else if(isNS4){str+='<layer id="'+itemID+'" left="'+iX+'" top="'+iY+'" width="'+fW+'" height="'+fH+'" z-index="'+zIndex+'" '+(outCol?(isImg?'background="':'bgcolor="')+outCol+'" ':'')}var evtMN="('"+mN+"',"+iN+")";str+='onmouseover="return '+myName+'.over'+evtMN+'" onmouseout="'+myName+'.out'+evtMN+'" onclick="return '+myName+'.click'+evtMN+'">'+getHTML(mN,iN,0)+(isNS4?'</layer>':'</div>')}var sR=myName+'.setupRef('+(docWrite?1:0)+',"'+mN+'")';if(isOp)setTimeout(sR,1000);var mVis=isOp&&isRoot?'visible':'hidden';if(docWrite){var targFr=eP&&eP.navigator?eP:window;targFr.document.write('<div id="'+myName+'-'+mN+'" style="position:absolute;visibility:'+mVis+';left:'+(isOp?-1000:0)+'0px;top:0px;width:'+(menuW+2)+'px;height:'+(menuH+2)+'px;z-index:1000">'+str+extraHTML+'</div>')}else{if(!lyr||!lyr.ref)lyr=setLyr(mVis,menuW,eP);else if(isIE4)setTimeout(myName+'.menu.'+mN+'[0].lyr.sty.width='+(menuW+2),50);with(lyr){sty.zIndex=50;write(str+extraHTML)}}if(!isOp)setTimeout(sR,100)}}};PmPt.setupRef=function(docWrite,mN){with(this)with(menu[mN][0]){var eP=eval(par);if(docWrite||!lyr||!lyr.ref)lyr=getLyr(myName+'-'+mN,eP);for(var i=1;i<menu[mN].length;i++)menu[mN][i].lyr=getLyr(myName+'-'+mN+'-'+i,isNS4?lyr.ref:eP);lyr.clip(0,0,menuW+2,menuH+2);if(oncreate)oncreate(this)}};

