function preloadImgs(){var d=document,a=arguments;if(!d.imgs)
d.imgs=new Array();if(d.images){for(var i=0;i<a.length;i++)
{d.imgs[i]=new Image;d.imgs[i].src=a[i];}}}
startList=function(){if(document.all&&document.getElementById){navRoot=document.getElementById("nav");for(i=0;i<navRoot.childNodes.length;i++){node=navRoot.childNodes[i];if(node.nodeName=="LI"){node.onmouseover=function(){this.className+=" over";}
node.onmouseout=function(){this.className=this.className.replace(" over","");}}}}}
window.onload=startList;var directions;function showMap(){if(GBrowserIsCompatible()){var map=new GMap2(document.getElementById("map"));var point=new GLatLng(35.2236111,-89.1888889);var marker=new GMarker(point);map.setCenter(point,13);map.addOverlay(marker);map.addControl(new GSmallMapControl());map.addControl(new GMapTypeControl());directions=new GDirections(map,document.getElementById("map_dir"));GEvent.addListener(directions,"error",handleErrors);}}
function setDirections(fromAddress){var locale="en_US";var toAddress="Laverne Davis Road, Whiteville, TN 38075";directions.load("from: "+fromAddress+" to: "+toAddress,{"locale":locale});}
function handleErrors(){if(directions.getStatus().code==G_GEO_UNKNOWN_ADDRESS)
alert("Unknown Address.\nPlease Enter it again");else if(directions.getStatus().code==G_GEO_SERVER_ERROR)
alert("A geocoding or directions request could not be successfully processed, yet the exact reason for the failure is not known.");else if(directions.getStatus().code==G_GEO_MISSING_QUERY)
alert("The HTTP q parameter was either missing or had no value. For geocoder requests, this means that an empty address was specified as input. For directions requests, this means that no query was specified in the input.");else if(directions.getStatus().code==G_GEO_BAD_KEY)
alert("The given key is either invalid or does not match the domain for which it was given.");else if(directions.getStatus().code==G_GEO_BAD_REQUEST)
alert("A directions request could not be successfully parsed.");else alert("An unknown error occurred.");}
function valEmail(){var fEmail=document.add_email;var email=fEmail.email.value;var valid=true;if(isEmail(email)==false){alert("Please enter a valid email address");fEmail.email.focus();valid=false;}
return valid;}
function TrimWhite(StrToRep)
{StrToRep=StrToRep.replace(/^\s*(.*\S|.*)\s*$/,'$1');return StrToRep;}
function isEmail(str){var supported=0;if(window.RegExp){var tempStr="a";var tempReg=new RegExp(tempStr);if(tempReg.test(tempStr))supported=1;}
if(!supported)
return(str.indexOf(".")>2)&&(str.indexOf("@")>0);var r1=new RegExp("(@.*@)|(\\.\\.)|(@\\.)|(^\\.)");var r2=new RegExp("^.+\\@(\\[?)[a-zA-Z0-9\\-\\.]+\\.([a-zA-Z]{2,3}|[0-9]{1,3})(\\]?)$");return(!r1.test(str)&&r2.test(str));}
function isDigits(element){var r1=new RegExp("[^0-9]");return!r1.test(element);}
function isAlpha(element){var r1=new RegExp("[^A-z^ ]");return!r1.test(element);}
function isAlphaNumeric(element){var r1=new RegExp("[^A-z^0-9^ '.!?,&;:]");return!r1.test(element);}
function isZipCode(code){var length=code.length;if((length!=5)&&(length!=9)){return FALSE;}
return isDigits(code);}
function isState(stateCode){if(!isAlpha(stateCode)){return false;}
if(stateCode.length!=2){return false;}
return true;}
function isPhoneNumber(phoneNumber){var r1=new RegExp("^([0-9]{3})[.-]([0-9]{3})[.-]([0-9]{4})$");return r1.test(phoneNumber);}
function valContact(){var cu=document.contactUsForm;var name=cu.name.value;var address=cu.address.value;var city=cu.city.value;var state=cu.state.value;var zip=cu.zip.value;var phone=cu.phone.value;var email=cu.email.value;var comments=cu.comments.value;var isValid=true;if(isAlpha(name)==false||name.length==0){alert("Please enter a valid name");cu.name.focus();isValid=false;}
if(TrimWhite(address).length>0){if(isAlphaNumeric(address)==false){alert("Please enter a valid address");cu.address.focus();isValid=false;}}
if(TrimWhite(city).length>0){if(isAlpha(city)==false){alert("Please enter a valid city");cu.city.focus();isValid=false;}}
if(TrimWhite(state).length>0){if(isState(state)==false){alert("Please enter a valid state");cu.state.focus();isValid=false;}}
if(TrimWhite(zip).length>0){if(isZipCode(zip)==false){alert("Please enter a valid zip");cu.zip.focus();isValid=false;}}
if(TrimWhite(phone).length>0){if(isPhoneNumber(phone)==false){alert("Please enter a valid phone");cu.phone.focus();isValid=false;}}
if(isEmail(email)==false||email.length==0){alert("Please enter a valid email");cu.email.focus();isValid=false;}
return isValid;}