

//---------------variaveis Globais------------------------

var gProcessando = 0;

var gDebugResponse = 0;   //habilite este flag para visualizar o retorno do ajax CUIDADO, PERIGOSO!!!

function setDebugOn(){

    gDebugResponse = 1;

}


function ancora(pParam){
       document.location.href = "#"+pParam;
}


function keepReturn(pObj){

	//alert (pObj.responseText );
}

function keepSessionAlive(){

	//alert('aqui');
	lRequestUrl = 'keepSessionAlive.php'
	lRequestParams = '';
	var myAjax = new Ajax.Request(lRequestUrl, {method: "post",encoding: "ISO-8859-1",parameters: lRequestParams,	onComplete: keepReturn , onFailure: keepReturn});

	setTimeout(keepSessionAlive,1000 * 60 * 6);
}

keepSessionAlive();


function validateObrigatorio_form1(){
      return 1;
}

/**
* Returns the value of the selected radio button in the radio group, null if
* none are selected, and false if the button group doesn't exist
*
* @param {radio Object} or {radio id} el
* OR
* @param {form Object} or {form id} el
* @param {radio group name} radioGroup
*/
function $RF(el, radioGroup) { 

	if($(el).type && $(el).type.toLowerCase() == "radio") {

		var radioGroup = $(el).name;

		var el = $(el).form;
	} else 
		if ($(el).tagName.toLowerCase() != 'form') {
			return false;
		}

	var checked = $(el).getInputs("radio", radioGroup).find( function(re) {return re.checked;} );
	return (checked) ? $F(checked) : null;
}



	function validaExtensaoFileControl(pId,pValidas,pInvalidas){
	
	   //----Pega extensao do arquivo....	
	   lFileNameObj = document.getElementById( pId );	
	
	   lFileName =  lFileNameObj.value;
	
	   lArr = lFileName.split(".");
	   
	   if( lArr.length > 1 ){
	   	 lExt = lArr[lArr.length-1];
	  	 lExt = lExt.toUpperCase(); 	
	   }else{
		 
		   alert( 'A extensão do arquivo não é válida!' );	
	 	   //lFileNameObj.value = '';	
		   return 0;
	   }	  
	
	  //---Se informou extensoes validas, entao verifica
	   if( pValidas.length > 0 ){
	   
	   		lArr = pValidas.split("|");
	   
	   
	   		for(i=0;i<lArr.length;i++){
			
				lExtValida = lArr[i];
				lExtValida = lExtValida.toUpperCase();
				lExtValida = lExtValida.replace(/^\s+|\s+$/g,""); // trim
								
				if( lExt == lExtValida )
					return 1;
			}

		   alert( 'Os arquivos do tipo ' + lExt + ' não são válidos para envio!' );	
	 	   //lFileNameObj.value = '';	
		   return 0;	
	   }
	  
	
	  //---Se informou extensoes invalidas, entao verifica
	   if( pInvalidas.length > 0 ){
	   

			lArr = pInvalidas.split("|");


			for(i=0;i<lArr.length;i++){
			
				lExtInvalida = lArr[i];
				lExtInvalida = lExtInvalida.toUpperCase();
				lExtInvalida = lExtInvalida.replace(/^\s+|\s+$/g,""); // trim
								
				if( lExt == lExtInvalida ){
					   alert( 'Os arquivos do tipo ' + lExt + ' não são válidos para envio!' );	
					//   lFileNameObj.value = '';	
					   return 0;
				}

			}

		   return 1;	
	   }
	  
	
	
	}



//-------------------------------------------------------------------------
//
// FUNCOES DE REQUEST
//
//-------------------------------------------------------------------------

//-------------------------------------------------------------------------
//---Funcao requestError--------------------------------------------------
//-------------------------------------------------------------------------
function requestError(){	

	alert("Erro de Request!" );

}

//-------------------------------------------------------------------------
//---Funcao trataProcessamento---------------------------------------------
//-------------------------------------------------------------------------
function trataProcessamento(pVal){



}


//-------------------------------------------------------------------------
//---Funcao requestReturn--------------------------------------------------
//-------------------------------------------------------------------------
function requestReturn(pObj){	

    if( gDebugResponse){
        if (pObj.responseText.substr(0,13) != '<?xml version')
                alert( pObj.responseText );
    }

	if(document.getElementById('tempoID')!=null){
		$('tempoID').hide();
	}
	
	gProcessando = 0;

	var root = pObj.responseXML.getElementsByTagName('actions')[0];
	var lActionsToDoLst = root.getElementsByTagName("actiontodo");

	for (var i = 0 ; i < lActionsToDoLst.length ; i++) {
	
		var lActionDoTo = lActionsToDoLst[i];
	
		var lAct = lActionDoTo.getElementsByTagName("actionoption")[0].firstChild.nodeValue;

		if(lAct == 'cACT_EXECFUNCTION'){
			lFunc = lActionDoTo.getElementsByTagName("func")[0].firstChild.nodeValue;
			eval( lFunc );
		}
		
		if(lAct == 'cACT_STARTTIMER'){
			lId = lActionDoTo.getElementsByTagName("id")[0].firstChild.nodeValue;
			startStopTimer( lId , true );
		//	eval('gTimer_' + lId + '_ativo = true;');
		//	eval( 'timer_' + lId + '()');
		}

		if(lAct == 'cACT_STOPTIMER'){
			lId = lActionDoTo.getElementsByTagName("id")[0].firstChild.nodeValue;
			startStopTimer( lId , false );
		//	eval('clearTimeout( gTimeOut_' + lId + ')');
		//	eval('gTimer_' + lId + '_ativo = false;');
		}		
		
		
		if(lAct == 'cACT_SHOW'){
			lId = lActionDoTo.getElementsByTagName("id")[0].firstChild.nodeValue;
			showHide(lId,true);
		}

		if(lAct == 'cACT_HIDE'){
			lId = lActionDoTo.getElementsByTagName("id")[0].firstChild.nodeValue;
			showHide(lId,false);
		}

		if(lAct == 'cACT_SHOWPARENT'){
			lId = lActionDoTo.getElementsByTagName("id")[0].firstChild.nodeValue;
			showHideParent(lId,true);
		}

		if(lAct == 'cACT_HIDEPARENT'){
			lId = lActionDoTo.getElementsByTagName("id")[0].firstChild.nodeValue;
			showHideParent(lId,false);
		}


		
		
		
		
		
		
		if(lAct == 'cACT_PERCWIDTH'){
		
		
			lId = lActionDoTo.getElementsByTagName("id")[0].firstChild.nodeValue;
			
			lVal = lActionDoTo.getElementsByTagName("val")[0].firstChild.nodeValue;			
			lElem = $( lId );
			lElem.width = lVal  + '%';
		}

		
		if(lAct == 'cACT_FIELDFOCUS'){
			lId = lActionDoTo.getElementsByTagName("id")[0].firstChild.nodeValue;
			lField = $( lId );
			lField.focus();
		}		

		if(lAct == 'cACT_SETCHECKRADIO'){
		
			lFormName = lActionDoTo.getElementsByTagName("formname")[0].firstChild.nodeValue;
			lId = lActionDoTo.getElementsByTagName("id")[0].firstChild.nodeValue;
			lVal = lActionDoTo.getElementsByTagName("val")[0].firstChild.nodeValue;
			setCheckRadioValue(lFormName,lId,lVal);
		}


		if(lAct == 'cACT_FIELDREADONLY'){
		
		
			lId = lActionDoTo.getElementsByTagName("id")[0].firstChild.nodeValue;
			lVal = lActionDoTo.getElementsByTagName("val")[0].firstChild.nodeValue;
	
	        if(document.getElementById(lId)!=null){
	
				lField = $(lId);
				
				if( lVal == 0)
					lField.readOnly = false;
				else	
					lField.readOnly = true;

			}
		}
		
		if(lAct == 'cACT_SETCSS'){
		
			lId = lActionDoTo.getElementsByTagName("id")[0].firstChild.nodeValue;
			lName = lActionDoTo.getElementsByTagName("name")[0].firstChild.nodeValue;
			lField = $(lId);
			
			if(document.getElementById(lId)!=null)
				lField.className  = lName;
		}		
		
	
		if(lAct == 'cACT_SETOPTIONLIST'){
		
			lId = lActionDoTo.getElementsByTagName("id")[0].firstChild.nodeValue;
			
			//Quando no retorno estoura o tamanho do nodo, o browser divide em mais de um nodo, por isso este laço
			var numNodos = lActionDoTo.getElementsByTagName("data").item(0).childNodes.length;
			var dados = "";
			var lDadosLst = lActionDoTo.getElementsByTagName("data");

			for(var j=0; j < numNodos;j++) {
				var lDado = lActionDoTo.getElementsByTagName("data").item(0).childNodes.item(j).nodeValue;
				dados = dados + lDado;
			}
			
			setFormOptionListField( lId,dados );	
		}
		
	
		if(lAct == 'cACT_SETHTMLDATAPARENT'){
		
			var d =  parent.document.getElementById( lActionDoTo.getElementsByTagName("id")[0].firstChild.nodeValue );
		
			//Quando no retorno estoura o tamanho do nodo, o browser divide em mais de um nodo, por isso este laço
			var numNodos = lActionDoTo.getElementsByTagName("data").item(0).childNodes.length;
			var dados = "";
			var lDadosLst = lActionDoTo.getElementsByTagName("data");
			for(var j=0; j < numNodos;j++) {
				var lDado = lActionDoTo.getElementsByTagName("data").item(0).childNodes.item(j).nodeValue;
				dados = dados + lDado;
			}
		
			d.innerHTML=dados;
			
		}

		if(lAct == 'cACT_SETHTMLDATA'){
		
			var d = $(lActionDoTo.getElementsByTagName("id")[0].firstChild.nodeValue); // 08/jul/08
		
		
			//Quando no retorno estoura o tamanho do nodo, o browser divide em mais de um nodo, por isso este laço
			var numNodos = lActionDoTo.getElementsByTagName("data").item(0).childNodes.length;
			var dados = "";
			var lDadosLst = lActionDoTo.getElementsByTagName("data");
			for(var j=0; j < numNodos;j++) {
				var lDado = lActionDoTo.getElementsByTagName("data").item(0).childNodes.item(j).nodeValue;
				dados = dados + lDado;
			}
		
			d.innerHTML=dados;
			
		}

 		if( (lAct == 'cACT_SETHTMLDATAGRID') || (lAct == 'cACT_SETHTMLDATAGRIDPARENT') ){
		
                      if (lAct == 'cACT_SETHTMLDATAGRID'){
                          var d = $(lActionDoTo.getElementsByTagName("id")[0].firstChild.nodeValue); // 08/jul/08
                          var footer = $(lActionDoTo.getElementsByTagName("id")[0].firstChild.nodeValue + '_footer'); // 08/jul/08                          
                      }else{
						  
					  
                          var d =  parent.document.getElementById( lActionDoTo.getElementsByTagName("id")[0].firstChild.nodeValue );
                          var footer =  parent.document.getElementById( lActionDoTo.getElementsByTagName("id")[0].firstChild.nodeValue + '_footer' );
                      }

                        		
		
			//Quando no retorno estoura o tamanho do nodo, o browser divide em mais de um nodo, por isso este laço
			var numNodos = lActionDoTo.getElementsByTagName("data").item(0).childNodes.length;
			var dados = "";
			var lDadosLst = lActionDoTo.getElementsByTagName("data");
			for(var j=0; j < numNodos;j++) {
				var lDado = lActionDoTo.getElementsByTagName("data").item(0).childNodes.item(j).nodeValue;
				dados = dados + lDado;
			}
		
			d.innerHTML=dados;
            footer.innerHTML= lActionDoTo.getElementsByTagName("footer")[0].firstChild.nodeValue;
			

		}       
        
 
 		if(lAct == 'cACT_SETHTMLDATAGRIDTPL'){
		
			var lID = lActionDoTo.getElementsByTagName("id")[0].firstChild.nodeValue;
		
             var d =  parent.document.getElementById( lID );
			 
			 var first1 = $(lID + '_first1'); 
			 var prior1 = $(lID + '_prior1'); 
			 var next1 = $(lID + '_next1'); 
			 var last1 = $(lID + '_last1'); 

			 var first2 = $(lID + '_first2'); 
			 var prior2 = $(lID + '_prior2'); 
			 var next2 = $(lID + '_next2'); 
			 var last2 = $(lID + '_last2'); 
			 
			 
			 var total = $(lID + '_total'); 
			 var paginas = $(lID + '_paginas'); 
			 
			//Quando no retorno estoura o tamanho do nodo, o browser divide em mais de um nodo, por isso este laço
			var numNodos = lActionDoTo.getElementsByTagName("data").item(0).childNodes.length;
			var dados = "";
			var lDadosLst = lActionDoTo.getElementsByTagName("data");
			for(var j=0; j < numNodos;j++) {
				var lDado = lActionDoTo.getElementsByTagName("data").item(0).childNodes.item(j).nodeValue;
				dados = dados + lDado;
			}
		
			d.innerHTML=dados;
			
			if( first1!=null)
				first1.innerHTML= lActionDoTo.getElementsByTagName("first")[0].firstChild.nodeValue;			
			
			if( prior1!=null)
				prior1.innerHTML= lActionDoTo.getElementsByTagName("prior")[0].firstChild.nodeValue;

			if( next1!=null)
				next1.innerHTML= lActionDoTo.getElementsByTagName("next")[0].firstChild.nodeValue;
				
			if( last1!=null)
				last1.innerHTML= lActionDoTo.getElementsByTagName("last")[0].firstChild.nodeValue;
				
			if( first2!=null)
				first2.innerHTML= lActionDoTo.getElementsByTagName("first")[0].firstChild.nodeValue;			
			
			if( prior2!=null)
				prior2.innerHTML= lActionDoTo.getElementsByTagName("prior")[0].firstChild.nodeValue;

			if( next2!=null)
				next2.innerHTML= lActionDoTo.getElementsByTagName("next")[0].firstChild.nodeValue;
				
			if( last2!=null)
				last2.innerHTML= lActionDoTo.getElementsByTagName("last")[0].firstChild.nodeValue;				
				

			if( total!=null)
				total.innerHTML= lActionDoTo.getElementsByTagName("total")[0].firstChild.nodeValue;			
				
			if( paginas!=null)
				paginas.innerHTML= lActionDoTo.getElementsByTagName("paginas")[0].firstChild.nodeValue;	
				
				
		}    
       
        
        

		if(lAct == 'cACT_ADDHTMLDATA'){
			d = $(lActionDoTo.getElementsByTagName("id")[0].firstChild.nodeValue);
		
		
			//Quando no retorno estoura o tamanho do nodo, o browser divide em mais de um nodo, por isso este laço
			var numNodos = lActionDoTo.getElementsByTagName("data").item(0).childNodes.length;
			var dados = "";
			var lDadosLst = lActionDoTo.getElementsByTagName("data");
			for(var j=0; j < numNodos;j++) {
				var lDado = lActionDoTo.getElementsByTagName("data").item(0).childNodes.item(j).nodeValue;
				dados = dados + lDado;
			}
		
			d.innerHTML= d.innerHTML + dados;
			
		}



		if(lAct == 'cACT_RESETFIELDVALUES'){
			//Busca o nome do form
			lFormName = lActionDoTo.getElementsByTagName("formname")[0].firstChild.nodeValue;
			Form.reset(lFormName);
		}	
	

		if(lAct == 'cACT_SETCHECKBOX'){
			lAux = lActionDoTo.getElementsByTagName("valuelist")[0].firstChild.nodeValue;

			//separa campo valor
			lFieldNameValue = lAux.split("=");

			lFieldID = lFieldNameValue[0];
			lFieldValue = lFieldNameValue[1];

			lField = $(lFieldID);
			if(lFieldValue==0)
				lField.checked = false;
			else		
				lField.checked = true;
		}
		
		if(lAct == 'cACT_SETFIELDVALUES'){
			lValueList = lActionDoTo.getElementsByTagName("valuelist")[0].firstChild.nodeValue;
			setFormFieldsValue( lValueList );	
		}
                

		if(lAct == 'cACT_SETALERT'){
			lMsg = lActionDoTo.getElementsByTagName("message")[0].firstChild.nodeValue;
			alert( lMsg );
		}

        if(lAct == 'cACT_SETCHECKED'){
            lCheck = lActionDoTo.getElementsByTagName("checkname")[0].firstChild.nodeValue;
			document.getElementById(lCheck).checked = true;
		}

        if(lAct == 'cACT_SETUNCHECKED'){
            lCheck = lActionDoTo.getElementsByTagName("checkname")[0].firstChild.nodeValue;
			document.getElementById(lCheck).checked = false;
		}

		if(lAct == 'cACT_CALLEVENT'){
			lFormName = lActionDoTo.getElementsByTagName("formname")[0].firstChild.nodeValue;
                        lUrl = lActionDoTo.getElementsByTagName("url")[0].firstChild.nodeValue;
			lEvent = lActionDoTo.getElementsByTagName("event")[0].firstChild.nodeValue;
			lSubmitValues = lActionDoTo.getElementsByTagName("submitvalues")[0].firstChild.nodeValue;
          
            
            
                        if(lSubmitValues==0)
                           makeRequest(lUrl ,'',lEvent,'',false);
                        else{
                            makeRequest(lUrl ,lFormName,lEvent,'',true);
                        }
		}


		if(lAct == 'cACT_CHECKUNCHECKGROUP'){
			lFormName = lActionDoTo.getElementsByTagName("formname")[0].firstChild.nodeValue;
                        lId = lActionDoTo.getElementsByTagName("id")[0].firstChild.nodeValue;
			lState = lActionDoTo.getElementsByTagName("state")[0].firstChild.nodeValue;

            setCheckUncheckGroup(lFormName,lId,lState);
		}


		if(lAct == 'cACT_CHECKUNCHECKALL'){
			lFormName = lActionDoTo.getElementsByTagName("formname")[0].firstChild.nodeValue;
                        lId = lActionDoTo.getElementsByTagName("id")[0].firstChild.nodeValue;
			lState = lActionDoTo.getElementsByTagName("state")[0].firstChild.nodeValue;

           
            if(lState == 1){
                lState = true;
            }else{
                lState = false;
            }

            setCheckUncheckAll(lFormName,lId,lState);
		}




		if(lAct == 'cACT_SETBROWSERURL'){
		
			lUrl = lActionDoTo.getElementsByTagName("url")[0].firstChild.nodeValue;
			lParent = lActionDoTo.getElementsByTagName("parent")[0].firstChild.nodeValue;
			
			//Pra nao dar erro no explorer, que coloca em cache a URl, adiciona um 
                        //campo data, isso faz com que cada vez que a  URL for chamada seja renovada	
                        if(lUrl.indexOf('?')==-1)
                          lUrl += '?ms='+ new Date().getTime();
                        else
                          lUrl += '&ms='+ new Date().getTime();
			
			if(lParent==1)
				parent.location= lUrl;	
			else
				window.location= lUrl;	
		}


 		if( (lAct == 'cACT_SETIMGSRC') || (lAct == 'cACT_SETIMGSRCPARENT') ){
		
		
					  lUrl = lActionDoTo.getElementsByTagName("url")[0].firstChild.nodeValue; 
		
                      if (lAct == 'cACT_SETIMGSRC'){
                          var lField = $(lActionDoTo.getElementsByTagName("id")[0].firstChild.nodeValue); // 08/jul/08
                      }else{
                          var lField = parent.document.getElementById( lActionDoTo.getElementsByTagName("id")[0].firstChild.nodeValue );
                      }

                       
                        uniq = new Date();
                        uniq = "?ms="+uniq.getTime();  
            
                        lField.src = lUrl + uniq;
		}
        
        
        

		if(lAct == 'cACT_SETBROWSERURLNEWWINDOW'){
		
			lUrl = lActionDoTo.getElementsByTagName("url")[0].firstChild.nodeValue;
			
			//Pra nao dar erro no explorer, que coloca em cache a URl, adiciona um 
                        //campo data, isso faz com que cada vez que a  URL for chamada seja renovada	
	                if(lUrl.indexOf('?')==-1)
                          lUrl += '?ms='+ new Date().getTime();
                        else
                          lUrl += '&ms='+ new Date().getTime();   
									
			newWindow=parent.open(lUrl, '_blank'); 
		}


		if(lAct == 'cACT_SETBROWSERURLPOPUP'){
		
		

			lUrl = lActionDoTo.getElementsByTagName("url")[0].firstChild.nodeValue;	

            		lWinName = lActionDoTo.getElementsByTagName("winname")[0].firstChild.nodeValue;	
            
			lLeft = lActionDoTo.getElementsByTagName("left")[0].firstChild.nodeValue;	

			lTop = lActionDoTo.getElementsByTagName("top")[0].firstChild.nodeValue;	

			lW = lActionDoTo.getElementsByTagName("w")[0].firstChild.nodeValue;	

			lH = lActionDoTo.getElementsByTagName("h")[0].firstChild.nodeValue;
			
			lmenuBar = lActionDoTo.getElementsByTagName("mb")[0].firstChild.nodeValue;
		
			lScrollBar = lActionDoTo.getElementsByTagName("sb")[0].firstChild.nodeValue;
	
			lResize = lActionDoTo.getElementsByTagName("rz")[0].firstChild.nodeValue;			

			//Pra nao dar erro no explorer, que coloca em cache a URl, adiciona um 
                        //campo data, isso faz com que cada vez que a  URL for chamada seja renovada	
	                if(lUrl.indexOf('?')==-1)
                          lUrl += '?ms='+ new Date().getTime();
                        else
                          lUrl += '&ms='+ new Date().getTime();            
            
		
			var lParams='width='+lW+',height='+lH+',left='+lLeft+',top='+lTop + ',menubar='+ lmenuBar + ',scrollbars='+ lScrollBar + ',resizable='+ lResize ;
			newWindow=window.open(lUrl, lWinName, lParams); 
		}
			
			
		if(lAct == 'cACT_SETBROWSERURLIFRAME'){

			lUrl = lActionDoTo.getElementsByTagName("url")[0].firstChild.nodeValue;	

			lName = lActionDoTo.getElementsByTagName("name")[0].firstChild.nodeValue;

			lLeft = lActionDoTo.getElementsByTagName("left")[0].firstChild.nodeValue;	

			lTop = lActionDoTo.getElementsByTagName("top")[0].firstChild.nodeValue;	

			lW = lActionDoTo.getElementsByTagName("w")[0].firstChild.nodeValue;	

			lH = lActionDoTo.getElementsByTagName("h")[0].firstChild.nodeValue;
			
			lScrollBar = lActionDoTo.getElementsByTagName("sb")[0].firstChild.nodeValue;

			//Pra nao dar erro no explorer, que coloca em cache a URl, adiciona um 
	  	    //campo data, isso faz com que cada vez que a  URL for chamada seja renovada	
	                if(lUrl.indexOf('?')==-1)
                          lUrl += '?ms='+ new Date().getTime();
                        else
                          lUrl += '&ms='+ new Date().getTime();   

			createUrlIframe (lName , lW, lH,lUrl,lLeft,lTop,lScrollBar);
		}
				
   
		if(lAct == 'cACT_CREATEDIV'){

			lID = lActionDoTo.getElementsByTagName("id")[0].firstChild.nodeValue;	

			lHtmlData = lActionDoTo.getElementsByTagName("htmldata")[0].firstChild.nodeValue;

			lLeft = lActionDoTo.getElementsByTagName("left")[0].firstChild.nodeValue;	

			lTop = lActionDoTo.getElementsByTagName("top")[0].firstChild.nodeValue;	

			lW = lActionDoTo.getElementsByTagName("w")[0].firstChild.nodeValue;	

			lH = lActionDoTo.getElementsByTagName("h")[0].firstChild.nodeValue;

                        creatediv(lID, lHtmlData, lLeft,lTop,lW, lH);
		}        
        
        
	}	
        

}

//-------------------------------------------------------------------------
//---Funcao makeRequestParams----------------------------------------------------
//-------------------------------------------------------------------------
function makeRequestParams(pRequestPath,pFormName,pControlEventName,pID){	


	var lFormFields = '';

	//Entra aqui caso seja um campo de formulário
	if(document.getElementById(pID)!=null){

		lField = $(pID);
		switch(lField.type){
	
			case "checkbox":

							if( lField.checked ) 
								lValue = "1";
							else	
								lValue = "0";
								
							//O ID é composto pelo ID +  '_' + o número da linha	
							lRow = pID.split("_");	
			
							lFormFields = "&pControlName=" + pID + "&pControlRow=" + lRow[1] + "&pControlValue=" + lValue;
						break;
						
						
			case "select-one":   
						lFormFields = "&pControlName=" + pID + "&pControlValue=" + lField.options[lField.selectedIndex].value;
						break;
						
						
			case "radio":
					
						//O ID é composto pelo ID +  '_' + o valor do radio	
						lData = pID.split("_");	
		
						lFormFields = "&pControlName=" + lData[0] + "&pControlValue=" + lData[1];
						break;									
	
	
		}
	}else{
	
		//Entra aqui caso seja um clique em uma imagem ,etc.

		//O ID é composto pelo ID +  '_' + params - Por enquanto trata um só	
		lControlVal = pID.split("_");
	
                   
		if(lControlVal.length>1){ 
                    
                        lControlVal2 = pID.split("|");
                         //para casos como este -->  'grid|BtnHotel_OnClick'
                        if(lControlVal2.length>1)
                          lFormFields = "&pControlName=" + lControlVal2[0] + "&pControlValue=" + lControlVal[1];
                        else
                          lFormFields = "&pControlName=" + lControlVal[0] + "&pControlValue=" + lControlVal[1];
		}else{	
			lFormFields = "&pControlValue=" + lControlVal[0];
	
                        if(pControlEventName!=''){
                          lControlVal = pControlEventName.split("_");
                        
                        
                          if(lControlVal.length>1)
                              lFormFields = lFormFields + "&pControlName=" + lControlVal[0];
                        }
                        
                }         
                
                    
	
	}
	
	var lRequestUrl = pRequestPath;
        var lRequestParams = "&pFormName=" + pFormName + "&pControlEventName=" + pControlEventName + lFormFields;
	

                
	//Pra nao dar erro no explorer, que coloca em cache a URl, adiciona um 
  	//campo data, isso faz com que cada vez que a  URL for chamada seja renovada	
	lRequestParams += '&ms='+ new Date().getTime();
	
	var myAjax = new Ajax.Request(lRequestUrl, {method: "post",encoding: "ISO-8859-1",parameters: lRequestParams,	onComplete: requestReturn , onFailure: requestError});
}


//-------------------------------------------------------------------------
//---Funcao makeRequest----------------------------------------------------
//-------------------------------------------------------------------------
function makeRequest(pRequestPath,pFormName,pControlEventName,pFunctionResultName,pSendFormFields){	


/*			
	if(gProcessando==1){
		alert("Aguarde....em processamento!");	
		return;
	} 	
	gProcessando = 1;			
	
	if(document.getElementById('tempoID')!=null){
	
		l = document.body.clientWidth / 2;
		t = document.body.clientHeight /2;
	
		$('tempoID').show(); 
		$('tempoID').style.left = l;//screen.width/2; 
		$('tempoID').style.top = t;//screen.height/2;
	}
*/	

	var lFormFields = '';		
			
	if( pFunctionResultName == '')
		pFunctionResultName = 'requestReturn';
	
	if( pSendFormFields ){ 
            
		lFormFields = '&' + Form.serialize(pFormName);
	}		
    
        //Envia o ID do controle...
        lControlVal = pControlEventName.split("_");
	if(lControlVal.length>1) 
          lFormFields = lFormFields  + "&pControlName=" + lControlVal[0];

    
   
    
	var lRequestUrl = pRequestPath;
        var lRequestParams = "&pFormName=" + pFormName + "&pControlEventName=" + pControlEventName + lFormFields;





	//Pra nao dar erro no explorer, que coloca em cache a URl, adiciona um 
  	//campo data, isso faz com que cada vez que a  URL for chamada seja renovada	
	lRequestParams += '&ms='+ new Date().getTime();
	
	var myAjax = new Ajax.Request(lRequestUrl, {method: "post",encoding: "ISO-8859-1",parameters: lRequestParams,	onComplete: requestReturn , onFailure: requestError});
}


//-------------------------------------------------------------------------
//---Funcao makeRequestParams----------------------------------------------------
//-------------------------------------------------------------------------
function makeSimpleRequest(pRequestPath){	


	//Pra nao dar erro no explorer, que coloca em cache a URl, adiciona um 
  	//campo data, isso faz com que cada vez que a  URL for chamada seja renovada	
	lRequestParams = '&ms='+ new Date().getTime();

	var myAjax = new Ajax.Request(pRequestPath, {method: "post",encoding: "ISO-8859-1",parameters: lRequestParams,	onComplete: requestReturn , onFailure: requestError});
}


//-------------------------------------------------------------------------
//---Funcao makeRequestParams----------------------------------------------------
//-------------------------------------------------------------------------
function makeSimpleRequestParams(pRequestPath,pControlEventName,pParams){	

	var lRequestUrl = pRequestPath;
    var lRequestParams = "&pControlEventName=" + pControlEventName + pParams;
	
	//Pra nao dar erro no explorer, que coloca em cache a URl, adiciona um 
  	//campo data, isso faz com que cada vez que a  URL for chamada seja renovada	
	lRequestParams += '&ms='+ new Date().getTime();

	var myAjax = new Ajax.Request(lRequestUrl, {method: "post",encoding: "ISO-8859-1",parameters: lRequestParams,	onComplete: requestReturn , onFailure: requestError});
}

//-------------------------------------------------------------------------
//---Funcao setDataBrowser-------------------------------------------------
//-------------------------------------------------------------------------
function setDataBrowser(pRequestPath,pComponentNameToFill){

	var lRequestUrl = pRequestPath;
    var lRequestParams = "&pComponentNameToFill=" + pComponentNameToFill;

	//Pra nao dar erro no explorer, que coloca em cache a URl, adiciona um 
  	//campo data, isso faz com que cada vez que a  URL for chamada seja renovada	
	lRequestParams += '&ms='+ new Date().getTime();
	
	var myAjax = new Ajax.Request(lRequestUrl, {method: "post",encoding: "ISO-8859-1",parameters: lRequestParams,	onComplete: requestReturn , onFailure: requestError});
}




//-------------------------------------------------------------------------
//---Funcao showHideDIV----------------------------------------------------
//-------------------------------------------------------------------------
function showHide(pID,pVal){

	if(document.getElementById(pID)!=null){
		
		if(pVal)
			$(pID).show();
		else	
			$(pID).hide();
	}
}

function showHideParent(pID,pVal){


   var d =  parent.document.getElementById( pID );

	if(d !=null){
		
		if(pVal)
			d .show();
		else	
			d .hide();
	}
}


//-------------------------------------------------------------------------
//---Funcao startStopTimer----------------------------------------------------
//-------------------------------------------------------------------------
function startStopTimer(pID,pVal){
	
		if(pVal){
			
			eval('gTimer_' + pID + '_ativo = true;');


			eval( 'timer_' + pID + '()');

		}else{
			eval('clearTimeout( gTimeOut_' + pID + ')');
			eval('gTimer_' + pID + '_ativo = false;');
		}		

}

function str_replace(needle, haystack, replacement) {
	var temp = haystack.split(needle);
	return temp.join(replacement);
}



//-------------------------------------------------------------------------
//---Funcao setFormFieldsValue---------------------------------------------
//-------------------------------------------------------------------------
function setFormFieldsValue(pList){

	//separa campos
	lFieldList = pList.split("&");
	for(i=0;i < lFieldList.length ;i++){
		
		lAux = lFieldList[i];
//		alert( lAux );
		
		//separa campo valor
		lFieldNameValue = lAux.split("=");

		lFieldID = lFieldNameValue[0];
		lFieldValue = unescape( lFieldNameValue[1] );
		lConcat = lFieldNameValue[2];
        
		setFieldValue(lFieldID,lFieldValue,lConcat);
	}	
	
}


//-------------------------------------------------------------------------
//---Funcao setFormListFieldValue---------------------------------------------
//-------------------------------------------------------------------------
function setFormOptionListField(pID,pData){

//	var lFieldList =$(pID);
	
	if(document.getElementById(pID)==null)
		 lFieldList = parent.document.getElementById(pID);
	else
		 lFieldList = $(pID);	


	//Formato:  texto||Valor||texto||valor


	// clear the did list 
	for (var count = lFieldList.length-1; count >-1; count--)
	{
		lFieldList.options[count] = null;
	}

	pData = unescape( pData );

	//separa campos
	lFieldData = pData.split("||");
	for(i=0;i < lFieldData.length ;i+=2){
		
		lFieldTexto = unescape( lFieldData[i] );
		lFieldValue = unescape( lFieldData[i+1] );
		
		lOptionItem = new Option( lFieldTexto, lFieldValue,  false, false);
		lFieldList.options[lFieldList.length] = lOptionItem;
	}	
	
}

//-------------------------------------------------------------------------
//---Funcao setFieldValue--------------------------------------------------
//-------------------------------------------------------------------------
function setFieldValue(pID,pValue,pConcat){


	if(document.getElementById(pID)==null)  //if(document.getElementById('pID')==null) modif 29 mai
		 lField = parent.document.getElementById(pID);
	else
		 lField = $(pID);

	 //12 mai 09

	if(lField==null){	
        	alert('O campo '+pID+' não existe na tela!');
		return;
	}

	switch(lField.type){
		case "text": 
		case "textarea": 
		case "hidden": 

                                                //Troca o outro caractere pelo &
                                                pValue =  pValue.replace( "þ", "&" );

                                                 if(pConcat==1)   
                                                      lField.value = lField.value + pValue;
                                                 else 
                                                    lField.value = pValue;


//                                                alert(pValue);
						break;                
        
        
		case "checkbox": 
						
                                                lField.value = pValue;
						break;
						
		case "select-one": 							
						for(var i=0;i<lField.options.length;i++){
							if(lField.options[i].value == pValue){
								lField.options[i].selected = true;
								return;
							}
						}	
						
		case "radio":
				
						var lRadios=document.getElementsByName(lField.name);
			
						for(var i = 0; i < lRadios.length; i++) {
							lRadios[i].checked = false;
							if(lRadios[i].value == pValue) {
								lRadios[i].checked = true;
								return;
							}
						}		
		
						
	}
}
	
//-------------------------------------------------------------------------
//---Funcao getFieldValue--------------------------------------------------
//-------------------------------------------------------------------------
function getFieldValue(pID,pValue){

	lField = $(pID);
	switch(lField.type){
		case "text": 
		case "textarea": 
		case "hidden": 
		case "checkbox": 
						return lField.value;
						break;
						
		case "select-one": 							
						for(var i=0;i<lField.options.length;i++)
							if(lField.options[i].value == pValue){
								return lField.options[lField.selectedIndex].value;
							}
	}
}

//-------------------------------------------------------------------------
//---Funcao setCheckRadioValue--------------------------------------------------
//-------------------------------------------------------------------------
function setCheckRadioValue(pFormName,pID,pValue){


	var lFieldList = Form.getInputs(pFormName,'radio',pID);

	for(var i=0;i<lFieldList.length ;i++)
		if ( lFieldList[i].value == pValue){
			lFieldList[i].checked = true;
			return;	
		}		
	
}


function setCheckUncheckAll(pFormName,pIDFull,pTrueFalse){
   
	var lFieldList = Form.getInputs(pFormName,'checkbox');

   	for(var i=0;i<lFieldList.length ;i++){

          lIdNome = pIDFull + '_' + i;

          lId = document.getElementById(lIdNome);


          if(lId!=null){
              lId.checked = pTrueFalse;

          }


        }

}


function setCheckUncheckGroup(pFormName,pIDFull,pState){
    
	var lFieldList = Form.getInputs(pFormName,'checkbox');

	for(var i=0;i<lFieldList.length ;i++){

          lIdCompleto = lFieldList[i].id;



          lIdArr = lIdCompleto.split("_");

          if(lIdArr[0] == pIDFull)
              lFieldList[i].checked = pState;
        }

}



function getCheckState(pFormName,pID){

    
     
    
	var lFields = Form.getInputs(pFormName,'checkbox',pID);

        if( lFields[0].checked )    
            return 1;
        else
            return 0;  

}


//-------------------------------------------------------------------------
//
// FUNCOES DE MANIP. TABELAS
//
//-------------------------------------------------------------------------

var gCurrRowID = '';
var gCurrCelssClassName;


function rowDeselect(pID){

	if(document.getElementById(pID)==null)
		return;

	lRow = document.getElementById(pID); 
	
	for (i=0;i<lRow.cells.length;i++)
   	 	lRow.cells[i].className =gCurrCelssClassName;
}

function rowSelect(pID,pClassName){

	rowDeselect(gCurrRowID);
	gCurrRowID = pID;

	lRow = document.getElementById(pID);
	  
	
	gCurrCelssClassName = lRow.cells[0].className;
	
	
	for (i=0;i<lRow.cells.length;i++){
	    gCurrCelssClassName = lRow.cells[i].className;
 	 	lRow.cells[i].className =pClassName;
   }

}
//
//function rowDeSelect(pID,pClassName){
//
//	rowDeselect(gCurrRowID);
//	gCurrRowID = pID;
//
//	lRow = document.getElementById(pID);
//	  
//	
//	gCurrCelssClassName = lRow.cells[0].className;
//	
//	
//	for (i=0;i<lRow.cells.length;i++){
//	    gCurrCelssClassName = lRow.cells[i].className;
// 	 	lRow.cells[i].className =pClassName;
//   }
//
//}


//-------------------------------------------------------------------------
//
// FUNCOES DE POPUP
//
//-------------------------------------------------------------------------
function newPopup(pUrl,pID,pW,pH,pLeft,pTop,pMenuBar,pScrollBar,pResize){



	var lParams='width='+pW+',height='+pH+',left='+pLeft+',top='+pTop + ',menubar='+ pMenuBar + ',scrollbars='+ pScrollBar + ',resizable='+ pResize ;
	return window.open(pUrl, pID, lParams);

}


//-------------------------------------------------------------------------
//
// FUNCOES DE IFRAME
//
//-------------------------------------------------------------------------
function deleteIframe(pID,pParent){

	if(pParent != null){	
		var ifr = pParent.document.getElementById(pID);//.style.height = 50;
   		ifr.parentNode.removeChild(ifr);
	}else{
	    var ifr = document.getElementById(pID);
	    ifr.parentNode.removeChild(ifr);
	}
}	


function createUrlIframe (pID, width, height,url,pOffSetX,pOffSetY,pScroll) {


	lAreaBrowser = 120;


	if(document.getElementById(pID)!=null){
		return;
	}

	var iframe;
	
	
	if (document.createElement && (iframe = document.createElement('iframe')) ) {

		iframe.name = iframe.id = pID;
		iframe.width = width;
		iframe.height = height;

		if (navigator.appName != "Microsoft Internet Explorer")
			iframe.scrolling = pScroll; 

		iframe.style.position="absolute";

		//Trata pos X
		if(pOffSetX =='C'){
			iframe.style.left= screen.width/2 - width/2;		
		}else{
			if(pOffSetX =='') pOffSetX = 0;	
			iframe.style.left= pOffSetX;
		
		}



	    //Trata pos Y centro
		if(pOffSetY =='C'){

			if (navigator.appName == "Microsoft Internet Explorer")
				lScroll = parent.document.body.scrollTop; 
			else
				lScroll = window.parent.pageYOffset;
				
			lMeioDoc = eval( parent.document.height/2);
			lMeioTela = eval( screen.height/2);
			lMeioIframe = eval( height/2);
			iframe.style.top= eval( (lMeioTela - lMeioIframe) + lScroll - lAreaBrowser);
			
		}else
			//Trata pos Y Top
			if(pOffSetY =='T'){
				if (navigator.appName == "Microsoft Internet Explorer")
					lScroll = parent.document.body.scrollTop; 
				else
					lScroll = window.parent.pageYOffset;			
				
				iframe.style.top = lScroll;
			}else
				if(pOffSetY =='') 
					  iframe.style.top= 0;
				else	  
					  iframe.style.top= pOffSetY;
		
		
		
		iframe.setAttribute('frameBorder','no');
		iframe.setAttribute('border','0');

        
		if(url!='')
			iframe.src = url;
		else	
			iframe.src = 'about:blank';

		document.body.appendChild(iframe);
	}
	return iframe;
}


/*


function createUrlIframe (pID, width, height,url,pOffSetX,pOffSetY,pScroll) {


	lAreaBrowser = 120;


	if(document.getElementById(pID)!=null){
		return;
	}

	var iframe;
	
	
	if (document.createElement && (iframe = document.createElement('iframe')) ) {

		iframe.name = iframe.id = pID;


		iframe.style.position="absolute";


		iframe.width = '100%';
		iframe.height = parent.document.height;
		iframe.style.left = '0';
		iframe.style.top = '0';
		
		iframe.setAttribute('frameBorder','no');
		iframe.setAttribute('border','0');

        
		if(url!='')
			iframe.src = url;
		else	
			iframe.src = 'about:blank';
		document.body.appendChild(iframe);
	}
	return iframe;
}
*/


//Modificadas estao funcoes para manter compatibilidade
function createIframe (pID, width, height,url) {
	iframe = createUrlIframe (pID, width, height,url,0,0,0);
	return iframe;

}

//Modificadas estao funcoes para manter compatibilidade
function createUrlIframeCenter (pID, width, height,url,pOffSetX,pOffSetY) {
	iframe = createUrlIframe (pID, width, height,url,'C','C',0);
	return iframe;
}


//-------------------------------------------------------------------------
//
// FUNCOES DE DIV
//
//-------------------------------------------------------------------------
function createDiv(pID, html, left, top, width, height,pZindex) {
  
  lAreaBrowser = 120; 



  //Se ja existe uma div com esse id retorna...	
  if(document.getElementById(pID)!=null){
		return;   
  }


   var newdiv = document.createElement('div');
   newdiv.setAttribute('id', pID);
   
   if (width) {
       newdiv.style.width = width;
   }
   
   if (height) {
       newdiv.style.height = height;
   }

	if( pZindex )
		newdiv.style.zindex = pZindex;
	
	
	//Trata pos X
	if(left =='C'){
		newdiv.style.left= screen.width/2 - width/2;		
	}else{
		if(left =='') 
			left = 0;	
		else
			newdiv.style.left= left;
	
	}




	//Trata pos Y centro
	if(top =='C'){

		if (navigator.appName == "Microsoft Internet Explorer")
			lScroll = parent.document.body.scrollTop; 
		else
			lScroll = window.parent.pageYOffset;
			
		lMeioDoc = eval( parent.document.height/2);
		lMeioTela = eval( screen.height/2);
		lMeioIframe = eval( height/2);
		newdiv.style.top= eval( (lMeioTela - lMeioIframe) + lScroll - lAreaBrowser);
		
	}else
		//Trata pos Y Top
		if(top =='T'){
			if (navigator.appName == "Microsoft Internet Explorer")
				lScroll = parent.document.body.scrollTop; 
			else
				lScroll = window.parent.pageYOffset;			
			
			newdiv.style.top = lScroll;
		}else
			if(top =='') 
				  newdiv.style.top= 0;
			else	  
				  newdiv.style.top= top;
		



   
   if ((left || top) || (left && top)) {
       newdiv.style.position = "absolute";
       
       if (left) {
         //  newdiv.style.left = left;
       }
       
       if (top) {
       //    newdiv.style.top = top;
       }
	   
   }
   



   if (html) {
       newdiv.innerHTML = html;
   } else {
       newdiv.innerHTML = "";
   }
   
   document.body.appendChild(newdiv);

} 


//------Posiciona DIV
function posicionaDiv(pID, left, top) {
  
  lAreaBrowser = 120; 

  //Se ja existe uma div com esse id retorna...	
  if(document.getElementById(pID)==null)
		return;   
	

   var lDiv = document.getElementById(pID);
   
   
   width = lDiv.style.width;
   height = lDiv.style.height;
   

	//Trata pos X
	if(left =='C'){
		lDiv.style.left= screen.width/2 - width/2;		
	}else{
		if(left =='') 
			left = 0;	
		else
			lDiv.style.left= left;
	
	}

	alert('--->' + window.pageYOffset );		


	//Trata pos Y centro
	if(top =='C'){

		if (navigator.appName == "Microsoft Internet Explorer")
			lScroll = parent.document.body.scrollTop; 
		else
			lScroll = window.pageYOffset;
			
		lMeioDoc = eval( document.height/2);
		lMeioTela = eval( screen.height/2);
		lMeioIframe = eval( height/2);
		lDiv.style.top = eval( (lMeioTela - lMeioIframe) + lScroll - lAreaBrowser);
	alert('--->' + window.pageYOffset );		
		
	}else
		//Trata pos Y Top
		if(top =='T'){
			if (navigator.appName == "Microsoft Internet Explorer")
				lScroll = parent.document.body.scrollTop; 
			else
				lScroll = window.parent.pageYOffset;			
			
			lDiv.style.top = lScroll;
		}else
			if(top =='') 
				  lDiv.style.top= 0;
			else	  
				  lDiv.style.top= top;
		


   
   if ((left || top) || (left && top)) {
       lDiv.style.position = "absolute";
       
       if (left) {
           lDiv.style.left = left;
       }
       
       if (top) {
           lDiv.style.top = top;
       }
   }
   

} 

function destroyDiv(pID) {
	
  //Se nao existe uma div com esse id retorna...	
  if(document.getElementById(pID)==null)
		return;   	
	
   lDiv = document.getElementById(pID);
   document.body.removeChild(lDiv);
}


function setaConteudoDiv(pID, pHTML){
	
  //Se nao existe uma div com esse id retorna...	
  if(document.getElementById(pID)==null)
		return;   	

   lDiv = document.getElementById(pID);
   lDiv.innerHTML = pHTML;

}

function setaAlignDiv(pID, pAlign){

  //Se nao existe uma div com esse id retorna...	
  if(document.getElementById(pID)==null)
		return;   	

   lDiv = document.getElementById(pID);
   lDiv.align = pAlign;

	
}

function setaVAlignDiv(pID,pVAlign){
	
  //Se nao existe uma div com esse id retorna...	
  if(document.getElementById(pID)==null)
		return;   	

   lDiv = document.getElementById(pID);
   lDiv.valign = pVAlign;	

}

function setaBackgroundDiv(pID,pBg){

  //Se nao existe uma div com esse id retorna...	
  if(document.getElementById(pID)==null)
		return;   	

   lDiv = document.getElementById(pID);
   lDiv.style.background = pBg;	
}

function setaBorderDiv(pID,pLargura,pCor){

  //Se nao existe uma div com esse id retorna...	
  if(document.getElementById(pID)==null)
		return;   	

   lDiv = document.getElementById(pID);
   lDiv.style.border = pLargura + 'px solid ' + pCor;	
   
}

function setaCssDiv(pID,pClass){

  //Se nao existe uma div com esse id retorna...	
  if(document.getElementById(pID)==null)
		return;   	

   lDiv.className = pClass;
}



function mostraLoading(id){

    document.getElementById(id).style.display = 'block';
    return 1;
}



//-------------------------------------------------------------------------
//
// DIV DE TEMPO...
//
//-------------------------------------------------------------------------


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 showDivTempoTransp(pTexto,pImgTempo,pCss){


	   //---div Transparente------- 
	   var newdiv = document.createElement('div');
	   newdiv.setAttribute('id', 'divTransp');
	   newdiv.style.position = "absolute";
	   newdiv.style.left = 0;
	   newdiv.style.top = 0;
	   newdiv.style.width = "100%";
	   newdiv.style.height = document.body.clientHeight  + 'px';
	   newdiv.style.backgroundColor = "#000000";
	   newdiv.className = "transparent_class";
	   newdiv.style.zIndex = 90000;
	   document.body.appendChild(newdiv);

	   //-----div Interna-------------
	   var lDefaultWidth = 200;	
	   var lDefaultHeight = 200;	

	   //div 2
	   var newdiv = document.createElement('div');
	   newdiv.setAttribute('id', "divView");
	   newdiv.style.width = lDefaultWidth + "px";
	   newdiv.style.height = lDefaultHeight + "px";
	   newdiv.style.backgroundColor = "#FFF";
	   newdiv.style.zIndex = 90001;
	   newdiv.innerHTML = '<table border="0" width="100%" height="100%"><tr><td  align="center"><img src="' + pImgTempo + '"><br><br>' + pTexto + "</td></tr></table>";
       newdiv.className = pCss;		   
	   document.body.appendChild(newdiv);

		showDivCenter(	lDefaultWidth, lDefaultHeight,'divView' );

}

function hideDivTempoTransp(){
	destroyDiv('divView');
    destroyDiv('divTransp');
}




function showDivTempo(pTexto,pImgTempo,pCss){
	
    createDiv('divtempo','','C', 'C', 200, 100);
	
	setaConteudoDiv('divtempo','<br><img src="' + pImgTempo + '"><br><br>' + pTexto );
	setaAlignDiv('divtempo','center');
 
    setaCssDiv('divtempo',pCss);	

}


function showDivTempoPosic(pTexto,pImgTempo,pCss,pX,pY){
	
    createDiv('divtempo','',pX, pY, 200, 100,'');
	
	setaConteudoDiv('divtempo','<br><img src="' + pImgTempo + '"><br><br>' + pTexto );
	setaAlignDiv('divtempo','center');
 
    setaCssDiv('divtempo',pCss);	

}


function hideDivTempo(){
	destroyDiv('divtempo');
}
