function PopUpObj()
{
	this.popUpInit = function(windowname,width)
	{	// initialize pop up base on the current size of browser
		popupwindow = windowname;
		if (parseInt(navigator.appVersion)>3) {
			winH = (navigator.appName=="Netscape")?window.innerHeight:document.body.offsetHeight;
			winW = (navigator.appName=="Netscape")?window.innerWidth:document.body.offsetWidth;
			//document.documentElement.style.overflowX="hidden";
		}
		//document.documentElement.style.overflowX = 'hidden';
		// create background
		popupwidth = width;
		
		if((navigator.appName).match("Microsoft")=="Microsoft")
		{	bg = document.createElement("<div id='popupbackground' style='position:absolute;display: none; background: #ddd; border: 0px solid #ffffff; left: 0px;  filter:alpha(opacity=70)'></div>");
		}else
		{
			bg = document.createElement("div");
			bg.setAttribute("id","popupbackground");
			bg.setAttribute("style","position:absolute;display: none; background: #ffffff; border: 0px solid #ffffff; left: 0px; opacity:0.7;");		
		}
		document.body.appendChild(bg);
	}
	this.onWindowResize = function()
	{	//  when window is resized
		var obj = document.getElementById("popupbackground");
		if((navigator.appName).match("Microsoft"))
		{
			tempwidth =document.body.offsetWidth-15;
			tempheight = document.body.offsetHeight-20;
			//alert(tempwidth+" "+tempheight);
		}else{
			tempwidth = (navigator.appName=="Netscape")?window.innerWidth:document.body.offsetWidth;
			tempheight = (navigator.appName=="Netscape")?window.innerHeight:document.body.offsetHeight;
		}
		if(winW < tempwidth)
			obj.style.width=tempwidth+"px";
		if(winH < tempheight)
			obj.style.height=(tempheight+2)+"px";
		
		var objpop = document.getElementById(popupwindow);
		objpop.style.left=(tempwidth/2-(popupwidth/2))+"px";

	}
	this.onWindowScroll = function()
	{		
		if(document.getElementById('popupbackground').style.display=="block")
		{	
			window.scroll(0,0);
		}
		
	}
	this.showPopUp = function()
	{	// trigger pop up to appear
		
		window.scroll(0,0);
		bpopup = 1;
		var obj = document.getElementById("popupbackground");
		obj.style.display="block";
		obj.style.width=((navigator.appName=="Netscape")?window.innerWidth:(navigator.appName=="Opera")?document.body.offsetWidth:document.body.offsetWidth-15)+"px";
		obj.style.height=(((navigator.appName=="Netscape")?window.innerHeight:(navigator.appName=="Opera")?document.body.offsetHeight:document.body.offsetHeight-20)+2)+"px";
		obj.style.left="0px";
		obj.style.top="0px";
		
		var objpop = document.getElementById(popupwindow);
		
		//objpop.style.left=(((navigator.appName=="Netscape")?window.innerWidth:document.body.offsetWidth)/2-(256/2))+"px";
		var obj = document.getElementById("popupbackground");
		if((navigator.appName).match("Microsoft"))
		{
			tempwidth =document.body.offsetWidth-15;
		}else{
			tempwidth = (navigator.appName=="Netscape")?window.innerWidth:document.body.offsetWidth;
		}
		objpop.style.display="block";

		objpop.style.left=Math.ceil((tempwidth-popupwidth)/2)+"px";
		
	}
	
	this.hidePopUp = function()
	{	// trigger pop up to disappear
		bpopup = 0;
		document.getElementById("popupbackground").style.display="none";
		document.getElementById(popupwindow).style.display="none";
	}
	var winH=0;
	var winW=0;
	var intervalid=0;
	window.onscroll=this.onWindowScroll;
	window.onresize=this.onWindowResize;
	var popupwindow;
	var scrolledX=0;
	var scrolledY=0;
	var bpopup = 0; // pertains to true
	var popupwidth =0;
}
// create pop up object, initialize it and point scrolling and resizing window event to pop up adapters.
g_sharepopup = new PopUpObj();
g_sharepopup.popUpInit("sharepopup",800);
g_msgboxpopup = new PopUpObj();
g_msgboxpopup.popUpInit("msgboxpopup",400);
g_editboxpopup=new PopUpObj();
g_editboxpopup.popUpInit("editboxpopup",400);
g_alertboxpopup=new PopUpObj();
g_alertboxpopup.popUpInit("alertboxpopup",400);



