//carga_secciones en formulario web

function carga_secciones(valor)
{  
	var secciones_ant=document.getElementById('n_secciones_ant').value*1;
	if(secciones_ant==""){
		secciones_ant=0;
	}
	/*
	if((valor*1)!=valor){
		valor=secciones_ant;
	}
	*/
	if(valor=='no') valor=0;

	document.getElementById('n_secciones_ant').value=valor;

	var xmlHttp=null;
	try
	{
		// Firefox, Opera 8.0+, Safari
		xmlHttp=new XMLHttpRequest();
	}
	catch (e)
	{
		// Internet Explorer
		try
		{
			xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
		}
		catch (e)
		{
			xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
		}
	}


	if(valor>0){
		if(valor>secciones_ant){

			var ini=(secciones_ant*1)+1;
			
			var i=ini;
			while(i<=valor){
				var sec="div_seccion"  + i;
				if(document.getElementById(sec)){
					carga_sec(i);			
					document.getElementById(sec).style.height="";
				}else{
					ini=i;
					xmlHttp.onreadystatechange=function()
					{
						if(xmlHttp.readyState==4)
						{
							if(ini==1){
								document.getElementById('div_secciones').innerHTML=xmlHttp.responseText;
							}else{
								document.getElementById('div_formu_web_secciones2').innerHTML+=xmlHttp.responseText;				
							}
							
							document.getElementById('div_secciones').className='div_formu_secc2';
							//document.getElementById('div_separa_secc').className='div_formu_web_separa';
							if(valor>5){
								var dif=valor-secciones_ant;
								//alert(dif);
								var h=document.getElementById('div_formu_web_secciones').style.height;
								var he=h.substring(0,h.length-2);
								he=(he*1)+(60*dif);
								if(he<310) he=310;
								document.getElementById('div_formu_web_secciones').style.height=he+"px";
							}

						}
					}
					carga="secciones.php";
					var unique=document.getElementById('unique_id').value;
					var url="principales/contactar_web/" + carga;
					url=url+"?ini="+ini+"&v="+valor+"&unique_id="+unique;
					url=url+"&sid="+Math.random();
					//alert(url);
					xmlHttp.open("GET",url,true);
					xmlHttp.send(null);  
					break;
				}
				i++;

			}
		}else{
			var dif=valor-secciones_ant;
			//alert(valor +"-"+ secciones_ant + "-" +dif);
			var h=document.getElementById('div_formu_web_secciones').style.height;
			var he=h.substring(0,h.length-2);
			he=(he*1)+(60*dif);
			if(he<310) he=310;
			document.getElementById('div_formu_web_secciones').style.height=he+"px";

			var i=(valor*1)+1;
			while(i<=secciones_ant){
				var sec="div_seccion"  + i;
				document.getElementById(sec).innerHTML="";
				document.getElementById(sec).style.height="1px";
				i++;
				
			}


		}
	}else{

		document.getElementById('div_secciones').innerHTML="";
		document.getElementById('div_secciones').className='div_formu_secc';
		//document.getElementById('div_separa_secc').className="";
	}


}

function carga_sec(valor)
{  
	var ini=valor;
	var xmlHttp=null;
	try
	{
		// Firefox, Opera 8.0+, Safari
		xmlHttp=new XMLHttpRequest();
	}
	catch (e)
	{
		// Internet Explorer
		try
		{
			xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
		}
		catch (e)
		{
			xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
		}
	}


	xmlHttp.onreadystatechange=function()
	{
		if(xmlHttp.readyState==4)
		{
			sec="div_seccion"  + ini;
			document.getElementById(sec).innerHTML=xmlHttp.responseText;
		}
	}

	if(valor>5){
		var h=document.getElementById('div_formu_web_secciones').style.height;
		var he=h.substring(0,h.length-2);
		he=(he*1)+60;
		if(he<310) he=310;
		document.getElementById('div_formu_web_secciones').style.height=he+"px";
	}


	carga="secciones.php";
	var unique=document.getElementById('unique_id').value;
	var url="principales/contactar_web/" + carga;
	url=url+"?ini="+ini+"&v="+valor+"&unique_id="+unique;
	url=url+"&sid="+Math.random();
	//alert(url);
	xmlHttp.open("GET",url,true);
	xmlHttp.send(null);  

}


//carga_secciones en formulario web

function carga_subseccion(valor,valor2)
{  

	var xmlHttp=null;
	try
	{
		// Firefox, Opera 8.0+, Safari
		xmlHttp=new XMLHttpRequest();
	}
	catch (e)
	{
		// Internet Explorer
		try
		{
			xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
		}
		catch (e)
		{
			xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
		}
	}


	xmlHttp.onreadystatechange=function()
	{
		if(xmlHttp.readyState==4)
		{
			var capa="div_subseccion_" + valor + "_" + valor2;
			document.getElementById(capa).innerHTML=xmlHttp.responseText;
		}
	}

	var h=document.getElementById('div_formu_web_secciones').style.height;
	var he=h.substring(0,h.length-2);
	he=(he*1)+20;
	if(he<310) he=310;
	document.getElementById('div_formu_web_secciones').style.height=he+"px";

	carga="subsecciones.php";
	var unique=document.getElementById('unique_id').value;
	var url="principales/contactar_web/" + carga;
	url=url+"?v="+valor+"&v2="+valor2+"&unique_id="+unique;
	url=url+"&sid="+Math.random();
	//alert(url);
	xmlHttp.open("GET",url,true);
	xmlHttp.send(null);  

}

function descarga_subseccion(valor,valor2)
{  

	var xmlHttp=null;
	try
	{
		// Firefox, Opera 8.0+, Safari
		xmlHttp=new XMLHttpRequest();
	}
	catch (e)
	{
		// Internet Explorer
		try
		{
			xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
		}
		catch (e)
		{
			xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
		}
	}


	xmlHttp.onreadystatechange=function()
	{
		if(xmlHttp.readyState==4)
		{
			var capa="div_subseccion_" + valor + "_" + valor2;
			document.getElementById(capa).innerHTML=xmlHttp.responseText;
		}
	}
	
	var h=document.getElementById('div_formu_web_secciones').style.height;
	var he=h.substring(0,h.length-2);
	he=(he*1)-20;
	if(he<310) he=310;
	document.getElementById('div_formu_web_secciones').style.height=he+"px";

	carga="desc_subsecciones.php";
	var unique=document.getElementById('unique_id').value;
	var url="principales/contactar_web/" + carga;
	url=url+"?v="+valor+"&v2="+valor2+"&unique_id="+unique;
	url=url+"&sid="+Math.random();
	//alert(url);
	xmlHttp.open("GET",url,true);
	xmlHttp.send(null);  

}




function carga_formu_web(valor,file)
{  
	if(valor>=1){
		var carga=file + ".php";
	}else{
		var carga="vacio.php";	
	}

	var xmlHttp=null;
	try
	{
		// Firefox, Opera 8.0+, Safari
		xmlHttp=new XMLHttpRequest();
	}
	catch (e)
	{
		// Internet Explorer
		try
		{
			xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
		}
		catch (e)
		{
			xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
		}
	}


	xmlHttp.onreadystatechange=function()
	{
		if(xmlHttp.readyState==4)
		{
			var carga="div_" + file;
			document.getElementById(carga).innerHTML=xmlHttp.responseText;
		}
	}
	var unique=document.getElementById('unique_id').value;
	var url="principales/contactar_web/" + carga;
	url=url+"?v="+valor+"&unique_id="+unique;
	url=url+"&sid="+Math.random();
	//alert(url);
	xmlHttp.open("GET",url,true);
	xmlHttp.send(null);  
}




//carga_formu_sem

function carga_formu_sem(valor)
{  
	if(valor==1){
		var carga="solo_creacion.php";
	}else{
		var carga="campana_existente.php";	
	}

	var xmlHttp=null;
	try
	{
		// Firefox, Opera 8.0+, Safari
		xmlHttp=new XMLHttpRequest();
	}
	catch (e)
	{
		// Internet Explorer
		try
		{
			xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
		}
		catch (e)
		{
			xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
		}
	}


	xmlHttp.onreadystatechange=function()
	{
		if(xmlHttp.readyState==4)
		{
			document.getElementById('carga_formu').innerHTML=xmlHttp.responseText;
		}
	}
	var unique=document.getElementById('unique_id').value;
	var url="principales/contactar_sem/" + carga;
	url=url+"?v="+valor+"&unique_id="+unique;
	url=url+"&sid="+Math.random();
	//alert(url);
	xmlHttp.open("GET",url,true);
	xmlHttp.send(null);  
}

function carga_formu_seo(valor)
{  
	if(valor==1){
		var carga="palabras_claves.php";
	}else{
		var carga="vacio.php";	
	}

	var xmlHttp=null;
	try
	{
		// Firefox, Opera 8.0+, Safari
		xmlHttp=new XMLHttpRequest();
	}
	catch (e)
	{
		// Internet Explorer
		try
		{
			xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
		}
		catch (e)
		{
			xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
		}
	}


	xmlHttp.onreadystatechange=function()
	{
		if(xmlHttp.readyState==4)
		{
			document.getElementById('carga_formu').innerHTML=xmlHttp.responseText;
		}
	}
	var unique=document.getElementById('unique_id').value;
	var url="principales/contactar_seo/" + carga;
	url=url+"?v="+valor+"&unique_id="+unique;
	url=url+"&sid="+Math.random();
	//alert(url);
	xmlHttp.open("GET",url,true);
	xmlHttp.send(null);  
}


function carga_formu_lopd(valor,capa,archivo)
{  
	if(valor==2){
		var carga=archivo + ".php";
	}else{
		var carga="vacio.php";	
	}
	var xmlHttp=null;
	try
	{
		// Firefox, Opera 8.0+, Safari
		xmlHttp=new XMLHttpRequest();
	}
	catch (e)
	{
		// Internet Explorer
		try
		{
			xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
		}
		catch (e)
		{
			xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
		}
	}


	xmlHttp.onreadystatechange=function()
	{
		if(xmlHttp.readyState==4)
		{
			//alert(carga + "--" + capa);

			document.getElementById(capa).innerHTML=xmlHttp.responseText;

			//alert(carga + "--" + capa);
		}
	}
	var unique=document.getElementById('unique_id').value;
	var url="principales/contactar_lopd/" + carga;
	url=url+"?v="+valor+"&unique_id="+unique;
	url=url+"&sid="+Math.random();
	//alert(url);
	xmlHttp.open("GET",url,true);
	xmlHttp.send(null);  
}



//carga provincias
function ajaxprovincia(valor,prov)
{  
	var xmlHttp=null;
	try
	{
		// Firefox, Opera 8.0+, Safari
		xmlHttp=new XMLHttpRequest();
	}
	catch (e)
	{
		// Internet Explorer
		try
		{
			xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
		}
		catch (e)
		{
			xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
		}
	}


	xmlHttp.onreadystatechange=function()
	{
		if(xmlHttp.readyState==4)
		{
			document.getElementById('selec_provincia').innerHTML=xmlHttp.responseText;
		}
	}
	var unique=document.getElementById('unique_id').value;
	var url="principales/selec_provincias.php";
	url=url+"?v="+valor+"&p="+prov+"&unique_id="+unique;
	url=url+"&sid="+Math.random();
	xmlHttp.open("GET",url,true);
	xmlHttp.send(null);  
}

//SELECCIÓN DE PÁGINAS WEBS
function ajaxpresuweb(valor,len)
{  
	var xmlHttp=null;
	try
	{
		// Firefox, Opera 8.0+, Safari
		xmlHttp=new XMLHttpRequest();
	}
	catch (e)
	{
		// Internet Explorer
		try
		{
			xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
		}
		catch (e)
		{
			xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
		}
	}


	xmlHttp.onreadystatechange=function()
	{
		if(xmlHttp.readyState==4)
		{
			document.getElementById('salwebs').innerHTML=xmlHttp.responseText;
		}
	}
	//var unique=document.getElementById('unique_id').value;
	var unique="";
	var url="principales/presus/selec_webs.php";
	url=url+"?v="+valor+"&len="+len+"&unique_id="+unique;
	url=url+"&sid="+Math.random();
	xmlHttp.open("GET",url,true);
	xmlHttp.send(null);  
}

//SELECCIÓN DE PLICACIONES
function ajaxpresuapli(valor,len)
{  
	var xmlHttp=null;
	try
	{
		// Firefox, Opera 8.0+, Safari
		xmlHttp=new XMLHttpRequest();
	}
	catch (e)
	{
		// Internet Explorer
		try
		{
			xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
		}
		catch (e)
		{
			xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
		}
	}


	xmlHttp.onreadystatechange=function()
	{
		if(xmlHttp.readyState==4)
		{
			document.getElementById('salapli').innerHTML=xmlHttp.responseText;
		}
	}
	//var unique=document.getElementById('unique_id').value;
	var unique="";
	var url="principales/presus/selec_apli.php";
	url=url+"?v="+valor+"&len="+len+"&unique_id="+unique;
	url=url+"&sid="+Math.random();
	xmlHttp.open("GET",url,true);
	xmlHttp.send(null);  
}

//SELECCIÓN DE EXTRAS DE DISEÑO
function ajaxpresuextdiseno(valor,len)
{  
	var xmlHttp=null;
	try
	{
		// Firefox, Opera 8.0+, Safari
		xmlHttp=new XMLHttpRequest();
	}
	catch (e)
	{
		// Internet Explorer
		try
		{
			xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
		}
		catch (e)
		{
			xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
		}
	}


	xmlHttp.onreadystatechange=function()
	{
		if(xmlHttp.readyState==4)
		{
			document.getElementById('salextdiseno').innerHTML=xmlHttp.responseText;
		}
	}
	//var unique=document.getElementById('unique_id').value;
	var unique="";
	var url="principales/presus/selec_extdiseno.php";
	url=url+"?v="+valor+"&len="+len+"&unique_id="+unique;
	url=url+"&sid="+Math.random();
	xmlHttp.open("GET",url,true);
	xmlHttp.send(null);  
}

//SELECCIÓN DE EXTRAS DE PROGRAMACIÓN
function ajaxpresuextprog(valor,len)
{  
	var xmlHttp=null;
	try
	{
		// Firefox, Opera 8.0+, Safari
		xmlHttp=new XMLHttpRequest();
	}
	catch (e)
	{
		// Internet Explorer
		try
		{
			xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
		}
		catch (e)
		{
			xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
		}
	}


	xmlHttp.onreadystatechange=function()
	{
		if(xmlHttp.readyState==4)
		{
			document.getElementById('salextprog').innerHTML=xmlHttp.responseText;
		}
	}
	//var unique=document.getElementById('unique_id').value;
	var unique="";
	var url="principales/presus/selec_extprog.php";
	url=url+"?v="+valor+"&len="+len+"&unique_id="+unique;
	url=url+"&sid="+Math.random();
	xmlHttp.open("GET",url,true);
	xmlHttp.send(null);  
}

//SELECCIÓN DE OTROS DISEÑO
function ajaxpresuotrosdis(valor,len)
{  
	var xmlHttp=null;
	try
	{
		// Firefox, Opera 8.0+, Safari
		xmlHttp=new XMLHttpRequest();
	}
	catch (e)
	{
		// Internet Explorer
		try
		{
			xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
		}
		catch (e)
		{
			xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
		}
	}


	xmlHttp.onreadystatechange=function()
	{
		if(xmlHttp.readyState==4)
		{
			document.getElementById('salotrosdis').innerHTML=xmlHttp.responseText;
		}
	}
	//var unique=document.getElementById('unique_id').value;
	var unique="";
	var url="principales/presus/selec_otrosdis.php";
	url=url+"?v="+valor+"&len="+len+"&unique_id="+unique;
	url=url+"&sid="+Math.random();
	xmlHttp.open("GET",url,true);
	xmlHttp.send(null);  
}

//SELECCIÓN DE MARKETING
function ajaxpresumarketing(valor,len)
{  
	var xmlHttp=null;
	try
	{
		// Firefox, Opera 8.0+, Safari
		xmlHttp=new XMLHttpRequest();
	}
	catch (e)
	{
		// Internet Explorer
		try
		{
			xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
		}
		catch (e)
		{
			xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
		}
	}


	xmlHttp.onreadystatechange=function()
	{
		if(xmlHttp.readyState==4)
		{
			document.getElementById('salmarketing').innerHTML=xmlHttp.responseText;
		}
	}
	//var unique=document.getElementById('unique_id').value;
	var unique="";
	var url="principales/presus/selec_marketing.php";
	url=url+"?v="+valor+"&len="+len+"&unique_id="+unique;
	url=url+"&sid="+Math.random();
	xmlHttp.open("GET",url,true);
	xmlHttp.send(null);  
}

//SELECCIÓN DE PROTECCIÓN DE DATOS
function ajaxpresuprotdatos(valor,len)
{  
	var xmlHttp=null;
	try
	{
		// Firefox, Opera 8.0+, Safari
		xmlHttp=new XMLHttpRequest();
	}
	catch (e)
	{
		// Internet Explorer
		try
		{
			xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
		}
		catch (e)
		{
			xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
		}
	}


	xmlHttp.onreadystatechange=function()
	{
		if(xmlHttp.readyState==4)
		{
			document.getElementById('salprotdatos').innerHTML=xmlHttp.responseText;
		}
	}
	//var unique=document.getElementById('unique_id').value;
	var unique="";
	var url="principales/presus/selec_protdatos.php";
	url=url+"?v="+valor+"&len="+len+"&unique_id="+unique;
	url=url+"&sid="+Math.random();
	xmlHttp.open("GET",url,true);
	xmlHttp.send(null);  
}

//SELECCIÓN DE REGISTROS DE DOMINIO
function ajaxpresuregdom(valor,len)
{  
	var xmlHttp=null;
	try
	{
		// Firefox, Opera 8.0+, Safari
		xmlHttp=new XMLHttpRequest();
	}
	catch (e)
	{
		// Internet Explorer
		try
		{
			xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
		}
		catch (e)
		{
			xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
		}
	}


	xmlHttp.onreadystatechange=function()
	{
		if(xmlHttp.readyState==4)
		{
			document.getElementById('salregdom').innerHTML=xmlHttp.responseText;
		}
	}
	//var unique=document.getElementById('unique_id').value;
	var unique="";
	var url="principales/presus/selec_regdom.php";
	url=url+"?v="+valor+"&len="+len+"&unique_id="+unique;
	url=url+"&sid="+Math.random();
	xmlHttp.open("GET",url,true);
	xmlHttp.send(null);  
}

//SELECCIÓN DE HOSTING
function ajaxpresuhosting(valor,len)
{  
	var xmlHttp=null;
	try
	{
		// Firefox, Opera 8.0+, Safari
		xmlHttp=new XMLHttpRequest();
	}
	catch (e)
	{
		// Internet Explorer
		try
		{
			xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
		}
		catch (e)
		{
			xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
		}
	}


	xmlHttp.onreadystatechange=function()
	{
		if(xmlHttp.readyState==4)
		{
			document.getElementById('salhosting').innerHTML=xmlHttp.responseText;
		}
	}
	//var unique=document.getElementById('unique_id').value;
	var unique="";
	var url="principales/presus/selec_hosting.php";
	url=url+"?v="+valor+"&len="+len+"&unique_id="+unique;
	url=url+"&sid="+Math.random();
	xmlHttp.open("GET",url,true);
	xmlHttp.send(null);  
}

