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=no,copyhistory=no,width='+w+',height='+h);
		viewimageWin.focus();
	}

function openC2C(w,h,webaddress,name,scrolls) {
 	var scroll = scrolls;
	var viewimageWin = window.open(webaddress,name,'left=0,top=0,toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars='+scroll+',resizable=no,copyhistory=no,width='+w+',height='+h);
	viewimageWin.focus();
}
	
function ShowCalendar(w,h,FormName, FieldName) {
	var curValue = eval("document."+FormName+"."+FieldName+".value");
	var winLeft = (screen.availWidth/2)-(w/2);
	var winTop = (screen.availHeight/2)-(h/2);
	window.open("DatePopup.cfm?getDate="+ curValue + "&FormName=" + FormName + "&FieldName=" + FieldName, "CalendarWindow", "width="+w+",height="+h+",left="+winLeft+",top="+winTop);
}

function showLayer(objLink,divID){
	var coors = findPos(objLink);
	coors[1] -= -15;					
	if (ng5) {
		var lyr = document.getElementById(divID);			
		if (lyr.style.display == "none") {
		lyr.style.display = "block";
		lyr.style.top = coors[1] + 'px';
		lyr.style.left = coors[0] + 'px';
		} else {
		lyr.style.display = "none";
		}	
	}
	else if (ns4) {
		var lyr = document.layers[divID];
		if (lyr.visibility == "hidden") {
		lyr.visibility = "show";
		lyr.style.top = coors[1] + 'px';
		lyr.style.left = coors[0] + 'px';
		} else {
		lyr.visibility = "hidden";
		}	
	}
	else if (ie4){
		var lyr = document.all[divID];
		if (lyr.style.display == "none") {
		lyr.style.display = "block";
		lyr.style.top = coors[1] + 'px';
		lyr.style.left = coors[0] + 'px';
		} 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);
	window.close();
	}
