var emailfilter=/^\w+[\+\.\w-]*@([\w-]+\.)*\w+[\w-]*\.([a-z]{2,4}|\d+)$/i;
var ocupado=false,loaded,timerespera,posespera,contrecursiv,finrecursivdonde,mustdo,close1,titclic,lastAccdondecomp,urlnavega;
urlnavega="";
mustdo=false;

var url2;
var actualxpand=0;
var contespera=0;
function checkmail(e,id_contenedor){
var returnval=emailfilter.test(e)
if (returnval==false){
	document.getElementById(id_contenedor).innerHTML ="E-mail es incorrecto";
}
	return returnval;
}
var Elementos=new Array(8);//total de subcontenedores
var ElementosBack=new Array(8);
var ElementosTipo=new Array(8);
var ElementosName=new Array(8);
var Parpadeo=new Array(8); //divs parpadeantes
var ParpadeoId=new Array(8);
var ParpadeoDivs=new Array(8);
var subirtop=new Array(8);
function esEntero(valor){  if(!isNaN(valor)){   for(var i = 0; i<valor.length;i++){ if(valor.charCodeAt(i)<48 || valor.charCodeAt(i)>57)     return false;    }  }else{   return false;  }   return true; }
function isset(varname)  {
  if(typeof( window[ varname ] ) != "undefined") return true;
  else return false;
}

function moveto2(anchor_name) {

var frame_URL = document.location.href;

var number_sign_index = frame_URL.indexOf("#");
if (number_sign_index != -1) {
frame_URL = frame_URL.substring(0, number_sign_index);
}
if(urlnavega==""){urlnavega=frame_URL;}
document.location = urlnavega + "#" + anchor_name;
}
function HexToDec(hexa)
{
   Input = hexa;

   Input = Input.toUpperCase();

   a = GiveDec(Input.substring(0, 1));
   b = GiveDec(Input.substring(1, 2));
   c = GiveDec(Input.substring(2, 3));
   d = GiveDec(Input.substring(3, 4));
   e = GiveDec(Input.substring(4, 5));
   f = GiveDec(Input.substring(5, 6));

   x = (a * 16) + b;
   y = (c * 16) + d;
   z = (e * 16) + f;

 return "rgb("+x+", "+y+", "+z+")";

}
function GiveDec(Hex)
{
   if(Hex == "A")
      Value = 10;
   else
   if(Hex == "B")
      Value = 11;
   else
   if(Hex == "C")
      Value = 12;
   else
   if(Hex == "D")
      Value = 13;
   else
   if(Hex == "E")
      Value = 14;
   else
   if(Hex == "F")
      Value = 15;
   else
      Value = eval(Hex);

   return Value;
}
function GuardarElements(form1,iddiv){ //se guardaran todos los elementos de cada subcontenedor creado dinamicamente en la array Elementos
var test1,onerr;
Elementos[iddiv]=new Array(form1.elements.length);
ElementosTipo[iddiv]=new Array(form1.elements.length);
ElementosName[iddiv]=new Array(form1.elements.length);
for (i = 0; i < form1.elements.length; i++) {
			ElementosTipo[iddiv][i]=form1.elements[i].type;
				ElementosName[iddiv][i]=form1.elements[i].name;
					Elementos[iddiv][i]=form1.elements[i].value;
	}
}
function comparar(iddiv)
{
	for(i=0;i<Elementos[iddiv].length;i++)
	{
			if((Elementos[iddiv][i]!=ElementosBack[iddiv][i]&&String(Elementos[iddiv][i])!=""&&(String(ElementosTipo[iddiv][i])=="text"||String(ElementosTipo[iddiv][i])=="textarea"))||(String(Elementos[iddiv][i])!=""&&String(ElementosBack[iddiv][i])=="undefined"&&(String(ElementosTipo[iddiv][i])=="text"||String(ElementosTipo[iddiv][i])=="textarea")))
			{
				return false;
			}
	}
	return true;// si son todos iguales es porque no se ha hecho ningun cambio a los campos.
}
function RGBToHex(rgb) {
var char = "0123456789ABCDEF";
return String(char.charAt(Math.floor(rgb / 16))) + String(char.charAt(rgb - (Math.floor(rgb / 16) * 16)));
}
function parpadeo(divins)
{
	var var1,color1,rgb1,hex1,hex2,titcolor,bg2;
/*	titcolor=url2.split("&");
	color1=titcolor[2];
	color1=color1.substr(9,6);*/
	try{
	bg2=divins;
	
	bg2=bg2.substr(8);
	bg2="Titcol"+bg2;
	
	color1=document.getElementById(bg2).style.backgroundColor;

	/*hex1="#"+color1;
		color1=HexToDec(color1);
			color1=String(color1);
				rgb1=color1;*/
					hex2=color1;
	if(String(Parpadeo[divins.substr(0,10)])=="undefined"){
		try{
		Parpadeo[divins.substr(0,10)]=document.getElementById(divins).style.color;
		}
		catch(e){}
	}
	try{
	var1=String(document.getElementById(divins).style.color);
	
	if(var1==rgb1||var1==hex1||var1==hex2){
		document.getElementById(divins).style.color=Parpadeo[divins.substr(0,10)];
	}else{
		document.getElementById(divins).style.color=hex2;
	}
	}
	catch(e){
	}
	}catch(e){}
}
function ReestablecerElements(form1,iddiv){ //se guardaran todos los elementos de cada subcontenedor creado dinamicamente en la array Elementos
ElementosBack[iddiv]=new Array(form1.elements.length);
	for (i = 0; i < form1.elements.length; i++) {
		ElementosBack[iddiv][i]=form1.elements[i].value;
if(String(Elementos[iddiv][i])!="undefined"){
	if(form1.elements[i].name==ElementosName[iddiv][i]){
		form1.elements[i].value=Elementos[iddiv][i];
	}
}
	}
}
function ini_cargar_form(id_contenedor){
	var valores,valores_buff,divins,form1,comp1;
		valores=id_contenedor;valores_buff=valores.split("#");divins=valores_buff[1];
		try{
			    form1=document.getElementById("form"+divins.substr(0,10));
				GuardarElements(form1,divins.substr(0,10));	
				comp1=comparar(divins.substr(0,10));

				if(comp1==false){
					try{
						//clearInterval(ParpadeoId[divins.substr(0,10)]);
					}catch(e){}
					//ParpadeoId[divins.substr(0,10)]=setInterval("parpadeo(\"titcolor"+divins+"\");",1000);
				}
			}
catch(e){
		}
}
//parpadeo info cliente,..
function parplinkmissatge()
{
var parp1;
	try{
		parp1=String(document.getElementById("parp1").style.color);
		
		//alert(parp1);
	}
		catch(e){setTimeout("parplinkmissatge();",500);}
}
function doinfocli(){
var parp1,parp2;
	CargarAjax('datoscli.php','datoscli');
}

function execdoinfocli()
{
	setTimeout("doinfocli();",500);
}
//**
function ini_set_form(id_contenedor){
	var valores,valores_buff,divins,form1,test1,err1;
	valores=id_contenedor;valores_buff=valores.split("#");divins=valores_buff[1];
		try{form1=document.getElementById("form"+divins.substr(0,10));
			clearInterval(ParpadeoId[divins.substr(0,10)]);
			ReestablecerElements(form1,divins.substr(0,10));
		}catch(e){}
}//****
function getElementHeight(Elem) {
		if(document.getElementById) {
			var elem = document.getElementById(Elem);
		} else if (document.all){
			var elem = document.all[Elem];
		}
			xPos = elem.offsetHeight;
		return xPos;
}
function dotipopanel()
{
	setTimeout("execpanel();",800);
}
function execpanel(){
var tipo;
	tipo=getCheckedValue(document.getElementById('panelcliag'));
	document.getElementById("acc_type").value=tipo;
	if(tipo=="account"){
	document.getElementById("usrclilog").innerHTML="L&iacute;nea:";
	}else{document.getElementById("usrclilog").innerHTML="Usuario:";}
}
function doiniexpand(id_contenedor)
{
	var iddivc=document.getElementById("Conte"+id_contenedor);
	var iddivc2=document.getElementById("alt"+id_contenedor);

	  var altura_=getElementHeight("alt"+id_contenedor);
		if(parseInt(iddivc.style.height)<=altura_){
				iddivc.style.height = parseInt(iddivc.style.height)+30+"px";
				iddivc2.style.top = parseInt(iddivc2.style.top)+30+"px";
		}else
		{
				clearInterval(actualxpand);
				actualxpand=0; //ocupado
			document.getElementById("Conte"+id_contenedor).style.visibility="visible";
		}

}
function execdoiniexpand(id_contenedor)
{
		 var valores,valores_buff,divins;
		 valores=id_contenedor;valores_buff=valores.split("#");divins=valores_buff[1];
		 var iddivc=document.getElementById("Conte"+divins);
		 var iddivc2=document.getElementById("alt"+divins);
		 var altura_=getElementHeight("alt"+divins);
		 try{
			if(actualxpand==0)
			{
				iddivc.style.height ="0px";
				document.getElementById(divins).style.visibility="visible";
				iddivc2.style.top =(altura_)*(-1);
				actualxpand=setInterval("doiniexpand(\""+divins+"\");",20);
			}	
		 }catch(e){}
}
function iniexpand(id_contenedor)
{
	setTimeout("execdoiniexpand(\""+id_contenedor+"\");",300);
}//****
function removeElement(parent,div){
var d1=document.getElementById(parent);
var d2=document.getElementById(div);
d1.removeChild(d2);
}
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 repCAjax(url,id_contenedor,closeb1,titclicb1){
	CargarAjax(url,id_contenedor,closeb1,titclicb1);
}
function CargarAjax(url,id_contenedor,closeb1,titclicb1){
	close1=closeb1;
	titclic=titclicb1;

if(ocupado==true&&loaded==true&&mustdo==false){
	if(ocupado==true && close1=="true"){
	}
}
else{
url2=url;
var str_,str_1,a,h,divst;
var usuario,password,url1,intro,evast,tot1,modifisend;
var email,persona,asunto,comentario,valores,valores_buff,divins,orden,form1,form1b,testfrm,destino,cantidad,saldo,conempre;
var pagina = false;
	valores=id_contenedor;
		valores_buff=valores.split("#");
			divins=valores_buff[1];

if (window.XMLHttpRequest) {
pagina = new XMLHttpRequest()
} else if (window.ActiveXObject){
try {
pagina = new ActiveXObject("Msxml2.XMLHTTP")
}
catch (e){
try{
pagina = new ActiveXObject("Microsoft.XMLHTTP")
}
catch (e){}
}
}
else
return false;

pagina.onreadystatechange=function(){ 

	cargarpagina(pagina, id_contenedor);
}
if(pagina.readyState!=1){
if(url.substr(0,9)=="inisesion"){ //para post
usuario=document.getElementById('user').value;
	password=document.getElementById('pass').value;
		document.getElementById('Loginpnet').innerHTML="<div align=\"center\"><img src=\"loading.gif\" width=\"16\" height=\"16\" align=\"middle\"/></div>";
		ocupado=true;espera();
    		  pagina.open("POST", url, true);
			  
	  	  			 pagina.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
	  						pagina.send("user="+usuario+"&pass="+password);
}
else if(url.substr(0,11)=="enviar_cons"&&url.substr(0,16)!="enviar_consmodif"){ //formulario consulta general
email=document.getElementById('consemail').value;
	persona=document.getElementById('conspersona').value;
		asunto=document.getElementById('consasunto').value;
		try{
		  conempre=document.getElementById('consempresa').value;
		}
		catch(e){
			conempre="";
		}
			comentario=document.getElementById('conscomentario').value;
document.getElementById('respAjaxSubConGene').innerHTML="<div align=\"center\"><img src=\"loading.gif\" width=\"16\" height=\"16\" align=\"middle\"/></div>";

if(email!="" && persona!="" && asunto !="" && comentario!=""){
	ocupado=true;espera();
	pagina.open("POST", url, true);
	  	   pagina.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
	  			pagina.send("email="+email+"&persona="+persona+"&asunto="+asunto+"&comentario="+comentario);
}
else{
		document.getElementById('respAjaxSubConGene').innerHTML="<span style=\"color:FF0000;\">Ha dejado uno o m&aacute;s campos requeridos(*) en blanco.</span>";	
	}
}//*****

else if(url.substr(0,16)=="enviar_consmodif"){ //formulario consulta general
email=document.getElementById('consmodifemail').value;
	persona=document.getElementById('consmodifpersona').value;
		asunto=document.getElementById('consmodifasunto').value;
		try{
		  	conempre=document.getElementById('consmodifempresa').value;
		}
		catch(e){
			conempre="";
		}
			comentario=document.getElementById('consmodifcomentario').value;
document.getElementById('respAjaxSubConCons').innerHTML="<div align=\"center\"><img src=\"loading.gif\" width=\"16\" height=\"16\" align=\"middle\"/></div>";

if(email!="" && persona!="" && asunto !="" && comentario!=""){
	ocupado=true;espera();
	pagina.open("POST", url, true);
	  	   pagina.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
	  			pagina.send("email="+email+"&persona="+persona+"&asunto="+asunto+"&comentario="+comentario);
}
else{
		document.getElementById('respAjaxSubConCons').innerHTML="<span style=\"color:FF0000;\">Ha dejado uno o m&aacute;s campos requeridos(*) en blanco.</span>";	
	}
}//*****

else if(url.substr(0,11)=="enviar_ftpl"){ //formulario ftpl
var correcto,ftplAuto1,ftpltelefono;
email=document.getElementById('ftplemail').value;
	persona=document.getElementById('ftplpersona').value;
		cantidad=document.getElementById('ftplcantidad').value;
			saldo=document.getElementById('ftplsaldo').value;
				comentario=document.getElementById('ftplobservaciones').value;
					ftplAuto1=document.getElementById('ftplAutorizo1');
						ftpltelefono=document.getElementById('ftpltelefono').value;
							correcto=true;

document.getElementById('respAjaxSubConftpl').innerHTML="<div align=\"center\"><img src=\"loading.gif\" width=\"16\" height=\"16\" align=\"middle\"/></div>";
if(email!="" && persona!="" && cantidad !="" && destino!="" && saldo!=""){
if(ftplAuto1.checked)
{
	correcto=true;
}
else
{
	document.getElementById('respAjaxSubConftpl').innerHTML="Debe aceptar las condiciones antes de solicitar la numeración voz IP adicional";
	correcto=false;
}
	if(esEntero(cantidad)==false || esEntero(saldo)==false){
		document.getElementById('respAjaxSubConftpl').innerHTML="<span style=\"color:FF0000;\">Cantidad y saldo deben ser n&uacute;mericos</span>";correcto=false;
	}else if(cantidad>0 && saldo>0){
		document.getElementById('respAjaxSubConftpl').innerHTML="<div align=\"center\"><img src=\"loading.gif\" width=\"16\" height=\"16\" align=\"middle\"/></div>";
		}else{document.getElementById('respAjaxSubConftpl').innerHTML="<span style=\"color:FF0000;\">Cantidad y saldo no pueden ser 0 !</span>";correcto=false;}

if(correcto==true){
	ocupado=true;espera();
		pagina.open("POST", url, true);
			   pagina.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
					pagina.send("email="+email+"&persona="+persona+"&cantidad="+cantidad+"&telefono="+ftpltelefono+"&destino="+destino+"&saldo="+saldo+"&observaciones="+comentario);
					moveto2('SubConftpl');
	}
	}
	else{
			document.getElementById('respAjaxSubConftpl').innerHTML="<span style=\"color:FF0000;\">Ha dejado uno o m&aacute;s campos requeridos(*) en blanco.</span>";	
			correcto=false;
			if(document.getElementById('misdatosftpl').style["display"] == "none"){
				ShowHide('misdatosftpl');	
			}
		}
}//*****
else if(url.substr(0,16)=="Modificar_enviar"){
tot1=document.getElementById('canti').value;
orden=getCheckedValue(document.getElementById('orden'));
modifisend="";
	for(h=0;h<tot1-1;h++)
		{
			modifisend=modifisend+"mail"+h+"="+document.getElementById('mail'+h).value+"&cargo"+h+"="+document.getElementById('cargo'+h).value+"&nom"+h+"="+document.getElementById('nom'+h).value+"&Nmail"+h+"="+document.getElementById('Nmail'+h).value;
				if (h<tot1-1){modifisend=modifisend+"&";}
		}
modifisend=modifisend+"&canti="+tot1+"&orden="+orden;
	 ocupado=true;espera();
	 pagina.open("POST", url, true);
	 	pagina.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
			pagina.send(modifisend);
				document.getElementById(id_contenedor).innerHTML="<div align=\"center\"><img src=\"loading.gif\" width=\"16\" height=\"16\" align=\"middle\"/></div>";
}
//*******SubConPortabilidad
else if(url.substr(0,13)=="enviar_portab"){//formulario portabilidad
var CNombre,CEmail,ITelefono,CNumero,DFecha_iniport,Ccomentario,Auto1,Correcto,Ppassword,Ppassword2,Porproveedor;
CNombre=document.getElementById('prtbNombre').value;
	CEmail=document.getElementById('prtbEmail').value;
		ITelefono=document.getElementById('prtbTelefono').value;
			CNumero=document.getElementById('prtbNumero').value;		
				DFecha_iniport=document.getElementById('prtbini_port').value;
					Ccomentario=document.getElementById('prtbcomentario').value;
						Auto1=document.getElementById('pAutorizo1');
							Porproveedor=document.getElementById('prtbproveedor').value;
			
//checkboxes aceptados
if(Auto1.checked)
{
	Correcto=true;
}
else
{
	document.getElementById('respAjaxSubConPort').innerHTML="Debe aceptar las condiciones antes de solicitar la portabilidad";
	Correcto=false;
}

if(CNombre!="" && CEmail!="" && ITelefono !="" && CNumero!="" && DFecha_iniport!="" && Ccomentario!=""){
}
else{
		document.getElementById('respAjaxSubConPort').innerHTML="<span style=\"color:FF0000;\">Ha dejado uno o m&aacute;s campos requeridos(*) en blanco.</span>";	
		Correcto=false;
		if(document.getElementById('misdatosportabilidad').style["display"] == "none"){
	   		ShowHide('misdatosportabilidad');
		}
	}
	if(Correcto==true){
		ocupado=true;espera();
		pagina.open("POST", url, true);
			   pagina.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
					pagina.send("Nombre="+CNombre+"&Email="+CEmail+"&Proveedor="+Porproveedor+"&Telefono="+ITelefono+"&Numero="+CNumero+"&Fecha_iniport="+DFecha_iniport+"&Comentario="+Ccomentario);
					moveto2("SubConPortabilidad");
	}
}
else if(url.substr(0,16)=="enviar_902basico"){//formulario portabilidad
var basNombre,basEmail,basTelefono,basNumero,bascomentario,basAuto1,Correcto;
basNombre=document.getElementById('basNombre').value;
	basEmail=document.getElementById('basEmail').value;
		basTelefono=document.getElementById('basTelefono').value;
			bascomentario=document.getElementById('basobservaciones').value;
				basAuto1=document.getElementById('basAutorizo1');
					basnum1=document.getElementById('basnum1').value;
						basnum2=document.getElementById('basnum2').value;
							basnum3=document.getElementById('basnum3').value;
								basnum4=document.getElementById('basnum4').value;
//checkboxes aceptados
if(basAuto1.checked)
{
	Correcto=true;
}
else
{
	document.getElementById('respAjaxSubCon902b').innerHTML="Debe aceptar las condiciones antes de solicitar el 902 b&aacute;sico";
	Correcto=false;
}
if(basNombre!="" && basEmail!="" && basTelefono !="" && basNumero!="" && bascomentario!=""){
}
else{
		document.getElementById('respAjaxSubCon902b').innerHTML="<span style=\"color:FF0000;\">Ha dejado uno o m&aacute;s campos requeridos(*) en blanco.</span>";	
		Correcto=false;
		if(document.getElementById('misdatos902basico').style["display"] == "none"){
	   		ShowHide('misdatos902basico');
		}
	}
	if(Correcto==true){
		ocupado=true;espera();
		pagina.open("POST", url, true);
			   pagina.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
					pagina.send("basNombre="+basNombre+"&basEmail="+basEmail+"&basTelefono="+basTelefono+"&basnum1="+basnum1+"&basnum2="+basnum2+"&basnum3="+basnum3+"&basnum4="+basnum4+"&bascomentario="+bascomentario);
					moveto2('SubCon902b');
	}
}
else if(url.substr(0,6)=="correo"){
var mail1;
mail1=document.getElementById('mailsuscr').value;
if(mail1!=""){
if(checkmail(mail1,'respsuscr')!=false){
document.getElementById('respsuscr').innerHTML="<img src=\"ajax2.gif\" width=\"16\" height=\"16\" align=\"absmiddle\"/>";
pagina.open("POST", url, true);
			   pagina.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
					pagina.send("mail="+mail1);
}
}
else{
	document.getElementById('respsuscr').innerHTML="Escriba aqu&iacute; su e-mail";
}
}
//*****suscripcion

//*******SubConPanel
else if(url.substr(0,12)=="enviar_panel"){//formulario panel de control
var PNombre,PEmail,PTelefono,PNumeroini,PFecha_iniport,Pcomentario,PAuto1,PAuto2,PAuto3,Correcto,Psaldo,Ppassword,Ppassword2;
PNombre=document.getElementById('panelNombre').value;
	PEmail=document.getElementById('panelEmail').value;
		PTelefono=document.getElementById('panelTelefono').value;
			PNumeroini=document.getElementById('panelNumero').value;		
				Psaldo=document.getElementById('panelsaldo').value;
					Pcomentario=document.getElementById('panelcomentario').value;
						PAuto1=document.getElementById('panelAutorizo1');
							Correcto=true;
if(Ppassword==Ppassword2)
{	}
else
{	document.getElementById('respAjaxSubConPane').innerHTML="Las contrase&ntilde;as no coinciden";
	Correcto=false;}
if(PAuto1.checked)
{	}
else
{	document.getElementById('respAjaxSubConPane').innerHTML="Debe aceptar las condiciones antes de solicitar el Panel de Control.";
	Correcto=false;}
if(esEntero(Psaldo)==false){
		document.getElementById('respAjaxSubConPane').innerHTML="<span style=\"color:FF0000;\">Saldo debe ser n&uacute;merico.</span>";Correcto=false;
	}else if(Psaldo>0){
	}else{document.getElementById('respAjaxSubConPane').innerHTML="<span style=\"color:FF0000;\">Saldo debe ser mayor que 0.</span>";Correcto=false;}

if(PNombre!="" && PEmail!="" && PTelefono !="" && PNumeroini!="" &&Ppassword!=""){
}
else{	document.getElementById('respAjaxSubConPane').innerHTML="<span style=\"color:FF0000;\">Ha dejado uno o m&aacute;s campos requeridos(*) en blanco.</span>";	
		Correcto=false;
	if(document.getElementById('misdatospanel').style["display"] == "none"){
		ShowHide('misdatospanel');
	}
		}
	if(Correcto==true){
		ocupado=true;espera();
		pagina.open("POST", url, true);
			   pagina.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
					pagina.send("panelNombre="+PNombre+"&panelEmail="+PEmail+"&panelTelefono="+PTelefono+"&panelNumero="+PNumeroini+"&panelsaldo="+Psaldo+"&panelcomentario="+Pcomentario+"&panelPassword="+Ppassword);
					moveto2('SubConPanel');
	}
}

//*******SubConCentralita
else if(url.substr(0,12)=="enviar_centr"){//formulario Centralita
var CNombre,CEmail,CAuto1,Correcto,Centraauto1,Centraauto2,centraempresa,CAuto1,Cobs;
try {
		centraempresa=document.getElementById('centraempresa').value;
	}catch(e){centraempresa="";}
CNombre=document.getElementById('centrapersona').value;
	CEmail=document.getElementById('centraemail').value;
		Cobs=document.getElementById('centracomentario').value;
			CAuto1=document.getElementById('centraAutorizo1');
				Centraauto1=document.getElementById('centraCon1');
					Centraauto2=document.getElementById('centraCon2');
						Correcto=true;
if(CAuto1.checked && Centraauto1.checked && Centraauto2.checked )
{	}
else
{	document.getElementById('respAjaxSubConCent').innerHTML="Debe aceptar todas las condiciones antes de solicitar la Centralita virtual.";
	Correcto=false;}

if(CNombre!="" && CEmail!=""){
}
else{document.getElementById('respAjaxSubConCent').innerHTML="<span style=\"color:FF0000;\">Ha dejado uno o m&aacute;s campos requeridos(*) en blanco.</span>";	
	   Correcto=false;
	    if(document.getElementById('misdatoscentralita').style["display"] == "none"){
	   		ShowHide('misdatoscentralita');
		}
	   }
	if(Correcto==true){
		ocupado=true;espera();
		pagina.open("POST", url, true);
			   pagina.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
					pagina.send("Nombre="+CNombre+"&Email="+CEmail+"&observaciones="+Cobs);
						moveto2('SubConCentralita');
	}
}
//*********SubConPymesNetCentralita
//enviar_pymesnetcentr

else if(url.substr(0,20)=="enviar_pymesnetcentr"){//formulario PymesNetCentralita

var pymesnetCNombre,pymesnetCEmail,Correcto,pymesnetperscontacto,pymesnettelcontacto,pymesnetcentraempresa,pymesnetCAuto1,pymesnetCobs,pymesnetprefijo,pymesnetprefijociudad,pymesnetnombreciudad,pymesnetprefijoteldestino1,mensajepymesnetcentr;
try {
		pymesnetcentraempresa=document.getElementById('pymesnetcentraempresa').value;
	}catch(e){pymesnetcentraempresa="";}

pymesnetCNombre=document.getElementById('pymesnetcentrapersona').value;
pymesnetCEmail=document.getElementById('pymesnetcentraemail').value;

pymesnettelcontacto=document.getElementById('pymesnetcentratelefono').value;
pymesnetprefijo=document.getElementById('pymesnetprefijo').value;
pymesnetprefijociudad=document.getElementById('pymesnetprefijociudad').value;
pymesnetnombreciudad=document.getElementById('pymesnetnombreciudad').value;
pymesnetCobs=document.getElementById('pymesnetcentracomentario').value;
pymesnetCAuto1=document.getElementById('pymesnetcentraAutorizo1').value;
pymesnetprefijoteldestino1=document.getElementById('pymesnetprefijoteldestino1').value;
pymesnetprefijoteldestino2=document.getElementById('pymesnetprefijoteldestino2').value;
pymesnetprefijoteldestino3=document.getElementById('pymesnetprefijoteldestino3').value;
pymesnetprefijoteldestino4=document.getElementById('pymesnetprefijoteldestino4').value;
pymesnetprefijoteldestino5=document.getElementById('pymesnetprefijoteldestino5').value;
pymesnetprefijociudadteldestino1=document.getElementById('pymesnetprefijociudadteldestino1').value;
pymesnetprefijociudadteldestino2=document.getElementById('pymesnetprefijociudadteldestino2').value;
pymesnetprefijociudadteldestino3=document.getElementById('pymesnetprefijociudadteldestino3').value;
pymesnetprefijociudadteldestino4=document.getElementById('pymesnetprefijociudadteldestino4').value;
pymesnetprefijociudadteldestino5=document.getElementById('pymesnetprefijociudadteldestino5').value;
pymesnetprefijociudadteldestinonumero1=document.getElementById('pymesnetprefijociudadteldestinonumero1').value;
pymesnetprefijociudadteldestinonumero2=document.getElementById('pymesnetprefijociudadteldestinonumero2').value;
pymesnetprefijociudadteldestinonumero3=document.getElementById('pymesnetprefijociudadteldestinonumero3').value;
pymesnetprefijociudadteldestinonumero4=document.getElementById('pymesnetprefijociudadteldestinonumero4').value;
pymesnetprefijociudadteldestinonumero5=document.getElementById('pymesnetprefijociudadteldestinonumero5').value;

mensajepymesnetcentr=document.getElementById('mensajepymesnetcentr').value;


Correcto=true;
if(document.getElementById('pymesnetcentraAutorizo1').checked)
{	}
else
{
document.getElementById('respAjaxSubConPyme').innerHTML="Debe aceptar todas las condiciones antes de solicitar la Centralita virtual.";
	Correcto=false;}

if(pymesnetCNombre!=""&&pymesnetCEmail!=""&&pymesnetprefijo!=""&&pymesnetprefijociudad!=""&&pymesnetnombreciudad!=""){
}
else{document.getElementById('respAjaxSubConPyme').innerHTML="<span style=\"color:FF0000;\">Ha dejado uno o m&aacute;s campos requeridos(*) en blanco.</span>";	
	   Correcto=false;
	}
	if(Correcto==true){
		ocupado=true;espera();
		pagina.open("POST", url, true);
			   pagina.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
					pagina.send("Nombre="+pymesnetCNombre+"&Email="+pymesnetCEmail+"&pymesnetcentraempresa="+pymesnetcentraempresa+"&telcontacto="+pymesnettelcontacto+"&telcontacto="+pymesnettelcontacto+"&prefijo="+pymesnetprefijo+"&prefijociudad="+pymesnetprefijociudad+"&nombreciudad="+pymesnetnombreciudad+"&nombreciudad="+pymesnetnombreciudad+"&observaciones="+pymesnetCobs+"&pymesnetprefijoteldestino1="+pymesnetprefijoteldestino1+"&pymesnetprefijoteldestino2="+pymesnetprefijoteldestino2+"&pymesnetprefijoteldestino3="+pymesnetprefijoteldestino3+"&pymesnetprefijoteldestino4="+pymesnetprefijoteldestino4+"&pymesnetprefijoteldestino5="+pymesnetprefijoteldestino5+"&pymesnetprefijociudadteldestino1="+pymesnetprefijociudadteldestino1+"&pymesnetprefijociudadteldestino2="+pymesnetprefijociudadteldestino2+"&pymesnetprefijociudadteldestino3="+pymesnetprefijociudadteldestino3+"&pymesnetprefijociudadteldestino4="+pymesnetprefijociudadteldestino4+"&pymesnetprefijociudadteldestino5="+pymesnetprefijociudadteldestino5+"&pymesnetprefijociudadteldestinonumero1="+pymesnetprefijociudadteldestinonumero1+"&pymesnetprefijociudadteldestinonumero2="+pymesnetprefijociudadteldestinonumero2+"&pymesnetprefijociudadteldestinonumero3="+pymesnetprefijociudadteldestinonumero3+"&pymesnetprefijociudadteldestinonumero4="+pymesnetprefijociudadteldestinonumero4+"&pymesnetprefijociudadteldestinonumero5="+pymesnetprefijociudadteldestinonumero5+"&mensajepymesnetcentr="+mensajepymesnetcentr);

						moveto2('SubConPymesNetCen');
	}
}
//*******SubConFaxemail
else if(url.substr(0,10)=="enviar_fax"){
var FNombre,FEmail,FTelefono,Fcomentario,faxAutorizo1,FCorrecto,envfaxem,faxcpais,faxcciudad,faxemail1,faxemail2,faxemail3,faxemail4,faxemail5,cuentasadic;
FNombre=document.getElementById('faxNombre').value;
	FEmail=document.getElementById('faxEmail').value;
		FTelefono=document.getElementById('faxTelefono').value;
			/*faxcpais=document.getElementById('faxpais1').value;
				faxcciudad=document.getElementById('faxciudad1').value;*/
					faxemail1=document.getElementById('faxemail1').value;
						cuentasadic=document.getElementById('cuentasadic').value;
							Fcomentario=document.getElementById('faxcomentario').value;
								faxAutorizo1=document.getElementById('faxAutorizo1');
									envfaxem=getCheckedValue(document.forms['formSubConFaxe'].elements['faxemailenv']);
										FCorrecto=true;
if(faxAutorizo1.checked)
{}
else
{	document.getElementById('respAjaxSubConFaxe').innerHTML="Debe aceptar las condiciones antes de solicitar el servicio fax-email/email-fax";
	FCorrecto=false;}
if(FNombre!=""&&FEmail!=""&&FTelefono!=""&&faxcpais!=""&&faxcciudad!=""&&(faxemail1!=""||cuentasadic!="")&&envfaxem!=""){
}
else{
		document.getElementById('respAjaxSubConFaxe').innerHTML="<span style=\"color:FF0000;\">Ha dejado uno o m&aacute;s campos requeridos(*) en blanco.</span>";	
		FCorrecto=false;
		if(document.getElementById('misdatosfaxemail').style["display"] == "none"){
			ShowHide('misdatosfaxemail');
		}
	}
	if(FCorrecto==true){
	ocupado=true;espera();
		pagina.open("POST", url, true);
		   pagina.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
			  pagina.send("Persona="+FNombre+"&Email="+FEmail+"&Telefono="+FTelefono+"&comentario="+Fcomentario+"&envfaxem="+envfaxem+"&faxemail1="+faxemail1+"&cuentasadic="+cuentasadic);
			  		moveto2('SubConFaxemail');
	}
}
//******SubConddi
else if(url.substr(0,10)=="enviar_ddi"){
var dNombre,dEmail,dTelefono,dcomentario,dPersona,dCorrecto,ddipais1,ddiciudad1,dsaldo,dAuto1,ddisolicit;
dNombre=document.getElementById('ddipersona').value;
	dEmail=document.getElementById('ddiemail').value;
		dTelefono=document.getElementById('dditelefono').value;
			dPersona=document.getElementById('ddipersona').value;
				dsaldo=document.getElementById('ddisaldo').value;
				  dcomentario=document.getElementById('ddiobservaciones').value;
						ddipais1=document.getElementById('ddipais1').value;
							ddiciudad1=document.getElementById('ddiciudad1').value;
								ddicantidad=document.getElementById('ddicantidad').value;
									dsolicit=document.getElementById('ddisolicit');
										dAuto1=document.getElementById('ddiAutorizo1');
											dCorrecto=true;
											
if(dAuto1.checked)
{}
else
{
	document.getElementById('respAjaxSubConddif').innerHTML="Debe aceptar las condiciones antes de solicitar la numeración telefónica nacional / internacional";
	dCorrecto=false;
}
if(dNombre!="" && dEmail!="" && dTelefono !="" &&dsaldo!="" && ddipais1!=""&& ddiciudad1!=""&&ddicantidad!=""){
}
else{
		document.getElementById('respAjaxSubConddif').innerHTML="<span style=\"color:FF0000;\">Ha dejado uno o m&aacute;s campos requeridos(*) en blanco.</span>";	
		dCorrecto=false;
		if(document.getElementById('misdatosddi').style["display"] == "none"){
			ShowHide('misdatosddi');
		}
	}
if(esEntero(dsaldo)==false || esEntero(ddicantidad)==false){
		document.getElementById('respAjaxSubConddif').innerHTML="<span style=\"color:FF0000;\">Saldo y cantidad deben ser n&uacute;merico.</span>";
		dCorrecto=false;
}else if(ddicantidad>0 && dsaldo>0){
}else{document.getElementById('respAjaxSubConddif').innerHTML="<span style=\"color:FF0000;\">Saldo y cantidad deben debe ser mayor que 0.</span>";dCorrecto=false;}

	if(dCorrecto==true){
		ocupado=true;espera();
		pagina.open("POST", url, true);
			 pagina.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
				  pagina.send("Nombre="+dNombre+"&Email="+dEmail+"&Persona="+dPersona+"&Telefono="+dTelefono+"&saldo="+dsaldo+"&comentario="+dcomentario+"&pais="+ddipais1+"&ciudad="+ddiciudad1+"&cantidad="+ddicantidad+"&solicit="+ddisolicit);
				  	moveto2('SubConddifrm');
	}
}
else if(url.substr(0,12)=="enviar_donde")
{//formulario donde comprar
var Dondeempresa,Dondepersona,Dondeemail,Dondetelf,Dondepais,Dondeciudad,Dondemotivo,Dondecomentario,dondeacepto,doCorrecto,dprovincia,prodsolic,serv_pais,serv_ciudad,serv_altatipo,cantidadlineas,entradas;
		Dondeempresa=document.getElementById('Dondeempresa').value;
			Dondepersona=document.getElementById('Dondepersona').value;
				Dondeemail=document.getElementById('Dondeemail').value;
					Dondetelf=document.getElementById('Dondetelf').value;
						Dondepais=document.getElementById('Dondepais').value;
							Dondeciudad=document.getElementById('Dondeciudad').value;
								Dondemotivo=document.getElementById('Dondemotivo').value;
									Dondecomentario=document.getElementById('Dondecomentario').value;
										Dondecpostal=document.getElementById('Dondecpostal').value;
											dondeacepto=document.getElementById('dondeAutorizo1');
												dprovincia=document.getElementById('Dondeprovincia').value;
													prodsolic=document.getElementById('servsolhidden').value;
														doCorrecto=true;
if(dondeacepto.checked)
{}
else
{
	document.getElementById('respAjaxSubConDond').innerHTML="Debe aceptar las condiciones antes de realizar la consulta.";
	doCorrecto=false;
}
if(Dondeempresa!="" && Dondepersona!="" && Dondeemail !="" && Dondetelf!="" && Dondepais!="" && Dondeciudad!="" && Dondemotivo!="" && Dondecpostal!=""){
	if(checkmail(Dondeemail,'respAjaxSubConDond')!=false&&doCorrecto==true){
			    document.getElementById('respAjaxSubConDond').innerHTML="";
					ocupado=true;espera();
						pagina.open("POST", url, true);
	  	   				pagina.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
						//**extradata
						cantidadlineas="";entradas="";
						try
							{
								serv_pais=document.getElementById("Dondealtapais1").value;
								serv_ciudad=document.getElementById("Dondealtaciudad1").value;
								serv_altatipo=getCheckedValue(document.forms['formSubConDond'].elements['Dondealtatipo']);
							}
							
							catch(e){serv_pais="No disponible";serv_ciudad="No disponible";}
							try{
									cantidadlineas=getCheckedValue(document.forms['formSubConDond'].elements['tarifacero_Cantidadlineas']);;
									entradas=getCheckedValue(document.forms['formSubConDond'].elements['tarifacero_entradas']);;
							   }
							catch(e){cantidadlineas="No disponible";entradas="No disponible";}
							
	  						pagina.send("Dondeempresa="+Dondeempresa+"&Dondepersona="+Dondepersona+"&Dondeemail="+Dondeemail+"&Dondetelf="+Dondetelf+"&Dondepais="+Dondepais+"&Dondeciudad="+Dondeciudad+"&Dondemotivo="+Dondemotivo+"&Dondecomentario="+Dondecomentario+"&Dondecpostal="+Dondecpostal+"&Dondeprovincia="+dprovincia+"&prodsolic="+prodsolic+"&serv_pais="+serv_pais+"&serv_ciudad="+serv_ciudad+"&serv_altatipo="+serv_altatipo+"&tarifacero_Cantidadlineas="+cantidadlineas+"&tarifacero_entradas="+entradas);
								moveto2('SubConDonde');
	}
		}
		else{
			document.getElementById('respAjaxSubConDond').innerHTML="<span style=\"color:FF0000;\">Ha dejado uno o m&aacute;s campos requeridos(*) en blanco</span>";}
}
else if(url.substr(0,15)=="enviar_registro")
{//formulario registro
var empresa,direccion,nif,ciudad,provincia,cp,pais,tel,movil,fax,contacto,cargo,mail,web,actividad,motivo_contacto,observaciones,consentimiento,registroclausula;
	empresa=document.getElementById('empresa').value;
		direccion=document.getElementById('direccion').value;
			nif=document.getElementById('nif').value;
				ciudad=document.getElementById('ciudad').value;
					provincia=document.getElementById('provincia').value;
						cp=document.getElementById('cp').value;
							pais=document.getElementById('pais').value;
								tel=document.getElementById('tel').value;
									movil=document.getElementById('movil').value;
										fax=document.getElementById('fax').value;
											contacto=document.getElementById('contacto').value;
												cargo=document.getElementById('regcargo').value;
													mail=document.getElementById('mail').value;
														web=document.getElementById('web').value;
															actividad=document.getElementById('actividad').value;
																motivo_contacto=document.getElementById('motivo_contacto').value;
																	observaciones=document.getElementById('observaciones').value;
																		consentimiento=document.getElementById('consentimiento').value;		
																			registroclausula=document.getElementById('registroclausula');
if(empresa!="" && direccion!="" && nif !="" && ciudad!="" && provincia!="" && cp!="" && pais!="" && tel!="" && movil!="" && fax!="" && contacto!="" && cargo!="" && mail!="" && web!="" && actividad!="" && motivo_contacto!="" && consentimiento!=""){
	if(registroclausula.checked){
	if(checkmail(mail,'respAjaxReg')!=false){
			    document.getElementById('respAjaxReg').value="";
					ocupado=true;espera();
					pagina.open("POST", url, true);
	  	   				pagina.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
	  						pagina.send("empresa="+empresa+"&direccion="+direccion+"&nif="+nif+"&ciudad="+ciudad+"&provincia="+provincia+"&cp="+cp+"&pais="+pais+"&tel="+tel+"&movil="+movil+"&fax="+fax+"&contacto="+contacto+"&cargo="+cargo+"&mail="+mail+"&web="+web+"&actividad="+actividad+"&motivo_contacto="+motivo_contacto+"&observaciones="+observaciones+"&consentimiento="+consentimiento);
							moveto2('SubRegistro');
}
	}
	else{
			document.getElementById('respAjaxReg').innerHTML="<span style=\"color:FF0000;\">Debe leer y aceptar la cláusula de consentimiento antes de continuar con el registro.</span>";
		}
		}else{
				document.getElementById('respAjaxReg').innerHTML="<span style=\"color:FF0000;\">Ha dejado uno o m&aacute;s campos requeridos(*) en blanco</span>";
			 }
}//*****
else{ //para gets
url1=url;
	if(id_contenedor.substr(0,13)=="SubContenedor")
	{
		try{
				document.getElementById(divins+'load').innerHTML="<div align=\"center\"><img src=\"loading.gif\" width=\"16\" height=\"16\" align=\"left\"/></div>";
		   }catch(e){
		}
		try { 
				document.getElementById(divins).innerHTML = document.getElementById(divins).innerHTML+"";
			}catch(e){
				url1=url1+"&Ndiv=true";
			}
	}
				ocupado=true;espera();
					pagina.open("GET", url1, true);
						pagina.send(null);
					
//fin ajax func
}
//***
}//***fin ocupado
}
function cargarpagina(pagina, id_contenedor){
	var resperr;
	resperr=false;
if(pagina.readyState == 4 && (pagina.status == 200 || window.location.href.indexOf ("http") == - 1)){
	//************
ocupado=false;
resperr=false;
document.getElementById('loading1').innerHTML="";
clearInterval(timerespera);
contespera=0;
posespera=0;
//***************	
	if(id_contenedor.substr(0,13)=="SubContenedor")
	{
		
		try{
				document.getElementById(divins+'load').innerHTML="";
		   }catch(e){}
		     try{			
			 			document.getElementById(divins).innerHTML=document.getElementById(divins).innerHTML+"";
				}
			catch(e){
						resperr=true;	
					}
		 try{
			
			 	document.getElementById(divins).innerHTML=document.getElementById(divins).innerHTML+"";
				str_=pagina.responseText;
				
				if(str_=="&nbsp;"){str_="";}

				if(str_==""){
					
					if(close1=="true"){
						removeElement("Contenido",divins);
					}else
					{
						if(resperr!=true&&close1!="compress"&&loaded==true)
						{
						}
					}
				}
				else
				{
					if(titclic!='true'&&resperr!=true&&close1!="compress"&&loaded==true){
						if(divins=="SubRegistro"){
							moveto2(divins.substr(3,divins.length));
						}else{  moveto2(divins.substr(6,divins.length)); }
					}
						//if(actualxpand==0){document.getElementById("Conte"+divins).style.visibility="hidden";}
						
						document.getElementById(divins).innerHTML=str_;
						//compresstot();
						//iniexpand(id_contenedor);
						try
						{
							revision();
						}catch(e){}
							ini_set_form(id_contenedor);
				}
			}
			catch(e){
				str_=pagina.responseText;
				if(str_!=""){
						if(loaded==true&&close1!="compress")
						{
							if(divins!="SubConTarifas")
							{
								mustdo=true;
									/*compresstot(divins);*/ 
								mustdo=false;
							}
						}
								divst="<div id='"+divins+"' style='margin:0px;'></div>";
								document.getElementById("Contenido").innerHTML=divst+document.getElementById("Contenido").innerHTML;
								//if(actualxpand==0){document.getElementById(divins).style.visibility="hidden";}
								document.getElementById(divins).innerHTML=str_;
								//if(actualxpand==0){document.getElementById("Conte"+divins).style.visibility="hidden";}
								ini_set_form(id_contenedor);//err
							
								moveto("Top");
								//if(actualxpand==0){
								//iniexpand(id_contenedor);}
							}
					}
	}
	else
	{
		 try{
			 	document.getElementById(id_contenedor).innerHTML = pagina.responseText;
				if(url.substr(0,9)=="inisesion"){ 
				execdoinfocli();
				}
				if(url.substr(0,8)=="datoscli"){ 
				setTimeout("parplinkmissatge();",500);
				}
				if(url.substr(0,19)=="login.php?acc=salir"){
				top.location='index.php';
				}
		    }
		    		catch(e){
		    				}
	}
 }
}
}