// JavaScript Document

function toggleme(obj)
{
    if (typeof(obj) == "string")
    {
        obj = document.getElementById(obj);
    }
    if (obj != null)
    {
        if (obj.style.display == "none")
	    {
	        obj.style.display = "block";
	    }
	    else if (obj.style.display == "block")
	    {
	        obj.style.display = "none";
	    } 
	    else if (obj.className == 'hide')
	    {
	        obj.className = 'show';
	    }
	    else if (obj.className == "show")
	    {
	        obj.className = 'hide';
	    }
	}
}
function hideme(obj)
{
    if (typeof(obj) == "string")
    {
        obj = document.getElementById(obj);
    }
    if (obj != null)
    {
        if (obj.style.display == "block")
	    {
	        obj.style.display = "none";
	    } 
	    else if (obj.className == 'show')
	    {
	        obj.className = 'hide';
	    }
	}
    
}
function showme(obj)
{
    if (typeof(obj) == "string")
    {
        obj = document.getElementById(obj);
    }
    if (obj != null)
    {
        if (obj.style.display == "none")
	    {
	        obj.style.display = "block";
	    } 
	    else if (obj.className == 'hide')
	    {
	        obj.className = 'show';
	    }
	}
}

function showmessage(message)
{
    showmessage(message, '');
}

function showmessage(message, spanclass)
{
    var literal = document.getElementById('liClientMessage');
    literal.innerHTML = '<div id="divMessageJS" class="messagebox" style="display: block;">' +
        '<div class="header">Message</div><p><span class="' +
        spanclass + '">' + message + '</span><br /></p><br /><p><a href="javascript:hideme(\'divMessageJS\');" class="closebtn">x close window</a></p></div>';
}

 //pop up function default
function openNewWindow(URLtoOpen, windowName, windowFeatures) 
{
    newWindow=window.open(URLtoOpen, windowName, windowFeatures); 
}

function openPhotoPopup(img, w, h)
{
    var url = "/detailphotopopup.aspx?img=" + img + "&w=" + w + "&h=" + h;
    openNewWindow(url, img, "resizable=yes,width=460,height=400");
}

function openSlideshow(album)
{
    var url = "/slideshowpopup.aspx?h=225&w=575&album=" + album;
    openNewWindow(url, album, "resizable=yes,width=675,height=325");
}

function openVideo(video)
{
    var url = "/assets/flv/videopopup.aspx?h=240&w=360&video=" + video;
    openNewWindow(url, video, "resizable=yes,width=480,height=340");
}

function openRegionalMap(region)
{
    var url = "/mappopup.aspx?h=400&w=550&region=" + region;
    openNewWindow(url, region, "resizable=yes,width=650,height=500");
}

function setFormAction()
{
    var myForm = document.forms['aspnetForm'];
    if (!myForm) {
        myForm = document.aspnetForm;
    }
    if (myForm != null)
    {
        myForm.action = top.location.href;
        if (top.location.href.indexOf(".aspx") < 0)
        {
            myForm.action += "index.aspx";
        }
    }
}

//handle menu rollovers for IE
var selectclasses = new Array();


//ie menu rollover
sfHover = function() 
{
	if (document.getElementById("nav"))
	{
		var sfEls = document.getElementById("nav").getElementsByTagName("LI");
		for (var i=0; i<sfEls.length; i++) 
		{
			sfEls[i].onmouseout=function() 
			{
				//document.getElementById("debug").innerHTML = this.className.replace(new RegExp("sfhover\\b"), "") + " --" + this.innerHTML;;
				//this.className=this.className.replace(new RegExp("sfhover\\b"), "");
				this.className="";
				/*var theForm = document.forms[0];//("frm");
				for(i = 0; i < theForm.elements.length; i++)
				{
					if(theForm.elements[i].selectedIndex != undefined)
					{
						theForm.elements[i].className = selectclasses[i];
					}
				}
				selectclasses = new Array();*/
			}
			sfEls[i].onmouseover=function() 
			{
				//this.className+="sfhover";
				this.className="sfhover";
				/*
				var theForm = document.forms[0];//("frm");
				for(i = 0; i < theForm.elements.length; i++)
				{
					if(theForm.elements[i].selectedIndex != undefined)
					{
						selectclasses[i] = theForm.elements[i].className;
						theForm.elements[i].className = "hideselect";
					}
				}*/
			}
		}
	}
}

function Browser() {

  var ua, s, i;

  this.isIE    = false;
  this.isNS    = false;
  this.version = null;

  ua = navigator.userAgent;

  s = "MSIE";
  if ((i = ua.indexOf(s)) >= 0) {
    this.isIE = true;
    this.version = parseFloat(ua.substr(i + s.length));
    return;
  }

  s = "Netscape6/";
  if ((i = ua.indexOf(s)) >= 0) {
    this.isNS = true;
    this.version = parseFloat(ua.substr(i + s.length));
    return;
  }

  // Treat any other "Gecko" browser as NS 6.1.

  s = "Gecko";
  if ((i = ua.indexOf(s)) >= 0) {
    this.isNS = true;
    this.version = 6.1;
    return;
  }
}

var browser = new Browser();
if (browser.isNS) document.captureEvents(Event.MOUSEMOVE)

// Set-up to use getMouseXY function onMouseMove
document.onmousemove = getMouseXY;

// Temporary variables to hold mouse x-y pos.s
var tempX = 0
var tempY = 0

// Main function to retrieve mouse x-y pos.s

function getMouseXY(e) {
  if (browser.isIE) { // grab the x-y pos.s if browser is IE
    tempX = event.clientX;// + document.body.scrollLeft;
    tempY = event.clientY;// + document.body.scrollTop;
  } else {  // grab the x-y pos.s if browser is NS
    tempX = e.pageX
    tempY = e.pageY
  }  
  // catch possible negative values in NS4
  if (tempX < 0){tempX = 0}
  if (tempY < 0){tempY = 0}  
  
  return true
}

function idprOnload()
{
    setFormAction();
    if (document.all) 
    {
        sfHover(); 
    }
    IsPageLoaded = true;
}

function showReserveMessage()
{
    var literal = document.getElementById('liReserveMessage');
    
    var message = 'Many of our campsite numbers and facility names have changed since last season. Please verify in the "Show Site Details" popup, that the site you have chosen is the site you intend to reserve.'
    literal.innerHTML = '<div style="position:absolute; top: -150px; left: 150px;" id="divReserveMessage" class="messagebox" style="display: block;">' +
        '<div class="header">Online Reservations</div><p><span>' + message + '</span><br /></p><br />' + 
        '<p><a href="javascript:top.location.href=\'http://idpr.camis.com\';" class="closebtn">Continue</a>' + 
        '<a href="javascript:void(0);" onclick="document.getElementById(\'divReserveMessage\').style.display = \'none\';" class="closebtn">x close window</a>' + 
        '</p></div>';
}
//void(0);" onclick="hideme(\'divReserveMessage\')