

		var gChildWindow = '';
		
		$.extend({
		  getUrlVars: function(){
			var vars = [], hash;
			var hashes = window.location.href.slice(window.location.href.indexOf('?') + 1).split('&');
			for(var i = 0; i < hashes.length; i++)
			{
			  hash = hashes[i].split('=');
			  vars.push(hash[0]);

//			  vars[hash[0]] = hash[1];
//gcp
			  var aux = hash[1];
			  aux = aux.replace("#None", "");			  
			  vars[hash[0]] = aux;
//gcp			  
			}
			return vars;
		  },
		  getUrlVar: function(name){
			return $.getUrlVars()[name];
		  }
		});	


	 // --- Função para fechar janela filho		
	 $(function() {
	  
			  // Note that the trailing semicolon is required here
			  destroyChildWindow = function() { 
				destroyWindow(gChildWindow);
			  };
	  
	 });

	

function showDivCenter(Xwidth,Yheight,divid) {
		// First, determine how much the visitor has scrolled
		
		var scrolledX, scrolledY;
		if( self.pageYOffset ) {
		scrolledX = self.pageXOffset;
		scrolledY = self.pageYOffset;
		} else if( document.documentElement && document.documentElement.scrollTop ) {
		scrolledX = document.documentElement.scrollLeft;
		scrolledY = document.documentElement.scrollTop;
		} else if( document.body ) {
		scrolledX = document.body.scrollLeft;
		scrolledY = document.body.scrollTop;
		}
		
		// Next, determine the coordinates of the center of browser's window
		
		var centerX, centerY;
		if( self.innerHeight ) {
		centerX = self.innerWidth;
		centerY = self.innerHeight;
		} else if( document.documentElement && document.documentElement.clientHeight ) {
		centerX = document.documentElement.clientWidth;
		centerY = document.documentElement.clientHeight;
		} else if( document.body ) {
		centerX = document.body.clientWidth;
		centerY = document.body.clientHeight;
		}
		
		// Xwidth is the width of the div, Yheight is the height of the
		// div passed as arguments to the function:
		var leftOffset = scrolledX + (centerX - Xwidth) / 2;
		var topOffset = scrolledY + (centerY - Yheight) / 2;
		// The initial width and height of the div can be set in the
		// style sheet with display:none; divid is passed as an argument to // the function
		var o=document.getElementById(divid);
		var r=o.style;
		r.position='absolute';
		r.top = topOffset + 'px';
		r.left = leftOffset + 'px';
		r.display = "block";
} 		
		
		
	function createWindow(pID,pTitulo,pW,pH,pUrl,pAll){

		 pUnidade = 'px';
		 lTitleBarH = 25;
		 lIframeH = pH - lTitleBarH;

		if( pAll )	
			 lHArea = parent.document.height + 'px';	
		else
			 lHArea = '100%';	

		 var lCode = '';
		 //Cria a janela de fundo transparente... 	
//		 lCode = lCode +  '<div  class="transparent_class" id="'+pID+'_transp" style="position:absolute;left:0px; top:0px; width:100%; height:100%; background-color:#000; z-index:1000">';
		 lCode = lCode +  '<div  class="transparent_class" id="'+pID+'_transp" style="position:absolute;left:0px; top:0px; width:100%; height:'+lHArea+'; background-color:#000; z-index:1000">';
		 lCode = lCode + '</div>';
		 	
		 //Cria a janela de exibicao....	
		 lCode = lCode +  '<div  class="windowStyle" id="'+pID+'" style="position:absolute; margin-left:auto; margin-right:auto; top:120px; width:'+pW+pUnidade+'; height:'+pH+pUnidade+'; z-index:1001">';

		 lCode = lCode + '<div class="windowTitleBar" align="left" style="position:absolute; width:90%; height:'+lTitleBarH+'px;">';
		 lCode = lCode + '<div style="margin-left:10px; margin-top:5px;">'+pTitulo+'</div>';
		 lCode = lCode + '</div>';
		 
		 lCode = lCode + '<div class="windowTitleBar" align="right" style="position:absolute; left:90%; width:10%; height:'+lTitleBarH+'px;"><a href="#None" onclick="destroyWindow(' +"'"+pID+"'"+');"><img src="./imagens/form/fechar.png" border="0"></a>&nbsp;</div>';
		 lCode = lCode + '<iframe frameborder="no" style="position:absolute;top:'+lTitleBarH+'px; height:'+lIframeH+pUnidade+'; width:100%;"  src="' + pUrl + '"></iframe>';
		 lCode = lCode + '</div>';


    	 $("body").append( lCode );
		 
		 showDivCenter(pW,pH,pID);

    }
	
	function createProgressWindow(pTitulo,pUrlToCall,gFilters,pAll){

		 pID = 'Relatorio';
		 pW = 450;
		 pH = 140;
		 pUrl = gApplActions +"windownx_ProgressWindowFormAc&pUrlToCall=" + pUrlToCall+'&'+gFilters;	
	

		 pUnidade = 'px';
		 lTitleBarH = 25;
		 lIframeH = pH - lTitleBarH;

		if( pAll )	
			 lHArea = parent.document.height + 'px';	
		else
			 lHArea = '100%';	

		 var lCode = '';
		 //Cria a janela de fundo transparente... 	
//		 lCode = lCode +  '<div  class="transparent_class" id="'+pID+'_transp" style="position:absolute;left:0px; top:0px; width:100%; height:100%; background-color:#000; z-index:1000">';
		 lCode = lCode +  '<div  class="transparent_class" id="'+pID+'_transp" style="position:absolute;left:0px; top:0px; width:100%; height:'+lHArea+'; background-color:#000; z-index:1000">';
		 lCode = lCode + '</div>';
		 	
		 //Cria a janela de exibicao....	
		 lCode = lCode +  '<div  class="windowStyle" id="'+pID+'" style="position:absolute; margin-left:auto; margin-right:auto; top:120px; width:'+pW+pUnidade+'; height:'+pH+pUnidade+'; z-index:1001">';

		 lCode = lCode + '<div class="windowTitleBar" align="left" style="position:absolute; width:90%; height:'+lTitleBarH+'px;">';
		 lCode = lCode + '<div style="margin-left:10px; margin-top:5px;">'+pTitulo+'</div>';
		 lCode = lCode + '</div>';
		 
		 lCode = lCode + '<div class="windowTitleBar" align="right" style="position:absolute; left:90%; width:10%; height:'+lTitleBarH+'px;"><a href="#None" onclick="destroyWindow(' +"'"+pID+"'"+');"><img src="./imagens/form/fechar.png" border="0"></a>&nbsp;</div>';
		 lCode = lCode + '<iframe frameborder="no" style="position:absolute;top:'+lTitleBarH+'px; height:'+lIframeH+pUnidade+'; width:100%;"  src="' + pUrl + '"></iframe>';
		 lCode = lCode + '</div>';


    	 $("body").append( lCode );
		 
		 showDivCenter(pW,pH,pID);

    }
	

	function destroyWindow(pID){

		pID2 = '#'+pID;
		$(pID2).remove(); 

		pID2 = '#'+pID+'_transp';
		$(pID2).remove(); 
		
    }

 	
