
	Popup	= {}
	Browser = {}  
	
	Browser.IsSafari = (navigator.userAgent.search(/Safari/i) != -1)|| false;
	
	//alert(Browser);
	
	Browser.GetClientWidth = function()
	{
		return(window.innerWidth||
			  (document.documentElement && document.documentElement.clientWidth)||
			  (document.body && document.body.clientWidth)||
			  0);
	}
	
	Browser.GetClientHeight = function()
	{
		return(window.innerHeight||
			  (document.documentElement && document.documentElement.clientHeight)||
			  (document.body && document.body.clientHeight)||
			  0);
	}
	
	Browser.GetPageScrollTop = function()
	{
		return(document.documentElement && document.documentElement.scrollTop)||
			  	 (document.body && document.body.scrollTop)||
			  0;
	}
	
	Browser.GetPageScrollLeft = function()
	{
		return(document.documentElement && document.documentElement.scrollLeft)||
			  (document.body && document.body.scrollLeft)||
			  0;
	}
	
	Browser.GetPageSize = function()
	{
		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;
		}
		
		//alert(windowWidth+" -- "+windowHeight);
		
		var pageHeight,pageWidth;
		
		if(yScroll < windowHeight) 
			pageHeight = windowHeight;
		else 
			pageHeight = yScroll;
		
		if(xScroll < windowWidth) pageWidth = windowWidth;
		else pageWidth = xScroll;
		
		return {pageWidth:pageWidth, pageHeight:pageHeight, windowWidth:windowWidth, windowHeight:windowHeight};
	}
	
	Popup.Background	  = '';
	Popup.Window		  = '';
	Popup.WorkSpace		  = '';
	Popup.divIdBackground = 'divPanel_popup_parent';
	Popup.divIdPopup 	  = 'divPanel_popup';
	Popup.divIdWorkSpace  = 'divPanelcontanier_popup';
	Popup.ComboElem       = [];
	
	Popup.Show = function(pmWindowtitle, pmTop, pmLeft, pmWidth, pmHeight) 
	{
		
		Popup.Loaded = false;
		Popup.CreatePopupBackground();
		Popup.HideComboElement();
		Popup.CreateWindow( pmTop, pmLeft, pmWidth, pmHeight);
		Popup.Window.innerHTML = Popup.UppendHTML(pmWindowtitle);
		document.body.appendChild(Popup.Window);
		Popup.WorkSpace = (Popup.divIdWorkSpace);
//		if(Browser.IsSafari)
//		{
//			HideObjectTags();
//		}
		return Popup.WorkSpace;
	}
	
	Popup.HideComboElement = function()
	{
		Element    = document.getElementsByTagName('select');
		this.count = Element.length;
		
		for( vLoop=0; vLoop<this.count; vLoop++ )
		{
			Popup.ComboElem.push(Element[vLoop]);
			Element[vLoop].style.display = 'none';
		}
	}
	
	Popup.ShowComboElement = function()
	{
		for ( vLoop=0; vLoop<Popup.ComboElem.length; vLoop++ )
			Popup.ComboElem[vLoop].style.display = 'inline';
	}
	
	Popup.CreatePopupBackground = function()
	{
		Popup.Background = document.createElement('div');
		Popup.Background.id = Popup.divIdBackground;
		PageSize = Browser.GetPageSize();
		Popup.Background.style.width 	= PageSize.pageWidth; 
		Popup.Background.style.height 	= PageSize.pageHeight; 
		Popup.Background.className 	= (Browser.IsSafari) ? "popupBackgroundSafari" : "popupBackground";
		document.body.appendChild(Popup.Background);
		return;
	}
	
	Popup.CreateWindow = function(pmTop, pmLeft, pmWidth, pmHeight)
	{
		Popup.Window = document.createElement('div');
		Popup.Window.id = Popup.divIdPopup;
//		Popup.Window.style.width 	= pmWidth; 
//		Popup.Window.style.height 	= pmHeight; 
		Popup.Window.style.left 	  = document.body.scrollLeft + pmLeft;  
		Popup.Window.style.top 		  = document.body.scrollTop +  pmTop; 
		Popup.Window.style.position 	= "absolute";
		return;		
	}
	Popup.UppendHTML = function(pmWindowTitle)
	{ 
		//this.vHTML  = PopUpNewCategoryStr;    
		return this.vHTML;
	}
	
	Popup.SetDivStringValue = function(pmSetDivStringValue) 
	{ 
		this.vHTML  = pmSetDivStringValue; 
		return this.vHTML;
	}
	
	
	Popup.Hide = function() 
	{		
		 if(Popup_Loaded == true) {		 
				Popup.ShowComboElement();
				if(typeof(Popup.Background) == "object") {
					document.body.removeChild(Popup.Background);			
					Popup.Background.className 	= "panelPopupTableBorder"; 
				}
				if(typeof(Popup.Window) == "object" ) {
					document.body.removeChild(Popup.Window);
				}  
			 Popup_Loaded = false;  
		   }	
		if(Browser.IsSafari){
			ShowObjectTags();
		}		   	
	}	
