function morganiza(targ,selObj,restore){ //v3.0
  eval(targ+".location='"+selObj.options[selObj.selectedIndex].value+"'");
  if (restore) selObj.selectedIndex=0;
}

function MM_jumpMenu(targ,selObj,restore){ //v3.0
  eval(targ+".location='"+selObj.options[selObj.selectedIndex].value+"'");
  if (restore) selObj.selectedIndex=0;
}
var ventana 
var cont=0 
var titulopordefecto = "Vista 360" //texto por defecto a mostrar en la barra de título en caso de omitir el argumento titulo 

function afoto(cual,titulo,enl) 
{ 
if(cont==1){ventana.close();ventana=null} 
if(titulo==null){titulo=titulopordefecto} 
ventana=window.open('','ventana','width=530,height=423,resizable=yes,scrollbars=no') 
ventana.document.write('<html><head><title>' + titulo + '</title></head><body style="overflow:hidden" marginwidth="0" marginheight="0" topmargin="0" bottommargin="0" leftmargin="0" rightmargin="0" scroll="no" onUnload="opener.cont=0"><APPLET archive="../vistas/PurePlayer.jar" code="PurePlayer" width="530" height="423"><param name="panorama" value="../' + enl + '/' + cual + '" /></APPLET></body></html>') 
ventana.document.close() 
cont++ 
} 
function redimensionar(ancho,alto) 
{ 
ventana.resizeTo(ancho+12,alto+28) 
ventana.moveTo((screen.width-ancho)/2,(screen.height-alto)/2) //centra la ventana. Eliminar si no se quiere centrar el popup 
}

// Documento JavaScript
// Esta función cargará las paginas
function llamarasincrono (url, id_contenedor)
{    
var pagina_requerida = false;    
if (window.XMLHttpRequest)  {        
// Si es Mozilla, Safari etc 
pagina_requerida = new XMLHttpRequest ();    
} else if (window.ActiveXObject) {        
// pero si es IE 
try { 
pagina_requerida = new ActiveXObject ("Msxml2.XMLHTTP");
}
catch (e)
{            
// en caso que sea una versión antigua
try { 
pagina_requerida = new ActiveXObject ("Microsoft.XMLHTTP");
}
catch (e)
{
}
}
} else
return false;
pagina_requerida.onreadystatechange = function ()
{        
// función de respuesta
cargarpagina (pagina_requerida, id_contenedor);
}
pagina_requerida.open ('GET', url, true); 
// asignamos los métodos open y send
pagina_requerida.send (null);
}
// todo es correcto y ha llegado el momento de poner la información requerida
// en su sitio en la paginaxhtml
function cargarpagina (pagina_requerida, id_contenedor)
{
if (pagina_requerida.readyState==1) {
document.getElementById (id_contenedor).innerHTML="<img src='img/spinner.gif' /><br />Cargando.......";
}
else if (pagina_requerida.readyState == 4 && (pagina_requerida.status == 200 || window.location.href.indexOf ("http") == - 1))    document.getElementById (id_contenedor).innerHTML = pagina_requerida.responseText;}


function nuevoAjax(){
   var xmlhttp=false;
   try {
      xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
   } catch (e) {
      try {
        xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
      } catch (E) {
        xmlhttp = false;
      }
   }

   if (!xmlhttp && typeof XMLHttpRequest!='undefined') {
      xmlhttp = new XMLHttpRequest();
   }
   return xmlhttp;
}

function creaAjax(){
  var objetoAjax=false;
  try {
   /*Para navegadores distintos a internet explorer*/
   objetoAjax = new ActiveXObject("Msxml2.XMLHTTP");
  } catch (e) {
   try {
     /*Para explorer*/
     objetoAjax = new ActiveXObject("Microsoft.XMLHTTP");
     } 
     catch (E) {
     objetoAjax = false;
   }
  }

  if (!objetoAjax && typeof XMLHttpRequest!='undefined') {
   objetoAjax = new XMLHttpRequest();
  }
  return objetoAjax;
}

function PFAjax (url,capa,valores,metodo)
{
   var ajax=creaAjax();
   var capaContenedora = document.getElementById(capa);

/*Creamos y ejecutamos la instancia si el metodo elegido es POST*/
 if(metodo.toUpperCase()=='POST'){
    ajax.open ('POST', url, true);
    ajax.onreadystatechange = function() {
         if (ajax.readyState==1) {
                 capaContenedora.innerHTML="<div style='float:left; display:inline; font-family:Tahoma; margin:4px 0 0 2px; color:#8A8A8A; font-size:11px;'><img src='http://www.casasychaletsdelujo.com/img/spinner-pq.gif' align='absmiddle' /> Cargando.......</div>";
         }
         else if (ajax.readyState==4){
            if(ajax.status==200)
            {
                 document.getElementById(capa).innerHTML=ajax.responseText; 
            }
            else if(ajax.status==404)
                 {

                     capaContenedora.innerHTML = "La direccion existe";
                 }
             else
                 {
                     capaContenedora.innerHTML = "Error: ".ajax.status;
                 }
        }
    }
    ajax.setRequestHeader('Content-Type','application/x-www-form-urlencoded');
    ajax.send(valores);
    return;
}
/*Creamos y ejecutamos la instancia si el metodo elegido es GET*/
if (metodo.toUpperCase()=='GET'){

    ajax.open ('GET', url, true);
    ajax.onreadystatechange = function() {
         if (ajax.readyState==1) {
                 capaContenedora.innerHTML="<span style='font-family:Tahoma; color:#8A8A8A; font-size:8pt;'>Procesando.......</span>";
         }
         else if (ajax.readyState==4){
            if(ajax.status==200){ 
                 document.getElementById(capa).innerHTML=ajax.responseText; 
            }
            else if(ajax.status==404)
                 {

                     capaContenedora.innerHTML = "La direccion existe";
                 }
                 else
                 {
                     capaContenedora.innerHTML = "Error: ".ajax.status;
                 }
        }
    }
    ajax.setRequestHeader('Content-Type','application/x-www-form-urlencoded');
    ajax.send(null);
    return
}
}


function solicitar(){
   var t1, t2, t3, contenedor;
   contenedor = document.getElementById('solicitar');
   t1 = document.getElementById('nombreform').value;
   t2 = document.getElementById('mailform').value;
   t3 = document.getElementById('idform').value;


   ajax=nuevoAjax();
   ajax.open("POST", "modulos/solicitar.php",true);
   ajax.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
   ajax.send("nombre="+t1+"&correo="+t2+"&id="+t3);
   ajax.onreadystatechange=function() {
	  if (ajax.readyState==1) {
         contenedor.innerHTML="<img src='img/spinner.gif' /><br />Enviando.......";
      }
      if (ajax.readyState==4) {
         contenedor.innerHTML = ajax.responseText
      }
   }
}

function valconsulta(form){

if (document.getElementById( 'Nombre' ).value == "")
{ alert("Debe proporcionarnos su Nombre"); document.getElementById( 'Nombre' ).focus(); return 0; }

if (document.getElementById( 'email' ).value == "")
{ alert("Debe especificar un correo de contacto"); document.getElementById( 'email' ).focus(); return 0; }

if (document.getElementById( 'Telefono' ).value == "")
{ alert("Debe proporcionarnos su numero de Telefono"); document.getElementById( 'Telefono' ).focus(); return 0; }

if (document.getElementById( 'Privacidad' ).checked == false)
{ alert("Debe aceptar la politica de privacidad"); document.getElementById( 'Privacidad' ).focus(); return 0; }

document.getElementById( 'fconsulta' ).submit();
}

function micasa() {

if (document.getElementById( 'Nombre' ).value == "")
{ alert("Debe proporcionarnos su Nombre"); document.getElementById( 'Nombre' ).focus(); return false; }

if (document.getElementById( 'Telefono' ).value == "")
{ alert("Debe proporcionarnos su numero de Telefono"); document.getElementById( 'Telefono' ).focus(); return false; }


if (document.getElementById( 'Privacidad' ).checked == false)
{ alert("Debe aceptar la politica de privacidad"); document.getElementById( 'Privacidad' ).focus(); return false; }

document.getElementById('fcontacto').submit();
}