<!--

var sDQ = String.fromCharCode(34);
var sSQ = String.fromCharCode(39);
var preloadFlag = false;

//=========================================================
 
 function trim_string(strValue) {
     var ichar, icount;
     //var strValue = this;
     ichar = strValue.length - 1;
     icount = -1;
     while (strValue.charAt(ichar)==' ' && ichar > icount)
         --ichar;
     if (ichar!=(strValue.length-1))
         strValue = strValue.slice(0,ichar+1);
     ichar = 0;
     icount = strValue.length - 1;
     while (strValue.charAt(ichar)==' ' && ichar < icount)
         ++ichar;
     if (ichar!=0)
         strValue = strValue.slice(ichar,strValue.length);
     return strValue;
 }
 
//=========================================================

function writeMenuButton(strCaption, strHref, strName){

	var  strRet;

	if(document.getElementById){
		//test for W3C compliance
		strRet = "<Span name='" + strName + "' class='menuitem'"		
		strRet = strRet + " onClick=" + sDQ;
		strRet = strRet + "javascript:location.href='" + strHref + "';" + sDQ;
		strRet = strRet + " onmousedown=" + sDQ + "javascript:this.className='menuclick';" + sDQ;
		strRet = strRet + " onmouseover=" + sDQ + "javascript:this.className='menuhighlight';" + sDQ;
		strRet = strRet + " onmouseout=" + sDQ + "javascript:this.className='menuitem';" + sDQ;
		strRet = strRet + ">&nbsp;" + strCaption + "&nbsp;</Span>&nbsp;";
	}
	else{
		strRet = " | <a href='" + strHref + "'>" + strCaption + "</a> | ";
	}	
	return strRet;
}

//=========================================================

function writeMenuFunction(strCaption, strFunction, strName){

	var  strRet;

	if(document.getElementById){
		//test for W3C compliance
		strRet = "<Span name='" + strName + "' class='menuitem'" 
		strRet = strRet + "' onClick=" + sDQ;
		strRet = strRet + strFunction + ";" + sDQ;
		strRet = strRet + " onmousedown=" + sDQ + "javascript:this.className='menuclick';" + sDQ;
		strRet = strRet + " onmouseover=" + sDQ + "javascript:this.className='menuhighlight';" + sDQ;
		strRet = strRet + " onmouseout=" + sDQ + "javascript:this.className='menuitem';" + sDQ;
		strRet = strRet + ">&nbsp;" + strCaption + "&nbsp;</Span>&nbsp;";
	}
	else{
		strRet = " | <a href='#'" + " onClick=" + sDQ + strFunction + ";" + sDQ + ">" + strCaption + "</a> | ";
		
	}	
	return strRet;
}
//=========================================================

function checkSize(strInfoName, strName, strVal, min, max){
	//test value
	if (min > 0){
		if (strVal.length < min || strVal.length > max){
			alert("Can not save " + strInfoName
				+ " information because the " + strName 
				+ " must be between " + min + " and " + max 
				+ " characters long");
			return false;
		}else{
			return true;
		}
	}else{
		if (strVal.length > max){
			alert("Can not save " + strInfoName
				+ " information because the " + strName 
				+ " must be less than  " + max 
				+ " characters long");
			return false;
		}else{
			return true;
		}

	}	
}


//=========================================================


function doHover(varItem, varSrc) {
	if (document.images) {
		document[varItem].src = varSrc;
	}
}

//=========================================================

function loadImage(arg) {
    var rslt;
	if (document.images) {
		rslt = new Image();
		rslt.src = arg;
		return rslt;
	}
}


//=========================================================

function checkPassword(strInfoName, strName ,strVal1, strVal2, min, max){
	var reobj1 = new RegExp(sDQ ,"g");
	var reobj2 = new RegExp(sSQ ,"g");

	//test password size
	if (checkSize(strInfoName, strName , strVal1, min, max)){	
		//test for invalid characters
		if (strVal1.match(reobj1 )){
			alert("The " + strName + " may not contain double quotes (" + sDQ  + "). Please try again.");
			return false;	
		}
		if (strVal1.match(reobj2)){
			alert("The " + strName + " may not contain single quotes (" + sSQ  + "). Please try again.");
			return false;	
		}		
		//run password compare
		if (strVal1 != strVal2){
			alert("The two " + strName + " fields are not the same.  Please try again.");
			return false;
		}
		return true;
	}else{
		return false;
	}
}

//=========================================================

function newImage(arg) {
	if (document.images) {
		rslt = new Image();
		rslt.src = arg;
		return rslt;
	}
}

//=========================================================

function changeImages() {
	if (document.images && (preloadFlag == true)) {
		for (var i=0; i<changeImages.arguments.length; i+=2) {
			document[changeImages.arguments[i]].src = changeImages.arguments[i+1];
		}
	}
}

//=========================================================

function preloadImages() {
	if (document.images) {
		lodging_over = newImage("images/lodging-over.gif");
		restaurants_over = newImage("images/restaurants-over.gif");
		onthewater_over = newImage("images/onthewater-over.gif");
		fishing_over = newImage("images/fishing-over.gif");
		shops_over = newImage("images/shops-over.gif");
		realestate_over = newImage("images/realestate-over.gif");
		business_over = newImage("images/business-over.gif");
		communitysrv_over = newImage("images/communitysrv-over.gif");
		calender_over = newImage("images/calendar-over.gif");
		history_over = newImage("images/history-over.gif");
		directions_over = newImage("images/directions-over.gif");
		countysites_over = newImage("images/countysites-over.gif");
		home_over = newImage("images/lodging-over.gif");
		preloadFlag = true;
	}
}


//-->

