function popup(_url,_w,_h,_left,_top) {
 window.open(_url,'', 'width='+_w+', height='+_h+', top='+_top+', left='+_left+', scrollbars=yes, status=no, toolbar=no, location=no, directories=no, menubar=no, resizable=no, fullscreen=no');
}

function goAjax2(url, metodo, modo, tagRetorno, parametros) {
       
	   if (document.getElementById) {
	    document.getElementById(tagRetorno).innerHTML='<div align="center" class="carregando"><img src="../../imagens/loading.gif"><br /><br />Loading...</div>';
		}
	   else if (document.all) {
						document.all[tagRetorno].innerHTML='<div align="center" class="carregando"><img src="carregando.gif"><br /><br />Loading...</div>';
		}
		
function createXMLHTTP()
            {
                        try
                        {
                                   ajax = new ActiveXObject("Microsoft.XMLHTTP");
                        }
                        catch(e)
                        {
                                   try
                                   {
                                               ajax = new ActiveXObject("Msxml2.XMLHTTP");
                                               alert(ajax);
                                   }
                                   catch(ex)
                                   {
                                               try
                                               {
                                                          ajax = new XMLHttpRequest();

														  
                                               }
                                               catch(exc)
                                               {
                                                            alert("Esse browser não tem recursos para uso do Ajax");
                                                            ajax = null;
                                               }
                                   }
                                   return ajax;
                        }
           
   

   
           
               var arrSignatures = ["MSXML2.XMLHTTP.5.0", "MSXML2.XMLHTTP.4.0",
               "MSXML2.XMLHTTP.3.0", "MSXML2.XMLHTTP",
               "Microsoft.XMLHTTP"];
               for (var i=0; i < arrSignatures.length; i++) {
                                                               try {                                                                    var oRequest = new ActiveXObject(arrSignatures[i]);
                                                                    return oRequest;
                                                                    } catch (oError) {
                                                            }
                                      }
           
                                      throw new Error("MSXML is not installed on your system.");
                        }   
			var xmlhttp = createXMLHTTP();

            if(metodo == "GET") {
                xmlhttp.open("GET", url, modo);
            } else {        
                xmlhttp.open("POST", url, modo);
                xmlhttp.setRequestHeader("Content-Type", "application/x-www-form-urlencoded; charset=iso-8859-1");
                xmlhttp.setRequestHeader("Cache-Control", "no-store, no-cache, must-revalidate");
                xmlhttp.setRequestHeader("Cache-Control", "post-check=0, pre-check=0");
                xmlhttp.setRequestHeader("Pragma", "no-cache");
            }    
            
            xmlhttp.onreadystatechange = function() {
                if(xmlhttp.readyState == 4) {
                    retorno=xmlhttp.responseText
                    /*var element = getObj(tagRetorno) */
					if (document.getElementById) {					
						/*document.getElementById(tagRetorno).innerHTML=retorno; */
						if (retorno == 1) {
						self.location = '../../default/redireciona.asp';
						} else
						{ document.getElementById(tagRetorno).innerHTML=retorno;  }
						}
					else if (document.all) {
						/*document.all[tagRetorno].innerHTML=retorno;*/
						
						if (retorno == 1) {
						self.location = '../../default/redireciona.asp';
						} else {document.all[tagRetorno].innerHTML=retorno; }
						}
						
                   /* findScript(retorno)*/
                }
            }
            if(metodo == "GET") {
                xmlhttp.send(null);
            } else {        
                xmlhttp.send(parametros);
            }
}


function goAjax(url, metodo, modo, tagRetorno, parametros) {
       
	   if (document.getElementById) {
	    document.getElementById(tagRetorno).innerHTML='<div align="center" class="carregando"><img src="../../imagens/loading.gif"><br /><br />Loading...</div>';
		}
	   else if (document.all) {
						document.all[tagRetorno].innerHTML='<div align="center" class="carregando"><img src="carregando.gif"><br /><br />Loading...</div>';
		}
		
function createXMLHTTP()
            {
                        try
                        {
                                   ajax = new ActiveXObject("Microsoft.XMLHTTP");
                        }
                        catch(e)
                        {
                                   try
                                   {
                                               ajax = new ActiveXObject("Msxml2.XMLHTTP");
                                               alert(ajax);
                                   }
                                   catch(ex)
                                   {
                                               try
                                               {
                                                          ajax = new XMLHttpRequest();

														  
                                               }
                                               catch(exc)
                                               {
                                                            alert("Esse browser não tem recursos para uso do Ajax");
                                                            ajax = null;
                                               }
                                   }
                                   return ajax;
                        }
           
   

   
           
               var arrSignatures = ["MSXML2.XMLHTTP.5.0", "MSXML2.XMLHTTP.4.0",
               "MSXML2.XMLHTTP.3.0", "MSXML2.XMLHTTP",
               "Microsoft.XMLHTTP"];
               for (var i=0; i < arrSignatures.length; i++) {
                                                               try {                                                                    var oRequest = new ActiveXObject(arrSignatures[i]);
                                                                    return oRequest;
                                                                    } catch (oError) {
                                                            }
                                      }
           
                                      throw new Error("MSXML is not installed on your system.");
                        }   
			var xmlhttp = createXMLHTTP();

            if(metodo == "GET") {
                xmlhttp.open("GET", url, modo);
            } else {        
                xmlhttp.open("POST", url, modo);
                xmlhttp.setRequestHeader("Content-Type", "application/x-www-form-urlencoded; charset=iso-8859-1");
                xmlhttp.setRequestHeader("Cache-Control", "no-store, no-cache, must-revalidate");
                xmlhttp.setRequestHeader("Cache-Control", "post-check=0, pre-check=0");
                xmlhttp.setRequestHeader("Pragma", "no-cache");
            }    
            
            xmlhttp.onreadystatechange = function() {
                if(xmlhttp.readyState == 4) {
                    retorno=xmlhttp.responseText
                    /*var element = getObj(tagRetorno) */
					if (document.getElementById) {					
						document.getElementById(tagRetorno).innerHTML=retorno;
						}
					else if (document.all) {
						document.all[tagRetorno].innerHTML=retorno;
						
						}
						
                   /* findScript(retorno)*/
                }
            }
            if(metodo == "GET") {
                xmlhttp.send(null);
            } else {        
                xmlhttp.send(parametros);
            }
}


function enviaPage(url, metodo, modo, tagId, parametros)
{
    goAjax( url+"?"+parametros+"&rnd"+ Math.random() , metodo, modo , tagId);
}
function enviaPage2(url, metodo, modo, tagId, parametros)
{
    goAjax2( url+"?"+parametros+"&rnd"+ Math.random() , metodo, modo , tagId);
}
function getObjeto(name)
{
	if (document.getElementById)
	{
		this.obj = document.getElementById(name);
		this.style = document.getElementById(name).style;
	}
	else if (document.all)
	{
		this.obj = document.all[name];
		this.style = document.all[name].style;
	}
	else if (document.layers)
	{
		this.obj = document.layers[name];
		this.style = document.layers[name];
	}
return this.obj.value
}
function getObjeto2(name)
{
	if (document.getElementById)
	{
		this.obj = document.getElementById(name);
		this.style = document.getElementById(name).style;
	}
	else if (document.all)
	{
		this.obj = document.all[name];
		this.style = document.all[name].style;
	}
	else if (document.layers)
	{
		this.obj = document.layers[name];
		this.style = document.layers[name];
	}
return this.obj
}
function MM_callJS(jsStr) { //v2.0
  return eval(jsStr)
}
function chamada()
{
	enviaPage('cidadexml.asp', 'GET', 'true', 'divescity','uf=PR')
}


// Limita a quantidade de caracteres. 
function limite(que,cuanto)
{
var v=que.value
if(v.length>cuanto)
	que.value=v.substring(0,cuanto)
else
	var element = getObjeto2('contador')
	element.value =cuanto-v.length
}
 

// Limita a quantidade de caracteres. 
function limite2(que,cuanto)
{
var v=que.value
if(v.length>cuanto)
	que.value=v.substring(0,cuanto)
else
	var element = getObjeto2('contador2')
	element.value=cuanto-v.length
}
function MM_goToURL() { //v3.0
  var i, args=MM_goToURL.arguments; document.MM_returnValue = false;
  for (i=0; i<(args.length-1); i+=2) eval(args[i]+".location='"+args[i+1]+"'");
}

