/******************************************************//*	Description :	Main Site Routines	               //*	**			:	Compatible with Templates v2+	   //*	Version		:	5.3								   //*	Date Stamp  :	8/03/05 - RH					   //******************************************************///-----------------------------------------------------Stock Macromedia Rollover Code->>function MM_preloadImages() { //v3.0  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}}function MM_swapImgRestore() { //v3.0  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;}function MM_findObj(n, d) { //v4.01  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);  if(!x && d.getElementById) x=d.getElementById(n); return x;}function MM_swapImage() { //v3.0  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}}//-----------------------------------------------------Track referrer for ctf->>// Vs. 1.0bfunction baseName(str){	bnParts=str.split("/");	return bnParts[2];}function compare(str1, str2){	if( baseName(str1) == (str2_bn=baseName(str2)) )		return false;	else		return str2_bn;}function setCookie(domain){	document.cookie="mdhCWD<%=flid%>="+domain;}function getCookie(){	cParts=document.cookie.split(";");	if(cParts[0].substr(0,6)=="mdhCWD")		return cParts[0].substr(cParts[0].lastIndexOf("=")+1);	else		return "";}function cookieDebug(){	document.write("COOKIE: "+document.cookie+"<br>"); 	document.write("RETURN: "+getCookie());}function setReferrer(field){	document.emailForm[field].value+="\n\nReffered by:  "+getCookie();}check = compare( location.href,((document.referrer)?document.referrer:location.href) );if(check!=false)	setCookie(check);	//-----------------------------------------------------Contact Validation && Redirection->>// Vs. 3.1var SUCCESS 		= "thankYou.jsp";var FAILURE 		= "thankYou.jsp";var ValidateName	= true;var highlighting	= true;			// form alert vars belowvalidName			= true;validEmail			= true;	def_bc			= "#000";	inv_bc			= "#0a348f";		inv_fg			= "#fff";	alertType			= "2";function init_ctf(){	// configuration for contact routines >> defaults above	arg=init_ctf.arguments;	if(arg[0])	highlighting =arg[0];	if(arg[1])	alertType	 =arg[1];	if(arg[2])	def_bc		 =arg[2]	if(arg[3])	inv_bc		 =arg[3];}//	Validates the required fieldsfunction isFieldsValid() {	var msg = "";		//	Validate the fields	if(ValidateName){		msg += validateName(document.emailForm.Name.value);	}		if(msg != "") {		msg += "\n";	}	msg += validateEmail(document.emailForm.Email.value);		//	Display a message if validation failed	if(msg != "") {		if(highlighting){				if(alertType=="2"){					form_alert2('Name', ((validName)?false:true));					form_alert2('Email', ((validEmail)?false:true));				}else{					form_alert('field1', ((validName)?false:true));					form_alert('field2', ((validEmail)?false:true));				}		}		alert("Please correct the following errors so that we can process your message:" +			  "\n\n" + msg);		return false;	}	else {		return true;	}}//	Validates the name fieldfunction validateName(name) {	var msg = "";	var errorMsg = "  - Enter a valid name";	name = trimString(name);		if(name == "") {		msg = errorMsg;	}	if(msg)		validName=false;	else		validName=true;	return msg;}//	Validate the email fieldfunction validateEmail(email) {	var msg = "";	var errorMsg = "  - Enter a valid email address";		email = trimString(email);		if(email == "") {		msg = errorMsg;	}	else {		var at = "@"		var dot = "."		var lat = email.indexOf(at)		var lstr = email.length - 1;		var ldot = email.indexOf(dot)		//	Validate presence of at least one @	  	if(email.indexOf(at) == -1 || email.indexOf(at) == 0 || email.indexOf(at) == lstr) {			msg = errorMsg;		}			//	Validate presence of only one @		else if(email.indexOf(at, (lat + 1)) != -1) {			msg = errorMsg;		}		//	Validate presence of at last one .		else if(email.indexOf(dot) == -1 || email.indexOf(dot) == 0 || email.indexOf(dot) == lstr) {			msg = errorMsg;		}				//	Validate that .@ or @. is not present		else if(email.substring(lat - 1, lat) == dot || email.substring(lat + 1, lat + 2) == dot) {			msg = errorMsg;		}		//	Validate @<char>. pattern is found		else if(email.indexOf(dot, (lat + 2)) == -1) {			msg = errorMsg;		}	}	if(msg==errorMsg)		validEmail=false;	else		validEmail=true;	return msg;}  //	Resets the formfunction resetForm() {	document.all.emailForm.reset();}var timerID;//	Submits the message to the serverfunction submitMessage() {	if(isFieldsValid()) {			if(isBrowserSupported()) {			//document.emailForm.target = "responseFrame";			document.emailForm.submit();			//timerID = setInterval("pollForResponse()", 500);		}		else {			//openCenteredWindow("/pd3/mail.htm", "emailPopup", 350, 250);			//document.emailForm.target = "emailPopup";			//setTimeout("document.emailForm.submit()", 500);		}	}}//	Returns true if a supported browser (IE 4.x or higher; Netscape 6.x or higher) //	is being usedfunction isBrowserSupported() {	var isSupported = false	if(navigator.appName == 'Microsoft Internet Explorer') {		if(getIEVersionNum() >= 5) {		  	isSupported = true;		}	}	else if(navigator.appName == 'Netscape') {		if(getNetscapeVersionNum() >= 5) {			isSupported = true;		}	}		return isSupported;}//	Gets the version number for Internet Explorerfunction getIEVersionNum() {	var brVer = navigator.userAgent;	var brVerId = brVer.indexOf('MSIE');	var brNum = brVer.substr(brVerId, 8);	return brNum.substring(5, 6);}//	Gets the version number for Netscapefunction getNetscapeVersionNum() {	var brVer = navigator.userAgent;	var reg = new RegExp('/');	var brVerId = brVer.search(reg);	var brNum = brVer.substring(brVerId + 1);	return brNum.substring(0, 1);}//	Polling function that waits for a response from the serverfunction pollForResponse() {	var response = responseFrame.document.body.innerHTML;		if(response != null && response != "") {		stopTimer();				if(response.indexOf("Your email was sent") != -1) {			parent.document.location.href = SUCCESS;		}		else {			parent.document.location.href = FAILURE;			}	}}//	Clears the polling timerfunction stopTimer(){	clearInterval(timerID);}//	Opens a window that is centered on the screenfunction openCenteredWindow(url, name, width, height) {	// Compute the window's top and left positions so that it is centered	var windowWidth 	= width;	var windowHeight 	= height;	var screenWidth 	= screen.availWidth;	var screenHeight 	= screen.availHeight;	var left 			= screenWidth  / 2 - windowWidth  / 2;	var top 			= screenHeight / 2 - windowHeight / 2;	var properties		= "resizable=yes,left=" + left + ",top=" + top + ",width=" + 		windowWidth + ",height=" + windowHeight;	window.open(url, name, properties);}//	Trims a stringfunction trimString(str) {	//	Remove leading whitespaces	while (str.charAt(0) == ' '  || str.charAt(0) == '\t' ||		   str.charAt(0) == '\r' || str.charAt(0) == '\n') {		str = str.substring(1,str.length);	}		//	Remove trailing whitespaces	while (str.charAt(str.length - 1) == ' '  || str.charAt(str.length - 1) == '\t' ||		   str.charAt(str.length - 1) == '\r' || str.charAt(str.length - 1) == '\n') {    	str = str.substring(0, str.length - 1);	}		return str;}//	Netscape 4.x bug fix - reloads the page when the browser is resizedfunction MM_reloadPage(init) {  	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();	}}//---------------------------------------------------------------------------Form Alert Script->>// v2.1 [IE/FF][RH]function form_alert(id, c){	// highlights background (ugly..)	obj=new Array();	obj[0]=document.getElementById(id+"-1");	obj[1]=document.getElementById(id+"-2");	if(obj[0]&&obj[1]){		for(var i=0;i<obj.length;i++){			bg=(c)?inv_bc:"transparent";			fg=(c)?inv_fg:"transparent";			obj[i].style.background=bg;			obj[i].style.color=fg;		}	}}function form_alert2(id,c){	// highlights border (cleaner)	color=(c)?inv_bc:def_bc;	document.emailForm[id].style.border="1px solid "+color;}//-----------------------------------------------------Redirection && thankYou Routines->>// Vs. 3.0//	Print Message (...) [USAGE]//		Outputs code to create the countdown box//		Params:	//		[0] ->	Time (milliseconds::1000~1sec)	//		[1]	->	Foreground Colorvar delay=100;function printMessage(){	var a=printMessage.arguments;	var timer=(a[0]!=null)?a[0]:5000; 	var txtcolor=(a[1]!=null)?a[1]:"black"; 		// Random		var symbol=".";		var size=22;		var bStr="";		var num_sym=50;		/* vs.2.0		// increases .s for more time		for(var i=0;i<timer;i+=100)			bStr+=symbol;		*/		// vs.3.0		// increases delay for more time		for(var i=0;i<num_sym;i++)			bStr+=symbol;		delay=Math.ceil(timer/num_sym);				document.write("<p align=\"center\"><strong>Thank you for your submission. <br>We will get back to you as soon as posssible </strong><br><br>");	document.write("<input name=\"rdtxt\" type=\"text\" value=\"Redirecting, Please Wait...\" size=\"23\" style=\"border:none; background-color:transparent; color:"+txtcolor+"; text-align:center;\"><br>");	document.write("<input type=\"text\" id=\"timeBox\" style=\"border:none; background-color:transparent; color:"+txtcolor+";\" value=\""+bStr+"\" size=\""+size+"\" readonly=\"1\"></p>");	remDot();	//	FailSafe -> Redirects after timer + 5 seconds.	setTimeout("location='index.jsp'",(timer+5000));}function remDot(){	b=document.getElementById("timeBox");	if(b.value.length>0){		b.value=b.value.substr(0,b.value.length-1);		setTimeout("remDot()",parseInt(delay));	}else{		location='index.jsp';		rd=document.getElementById("rdtxt");		rd.value="Redirecting";	}}MM_reloadPage(true);//---------------------------------------------------------------------------Div Toggle Ctrls->>// Vs. 2.8//	divToggle (...) [USAGE]//		Creates explorer style collapsable divs//		@Params:	//		[0] ->	id  		-> Div ID	//		[1]	->	useImgs		-> using +/- images (optional, default: true)//		#Notes:	//		-	name the controlling image-link the same ID as the div with "Ctrl" at the end !important	//		-	ie: div ID = "div", image ID = "divCtrl"	//		-	plus/minus images MUST be in the same folder	//		-	plus/minus images can be any extension (gif|jpg|etc)function divToggle(){	var a=divToggle.arguments;	var id=a[0];	var useImgs=(a[1]!=null)?a[1]:false;	elem=document.getElementById(id);	elem.style.display=(elem.style.display=="none" || elem.style.display=="")?"block":"none";		if(useImgs){		// toggle (path)/(plus|minus).(gif|jpg)		img=document.getElementById(id+"Ctrl");		lS=img.src.lastIndexOf("/") + 1;	// last slash		path=img.src.substr(0,lS);			// read path		pm=img.src.substr(lS);				// read img name		ext=pm.substr(pm.lastIndexOf("."));	// get img extension		img.src=path + ((pm=="minus"+ext)?"plus"+ext:"minus"+ext);	}}//---------------------------------------------------------------------------Print Friendly Page->>// v1.2 [IE/FF][RH]function print_directions(){	if( document.getElementById('directions_frame') && document.getElementById('directions_head')){		theHead=document.getElementById('directions_head').innerHTML;	// directions.jsp 		 [div]		theTxt=document.getElementById('directions_frame').innerHTML;	// drivingDirections.jsp [div]		theWin=window.open("","printWin");		theTitle=location.title;		theWin.document.write('<head><title>'+theTitle+'</title><style type="text/css">a.dir-link{display:none}</style></head>');		theWin.document.write(theHead + "<br><br>");		theWin.document.write(theTxt);	}}//----------------------------------------------------------------------------------Bookmark Page->>// v1.0 [IE][RH]//	bookmark_init (...) [USAGE]//		Creates bookmark link for IE browsers only//		@Params:	//		[0] ->	string1  	-> Link Template	//		[1]	->	string2		-> Non-Compliant Output		// 	[EXAMPLE]	[bookmark_init("[ :Bookmark Us: ]","");]		//		string1 = "[ :Bookmark Us: ]"		//		string2 = ''		//			on  IE: a link that says 'Bookmark Us'		//			not IE: nothing output		function bookmark_init(string1,string2){	if ((navigator.appName == "Microsoft Internet Explorer") && (parseInt(navigator.appVersion) >= 4)){		s1p=string1.split(/:/);		outStr=s1p[0] + '<a href="javascript:bookmark();" class="A_mini">' +s1p[1]+ '</a>' + s1p[2];	}else		outStr=string2;	document.write(outStr);}function bookmark(){	url=location.href;	title=document.title;	window.external.AddFavorite(url,title)}// EOF;