
function abrir(direccion, pantallacompleta, herramientas, direcciones, estado, barramenu, barrascroll, cambiatamano, ancho, alto, izquierda, arriba, sustituir){ 
     var opciones = "fullscreen=" + pantallacompleta + 
                 ",toolbar=" + herramientas + 
                 ",location=" + direcciones + 
                 ",status=" + estado + 
                 ",menubar=" + barramenu + 
                 ",scrollbars=" + barrascroll + 
                 ",resizable=" + cambiatamano + 
                 ",width=" + ancho + 
                 ",height=" + alto + 
                 ",left=" + izquierda + 
                 ",top=" + arriba; 
     var ventana = window.open(direccion,"lafabricadelasmarcas",opciones,sustituir); 

}  

function Delete_miles(numero_puntos){
	
		//alert("En Delete_miles");
		
    		var num_p;
    		num_p = numero_puntos;
    		//alert("Valor de num_p :" + num_p);
    
    		longitud = 0;
    		longitud = num_p.length;
    		//alert("Longitud de la cifra :" + longitud);
    		n = 0;
    
    		var num_sp = "";
    
    		while (n<longitud){
        
        		//alert ("Dentro del while");
        		var car = ' ';
        		var car = num_p.charAt(n);
        		//alert("Carácter recogido :" + car);
        		if (car != '.')
            			num_sp += num_p.charAt(n);
        		n++;
        
    		}
    		//alert("num_sp :" + num_sp);
    
    		var sin_puntos = parseInt(num_sp,10);
    
    		//alert("Valor que devuelve Delete_miles :" + sin_puntos);
    		return sin_puntos;
	}
	
function PonPuntos(obj, sign, imaxlength)
{

   //comprueba que el length no supere el maximo para esa caja de texto	  	
   
   var snumero;
   snumero = obj.value + 1; 
 
  if (snumero.length > imaxlength)
   {  
     event.returnValue = false;
     return false;  
   }
 
	
  //no dejar que ponga cero al principio de teclear el campo
  
  if ((obj.value=="") && (event.keyCode == 48)) {
     event.returnValue = false;
  }
  else
  if (sign == "positive")
  {
    if ((event.keyCode < 48) || (event.keyCode > 57))
    {
      event.returnValue = false;
    }
    else 
    {
      var s_pre = obj.value;
      var s_inter = "";
      var s_post = "";
      var single_character = "";
      var poner_punto = 1;

      for (var i = 0; i < s_pre.length; i++)
      {
        single_character = s_pre.substring(i,i+1);
        if (single_character != ".")
        {
          s_inter = s_inter + single_character;
        }
      }

      s_inter = s_inter + String.fromCharCode(event.keyCode);

      for (var j = s_inter.length; j > 0; j--, poner_punto++)
      {
        s_post = s_inter.substring(j-1,j) + s_post;

        if ((poner_punto == 3) && (j != 1))
        {
          poner_punto = 0;
          s_post = "." + s_post;
        }
      }

      obj.value = s_post;

      event.returnValue = false;
    }
  }
  else
  {
    if (
         (
           isEmpty(obj.value)
             &&
           ((event.keyCode < 48) || (event.keyCode > 57))
             &&
           (event.keyCode != 43)
             &&
           (event.keyCode != 45)
         )
           ||
         (
           (obj.value.length > 0)
             &&
           ((event.keyCode < 48) || (event.keyCode > 57))
         )
       )
    {
      event.returnValue = false;
    }
    else if (obj.value != "+" && obj.value != "-")
    {
      var s_pre = obj.value;
      var s_inter = "";
      var s_post = "";
      var single_character = "";
      var poner_punto = 1;
      var sign_character = "";

      if (
           (s_pre.substring(0, 1) == "+")
             ||
           (s_pre.substring(0, 1) == "-")
         )
      {
        sign_character = s_pre.substring(0, 1);
        s_pre = s_pre.substring(1, s_pre.length);
      }

      for (var i = 0; i < s_pre.length; i++)
      {
        single_character = s_pre.substring(i,i+1);

        if (single_character != ".")
        {
          s_inter = s_inter + single_character;
        }
      }

      s_inter = s_inter + String.fromCharCode(event.keyCode);

      for (var j = s_inter.length; j > 0; j--, poner_punto++)
      {
        s_post = s_inter.substring(j-1,j) + s_post;

        if ((poner_punto == 3) && (j != 1))
        {
          poner_punto = 0;
          s_post = "." + s_post;
        }
      }

      obj.value = sign_character + s_post;

      event.returnValue = false;
    }
  }
}
   
function Formato_numero(numero){

	var nombre = "";

	//alert("En Formato_numero, Nombre recibido :" + name);
		var num = numero;
	//alert("Numero recibido :" + num);
	
	if (num != ""){
	
	//alert ("Entra en num !=");
	
		var str = "";


		while (num > 999){
	
			n1 = Math.floor(num/1000);
			n2 = num - 1000 * n1;
			
			if (n2 < 10){
			   n2 = "00" + n2;
	        	}   
			else{
			   if (n2 < 100)
	       		      n2 = "0" + n2;
	                }
			str = "." + n2 + str;
			num = n1;
	
		}
		str = num + str;
		//return (str);
	}
	return (str);
}

 
function esNumero(temp){
        cadenaInput=""+temp;
        if (cadenaInput=="NaN"){
                return false;
        }
        for ( var j=0 ; j <= cadenaInput.length-1 ; j++ ){
                var caracter=cadenaInput.charAt(j);
                if (caracter <"0" || caracter >"9"){
                        if (caracter!="."){
                                return false;
                        }
                }
        }
        return true;
}

function entreLimites(inf,sup,temp,cadena){
        resultado=true
        if(temp.value=="") {
                temp.value = 0
        }
        cantidad=quitaMillares(temp.value);
        if (esNumero(cantidad)){
                if (cantidad < inf || cantidad > sup){
                        alert("Por favor, introduzca un valor comprendido entre "+formatoMoneda(inf,".")+" y "+formatoMoneda(sup,".")+cadena);
                        temp.value="";
                        resultado=false;
                }
        } else {
                alert("Por favor, introduzca un numero.");
                temp.value="";
                resultado=false;
        }
        return resultado;
}
function calculaPrestamo(temp){
        if (validas == 1) {
        temp.formCapital.value=quitaMillares(temp.formCapital.value);
        var capital=temp.formCapital.value;
        var tiempo=temp.formTiempo.value;
        var interes=temp.formInteres.value/1200;
        factor=Math.pow((1+interes),tiempo)
        cuota=capital * ( (factor*interes) / (factor-1) );
        temp.formCapital.value=formatoMoneda(temp.formCapital.value);
        temp.formTiempo.value=formatoMoneda(temp.formTiempo.value);
        
        if("NaN"==""+cuota || "Infinity"==""+cuota){
                cuota=0;
        }
        temp.formResultado.value=formatoMoneda(Math.round(cuota));
        }
        else{
        temp.formResultado.value=""
        }
}
function compruebaEntradas(temp){
        
        validas=1;
        if(!esNumero(quitaMillares(temp.formCapital.value))){
                alert("Por favor, introduzca un n&uacute;mero.");
                temp.formCapital.value="";
                validas=0;
        }
        if(!entreLimites(1000000,30000000,temp.formCapital,' de pesetas.')){
                validas=0;
        }
        if(!entreLimites(1,300,temp.formTiempo,' meses.')){
                validas=0;
        }
}
function ponInteres(temp){
        var inte=0;
        if (temp.Rmeses[0].checked){
                inte=3.75;
        }
        if (temp.Rmeses[1].checked){
                inte=4.25;
        }
        if (temp.Rmeses[2].checked){
                inte=6.;
        }
        temp.formInteres.value=inte;
}
function ponInteres2(temp){
        var t_inte=0;
        if (temp.periodo_inicial.options[0].selected == true){
                t_inte=3.75;
        }
        if (temp.periodo_inicial.options[1].selected == true){
                t_inte=4.25;
        }
        if (temp.periodo_inicial.options[2].selected == true){
                t_inte=6.;
        }
        temp.formInteres.value=t_inte;
}
var elem=new Array(6,9,11,12,13,17,19)
var campos=new Array("Importe a financiar","Plazo","Apellidos","Nombre","D.N.I.","E-mail","Teléfono")
function obligatorios(){
        var cont=0
        //document.forms['PrestamoPersonal'].action="http://www.ctv.es/cgi-bin/CLIENTES/mailtocli2.cgi?ptm@ctv.es,Prestamo_Personal,http://www.cisa.es/catresp.htm.htm"
        var paso=true
        for (var i=0;i<elem.length;i++){
        cont+=1 
                if(document.forms['PrestamoPersonal'].elements[elem[i]].value==""){
					alert("Debe rellenar el campo \""+campos[i]+"\"")
					document.forms['PrestamoPersonal'].elements[elem[i]].focus()
					paso=false
					break
                }
        }
        if (paso) document.forms['PrestamoPersonal'].submit()
}

var datos = new Array(4)
var nomdatos =new Array("Capital inicial","Tipo de interés","Plazo de amortización","Mensualidad")
var capitemp=0
var intetemp=0
var plazotemp=0
var mensutemp=0

function borradato(num){
	document.forms[0].elements[num].value=""
}

function compruebadatos(){

sigo = true
if (!(document.getElementById('c').value == "")){
document.getElementById('c').value = Delete_miles(document.getElementById('c').value);}
if (!(document.getElementById('m').value == "")){
document.getElementById('m').value = Delete_miles(document.getElementById('m').value);}
if (document.forms[0].elements[0].value < document.forms[0].elements[3].value && !(document.forms[0].elements[0].value == ""))
{
	alert ("La cuota no puede ser mayor que el importe inicial!");
	document.forms[0].elements[3].focus();
	return;
}
if (document.forms[0].elements[1].value < 0){
				alert ("No introduzca intereses negativos");
				//document.forms[0].elements[1].value = "";
				document.getElementById('c').value = Formato_numero(document.getElementById('c').value);
				document.forms[0].elements[1].focus();
				return; }
if (document.forms[0].elements[2].value < 0){
				alert ("No introduzca años negativos");
				//document.forms[0].elements[1].value = "";
				document.getElementById('c').value = Formato_numero(document.getElementById('c').value);
				document.forms[0].elements[2].focus();
				return; }
  if (document.forms[0].elements[2].value > 50)
  {
	alert("Consulte con su banco para operaciones de más de 50 Años");
	//document.forms[0].elements[1].value = "";
    document.forms[0].elements[2].value = ""; 
    document.getElementById('c').value = Formato_numero(document.getElementById('c').value);
    document.forms[0].elements[2].focus();
	return;
  }

  if (document.forms[0].elements[1].value > 20)
  {
	alert("El interés máximo es 20%!");
    if (!(document.getElementById('c').value == "")) {
    document.getElementById('c').value = Formato_numero(document.getElementById('c').value);}
    if (!(document.getElementById('m').value == "")) {
    document.getElementById('m').value = Formato_numero(document.getElementById('m').value);}
    
    document.forms[0].elements[1].focus();
	return;
  }
	for (i=0;i<4;i++){
	
		if (isNaN(document.forms[0].elements[i].value)){
			sigo=false
			alert("El dato introducido en "+nomdatos[i]+" no es un número");
			if (!(document.forms[0].elements[0].value == "")){
			document.forms[0].elements[0].value = Formato_numero(document.forms[0].elements[0].value);}
			if (!(document.forms[0].elements[3].value == "")){
			document.forms[0].elements[3].value = Formato_numero(document.forms[0].elements[3].value);}
			document.forms[0].elements[i].focus();
			break
		}
	}
	if (sigo){
		if (!(document.getElementById('p').value == "")) {
		document.getElementById('p').value = parseInt(document.getElementById('p').value) * 12;}
		calculaprestamo()
	}
if (!(document.getElementById('c').value == "") && !(document.getElementById('m').value == "")){
document.getElementById('c').value = Formato_numero(document.getElementById('c').value);
document.getElementById('m').value = Formato_numero(document.getElementById('m').value);}
}


function calculaprestamo(){
var suma=0
correcto=true
	for (i=0;i<4;i++){
		datos[i]=document.forms[0].elements[i].value
		if (datos[i]!=""){
			suma+=1
		}
	}
	if (suma==4){
		correcto=false
		document.getElementById('p').value = parseInt(document.getElementById('p').value) / 12;
		alert("Es necesario que deje uno de los datos vacio")
	}else{
		if (suma<3){
			correcto=false
			document.getElementById('p').value = parseInt(document.getElementById('p').value) / 12;
			document.forms[0].elements[2].value = ""; 
			alert("Es necesario que introduzca tres datos")
			for (h=0;h<3;h++){
			if (!(document.getElementById('h').value == "")){
				document.getElementById('h').value = Formato_numero(document.getElementById('h').value);}
			}
		}
	}
	if (correcto){
		if (datos[1]==""){
			mtemp=datos[0]/datos[2]
			if (datos[3]<mtemp){
				correcto=false
				alert("Ha introducido una combinación no válida de capital, plazo y mensualidad")
			}else{
				calculainteres()
			}
		}
		if (datos[0]==""){
			id=datos[1]/1200

			//******************Operación espejo***********************
			if (plazotemp==datos[2] && intetemp==id && parseInt(mensutemp)==datos[3]){
				res=mensutemp/((Math.pow(1+intetemp,plazotemp)*intetemp)/(Math.pow(1+intetemp,plazotemp)-1))
			}else{
				res=datos[3]/((Math.pow(1+id,datos[2])*id)/(Math.pow(1+id,datos[2])-1))
			}
			res=parseInt(res)
			
			document.forms[0].elements[0].value=res
			document.getElementById('p').value = parseInt(document.getElementById('p').value) / 12;
		}
		if (datos[2]==""){
			id=datos[1]/1200
			//res=-Math.log((datos[0]*i/datos[3])-1)/Math.log(1+id)
			dividendo1=Math.log(datos[3])
			suma1=(-datos[0]*id)
			
			suma2=datos[3]
			
			sumando=parseFloat(suma1)+parseFloat(suma2)
			
			dividendo2=Math.log(sumando)
			//alert("Dividiendo..:" + dividendo2 + "Sumando..:" + sumando);

			divisor=Math.log(1+id)
			
			res=(dividendo1-dividendo2)/divisor

			res=Math.ceil(res)
			
			document.forms[0].elements[2].value=res
			if ((res /12) > 35 || isNaN(res)) {
				alert("El Banco de España no autoriza amortizaciones de mas de 35 años");
				//document.forms[0].elements[1].value = "";
				document.forms[0].elements[2].value = "";
				document.getElementById('c').value = Formato_numero(document.getElementById('c').value);
				document.forms[0].elements[2].focus(); 
				return;
			}

			//**********Modificamos el capital inicial******************
			cinicial=datos[3]/((Math.pow(1+id,res)*id)/(Math.pow(1+id,res)-1))
			if (document.forms[0].elements[0].value!=parseInt(cinicial)){ 
				document.forms[0].elements[0].value=parseInt(cinicial)
				//document.getElementById('p').value = Math.round(parseInt(document.getElementById('p').value) / 12);
				alert("Se ha modificado el Capital inicial para que sea \ncoherente con el resultado del plazo en valores enteros")
			}		
		document.getElementById('p').value = Math.round(parseInt(document.getElementById('p').value) / 12);
		}
		if (datos[3]==""){
			id=datos[1]/1200
			//res=datos[0]/((1-Math.pow(1+id,2)-datos[2])/id)
			res=datos[0]*((Math.pow(1+id,datos[2])*id)/(Math.pow(1+id,datos[2])-1))
			intetemp=id
			capinitemp=datos[0]
			plazotemp=datos[2]
			mensutemp=res
			dato=res+""
			indi=dato.indexOf(".")
			if (dato!=-1){
				
				deci=dato.substring(indi+1,indi+3)
				
				if (parseInt(deci)>=50){
					document.forms[0].elements[3].value=Math.ceil(res)
				}else{
					document.forms[0].elements[3].value=parseInt(res)
				}
			}else{
				res=parseInt(res)
				document.forms[0].elements[3].value=res
			}				document.getElementById('p').value = parseInt(document.getElementById('p').value) / 12;

		}
	}
	
}

function calculainteres(){
	inter=4.50
	
	//******************Operación espejo***********************************
			if (plazotemp==datos[2] && capinitemp==datos[0] && parseInt(mensutemp)==datos[3]){
				d3=mensutemp
				d2=plazotemp
				d0=capinitemp
			}else{
		
				d0=datos[0]
				d3=datos[3]
				d2=datos[2]
			}
	//**********************************************************************
	do{
	id=inter/1200
	res=d0*((Math.pow(1+id,d2)*id)/(Math.pow(1+id,d2)-1))
	if (parseInt(res)>d3){
			inter=inter-0.01
	}
	if (parseInt(res)<d3){
			inter= inter+0.01
	}
	
	comparo=(parseInt(d3))+parseInt(31)
	
	comparo1=(parseInt(d3))-parseInt(31)
	//alert(comparo1)
	//alert("paso="+parseInt(res)<parseInt(comparo) && parseInt(res)>parseInt(comparo1))
	

	}
	while (parseInt(res)>parseInt(comparo) || parseInt(res)<parseInt(comparo1))
	inter=inter*100
	inter=parseInt(inter)
	inter=inter/100
	document.forms[0].elements[1].value=inter
	//**********Modificamos el capital inicial******************
			id=inter/1200
			cinicial=datos[3]/((Math.pow(1+id,datos[2])*id)/(Math.pow(1+id,datos[2])-1))
			if (document.forms[0].elements[0].value!=parseInt(cinicial)){ 
				document.forms[0].elements[0].value=parseInt(cinicial)
				//document.getElementById('p').value = parseInt(document.getElementById('p').value) / 12;
				alert("Se ha modificado el Capital inicial para que sea \ncoherente con el redondeo aplicado al resultado")
			}
	document.getElementById('p').value = parseInt(document.getElementById('p').value) / 12;
	capinitemp=0
	plazotemp=0
	
}

//-->

	function cerrar() {
		//alert ("se va cerrar");
		window.close();
	}

function borrar(obj) {
	obj.value = "";
}


function pts() {
	if (!(document.forms[0].c.value == "")){
	var valor_actual;
	var res;

		valor1=Delete_miles(document.forms[0].c.value);

	valor_actual = valor1 * 166.386;
	document.forms[0].c.value = Math.round(valor_actual);
	document.forms[0].c.value = Formato_numero(document.forms[0].c.value);
	alert ("El valor en pesetas se reajusto!");
	valor_actual = 0;
	}
}

function euro() {

	
	if (!(document.forms[0].c.value == "")){
	var valor_actual;
	var res;

		valor1=Delete_miles(document.forms[0].c.value);

	valor_actual = valor1 / 166.386;
	document.forms[0].c.value = Math.round(valor_actual);
	document.forms[0].c.value = Formato_numero(document.forms[0].c.value);
	}
}


function comprobar2(){

if (document.getElementById('nombre').value=='')
{
	alert('Debe escribir el nombre');
	document.getElementById('nombre').focus();
	return false;
}


if (document.getElementById('telefono').value==""){
		alert("El telefono debe ser valido");
		document.getElementById('telefono').focus();
		return false;
		
	}else{
	
	var telf;
	
	telf=document.getElementById('telefono').value;
	
	if (isNaN(telf)){
		alert("El telefono debe ser valido");
		document.getElementById('telefono').focus();
		return false;
	}
	
	if (telf.length!=9){
		alert("El telefono debe ser valido");
		document.getElementById('telefono').focus();
		return false;
	}

	if (telf.substr(0,1)!=9){
		valido=false;
			if (telf.substr(0,1)!=6){
			valido=false;
	        if (telf.substr(0,1)!=8){
			valido=false;	
			}else{
			valido=true;			
			}
			}else{
			valido=true;			
			}	

	}else{
	valido=true;
	}	


	if (valido==false){
		alert("El telefono debe ser valido");
		document.getElementById('telefono').focus();
		return false;
	
	}
	
	}
if (document.getElementById('email').value==""){
		alert("El email debe ser valido");
	document.getElementById('email').focus();
	return false;
	}else{

	var email = document.getElementById('email').value;
	var pos = email.indexOf("@");	
	var punto = email.indexOf(".");

	
	if (pos<=1){
		alert("El email debe ser valido");
	document.getElementById('email').focus();
	return false;
	
	}
	
	
	
	}
	

if (document.getElementById('consulta').value=='')
{
		alert("Debe escribir su consulta");
	document.getElementById('consulta').focus();
	return false;
}


document.getElementById('formulari').submit();

}


function eliminar_img(ids){

if (confirm('esta seguro de que desea eliminar la imagen seleccionada?')){

document.getElementById(ids).value="";

	for (a=1;a<=8;a++){
	
	siguiente = a+1;
	if (siguiente>=8){
	siguiente = 8;
	}
	
	
	if (document.getElementById('imagen'+a).value=='' && document.getElementById('imagen'+siguiente).value!=''){
		
			document.getElementById('imagen'+a).value=document.getElementById('imagen'+siguiente).value;
			document.getElementById('imagen'+siguiente).value='';
			
		}

	

	if (a==8){
		act_zonas();
	}

}



}

}
function act_zonas(){
	

		

			document.getElementById('formulari').action="venderoalquilar.asp";			
			document.getElementById('formulari').submit();
			

	
	}
	
function act_zonas3(){
	

		

			document.getElementById('formulari').action="buscamos.asp";			
			document.getElementById('formulari').submit();
			

	
	}
	
function activar(obj)
{
if (document.getElementById(obj).className=='activo'){
document.getElementById(obj).className='oculto';

}else{
document.getElementById(obj).className='activo';
	
	}

}

/*
Simple Image Trail script- By JavaScriptKit.com
Visit http://www.javascriptkit.com for this script and more
This notice must stay intact
*/ 

var w=1
var h=1

if (document.getElementById || document.all)
document.write('<div id="trailimageid" style="position:absolute;visibility:hidden;left:0px;top:-1000px;width:1px;height:1px;border:1px solid #888888;background:#DDDDDD;"><img id="ttimg" src="img/s.gif" style="width:320px;" /></div>')

function gettrailobj()
{
	if (document.getElementById) return document.getElementById("trailimageid").style
	else if (document.all) return document.all.trailimagid.style
}

function truebody()
{
	return (!window.opera && document.compatMode && document.compatMode!="BackCompat")? document.documentElement : document.body
}

function hidetrail()
{
	document.onmousemove=""
	document.getElementById('ttimg').src='/img/s.gif'
	gettrailobj().visibility="hidden"
	gettrailobj().left=-1000
	gettrailobj().top=0
}


function showtrail(width,height,file)
{
	if(navigator.userAgent.toLowerCase().indexOf('opera') == -1)
	{
		w=width
		h=height
		
		// followmouse()
	
		document.getElementById('ttimg').src=file
		document.onmousemove=followmouse
		gettrailobj().visibility="visible"
		gettrailobj().width=w+"px"
		gettrailobj().height=h+"px"


	}
}


function followmouse(e)
{

	if(navigator.userAgent.toLowerCase().indexOf('opera') == -1)
	{

		var xcoord=20
		var ycoord=20

		if (typeof e != "undefined")
		{
			xcoord+=e.pageX
			ycoord+=e.pageY
		}
		else if (typeof window.event !="undefined")
		{
			xcoord+=truebody().scrollLeft+event.clientX
			ycoord+=truebody().scrollTop+event.clientY
		}

		var docwidth=document.all? truebody().scrollLeft+truebody().clientWidth : pageXOffset+window.innerWidth-15
		var docheight=document.all? Math.max(truebody().scrollHeight, truebody().clientHeight) : Math.max(document.body.offsetHeight, window.innerHeight)

		if (xcoord+w+3>docwidth)
		xcoord=xcoord-w-(20*2)

		if (ycoord-truebody().scrollTop+h>truebody().clientHeight)
		ycoord=ycoord-h-20;

		gettrailobj().left=xcoord+"px"
		gettrailobj().top=ycoord+"px"

	}

}

function filtra(){

var tipo;
var zona;
var modo;
var habitaciones;
var rango;
var hasta;
var linka;





hasta = document.getElementById('hasta').value;


tipo = document.getElementById('tipo').value;



zona= document.getElementById('zona').value;



modo= document.getElementById('modo').value;


habitaciones = document.getElementById('habitaciones').value;


rango=document.getElementById('rango').value;	


linka= 'modo='+modo+'&tipo='+tipo+'&zona='+zona+'&habitaciones='+habitaciones+'&hasta='+hasta+'&rango='+rango;


processajax('contenido','listado.asp?'+linka);
}



function filtra_playa(){

var tipo;
var zona;
var modo;
var habitaciones;
var rango;
var hasta;
var linka;





hasta = document.getElementById('hasta').value;


tipo = document.getElementById('tipo').value;



zona= document.getElementById('zona').value;



modo= document.getElementById('modo').value;


habitaciones = document.getElementById('habitaciones').value;


rango=document.getElementById('rango').value;	


linka= 'modo='+modo+'&tipo='+tipo+'&zona='+zona+'&habitaciones='+habitaciones+'&hasta='+hasta+'&rango='+rango;


processajax('contenido','playas.asp?'+linka);
}



function cambia(ima)
{
	document.getElementById('img_principal').src=document.getElementById(ima).src;
	
	}
	//functions.js
	
	//Función para establecer el estado de carga.
	function setStatus (theStatus, theObj){
		obj = document.getElementById(theObj);
		if (obj){
			obj.innerHTML = "<div class=\"bold\">" + theStatus + "</div>";
		}
	}
	
	function changesize (img, sml, nu, a){
		//Mostrar el mensaje informativo al usuario.
		theobj = document.getElementById("showimg"+nu);
		if (theobj){
			setStatus ("Cargando...","showimg"+nu);
			var loc = "thumb" + a + ".php?img=" + img + "&sml=" + sml;
			processajax ("showimg"+nu,loc);

		}
	}
	

function CheckNumeric(obj)
{
   // Get ASCII value of key that user pressed
   var key = window.event.keyCode;

   // dejar introducir nmeros 0..9 o barra /
   if ( key > 47 && key < 58 )
      return;
   else
 
	  window.event.returnValue = null;
} 

function ocultar(){
if (document.getElementById('envio').style.visibility=='hidden'){
document.getElementById('envio').style.visibility='visible';
}else{
document.getElementById('envio').style.visibility='hidden';
}
}


function comprobar(){

if (document.getElementById('nombre').value==""){
	alert('Debe escribir su Nombre');
	document.getElementById('nombre').focus();
	return false;
}


if (document.getElementById('apellidos').value==""){
	alert('Debe escribir sus apellidos');
	document.getElementById('apellidos').focus();
	return false;
}

if (document.getElementById('email').value==""){
	alert('Debe escribir su email');
	document.getElementById('email').focus();
	return false;
}

if (document.getElementById('telefono').value==""){
	alert('Debe escribir su telefono');
	document.getElementById('telefono').focus();
	return false;
}

if (document.getElementById('condiciones').checked==false){
	alert('Debe aceptar las condiciones');
	document.getElementById('condiciones').focus();
	return false;
}

document.getElementById('formulari').submit();

}


function ciudades(){

var modo = document.getElementById('modo').value;

var ciudad = document.getElementById('ciudad').value;


window.open('listado.asp?ciudad='+ciudad+'&modo='+modo,'_parent');

}
function modos2(){


var modo = document.getElementById('modo').value;


window.open('listado.asp?modo='+modo,'_parent');

}
