
var itemswindow;
function popitem_window(details,imw,imh)
{
if (itemswindow)
		{
		itemswindow.close();
		}
    w=imw+30;
    h=imh+80;
	itemswindow=window.open(details, "FullSize", "toolbar=no,menubar=no,scrollbars=yes,directories=no,width="+w+",height="+h);
	itemswindow.focus();
	return false;

}


function shift_state_box(stateid)
	{
	var StateSelect=document.getElementById("homeStateId");
	StateSelect.selectedIndex = stateid;
	var inputString=document.getElementById("inputString");
	inputString.value='';
	
	
	}
	
// HOME PAGHE

function change_select_vis()
	{
	var checkone=document.getElementById("accomorsight_accom");
	var checktwo=document.getElementById("accomorsight_sight");
	
	if (checktwo.checked==true)
		{
		//alert("Goats2");
		document.getElementById("SelectCategory_accom").style.visibility='hidden';
		document.getElementById("SelectCategory_sights").style.visibility='visible';		
		}
	else if (checkone.checked==true)
		{
		document.getElementById("SelectCategory_accom").style.visibility='visible';
		document.getElementById("SelectCategory_sights").style.visibility='hidden';		
		}
	}
	
//
var iFrameLoaded=new Array();
function showhide_path_iframe(theId,parentid,countid)
	{	
	theelement=document.getElementById(theId);
	if (theelement.style.display=='none')
		{
		theelement.style.display='';	
		if (iFrameLoaded[countid]!=1)
			{
			theelement.src="find_a_path_iframe.php?resId="+parentid+"&theCount="+countid;
			//iFrameLoaded[countid]=1;
			}
		}
	else
		{
		theelement.style.display='none';
		//theelement.src="find_a_path_iframe.php?resId="+parentid+"&theCount="+countid;		
		}
	
	}
	

function dist_between_to_zoom(tdistance)
	{
	var	theZoom=5;	
	var Adjuster=-1;
	if (tdistance<40)
		{
		theZoom=11;
		}
	if (tdistance<80)
		{
		theZoom=10;
		}
	else if (tdistance<120)
		{
		theZoom=9;
		}	
	else if (tdistance<200)
		{
		theZoom=8;
		}	
	else if (tdistance<500)
		{
		theZoom=7;
		}
	else if (tdistance<1200)
		{
		theZoom=6;
		}
	
	theZoom=theZoom+Adjuster;
	return theZoom;	
	}
	

function print_r(theObj){
  if(theObj.constructor == Array ||
     theObj.constructor == Object){
    document.write("<ul>")
    for(var p in theObj){
      if(theObj[p].constructor == Array||
         theObj[p].constructor == Object){
document.write("<li>["+p+"] => "+typeof(theObj)+"</li>");
        document.write("<ul>")
        print_r(theObj[p]);
        document.write("</ul>")
      } else {
document.write("<li>["+p+"] => "+theObj[p]+"</li>");
      }
    }
    document.write("</ul>")
  }
}
	
function str_replace(search, replace, subject) {
    // http://kevin.vanzonneveld.net
    // +   original by: Kevin van Zonneveld (http://kevin.vanzonneveld.net)
    // +   improved by: Gabriel Paderni
    // +   improved by: Philip Peterson
    // +   improved by: Simon Willison (http://simonwillison.net)
    // +    revised by: Jonas Raoni Soares Silva (http://www.jsfromhell.com)
    // +   bugfixed by: Anton Ongson
    // +      input by: Onno Marsman
    // +   improved by: Kevin van Zonneveld (http://kevin.vanzonneveld.net)
    // +    tweaked by: Onno Marsman
    // *     example 1: str_replace(' ', '.', 'Kevin van Zonneveld');
    // *     returns 1: 'Kevin.van.Zonneveld'
    // *     example 2: str_replace(['{name}', 'l'], ['hello', 'm'], '{name}, lars');
    // *     returns 2: 'hemmo, mars'
 
    var f = search, r = replace, s = subject;
    var ra = r instanceof Array, sa = s instanceof Array, f = [].concat(f), r = [].concat(r), i = (s = [].concat(s)).length;
 
    while (j = 0, i--) {
        if (s[i]) {
            while (s[i] = (s[i]+'').split(f[j]).join(ra ? r[j] || "" : r[0]), ++j in f){};
        }
    };
 
    return sa ? s : s[0];
}


function showhide_facilslist()
	{
	var theList=document.getElementById("FacilsDD");
	var theButton=document.getElementById("FacilsDD_Button");
	var ListVis=theList.style.display;
	
	if (ListVis=='none')
		{
		theButton.value='Display Facilities > ';
		theList.style.display='';
		}
	else
		{
		theButton.value='Hide Facilities > ';
		theList.style.display='none';
		}

	}
	

function link_tracker(dsturl,compid) 
	{
    if(document.images)
		{
        (new Image()).src="_click_track.php?dsturl="+dsturl+"&cpid="+compid+"&frmloc="+document.location;
	    }    
	}
	
	
function change_campgrounds_status(theStatus)
	{
	theLoc=self.location;
	if (theStatus==true)
		{
		theLoc=theLoc+'&shcmpg=1';
		}
	else
		{
		theLoc=theLoc+'&shcmpg=2';		
		}
	theLoc=str_replace('.php?', '.php', theLoc);
	theLoc=str_replace('.php', '.php?', theLoc);
	window.location=theLoc;
	
	}

