ng5 = (document.getElementById) ? true:false
ns4 = (document.layers) ? true:false
ie4 = (document.all) ? true:false 
	

function openPop(w,h,webaddress,name,scrolls) {
	 	var winLeft = (screen.availWidth/2)-(w/2);
		var winTop = (screen.availHeight/2)-(h/2);
		var scroll = scrolls;
		var viewimageWin = window.open(webaddress,name,'left='+winLeft+',top='+winTop+',toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars='+scroll+',resizable=yes,copyhistory=no,width='+w+',height='+h);
		viewimageWin.focus();
	}
function showLyr(divID){				
	if (ng5) {
		var lyr = document.getElementById(divID);			
		if (lyr.style.display == "none") {
		lyr.style.display = "block";
		} else {
		lyr.style.display = "none";
		}	
	}
	else if (ns4) {
		var lyr = document.layers[divID];
		if (lyr.visibility == "hidden") {
		lyr.visibility = "show";
		} else {
		lyr.visibility = "hidden";
		}	
	}
	else if (ie4){
		var lyr = document.all[divID];
		if (lyr.style.display == "none") {
		lyr.style.display = "block";
		} else {
		lyr.style.display = "none";
		}	
	}	
}

function findPos(obj)
{
	var curleft = curtop = 0;
	if (obj.offsetParent) {
		curleft = obj.offsetLeft
		curtop = obj.offsetTop
		while (obj = obj.offsetParent) {
			curleft += obj.offsetLeft
			curtop += obj.offsetTop
		}
	}
	return [curleft,curtop];
}


function changeParent(page){
 		opener.location.replace(page);
		opener.focus();
	window.close();
	}

function closeLayer(divIDClose,divIDFade,divClose){			
	if (ng5) {
		if (document.getElementById(divIDClose).style.display == "none") {
		document.getElementById(divIDClose).style.display = "block";	
		document.getElementById(divIDFade).style.filter = "alpha(opacity=100)";
		document.getElementById(divClose).src = "gfx/close.gif";
		}
		else {
		document.getElementById(divIDClose).style.display = "none";	
		document.getElementById(divIDFade).style.filter = "alpha(opacity=25)";
		document.getElementById(divClose).src = "gfx/open.gif";
		}		
	}
	else if (ns4) {
		if (document.layers[divIDClose].visibility = "hidden") {
		document.layers[divIDClose].visibility = "show";
		document.layers[divIDFade].opacity = "1";
		document.layers[divClose].src = "gfx/close.gif";
		}
		else {
		document.layers[divIDClose].visibility = "hidden";
		document.layers[divIDFade].opacity = "0.25";
		document.layers[divClose].src = "gfx/open.gif";
		}
	}
	else if (ie4){
		if (document.all[divIDClose].display = "block") {
		document.all[divIDClose].display = "none";
		document.all[divIDFade].opacity = "0.25";
		document.all[divIDClose].src = "gfx/close.gif";
		}
		else {
		document.all[divIDClose].display = "none";
		document.all[divIDFade].opacity = "0.25";
		document.all[divIDClose].src = "gfx/open.gif";
		}
	}	
}