﻿    function consulta(promocion,provincia){
    closecnt();
    
    var mybody=document.getElementsByTagName("body");
    
     var divcnt = document.createElement("div");
     divcnt.id="consultaceigrup";
     divcnt.style.height="367px";
     divcnt.style.width="450px";
     divcnt.style.backgroundImage="url(http://ceigrup.es/nimagenes/consultafnd.png)";
     divcnt.style.zIndex=1000;
     divcnt.style.position="absolute";
     var myWidth = 0, myHeight = 0;
  if( typeof( window.innerWidth ) == 'number' ) {
    //Non-IE
    myWidth = window.innerWidth;
    myHeight = window.innerHeight;
  } else if( document.documentElement && ( document.documentElement.clientWidth || document.documentElement.clientHeight ) ) {
    //IE 6+ in 'standards compliant mode'
    myWidth = document.documentElement.clientWidth;
    myHeight = document.documentElement.clientHeight;
  } else if( document.body && ( document.body.clientWidth || document.body.clientHeight ) ) {
    //IE 4 compatible
    myWidth = document.body.clientWidth;
    myHeight = document.body.clientHeight;
  }
  
   
  
     divcnt.style.left=(myWidth-450)/2 +"px";
     divcnt.style.top="200";
     
    
     var divclose = document.createElement("div");
    divclose.ID="Cerrardiv";
      divclose.style.height="40"
     
      divclose.style.width="450"
      divclose.style.textAlign="left";
      
      divclose.innerHTML="<a href='javascript:closecnt()' ><img src='http://ceigrup.es/nimagenes/void.gif' border='0' width='40' height='40'></a>"
    
     
     divcnt.appendChild(divclose);
     
     
     var divclose = document.createElement("div");
      divclose.style.height="320"
      divclose.style.width="450"
      if (promocion==""){
      var drop=fgenerales.llenardropdownpob();
      divclose.innerHTML="<table><tr><td width='35' rowspan='9'><input id='param1' value='" + promocion + "' type='hidden'><input id='param2' value='" + provincia + "' type='hidden'></td></tr><tr><td colspan='2'><span id='lblcons'>Cumplimente los datos para su consulta</span></td></tr><tr><td colspan='2'><span id='lblcons'>&nbsp;</span></td></tr><tr><td width='100' align='left' class='n10'>Nombre</td><td><input type='text' id='nombre' class='txtcons'></td></tr><tr><td width='100' align='left' class='n10'>Teléfono</td><td><input type='text' id='telefono'  class='txtcons'></td></tr><tr><td width='100' align='left' class='n10'>E-mail</td><td><input type='text' id='mail' class='txtcons'></td></tr><tr><td width='100' align='left' class='n10'>Población a la que se refiere</td><td>" + drop.value + "</td></tr><tr><td width='100' align='left' class='n10'>Consulta</td><td><textarea id='consultaarea' COLS=25 ROWS=6 class='txtconsulta'></textarea></td></tr><tr><td colspan='2' height='45' valign='bottom' align='right'><a href='javascript:envcons()' class='btenvcons'>enviar >></a></td></tr></table>"
       }else{
      divclose.innerHTML="<table><tr><td width='35' rowspan='8'><input id='param1' value='" + promocion + "' type='hidden'><input id='param2' value='" + provincia + "' type='hidden'></td></tr><tr><td colspan='2'><span id='lblcons'>Consulta sobre la promoción " + promocion + " en la provincia de " + provincia +"</span></td></tr><tr><td colspan='2'><span id='lblcons'>&nbsp;</span></td></tr><tr><td width='100' align='left' class='n10'>Nombre</td><td><input type='text' id='nombre' class='txtcons'></td></tr><tr><td width='100' align='left' class='n10'>Teléfono</td><td><input type='text' id='telefono'  class='txtcons'></td></tr><tr><td width='100' align='left' class='n10'>E-mail</td><td><input type='text' id='mail' class='txtcons'></td></tr><tr><td width='100' align='left' class='n10'>Consulta</td><td><textarea id='consultaarea' COLS=25 ROWS=6 class='txtconsulta'></textarea></td></tr><tr><td colspan='2' height='45' valign='bottom' align='right'><a href='javascript:envcons()' class='btenvcons'>enviar >></a></td></tr></table>"
    }
    
     divcnt.appendChild(divclose);
     
     document.body.appendChild(divcnt);

 var buscacomunidaddiv = document.getElementById("buscacomunidad");
 if (buscacomunidaddiv){
			buscacomunidaddiv.style.display="none";
			buscacomunidaddiv.style.height="315";
			}
  window.location="#";
    }
    
    function consultainm(inmueble,provincia,abonado){
    closecnt();
    var mybody=document.getElementsByTagName("body");
     var divcnt = document.createElement("div");
     divcnt.id="consultaceigrup";
     divcnt.style.height="367px";
     divcnt.style.width="450px";
     divcnt.style.backgroundImage="url(http://ceigrup.es/nimagenes/consultafnd.png)";
     divcnt.style.zIndex=1000;
     divcnt.style.position="absolute";
      var myWidth = 0, myHeight = 0;
  if( typeof( window.innerWidth ) == 'number' ) {
    //Non-IE
    myWidth = window.innerWidth;
    myHeight = window.innerHeight;
  } else if( document.documentElement && ( document.documentElement.clientWidth || document.documentElement.clientHeight ) ) {
    //IE 6+ in 'standards compliant mode'
    myWidth = document.documentElement.clientWidth;
    myHeight = document.documentElement.clientHeight;
  } else if( document.body && ( document.body.clientWidth || document.body.clientHeight ) ) {
    //IE 4 compatible
    myWidth = document.body.clientWidth;
    myHeight = document.body.clientHeight;
  }
  
   
  
     divcnt.style.left=(myWidth-450)/2 +"px";
     divcnt.style.top="200";
     
    
     var divclose = document.createElement("div");
    divclose.ID="Cerrardiv";
      divclose.style.height="40"
     
      divclose.style.width="450"
      divclose.style.textAlign="left";
      
      divclose.innerHTML="<a href='javascript:closecnt()' ><img src='http://ceigrup.es/nimagenes/void.gif' border='0' width='40' height='40'></a>"
    
     
     divcnt.appendChild(divclose);
     
      var divclose = document.createElement("div");
      divclose.style.height="320"
      divclose.style.width="450"
      
      divclose.innerHTML="<table><tr><td width='35' rowspan='8'><input id='param1' value='" + inmueble + "' type='hidden'><input id='param2' value='" + provincia + "' type='hidden'><input id='param3' value='" + abonado + "' type='hidden'></td></tr><tr><td colspan='2'><span id='lblcons'>Consulta sobre el inmueble de referencia " + inmueble + "<br>en la provincia de " + provincia +"</span></td></tr><tr><td colspan='2'><span id='lblcons'>&nbsp;</span></td></tr><tr><td width='100' align='left' class='n10'>Nombre</td><td><input type='text' id='nombre' class='txtcons'></td></tr><tr><td width='100' align='left' class='n10'>Teléfono</td><td><input type='text' id='telefono'  class='txtcons'></td></tr><tr><td width='100' align='left' class='n10'>E-mail</td><td><input type='text' id='mail' class='txtcons'></td></tr><tr><td width='100' align='left' class='n10'>Consulta</td><td><textarea id='consultaarea' COLS=25 ROWS=6 class='txtconsulta'></textarea></td></tr><tr><td colspan='2' height='45' valign='bottom' align='right'><a href='javascript:envcons()' class='btenvcons'>enviar >></a></td></tr></table>"
      
      //divclose.innerHTML="<table><tr><td width='35' rowspan='8'><input id='param1' value='" + inmueble + "' type='hidden'><input id='param2' value='" + provincia + "' type='hidden'></td></tr><tr><td colspan='2'><span id='lblcons'>Consulta sobre el inmueble de referencia " + inmueble + "<br>en la provincia de " + provincia +"</span></td></tr><tr><td colspan='2'><span id='lblcons'>&nbsp;</span></td></tr><tr><td width='100' align='left' class='n10'>Nombre</td><td><input type='text' id='nombre' class='txtcons'></td></tr><tr><td width='100' align='left' class='n10'>Teléfono</td><td><input type='text' id='telefono'  class='txtcons'></td></tr><tr><td width='100' align='left' class='n10'>E-mail</td><td><input type='text' id='mail' class='txtcons'></td></tr><tr><td width='100' align='left' class='n10'>Consulta</td><td><textarea id='consultaarea' COLS=25 ROWS=6 class='txtconsulta'></textarea></td></tr><tr><td colspan='2' height='45' valign='bottom' align='right'><a href='javascript:envcons()' class='btenvcons'>enviar >></a></td></tr></table>"
     divcnt.appendChild(divclose);
     
     
     document.body.appendChild(divcnt);
 window.location="#";
    }
    
 function closecnt(){
 var consultacapa = document.getElementById("consultaceigrup");

 if (consultacapa){

			document.body.removeChild(consultacapa);
			}
			 
			var buscacomunidaddiv = document.getElementById("buscacomunidad");
 if (buscacomunidaddiv){
			buscacomunidaddiv.style.display="block";
			buscacomunidaddiv.style.height="315";
			}
 }
 
 function envcons(){
 //alert(document.getElementById("param1").value + " / " +  document.getElementById("param2").value+ " / " +  document.getElementById("nombre").value+ " / " +  document.getElementById("telefono").value+ " / " +  document.getElementById("mail").value+ " / " +  document.getElementById("consultaarea").value+ " / " +  document.getElementById("lblcons").innerHTML);
 if (document.getElementById("drpconspob")){
 if (document.getElementById('drpconspob').options[document.getElementById('drpconspob').selectedIndex].value=="0"){
 alert("Seleccione la población a la que se refiere la consulta");
 }else{
 fgenerales.envconsulta(document.getElementById("param1").value, document.getElementById('drpconspob').options[document.getElementById('drpconspob').selectedIndex].text,"",  document.getElementById("nombre").value,  document.getElementById("telefono").value,  document.getElementById("mail").value,  document.getElementById("consultaarea").value,  document.getElementById("lblcons").innerHTML,getServerTime_callback); 
}
}else{
fgenerales.envconsulta(document.getElementById("param1").value, document.getElementById("param2").value,document.getElementById("param3").value,  document.getElementById("nombre").value,  document.getElementById("telefono").value,  document.getElementById("mail").value,  document.getElementById("consultaarea").value,  document.getElementById("lblcons").innerHTML,getServerTime_callback); 
}
}



function getServerTime_callback(res)
{
  alert( res.value );
  if(res.value.indexOf("Rellene los campos obligatorios correctamente")==-1){
  closecnt();
  }  
}

function seltipobsq(obj){
if (obj.options[obj.selectedIndex].value!="0"){
if(obj.options[obj.selectedIndex].value=="ext"){
fgenerales.GetTipoExtbsq(devtipobsqgen);
}else{
fgenerales.cambiartipocmb(obj.options[obj.selectedIndex].text,'Tipo',devtipobsqgen);
}
}
}

function devtipobsqgen(res){
document.getElementById('spntipobsqgen').innerHTML=res.value;

}

