// JavaScript Document

//Changes the navigation to a downstate for the right page

function mainNavDown(b) {
	document.getElementById(b).style.backgroundColor="#fff";
}

function toggle( targetId ){
  if (document.getElementById){
        target = document.getElementById( targetId );
           if (target.style.display == "block"){
              target.style.display = "none";
           } else {
              target.style.display = "block";
           }
     }
} 

// for the image popup resizer

function PopupInfo(URL) {
	
	window.open( URL, "popUpInfo","resizable=1,height=280,width=400");
}

function PopupWindow(URL) {
	
	window.open( URL, "Information","resizable=1,height=600,width=800,scrollbars=yes");
}

function PopupPic(sPicURL) {
     window.open( "imgPop.asp?"+sPicURL, "popUp","resizable=1,height=1,width=1");
} 


var arrTemp=self.location.href.split("?");
var imgname = (arrTemp.length>1)?arrTemp[1]:"";
var NS = (navigator.appName=="Netscape")?true:false;

function FitPic() {
       iWidth = (NS)?window.innerWidth:document.body.clientWidth;
       iHeight = (NS)?window.innerHeight:document.body.clientHeight;
       iWidth = document.images[0].width - iWidth;
       iHeight = document.images[0].height - iHeight;
       window.resizeBy(iWidth, iHeight);
       self.focus();
}; 

function imagpop_onload() {
var window_size = ICJ_browserWindowSize();
window.resizeBy(document.images[0].width - window_size['width'], document.images[0].height - window_size['height']);
self.focus();
}

function ICJ_browserWindowSize() {
var r = new Array();
r['width'] = 0;
r['height'] = 0;
if(typeof(window.innerWidth) == 'number' ) {
//Non-IE
r['width'] = window.innerWidth;
r['height'] = window.innerHeight;
}
else if(document.documentElement && (document.documentElement.clientWidth || document.documentElement.clientHeight)) {
//IE 6+ in 'standards compliant mode'
r['width'] = document.documentElement.clientWidth;
r['height'] = document.documentElement.clientHeight;
}
else if(document.body && (document.body.clientWidth || document.body.clientHeight)) {
//IE 4 compatible
r['width'] = document.body.clientWidth;
r['height'] = document.body.clientHeight;
}
return r;
}

// open the main window from popup and close popup
function mainFromPop(URL) {
	window.opener.location.href = URL;
	window.close();
}