function ShowPop(popName)
{
	var f = document.forms[0];
		
	if (typeof(Page_Validators) == "undefined") {			        
		
		DisplayDropDowns("none");
		setVisibleStyle(popName) ;
	} else {
		if (Page_IsValid ) {						
			DisplayDropDowns("none");
			setVisibleStyle(popName) ;		
		}
	}
	return false;
	
}
function ShowPopNoValidate(popName)
{
	var f = document.forms[0];			        
		
	DisplayDropDowns("none");
	setVisibleStyle(popName) ;
	
	return false;
	
}
function setVisibleStyle(popName) {
	
	var dvpop = document.getElementById(popName);
	dvpop.style.display = "inline";
	dvpop.style.position = "absolute";
	dvpop.style.zIndex = -1;	//set behind to not show moving			
	//dvpop.style.left = 387;		
	//dvpop.style.top = 161;				
	
	positionPop(popName);	
	dvpop.style.zIndex = 99;				
	
	 
}
function positionPop(popName) {
	
	var element = document.getElementById("root");
	var dvpop = document.getElementById(popName);
	dvpop.style.zIndex = -1;
//	if (dvpop) {	
//		if (element) {		
//			dvpop.style.left = calculateOffsetLeft(element) + parseInt(element.offsetWidth/2) - parseInt(dvpop.offsetWidth/2) + "px";;
//			dvpop.style.top = calculateOffsetTop(element) + parseInt(element.offsetHeight/2) -  parseInt(dvpop.offsetHeight/2) + "px";	
//			alert(dvpop.style.left + " " + dvpop.style.top);				
//						
//		} else {
//			dvpop.style.top = parseInt(70 +((document.body.clientHeight - dvpop.offsetHeight) / 2),10) + "px"  ;						
//			dvpop.style.left = parseInt(10 + ((document.body.clientWidth - dvpop.offsetWidth) / 2),10) + "px";	
//	
//		}	
//  }

    if (dvpop) {	
			var myWidth = 0, myHeight = 0;
			if( typeof( window.innerWidth ) == 'number' ) {
				//Non-IE
				myWidth = window.innerWidth;
				myHeight = window.innerHeight;
			} else if( document.documentElement && ( document.documentElement.clientWidth || document.documentElement.clientHeight ) ) {
				//IE 6+ in 'standards compliant mode'
				myWidth = document.documentElement.clientWidth;
				myHeight = document.documentElement.clientHeight;
			} else if( document.body && ( document.body.clientWidth || document.body.clientHeight ) ) {
				//IE 4 compatible
				myWidth = document.body.clientWidth;
				myHeight = document.body.clientHeight;				
			}			
			if (element && document.all) {	
			    dvpop.style.left = calculateOffsetLeft(element);			    
			} else {
			    dvpop.style.left = (parseInt(myWidth/2) - parseInt(dvpop.clientWidth/2)) + "px";;
			}
			dvpop.style.top = (parseInt(myHeight/2) - parseInt(dvpop.clientHeight/2)) + "px";				
		}
	dvpop.style.zIndex = 99;
}
function calculateOffsetTop(field) {
        return calculateOffset(field, "offsetTop");
    }

function calculateOffsetLeft(field) {
    return calculateOffset(field, "offsetLeft");
}

function calculateOffset(field, attr) {
    var offset = 0;
    while(field) {
    offset += field[attr]; 
    field = field.offsetParent;
    }
    return offset;
}
    
function DisplayDropDowns(sMode)
{
	var x=0;
	var y=0;
	var bHide=false;
	
	for(x=0;x<document.forms.length;x++)
	{
		for(y=0;y<document.forms[x].elements.length;y++)
		{
			if(document.forms[x].elements[y].type=="select-one") { document.forms[x].elements[y].style.display = sMode; } 			
		}
	}
	if(bHide==true) { DisplayDropDowns("none"); }
}

function HidePop(popName)
{
	
	if (document.getElementById(popName)) {
		if (document.getElementById(popName).style.display != "none") {
			document.getElementById(popName).style.display = "none";		
			DisplayDropDowns("inline");
		}
	}
	
}

