//image window popup resize script
PositionX = 100;
PositionY = 100;

defaultWidth  = 600;
defaultHeight = 480;

var AutoClose = true;

// Do not edit below this line...
// ================================
if (parseInt(navigator.appVersion.charAt(0))>=4){
var isNN=(navigator.appName=="Netscape")?1:0;
var isIE=(navigator.appName.indexOf("Microsoft")!=-1)?1:0;}
var optNN='scrollbars=no,width='+defaultWidth+',height='+defaultHeight+',left='+PositionX+',top='+PositionY;
var optIE='scrollbars=no,width=150,height=100,left='+PositionX+',top='+PositionY;
function popImage(imageURL,imageTitle){
if (isNN){imgWin=window.open('about:blank','',optNN);}
if (isIE){imgWin=window.open('about:blank','',optIE);}
with (imgWin.document){
writeln('<html><head><title>Loading...</title><style>body{margin:0px;}</style>');writeln('<sc'+'ript>');
writeln('var isNN,isIE;');writeln('if (parseInt(navigator.appVersion.charAt(0))>=4){');
writeln('isNN=(navigator.appName=="Netscape")?1:0;');writeln('isIE=(navigator.appName.indexOf("Microsoft")!=-1)?1:0;}');
writeln('function reSizeToImage(){');writeln('if (isIE){');writeln('window.resizeTo(100,100);');
writeln('width=100-(document.body.clientWidth-document.images[0].width);');
writeln('height=100-(document.body.clientHeight-document.images[0].height);');
writeln('window.resizeTo(width,height);}');writeln('if (isNN){');       
writeln('window.innerWidth=document.images["George"].width;');writeln('window.innerHeight=document.images["George"].height;}}');
writeln('function doTitle(){document.title="'+imageTitle+'";}');writeln('</sc'+'ript>');
if (!AutoClose) writeln('</head><body bgcolor=000000 scroll="no" onload="reSizeToImage();doTitle();self.focus()">')
else writeln('</head><body bgcolor=000000 scroll="no" onload="reSizeToImage();doTitle();self.focus()" onblur="self.close()">');
writeln('<img name="George" src='+imageURL+' style="display:block"></body></html>');
close();		
}}

//<![CDATA[
function showDiv(id) {

  var divs=document.getElementsByTagName("div");

for(i=0;i<divs.length;i++) {
if(divs[i].className=="showHide") {
   divs[i].style.display="none";
  }
 }
   document.getElementById(id).style.display="block";
 }
//]]>


function openDir( form ) { 
	var newIndex = form.fieldname.selectedIndex; 
	if ( newIndex != 0 ) {  
		cururl = form.fieldname.options[ newIndex ].value; 
		window.location.assign( cururl ); 
	} 
} 

function MM_jumpMenu(targ,selObj,restore){ //v3.0
  eval(targ+".location='"+selObj.options[selObj.selectedIndex].value+"'");
  if (restore) selObj.selectedIndex=0;
}

/***********************************************
* Overlapping Content link- � Dynamic Drive (www.dynamicdrive.com)
* This notice must stay intact for legal use.
* Visit http://www.dynamicdrive.com/ for full source code
***********************************************/

function getposOffset(overlay, offsettype) {
	var totaloffset=(offsettype=="left")? overlay.offsetLeft : overlay.offsetTop;
	var parentEl=overlay.offsetParent;

	while (parentEl!=null) {
		totaloffset=(offsettype=="left")? totaloffset+parentEl.offsetLeft : totaloffset+parentEl.offsetTop;
		parentEl=parentEl.offsetParent;
	}
	return totaloffset;
}

function overlay(curobj, subobj) {
	if (document.getElementById) {
		var subobj=document.getElementById(subobj)
		subobj.style.left=getposOffset(curobj, "left")+"px"
		subobj.style.top=getposOffset(curobj, "top")+"px" 
		subobj.style.display="block"

		return false
	}
	else
		return true
}

function overlayclose(subobj) {
	document.getElementById(subobj).style.display="none"
}


var preloaded = [];
var preName = [];


preName[1] = 'default';
preName[2] = 'biodiversity-of-nh';
preName[3] = 'rare-plants-and-communities';
preName[4] = 'web_towns.pdf';
preName[5] = 'frequently-asked-questions';
preName[6] = 'protect state-rare species';


for (var i = 1; i <= 6; i++) {
	preloaded[i] = [loadImage(preName[i] + "-0.gif"), loadImage(preName[i] + "-1.gif")];
}


function init() {
	//==========================================================================================
	// if supported, initialize TransMenus
	//==========================================================================================
	// Check isSupported() so that menus aren't accidentally sent to non-supporting browsers.
	// This is better than server-side checking because it will also catch browsers which would
	// normally support the menus but have javascript disabled.
	//
	// If supported, call initialize() and then hook whatever image rollover code you need to do
	// to the .onactivate and .ondeactivate events for each menu.
	//==========================================================================================
	if (TransMenu.isSupported()) {
		TransMenu.initialize();

		// hook all the highlight swapping of the main toolbar to menu activation/deactivation
		// instead of simple rollover to get the effect where the button stays hightlit until
		// the menu is closed.
				
	


	}
}


// preloader
function loadImage(sFilename) {
	var img = new Image();
	img.src ="/library/images/top-nav/" + sFilename;
	//img.src =sFilename;
	return img;
}
			
// swapper l'image
function swapImage(imgName, sFilename) {
//alert(sFilename);
	document.images[imgName].src = sFilename;
}

