// JavaScript Document
SiteRoot = "";
var imgPlus = new Image();
imgPlus.src = SiteRoot + "images/site/plus.gif";
var imgMinus = new Image();
imgMinus.src = SiteRoot + "images/site/minus.gif";


function ContextMenuClick(node, itemText)
{
	if(itemText == "Delete Page")
	{
		return confirm('Are you sure you want to delete this page?');
	}
	else return true;
}


function toggleme(obj)
{
	if (obj.className == 'hide')
	{
		showme(obj);
	}
	else
	{
		hideme(obj);
	}
}
function hideme(obj)
{
	obj.className = 'hide';
}
function showme(obj)
{
	obj.className = 'show';
}

function expShowPanel(panelid)
{
	document.getElementById(panelid).style.visibility = 'visible';
	document.getElementById(panelid).style.height = 'auto';
}

function expHidePanel(panelid)
{
	document.getElementById(panelid).style.visibility = 'hidden';
	document.getElementById(panelid).style.height = '1px';
}


 //pop up function default
function openNewWindow(URLtoOpen, windowName, windowFeatures) {
newWindow=window.open(URLtoOpen, windowName, windowFeatures); }

function PopRegionMap(regionid)
{
	openNewWindow('regionmap.aspx?RegionID=' + regionid, 'Region', 'width=600,height=560');
}

function printArticle() {
	var prn = new Image();
	prn.src="http://www.rvidaho.org";
	if (window.print) {
		setTimeout('window.print();',200);
	}
	else if (agt.indexOf("mac") != -1) {
		alert("Press 'Cmd+p' on your keyboard to print article.");
	}
	else {
		alert("Press 'Ctrl+p' on your keyboard to print article.")
	}
}

/* btnswap function to swap styles- - - - - - - - - - - - - - - - - */

function btnswap(obj, new_style) {
    obj.className = new_style;
}

//submit button rollover function
function btnsubmitswap(obj, new_style) {
    obj.className = new_style;
}

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].onmouseover=function() 
			{
				this.className+="sfhover";
				var theForm = document.forms[0];
				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";
					}
				}
			}
			sfEls[i].onmouseout=function() 
			{
				this.className=this.className.replace(new RegExp("sfhover\\b"), "");
				var theForm = document.forms[0];
				for(i = 0; i < theForm.elements.length; i++)
				{
					if(theForm.elements[i].selectedIndex != undefined)
					{
						theForm.elements[i].className = selectclasses[i];
					}
				}
				selectclasses = new Array();
			}
		}
	}
}
if (document.all) 
{ 
	//MS IE
	if (window.attachEvent) 
	{
		window.attachEvent("onload", sfHover);
	}
	else 
	{ 
		//IE 5.2 Mac does not support attachEvent
		var old = window.onload; 
		window.onload = function() 
		{ 
			if (old) old(); 
			sfHover(); 
		} 
	}
}

//map pop up window
function mappop(url) {
day = new Date();
id = day.getTime();
eval("page" + id + " = window.open(url, '" + id + "', 'toolbar=0,scrollbars=1,location=0,statusbar=0,menubar=0,resizable=1,width=630,height=600,left = 100.5,top = 100.5');");
}
