function objetus(file) {
xmlhttp=false;
this.AjaxFailedAlert = "Su navegador no soporta las funcionalidades de este sitio y podria experimentarlo de forma diferente a la que fue pensada. Por favor habilite javascript en su navegador para verlo normalmente.\n";
	this.requestFile = file;
//	this.method = "POST";
	this.URLString = "";
	this.encodeURIString = true;
	this.execute = false;
if (window.XMLHttpRequest) { // Mozilla, Safari, ...
            this.xmlhttp = new XMLHttpRequest();
            if (this.xmlhttp.overrideMimeType) {
                this.xmlhttp.overrideMimeType('text/xml');}} else if (window.ActiveXObject) { // IE
try {
  this.xmlhttp  = new ActiveXObject("Msxml2.XMLHTTP");
}catch (e) {
	try {
		this.xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
		} catch (e) {
			this.xmlhttp = null;
			}
	      }
	if (!this.xmlhttp  && typeof XMLHttpRequest!='undefined') {
                this.xmlhttp = new XMLHttpRequest();
				if (!this.xmlhttp){
			this.failed = true; 
		}
				    } }
	return this.xmlhttp ;
	}
function onreadyestado(elajax,caper){
var alreadyrunning=0;
var texto='';
elajax.onreadystatechange=function() {
/** 200 Todo correcto
* 400 Bad syntax (Error de sintaxis)
* 401 Unauthorized (Acceso no autorizado, el usuario debe autentificarse)
* 403 Forbidden (Acceso Prohibido)
* 404 Not Found (No Encontrado)
* 405 Method not allowed (Modo no permitido)
* 500 Internal Error (Error Interno)
* 501 Not Implemented (No Implementado)
* 502 Overloaded (Sobrecargado)
* 503 Service Unavailable (Servicio no disponible)
* 504 Gateway Timeout (Gateway Fuera de Tiempo)
* 505 HTTP Version not supported (Versisn de HTTP no Soportada)*/
if (elajax.readyState==1){
if(texto!=""){caper.innerHTML = texto;}else {caper.innerHTML = "<div style='text-align:center; height:100%;width:100%;padding-top:50px'><img src='http://www.auream.com/aureaprm/orgnl/imagenes/loadingcircle.gif' align='center'></div>";
}  
}

	if (elajax.readyState==2){
		if(texto!=""){caper.innerHTML = texto;}else {caper.innerHTML = "Enviando pedido. Aguarda por favor...";}
		}
	if (elajax.readyState==3){
		if(texto!=""){caper.innerHTML = texto;}else {caper.innerHTML = "<div style='text-align:center; font:12px Arial; color:#000000; height:100%;width:100%;padding-top:50px'><img src='http://www.videoblogs.com.ar/imagenes/ajax-loader.gif' align='center'><br>Recibiendo informacion. Aguarda por favor...</div>";}
		}
		if (elajax.readyState==4) {
			if(elajax.status==200)
			{
				caper.innerHTML = elajax.responseText;
				alreadyrunflag=1;
				}
			else if(elajax.status==404) {caper.innerHTML = "La direccion no existe"; } else {
            caper.innerHTML = "Error: ".ajax.status;
}
}
}
return alreadyrunning;
}

function recibeid(_pagina,valorget,valor,capa,truefalse,texto){ 
ajax=objetus(_pagina);
var capex=document.getElementById(capa);
if(truefalse==''){truefalse=true;}
if(valor!=""){
ajax.open("POST", _pagina+"?"+valorget+"&tiempo="+new Date().getTime(),truefalse);
} else {
ajax.open("GET", _pagina+"?"+valorget+"&tiempo="+new Date().getTime(),truefalse);
}
onreadyestado(ajax,capex);
//if(      onreadyestado(ajax,capex)  !=1  ){}
if(valor!=""){
ajax.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
ajax.send(valor);
} else {
ajax.send(null);
}
} 
function confirmDel()
{
var agree=confirm("¿Realmente deseas eliminarlo?");
if (agree){ return true ;}
else {return false ;}
}

/*function initio(){
document.getElementById("logueo").innerHTML='<iframe src="http://auream.com/fncapl/login.php" height="50px" width="500px" scrolling="no" frameborder="0" name="miYframe"></iframe>';
}*/


function enableField()
{
if((document.formregistro.campoverifcomple.value==document.formregistro.hiddenCampo.value)&&(document.formregistro.campoverifcomple.value!='')&&(document.formregistro.activarcompleto.checked==true)){
document.formregistro.buttonsend.disabled=false;
document.formregistro.buttonsend.style.background="url( http://www.auream.com/aureaprm/orgnl/imagenes/buttoncontinuar.gif)";
document.formregistro.buttonsend.style.border="0"; 
document.formregistro.buttonsend.style.width="214px"; 
document.formregistro.buttonsend.style.height="42px"; 
document.formregistro.buttonsend.style.cursor="hand"; 
document.formregistro.buttonsend.style.cursor="pointer";
	}
}

function checkSubmit(widthaca,heigthaca,imagenreemplazo,botonaverificar,formularioaenviar) {
document.forms[formularioaenviar].submit();
document.getElementById(botonaverificar).disabled = true;
	document.getElementById(botonaverificar).style.background="url( "+imagenreemplazo+")";
document.getElementById(botonaverificar).style.border="0"; 
document.getElementById(botonaverificar).style.width=widthaca; 
document.getElementById(botonaverificar).style.height=heigthaca; 
document.getElementById(botonaverificar).style.cursor="wait"; 
    return true;
}

function functionsendformi(valor){
	if(valor=="fecha"){
		document.getElementById("ventasdesdehasta").style.visibility="visible";
		document.getElementById("ventasdesdehasta").style.height="115px";
		} else {
		document.form1.submit();	
		}
}

contenido_textarea = "";
num_caracteres_permitidos = 2000;
function valida_longitud(){
	num_caracteres = document.formpregunta.preugntaaca.value.length
	if(num_caracteres==''){num_caracteres=0;}
	if (num_caracteres <= num_caracteres_permitidos){
		contenido_textarea = document.formpregunta.preugntaaca.value;
	}else{
		document.formpregunta.preugntaaca.value = contenido_textarea;
	}
	
	if (num_caracteres >= num_caracteres_permitidos){
		document.formpregunta.caracteres.style.color="#ff0000";
	}else{
		document.formpregunta.caracteres.style.color="#000000";
	}
	
	cuenta()
}
function cuenta(){
	document.formpregunta.caracteres.value=document.formpregunta.preugntaaca.value.length;
}
function mostrarcapa(Capa){
	document.getElementById(Capa).style.display="block";
	}		
function cerrarcapa(capa){
document.getElementById(capa).style.height="0";
document.getElementById(capa).style.visibility="hidden";
if(capa=='capaventana'){
	    document.getElementById("capafondo").style.visibility="hidden"; 
}
}

function abrircapa(ancho,alto,contenidocapa,capa){
	document.getElementById(capa).style.height=alto;
	document.getElementById(capa).style.width=ancho;
	var iframe='<iframe src="'+contenidocapa+'" style="height:540px;width:790px" frameborder="0"></iframe>';
    document.getElementById("capafondo").style.visibility="visible"; 
	document.getElementById('Content').innerHTML=iframe;
	document.getElementById(capa).style.visibility="visible";
	
}
function enviarForm(NombreDelFormulario)
{
document.getElementById("esteesmipais").value=NombreDelFormulario;
document.forms["esteesmiform"].submit();
}



/*window.onload = function()
      {
         initio();
      }*/