
	// contem objeto para solicitar recursos remotos.
function limpaCombo(oList){
 for (var i = oList.options.length - 1; i >= 0; i--){
   oList.options[i] = null;
 }
 oList.selectedIndex = -1;
}
function getCheckedValue(radioObj) {
    if(!radioObj)
		return "";
	var radioLength = radioObj.length;
	if(radioLength == undefined)
		if(radioObj.checked)
			return radioObj.value;
		else
			return "";
	for(var i = 0; i < radioLength; i++) {
		if(radioObj[i].checked) {
			return radioObj[i].value;
		}
	}
	return "";
    
}
function CurrencyFormatted(amount)
{
	var i = parseFloat(amount);
	if(isNaN(i)) { i = 0.00; }
	var minus = '';
	if(i < 0) { minus = '-'; }
	i = Math.abs(i);
	i = parseInt((i + .005) * 100);
	i = i / 100;
	s = new String(i);
	if(s.indexOf('.') < 0) { s += '.00'; }
	if(s.indexOf('.') == (s.length - 2)) { s += '0'; }
	s = minus + s;
	return s;
}
function MascaraMoeda(objTextBox, SeparadorMilesimo, SeparadorDecimal, e){
var sep = 0;
var key = '';
var i = j = 0;
var len = len2 = 0;
var strCheck = '0123456789';
var aux = aux2 = '';
var whichCode = (window.Event) ? e.which : e.keyCode;
if (whichCode == 13) return true;
key = String.fromCharCode(whichCode); // Valor para o código da Chave
if (strCheck.indexOf(key) == -1) return false; // Chave inválida
len = objTextBox.value.length;
for(i = 0; i < len; i++)
if ((objTextBox.value.charAt(i) != '0') && (objTextBox.value.charAt(i) != SeparadorDecimal)) break;
aux = '';
for(; i < len; i++)
if (strCheck.indexOf(objTextBox.value.charAt(i))!=-1) aux += objTextBox.value.charAt(i);
aux += key;
len = aux.length;
if (len == 0) objTextBox.value = '';
if (len == 1) objTextBox.value = '0'+ SeparadorDecimal + '0' + aux;
if (len == 2) objTextBox.value = '0'+ SeparadorDecimal + aux;
if (len > 2) {
aux2 = '';
for (j = 0, i = len - 3; i >= 0; i--) {
if (j == 3) {
aux2 += SeparadorMilesimo;
j = 0;
}
aux2 += aux.charAt(i);
j++;
}
objTextBox.value = '';
len2 = aux2.length;
for (i = len2 - 1; i >= 0; i--)
objTextBox.value += aux2.charAt(i);
objTextBox.value += SeparadorDecimal + aux. substr(len - 2, len);
}
return false;
}
function createXMLHttpRequest() {

	/*

		Interface genérica para acesso ao conector remoto.

	*/

   try{ return new ActiveXObject("Msxml2.XMLHTTP"); }catch(e){}

   try{ return new ActiveXObject("Microsoft.XMLHTTP"); }catch(e){}

   try{ return new XMLHttpRequest(); }catch(e){}

   alert("XMLHttpRequest not supported");

   return null;

}

  var xhReq = createXMLHttpRequest();

function xhSend(url){

	/*

		envia a requisicao para o servidor, e tudo o que eh

		retornado eh passado a funcao do_readyStateChange

	*/
    
    xhReq.open("GET",url,true);

    xhReq.onreadystatechange = do_readyStateChange;

    xhReq.send(null);



}
function xhSend2(url){

	/*

		envia a requisicao para o servidor, e tudo o que eh

		retornado eh passado a funcao do_readyStateChange

	*/

    xhReq.open("GET",url,true);

    xhReq.onreadystatechange = do_readyStateChange2;

    xhReq.send(null);



}
function xhSend3(url){

	/*

		envia a requisicao para o servidor, e tudo o que eh

		retornado eh passado a funcao do_readyStateChange

	*/

    xhReq.open("GET",url,true);

    xhReq.onreadystatechange = do_readyStateChange3;

    xhReq.send(null);



}
function xhSendPost(url,form){



  var form_string = getObj(form);  

	xhReq.open("POST",url,true);

	xhReq.setRequestHeader('Content-Type','application/x-www-form-urlencoded');

	//xhReq.setRequestHeader('Content-Lenght',form_string.lenght);	

  xhReq.onreadystatechange = do_readyStateChange_post;  
  xhReq.send(form_string);



}
function xhSendPost2(url,form){



  var form_string = getObj(form);  

	xhReq.open("POST",url,true);

	xhReq.setRequestHeader('Content-Type','application/x-www-form-urlencoded');

	//xhReq.setRequestHeader('Content-Lenght',form_string.lenght);	

  xhReq.onreadystatechange = do_readyStateChange_post2;  
  xhReq.send(form_string);



}
function xhSendPost3(url,form){



  var form_string = getObj(form);  

	xhReq.open("POST",url,true);

	xhReq.setRequestHeader('Content-Type','application/x-www-form-urlencoded');

	//xhReq.setRequestHeader('Content-Lenght',form_string.lenght);	

  xhReq.onreadystatechange = do_readyStateChange_post3;  
  xhReq.send(form_string);



}
function getObj(obj) {

	// come from: http://www.captain.at/howto-ajax-form-post-get.php

  var getstr = "";



  

  for (i=0;i<obj.elements.length;i++){       
   

	 if (obj.elements[i].tagName == "INPUT") {

	  if (obj.elements[i].type == "hidden") {

		   getstr += obj.elements[i].name + "=" + obj.elements[i].value + "&";

		}

    if (obj.elements[i].type == "text") {
		   
           getstr += obj.elements[i].name + "=" + obj.elements[i].value + "&";

		}

		if (obj.elements[i].type == "checkbox") {
      
          
		   if (obj.elements[i].checked) {
              
			  getstr += obj.elements[i].name + "=" + obj.elements[i].value + "&";
            
		   } else {

			  getstr += obj.elements[i].name + "=&";

		   }
            
		}

		if (obj.elements[i].type == "radio") {

		   if (obj.elements[i].checked) {

			  getstr += obj.elements[i].name + "=" + obj.elements[i].value + "&";

		   }

		}

	 }   
     
	 if (obj.elements[i].tagName == "SELECT") {

		var sel = obj.elements[i];

		getstr += sel.name + "=" + sel.options[sel.selectedIndex].value + "&";

	 }
     if (obj.elements[i].type == "textarea") {
        getstr += obj.elements[i].name + "=" + obj.elements[i].value + "&";

	}


	 

  }



  return getstr;

}

function refreshPagina() {

	

	var form = document.form1

	var html = ''



	var objDiv = document.getElementById("appletAssinador");

	objDiv.innerHTML = sHtmlAfterApplet;	

    form.hddAssinado.value = "true";       

    form.submit();	

}    

function xhAlteraStatus(url){

	/*

		envia a requisicao para o servidor, e tudo o que eh

		retornado eh passado a funcao do_readyStateChange

	*/

    xhReq.open("GET",url,true);

    xhReq.onreadystatechange = do_readyStateChange;

    xhReq.send(null);



}



function assinaDocumento(sBaseUrl, sStatusDepAss, sIdDoc, sNumCpf) {  	

  

	if (sIdDoc == "") {

		alert("Não foi possível efetuar a operação: não existem documentos para assinar")

	} else {

		carregaAppletAssinador(sBaseUrl, sStatusDepAss, sIdDoc, sNumCpf)

	}

}



var sHtmlAfterApplet = "";



function carregaAppletAssinador(sBaseUrl, sStatusDepAss, sIdDoc, sNumCpf) {

	

	var strColecaoDocumentos = sIdDoc + ';';

	

	var html = ''



	var objDiv = document.getElementById("appletAssinador");

	

	sHtmlAfterApplet = objDiv.innerHTML;





	html += '<tr>'

	html += '&nbsp;'

	html += '</tr>'

	html += '<tr valign="center">'

	html += 'Certificado Digital (Padrão ICP-Brasil A3)</br>'

	// montar o applet para a assinatura

	html += '</tr>'

	html += '<tr align="center">'

	html += '<object name="assinadorPrd" classid = "clsid:CAFEEFAC-0015-0000-0000-ABCDEFFEDCBA"'

	html += 'codebase = "http://java.sun.com/update/1.5.0/jinstall-1_5_0-windows-i586.cab#Version=1,5,0,0"'

	html += 'width="530" height="80" align="center" mayscript="true">'

	html += '<param name="type" value="application/x-java-applet;version=1.5">'

	html +=	'<param name="backgroundColor" VALUE="0xa9b7c2">'

	html += '<param name="codebase" value="' + sBaseUrl +  'global/">' 

	html += '<param name="code" value="br.gov.prodemge.agw1.AssinadorAgw1">'

	html += '<param name="archive" value="AssinadorAgw1Thread.jar,' 

	html += '                             PrdCertificacaoDigitalAgw1Ass.jar">'

	html += '<comment>'

	html += '    <embed'

	html += '        name="assinadorPrd"' 

	html +=	'        backgroundColor="0xa9b7c2"'

	html += '        type="application/x-java-applet;version=1.5"'

	html += '        pluginspage="http://java.sun.com/products/plugin/index.html#download"'

	html += '        code="AssinadorAgw1" archive="AssinadorAgw1Thread.jar, PrdCertificacaoDigitalAgw1Ass.jar"'

	html += '        width="530" height="80">'

	html += '		<noembed>'

	html += '           O applet para assinutaura digital não pôde ser iniciado.'

	html += '           O Java Plug-In version 1.5 ou superior deve ser instalado.'

	html += '        </noembed>'

	html += '    </embed>'

	html += '</comment>'

	html += '</object>'

	html += '</tr>'

	html += '<tr>'

	html += '&nbsp;'

	html += '</tr>'

	

	// envio da coleçao de propostas para o applet assinador

	

	objDiv.innerHTML = html;

	var objApplet = document.getElementById("assinadorPrd");

	objApplet.setColecaoDocumentos(strColecaoDocumentos);

  	var reason = 'Aprovado';

	objApplet.setReason(reason);

	var blankField = 'Superintendente';

	objApplet.setBlankField(blankField);

	var strStatusDepAss = sStatusDepAss;

	objApplet.setStatusDepAss(strStatusDepAss);

	var strNumCpf = sNumCpf;

	objApplet.setNumCpf(strNumCpf);

	var urlEnvioDocs = sBaseUrl + 'global/rec_documento.php';

  	objApplet.setUrlEnvioDocumentos(urlEnvioDocs);

	var urlRecDocs = sBaseUrl + 'global/rec_documento.php' ;

	objApplet.setUrlRecDocumentos(urlRecDocs);

}





function visualizaDocumento (oComboDenuncia, iTipDoc, sBaseURL) {



	var optionSelected = oComboDenuncia.value

	var id_denuncia = ''

	var ano_denuncia = ''

	var id_tipo_documento = iTipDoc

	var targetURL = sBaseURL

	

	// DNC 016/2006

	

	id_denuncia = optionSelected.substring(optionSelected.indexOf(' '), optionSelected.indexOf('/'))

	id_denuncia = (parseInt(id_denuncia, 10)).toString()

	ano_denuncia = optionSelected.substring(optionSelected.indexOf('/')+1,optionSelected.length)

	targetURL += 'global/rec_documento.php'

  targetURL += '?id_denuncia='+id_denuncia

	targetURL += '&ano_denuncia='+ano_denuncia 

	targetURL += '&id_tipo_documento='+id_tipo_documento 

	bOpenWindow( targetURL, 600, 600, 'winDocumento',false,true,true)

	

}





function valida_NumProcesso(oNumProcesso) {

  var NumP = oNumProcesso;

  var ExpReg = new RegExp("([0-9]{3})/([0-9]{4})");

  erro = false;

 

  if ( NumP.search(ExpReg) == -1 )

    erro = true;



  if ( (erro) && (NumP.value != '') ) {

    alert("Informe o número do processo / Ano no formato: 000/0000 .");

    //NumP.focus();

    return false;

  }

  else return true;

}





function valida_tel(oTel) {

  var tel = oTel.value;

  var ExpReg = new RegExp("([0-9]{2})-([0-9]{4})-([0-9]{4})");

  erro = false;



  if ( tel.search(ExpReg) == -1 )

    erro = true;

  if ( (erro) && (oTel.value != '') ) {

    alert("Telefone Inválido!");

    oTel.focus();

  }

}

function valida_masp(oMasp) {

  var masp = oMasp.value;

  var ExpReg = new RegExp("([0-9]{3}).([0-9]{3}).([0-9]{3})-([0-9]{1,2})");

  erro = false;



  if ( masp.search(ExpReg) == -1 )

    erro = true;

  if ( (erro) && (oMasp.value != '') ) {

    alert("Masp Inválido!");

    oMasp.focus();

  }

}

function valida_hora(oTime) {

  var time = oTime.value;

  var ExpReg = new RegExp("(0[0-9]|1[0-9]|[2][0-3]):(0[0-9]|1[0-9]|2[0-9]|3[0-9]|4[0-9]|5[0-9])");

  erro = false;



  if ( time.search(ExpReg) == -1 )

    erro = true;

  if ( (erro) && (oTime.value != '') ) {

    alert("Hora Invalida!");

    oTime.focus();

  }

}



function valida_tel(oTel) {

  var tel = oTel.value;

  var ExpReg = new RegExp("([0-9]{2})-([0-9]{4})-([0-9]{4})");

  erro = false;



  if ( tel.search(ExpReg) == -1 )

    erro = true;

  if ( (erro) && (oTel.value != '') ) {

    alert("Telefone Inválido!");

    oTel.focus();

  }

}



function valida_email(valor)

{

  if (valor.value != "")

  {

    if (valor.value.indexOf('.', 0) == -1)

    {

      alert("O Email é Inválido !!!");

      valor.focus();

      return (false);

    }

    if (valor.value.indexOf(' ', 0) != -1)

    {

      alert("O Email é Inválido !!! Verifique se há espaços");

      valor.focus();

      return (false);

    }    

    if (valor.value.indexOf('@', 0) == -1)

    {

      alert("O Email é Invalido !!!");

      valor.focus();

      return (false);

    }

  }

}



function valida_data(oDate) {

  var date = oDate.value;

  var array_data = new Array;

  var ExpReg = new RegExp("(0[1-9]|[12][0-9]|3[01])-(0[1-9]|1[012])-[12][0-9]{3}");

  //vetor que contem o dia o mes e o ano

  array_data = date.split("-");

  erro = false;

  //Valido se a data esta no formato dd/mm/yyyy e se o dia tem 2 digitos e esta entre 01 e 31

  //se o mes tem d2 digitos e esta entre 01 e 12 e o ano se tem 4 digitos e esta entre 1000 e 2999

  if ( date.search(ExpReg) == -1 )

    erro = true;

  //Valido os meses que nao tem 31 dias com execao de fevereiro

  else if ( ( ( array_data[1] == 4 ) || ( array_data[1] == 6 ) || ( array_data[1] == 9 ) || ( array_data[1] == 11 ) ) && ( array_data[0] > 30 ) )

    erro = true;

  //Valido o mes de fevereiro

  else if ( array_data[1] == 2 ) {

    //Valido ano que nao e bissexto

    if ( ( array_data[0] > 28 ) && ( ( array_data[2] % 4 ) != 0 ) )

      erro = true;

    //Valido ano bissexto

    if ( ( array_data[0] > 29 ) && ( ( array_data[2] % 4 ) == 0 ) )

      erro = true;

  }

  if ( (erro) && (oDate.value != '') ) {

    alert("Data Invalida!");

    oDate.focus();

  }

}

function mascara_hora(oDate,caracter)  {

  if(document.all) { // Internet Explorer

    var tecla = event.keyCode;

  }

  else {

    if(document.layers) { // Nestcape

      var tecla = caracter.which;

    }

  }

  if (tecla != 8 ){

    if (oDate.value.length=="2")

    {

      oDate.value = oDate.value + ":";

    }

  }

}

function mascara_data(oDate,caracter)  {

  if(document.all) { // Internet Explorer

    var tecla = event.keyCode;

  }

  else {

    if(document.layers) { // Nestcape

      var tecla = caracter.which;

    }

  }

  if (tecla != 8 ){

    if (oDate.value.length=="2")

    {

      oDate.value = oDate.value + "-";

    }

    else if (oDate.value.length=="5")

    {

      oDate.value = oDate.value + "-";

    }

  }

}

function bApenasNumericos(caracter,valor) {

if(document.all) { // Internet Explorer

  var tecla = event.keyCode;

}

else {

  if(document.layers) { // Nestcape

    var tecla = caracter.which;

  }

}





if((tecla > 47 && tecla < 58)) { // numeros de 0 a 9 e .

  return true;

}

else {

  if (tecla != 8 ) { // backspace

  return false;

  }

  else {

    return true;

  }

}

}

function mascara_tel(oTel,caracter)  {

  if(document.all) { // Internet Explorer

    var tecla = event.keyCode;

  }

  else {

    var tecla = caracter.which;

      /*if(document.layers) { // Nestcape

      var tecla = caracter.which; */

    }

  

  if (tecla != 8 ){     // tecla backspace

    if (oTel.value.length=="2")

    {

      oTel.value = oTel.value + "-";

    }

    else if (oTel.value.length=="7")

    {

      oTel.value = oTel.value + "-";

    }

  }

}



function mascara_CPF(oCPF,caracter)  {

  if(document.all) { // Internet Explorer

    var tecla = event.keyCode;

  }

  else {

    var tecla = caracter.which;

      /*if(document.layers) { // Nestcape

      var tecla = caracter.which; */

    }

  

  if (tecla != 8 ){     // tecla backspace

    if (oCPF.value.length=="3"){

      oCPF.value = oCPF.value + ".";

    }

    else if (oCPF.value.length=="7") {

      oCPF.value = oCPF.value + ".";

    }

    else if (oCPF.value.length=="11") {

      oCPF.value = oCPF.value + "-";

    }    

  }

}



function valida_CPF(CPF) {



texto = "";

texto = texto + CPF.substr(0,3);

texto = texto + CPF.substr(4,3);

texto = texto + CPF.substr(8,3);

texto = texto + CPF.substr(12,2);

CPF = texto;



// Aqui começa a checagem do CPF

var POSICAO, I, SOMA, DV, DV_INFORMADO;

var DIGITO = new Array(10);

DV_INFORMADO = CPF.substr(9, 2); // Retira os dois últimos dígitos do número informado

// Desemembra o número do CPF na array DIGITO

for (I=0; I<=8; I++) {

  DIGITO[I] = CPF.substr( I, 1);

}



// Calcula o valor do 10º dígito da verificação

POSICAO = 10;

SOMA = 0;

   for (I=0; I<=8; I++) {

      SOMA = SOMA + DIGITO[I] * POSICAO;

      POSICAO = POSICAO - 1;

   }

DIGITO[9] = SOMA % 11;

   if (DIGITO[9] < 2) {

        DIGITO[9] = 0;

}

   else{

       DIGITO[9] = 11 - DIGITO[9];

}



// Calcula o valor do 11º dígito da verificação

POSICAO = 11;

SOMA = 0;

   for (I=0; I<=9; I++) {

      SOMA = SOMA + DIGITO[I] * POSICAO;

      POSICAO = POSICAO - 1;

   }

DIGITO[10] = SOMA % 11;

   if (DIGITO[10] < 2) {

        DIGITO[10] = 0;

   }

   else {

        DIGITO[10] = 11 - DIGITO[10];

   }



// Verifica se os valores dos dígitos verificadores conferem

DV = DIGITO[9] * 10 + DIGITO[10];

   if (DV != DV_INFORMADO) {

      alert('CPF inválido');

      CPF.focus(); 

      return false;

   } 

}



function mascara_sipro(oSipro,caracter)  {

  if(document.all) { // Internet Explorer

    var tecla = event.keyCode;

  }

  else {

    var tecla = caracter.which;

      /*if(document.layers) { // Nestcape

      var tecla = caracter.which; */

    }

  

  if (tecla != 8 ){    // tecla backspace

    if (oSipro.value.length=="6")

    {

      oSipro.value = oSipro.value + "-";

    }

    else if (oSipro.value.length=="11")

    {

      oSipro.value = oSipro.value + "/";

    }

    else if (oSipro.value.length=="16")

    {

      oSipro.value = oSipro.value + "-";

    }

  }

}



function mascara_num_processo(oNumProcesso,caracter)  {

  if(document.all) { // Internet Explorer

    var tecla = event.keyCode;

  }

  else {

    var tecla = caracter.which;

      /*if(document.layers) { // Nestcape

      var tecla = caracter.which; */

    }

  

  if (tecla != 8 ){    // tecla backspace

    if (oNumProcesso.value.length=="3")

      oNumProcesso.value = oNumProcesso.value + "/";

  }

} 





function mascara_masp(oMasp,caracter) {

 if(document.all) { // Internet Explorer

    var tecla = event.keyCode;

 }

 else {

    var tecla = caracter.which;

    /*if(document.layers) { // Nestcape

    var tecla = caracter.which; */

  }

 

 if (tecla != 8 ){

   if (oMasp.value.length=="3")

   {

     oMasp.value = oMasp.value + ".";

   }

   else if (oMasp.value.length=="7")

   {

     oMasp.value = oMasp.value + ".";

   }

   else if (oMasp.value.length=="11")

   {

     oMasp.value = oMasp.value + "-";

   }

 }

}



function mascara_cep(oCEP,caracter) {

 if(document.all) { // Internet Explorer

    var tecla = event.keyCode;

 }

 else {

    var tecla = caracter.which;

   /* if(document.layers) { // Nestcape

    var tecla = caracter.which;*/

  }

 

 if (tecla != 8 ){

   if (oCEP.value.length=="2")

   {

     oCEP.value = oCEP.value + ".";

   }

   else if (oCEP.value.length=="6")

   {

     oCEP.value = oCEP.value + "-";

   }

 }

}



/***********************************************************************

function bShowLayer(sLayerName,bVisibility)



	Description:

		Sets visibility on a layer



	Input:

		sLayerName	=	the layers name

		bVisibility	=	show or hide layer?



	History:

		2001-08-30	Daniel Önnerby		Init version.



************************************************************************/

function bShowLayer(sLayerName,bVisibility){

	switch(dom){

		case 1:

			document.layers[sLayerName].visibility=bVisibility?"show":"hide";

			break;

		case 2:

			document.all[sLayerName].style.visibility=bVisibility?"visible":"hidden";

			break;

		case 3:

			document.getElementById(sLayerName).style.visibility=bVisibility?"visible":"hidden";

			break;

	}

}



/***********************************************************************

function bMoveLayer(sLayerName,iX,iY)



	Description:

		Moves a layer



	Input:

		sLayerName	=	the layers name

		iX		=	x-position of the layer

		iY		=	y-position of the layer



	History:

		2001-08-30	Daniel Önnerby		Init version.



************************************************************************/

function bMoveLayer(sLayerName,iX,iY){

	switch(dom){

		case 1:

			document.layers[sLayerName].moveTo(iX,iY);

			break;

		case 2:

			document.all[sLayerName].style.top=iY;

			document.all[sLayerName].style.left=iX;

			break;

		case 3:

			document.getElementById(sLayerName).style.top=iY;

			document.getElementById(sLayerName).style.left=iX;

			break;

	}

}





/***********************************************************************

function bMoveClipLayer(sLayerName,iX,iY,iWidth,iHeight,iDX,iDY)



	Description:

		Clips a layer



	Input:

		sLayerName	=	the layers name

		iX		=	x-position of the layer

		iY		=	y-position of the layer

		iWidth		=	the clipping-width

		iHeight		=	the clipping-height

		iDX		=	layer clipping moved

		iDY		=	layer clipping moved



	History:

		2001-08-30	Daniel Önnerby		Init version.



************************************************************************/

function bMoveClipLayer(sLayerName,iX,iY,iWidth,iHeight,iDX,iDY){

	switch(dom){

		case 1:

			document.layers[sLayerName].moveTo(iX-iDX,iY-iDY);

			document.layers[sLayerName].clip.top=iDY;

			document.layers[sLayerName].clip.right=iDX+iWidth;

			document.layers[sLayerName].clip.bottom=iDY+iHeight;

			document.layers[sLayerName].clip.left=iDX;

			break;

		case 2:

			document.all[sLayerName].style.top=iY-iDY;

//			document.all[sLayerName].style.left=iX-iDX;

			document.all[sLayerName].style.height=iHeight+iDY;

			document.all[sLayerName].style.clip="rect("+iDY+" "+(iDX+iWidth)+" "+(iDY+iHeight)+" "+iDX+")";

			break;

		case 3:

			document.getElementById(sLayerName).style.top=iY-iDY;

//			document.getElementById(sLayerName).style.left=iX-iDX;

//			document.getElementById(sLayerName).style.height=iHeight+iDY;

			document.getElementById(sLayerName).style.clip="rect("+iDY+","+(iDX+iWidth)+","+(iDY+iHeight)+","+iDX+")";

			break;

	}

}





/*****************************************************

function sPostCreateLayer



	Description:







	History:

		2002-04-02	Daniel Önnerby	Init version.



*****************************************************/

function sPostCreateLayer(sLayerName,iX,iY,sContent,iWidth,sOnMouseDown){

	switch(dom){

		case 1:

			if(sOnMouseDown){

				sContent='<a href="Javascript:void(null);" onmousedown="return '+sOnMouseDown+'(event);">'+sContent+'</a>';

			}

			document.layers[sLayerName]=new Layer(iWidth);

			document.layers[sLayerName].document.open();

			document.layers[sLayerName].document.write(sContent);

			document.layers[sLayerName].document.close();

			document.layers[sLayerName].moveTo(iX,iY);

			document.layers[sLayerName].visibility='hide';

			break;

		case 2:

			var sTemp="";

			if(sOnMouseDown){

				sTemp+=" onMouseDown=\""+sOnMouseDown+"();\" ";

			}

			document.body.insertAdjacentHTML('BeforeEnd','<div id="'+sLayerName+'" style="position:absolute;width:'+iWidth+';top:'+iY+';left:'+iX+';visibility:hidden;" '+sTemp+'>'+sContent+'</div>');

			break;

		case 3:

			var div;

			if(sOnMouseDown){

				sContent='<a href="Javascript:void(null);" onmousedown="return '+sOnMouseDown+'(event);">'+sContent+'</a>';

			}

			div=document.createElement('DIV');

			div.id=sLayerName;

			div.setAttribute('style','position:absolute;left:'+iX+';top:'+iY+';width:'+iWidth+';visibility:hidden;');

			div.innerHTML=sContent;

			document.body.appendChild(div);

			break;

	}

	return sLayerName;

}



/*****************************************************

function sPreCreateLayer



	Description:







	History:

		2002-04-10	Daniel Önnerby	Init version.



*****************************************************/

function sPreCreateLayer( sLayerName,iX,iY,sContent,iHeight ){

	var sLayer="";

	if(dom==1){

		sLayer+="<layer name=\""+sLayerName+"\" pagex="+iX+" pagey="+iY+" visibility=\"hide\">"+sContent+"</layer>\n";

	}else{

		if(iHeight){

			sLayer+="<div id=\""+sLayerName+"\" style=\"position:absolute;left:"+iX+";top:"+iY+";visibility:hidden;height:"+iHeight+";\">"+sContent+"</div>\n";

		}else{

			sLayer+="<div id=\""+sLayerName+"\" style=\"position:absolute;left:"+iX+";top:"+iY+";visibility:hidden;\">"+sContent+"</div>\n";

		}

	}

	return sLayer;

}





/*****************************************************

function bChangeImage



	Description:







	History:

		2002-04-10	Daniel Önnerby	Init version.



*****************************************************/

function bChangeImage( sName, sNewImage, sLayerName ){

	if(dom==1 && sLayerName){

		document.layers[sLayerName].document.images[sName].src=sNewImage;

	}else{

		document.images[sName].src=sNewImage;

	}

}



/*****************************************************

function bOpenWindow



	Description:







	History:

		2003-12-17	Daniel Önnerby	Init version.



*****************************************************/



function bOpenWindow( sURL, iWidth, iHeight, sName,bModal,bCenter,bScroll){

	if(document.all && bModal){

    if(bScroll)  

		  return showModalDialog(sURL, window,"resizable: no; help: no; status: no; scroll: no; dialogWidth:"+iWidth+"px; dialogHeight:"+iHeight+"px");

    else

      return showModalDialog(sURL, window,"resizable: no; help: no; status: no; scroll: yes; dialogWidth:"+iWidth+"px; dialogHeight:"+iHeight+"px");

	}else{

  

    if(bScroll)

		  var oWin=window.open(sURL,sName,"width="+iWidth+",height="+iHeight+",scrollbars=1");

    else

      var oWin=window.open(sURL,sName,"width="+iWidth+",height="+iHeight);

		var opener = window;

    var x = 0;

    var y = 0;

    if(!bCenter){

		  x = opener.screenX + (opener.outerWidth - oWin.outerWidth) / 2;

		  y = opener.screenY + (opener.outerHeight - oWin.outerHeight) / 2;      

    }

    else{

      x = parseInt((screen.width-iWidth)/2);

      y = parseInt((screen.height-iHeight)/2);          

    }

		oWin.moveTo(x, y);

		oWin.focus();

		return oWin;

	}

}

/*****************************************************

function iGetLayerWidth



	Description:







	History:

		2003-12-17	Daniel Önnerby	Init version.



*****************************************************/

function iGetLayerWidth( sLayerName ){

	var iWidth=0;

	switch(dom){

		case 1:

			iWidth=document.layers[sLayerName].width;

			break;

		case 2:

			iWidth=document.all[sLayerName].offsetWidth;

			break;

		case 3:

			iWidth=document.getElementById(sLayerName).offsetWidth;

			break;

	}

	return iWidth;



}



function iInt( sValue ){

	var iReturn=0;

	if( parseInt(sValue) ){

		iReturn=parseInt(sValue);

	}

	return iReturn;

}





function sGetValorSelectPrioridade( sSelectName){

	if(dom==1 && sLayerName){

		document.layers[sLayerName].document.images[sName].src=sNewImage;

	}else{

		document.images[sName].src=sNewImage;

	}

}



function showhide(layer_ref,value) {

  

  var state;



  if (value == 1) {

    state = 'hidden';

    //state = true;

  }

  else {

    state = 'visible';

    //state = false;

  }

  if (document.all) { //IS IE 4 or 5 (or 6 beta)

    eval( "document.all." + layer_ref + ".style.visibility = state");

    //eval( "document.all." + layer_ref + ".disabled = state");

  }

  if (document.layers) { //IS NETSCAPE 4 or below

    document.layers[layer_ref].visibility = state;

    //document.layers[layer_ref].disabled = state;

  }

  if (document.getElementById && !document.all) {

    maxwell_smart = document.getElementById(layer_ref);

    maxwell_smart.style.visibility = state;

    //maxwell_smart.disabled = state;

  }  

  

}