function getPageScroll() {
 var xScroll, yScroll;
 if (self.pageYOffset) {
 xScroll = self.pageXOffset;
 yScroll = self.pageYOffset;
 }
 else if (document.documentElement && document.documentElement.scrollTop) {
 xScroll = document.documentElement.scrollLeft;
 yScroll = document.documentElement.scrollTop;
 }
 else if (document.body) {
 xScroll = document.body.scrollLeft;
 yScroll = document.body.scrollTop;
 }
 arrayPageScroll = new Array(xScroll, yScroll);
 return arrayPageScroll;
}

function getPageSize() {
 var xScroll, yScroll;
 if (window.innerHeight && window.scrollMaxY) {
 xScroll = document.body.scrollWidth;
 yScroll = window.innerHeight + window.scrollMaxY;
 }
 else if (document.body.scrollHeight > document.body.offsetHeight) { 
 xScroll = document.body.scrollWidth;
 yScroll = document.body.scrollHeight;
 }
 else { 
 xScroll = document.body.offsetWidth;
 yScroll = document.body.offsetHeight;
 }
 var windowWidth, windowHeight;
 if (self.innerHeight) { 
 windowWidth = self.innerWidth;
 windowHeight = self.innerHeight;
 }
 else if (document.documentElement && document.documentElement.clientHeight) { 
 windowWidth = document.documentElement.clientWidth;
 windowHeight = document.documentElement.clientHeight;
 }
 else if (document.body) { 
 windowWidth = document.body.clientWidth;
 windowHeight = document.body.clientHeight;
 }
 if (yScroll < windowHeight) {
 pageHeight = windowHeight;
 }
 else {
 pageHeight = yScroll;
 }
 pageWidth = (xScroll < windowWidth ? xScroll : windowWidth);
 arrayPageSize = new Array(pageWidth, pageHeight, windowWidth, windowHeight);
 return arrayPageSize;
}
	function displayPopup(wdwWidth,wdwHeight) {
		wdw=document.getElementById("editorPopup");
	  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;
	  }		
		
		var docSize=getPageSize()
		var docScroll=getPageScroll()
		docHeight=docSize[1]
		
		var Xcor = (myWidth-wdwWidth)/2; 
		var Ycor = ((myHeight-wdwHeight)/2)+docScroll[1]
		//alert("left="+Xcor+"\ntop="+Ycor)
		document.getElementById("blankout").style.height=docHeight+'px'
		document.getElementById("blankout").style.display='block'
		document.getElementById("blankout").style.zIndex='900'
		
		wdw.style.width=wdwWidth+"px"
		wdw.style.height=wdwHeight+"px"
		
		wdw.style.left=""+Xcor+"px"
		wdw.style.top=Ycor+"px"
		wdw.style.display='block'
		wdw.style.zIndex='950'
	}
	
	function hidePopup() {
		document.getElementById("editorPopup").innerHTML=""
		document.getElementById("editorPopup").style.display='none'
		document.getElementById("blankout").style.display='none'
	}	


	function displayPopup2(wdwWidth,wdwHeight) {
		wdw=document.getElementById("editorPopup2");
	  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;
	  }		
		
		var docSize=getPageSize()
		var docScroll=getPageScroll()
		docHeight=docSize[1]
		
		var Xcor = (myWidth-wdwWidth)/2; 
		var Ycor = ((myHeight-wdwHeight)/2)+docScroll[1]
		//alert("left="+Xcor+"\ntop="+Ycor)
		document.getElementById("blankout2").style.height=docHeight+'px'
		document.getElementById("blankout2").style.display='block'
		document.getElementById("blankout2").style.zIndex='980'
		
		wdw.style.width=wdwWidth+"px"
		wdw.style.height=wdwHeight+"px"
		
		wdw.style.left=""+Xcor+"px"
		wdw.style.top=Ycor+"px"
		wdw.style.display='block'
		wdw.style.zIndex='999'
	}

	function hidePopup2() {
		document.getElementById("editorPopup2").innerHTML=""
		document.getElementById("editorPopup2").style.display='none'
		document.getElementById("blankout2").style.display='none'
	}
	

var xmlHttp
var currentReceivingObj

function postAjaxObj(URLstr,receivingObjId,params) {
	xmlHttp=GetXmlHttpObject()
	if (xmlHttp==null) {
	 alert ("Browser does not support HTTP Request")
	 return
	}
	currentReceivingObj=receivingObjId
	var url=URLstr
	
	
	xmlHttp.open("POST", url, true);	
	xmlHttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
	xmlHttp.setRequestHeader("Content-length", params.length);
	xmlHttp.setRequestHeader("Connection", "close");	
	xmlHttp.onreadystatechange=stateChanged
	xmlHttp.send(params);
}






function getAjaxObj(URLstr,receivingObjId) {
	
	xmlHttp=GetXmlHttpObject()
	if (xmlHttp==null) {
	 alert ("Browser does not support HTTP Request")
	 return
	}
	currentReceivingObj=receivingObjId
	
	var url=URLstr
	xmlHttp.onreadystatechange=stateChanged
	xmlHttp.open("GET",url,true)
	xmlHttp.send(null)
	
}

function stateChanged() { 
	if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete") { 
		var resp=xmlHttp.responseText
			//alert (resp)
			document.getElementById(currentReceivingObj).innerHTML=xmlHttp.responseText 
			try {
				runAfterAjaxLoad()
			} catch (e) {
			
			}
	} else {
		document.getElementById(currentReceivingObj).innerHTML='<img src="/images/system/ball_3_anim.gif" width="33" height="33" alt="">... retrieving'
	}
}

function GetXmlHttpObject() {
	var xmlHttp=null;
	try {
	 // Firefox, Opera 8.0+, Safari
	 xmlHttp=new XMLHttpRequest();
 	} catch (e)  {
 	//Internet Explorer
 		try {
  		xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
  	}  catch (e) {
  		xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
  	}
 	}
	return xmlHttp;
}
