function clic() {
		Event.observe('celda1','click', function() { Effect.divSwap('foto1','fotos'); $('celda1').addClassName('current'); });
		Event.observe('celda2','click', function() { Effect.divSwap('foto2','fotos'); $('celda2').addClassName('current'); });
		Event.observe('celda3','click', function() { Effect.divSwap('foto3','fotos'); $('celda3').addClassName('current'); });
		Event.observe('celda4','click', function() { Effect.divSwap('foto4','fotos'); $('celda4').addClassName('current'); });
		Event.observe('celda5','click', function() { Effect.divSwap('foto5','fotos'); $('celda5').addClassName('current'); });
		Event.observe('celda6','click', function() { Effect.divSwap('foto6','fotos'); $('celda6').addClassName('current'); });
		Event.observe('celda7','click', function() { Effect.divSwap('foto7','fotos'); $('celda7').addClassName('current'); });
		Event.observe('celda8','click', function() { Effect.divSwap('foto8','fotos'); $('celda8').addClassName('current'); });
		Event.observe('celda9','click', function() { Effect.divSwap('foto9','fotos'); $('celda9').addClassName('current'); });
		Event.observe('celda10','click', function() { Effect.divSwap('foto10','fotos'); $('celda10').addClassName('current'); });
		Event.observe('celda11','click', function() { Effect.divSwap('foto11','fotos'); $('celda11').addClassName('current'); });
		Event.observe('celda12','click', function() { Effect.divSwap('foto12','fotos'); $('celda12').addClassName('current'); });
}

function MM_CheckFlashVersion(reqVerStr,msg){
  with(navigator){
    var isIE  = (appVersion.indexOf("MSIE") != -1 && userAgent.indexOf("Opera") == -1);
    var isWin = (appVersion.toLowerCase().indexOf("win") != -1);
    if (!isIE || !isWin){  
      var flashVer = -1;
      if (plugins && plugins.length > 0){
        var desc = plugins["Shockwave Flash"] ? plugins["Shockwave Flash"].description : "";
        desc = plugins["Shockwave Flash 2.0"] ? plugins["Shockwave Flash 2.0"].description : desc;
        if (desc == "") flashVer = -1;
        else{
          var descArr = desc.split(" ");
          var tempArrMajor = descArr[2].split(".");
          var verMajor = tempArrMajor[0];

          var tempArrMinor = (descArr[3] != "") ? descArr[3].split("r") : descArr[4].split("r");

          var verMinor = (tempArrMinor[1] > 0) ? tempArrMinor[1] : 0;

          flashVer =  parseFloat(verMajor + "." + verMinor);

        }

      }

      // WebTV has Flash Player 4 or lower -- too low for video

      else if (userAgent.toLowerCase().indexOf("webtv") != -1) flashVer = 4.0;



      var verArr = reqVerStr.split(",");

      var reqVer = parseFloat(verArr[0] + "." + verArr[2]);

  

      if (flashVer < reqVer){

        if (confirm(msg))

          window.location = "http://www.macromedia.com/shockwave/download/download.cgi?P1_Prod_Version=ShockwaveFlash";

      }

    }

  } 

}



function agregar(){

   if ((navigator.appName=="Microsoft Internet Explorer") && 

         (parseInt(navigator.appVersion)>=4)) {

      var url="http://www.pisomap.com"; 

      var titulo="Pisomap | Servicios Inmobiliarios Integrales";

      window.external.AddFavorite(url,titulo);

   } else { 

      if(navigator.appName == "Netscape") 

         alert("Presione Crtl+D para agregar este sitio en sus Marcadores"); 

   }

}



function verificar_numero(numero,formulario)

{

	if (numero.value=='')

	{

	}

	var noes=0;

	var str = numero.value;

	for (var i = 0; i < str.length; i++)        

	{	var ch = str.substring(i, i + 1)

	        if ((ch < "0" || "9" < ch) && ch != '.' && ch != ',') 

		{  numero.value=''

	           numero.focus()

	           numero.select()

		   noes=1

		}               

	}	  

	if (noes==1)

	{ alert('El valor introducido "' + str + '" no es un número')

	  return 1

	}

	return 0;

}



function calcula() {

	imp = parseInt(document.hipoteca.capital.value)

	plazo_meses = parseInt(document.hipoteca.tiempo.value)

	tipo_mensual = parseFloat(document.hipoteca.interes.value)



	if ( isNaN(imp) || imp == 0 )

	{ alert("Debe rellenar el campo 'Importe'")

	  return }

	if ( isNaN(plazo_meses) || plazo_meses == 0 )

	{ alert("Debe rellenar el campo 'Plazo'")

	  return }

	if ( isNaN(tipo_mensual) || tipo_mensual == 0.0 ) 

	{ alert("Debe rellenar el campo 'Tipo de interés'")

	  return }



	if ( tipo_mensual > 20.0 ) 

	{ alert("El Tipo Nominal es superior al 20% y no es aceptable para un préstamo hipotecario")

	  return }





	plazo_meses = plazo_meses * 12



		// EL TIPO DE INTERES VIENE EN AÑOS Y LOS PASAMOS A TIPO INTERES MENSUAL

	tipo_mensual = tipo_mensual / 1200.0

	y  = 1.0 + tipo_mensual

	cuota = imp * tipo_mensual * Math.pow(y,plazo_meses) / ( Math.pow(y,plazo_meses) - 1.0 ) 

	document.hipoteca.cuota.value = Math.round(cuota*100)/100

}



// Poner valores de los slider

function setSliderValue(slider, value) {
	// due to onChange code above we need this or 
	// a 0 will be put in the text box when you delete the value

	if (value == '') return;
	if (isNaN(value))
		slider.setValue(0);
	else
		slider.setValue(value);
}

function financia() {
	imp = parseInt(document.financiacion.slider_value1.value);
	plazo_meses = parseInt(document.financiacion.slider_value2.value);
	tipo_mensual = parseFloat(document.financiacion.slider_value3.value);

	if ( isNaN(imp) || imp == 0 ){ 
		imp=0;
		return;
	}

	if ( isNaN(plazo_meses) || plazo_meses == 0 ){
		plazo_meses=0;
		return;
	}

	if ( isNaN(tipo_mensual) || tipo_mensual == 0.0 ){
		tipo_mensual=0;
		return;
	}

	plazo_meses = plazo_meses * 12;
	tipo_mensual = tipo_mensual / 1200.0;
	y  = 1.0 + tipo_mensual;
	cuota = imp * tipo_mensual * Math.pow(y,plazo_meses) / ( Math.pow(y,plazo_meses) - 1.0 ) ;
	cuota = Math.round(cuota*100)/100;
	interes = Math.round((cuota*plazo_meses)-imp);
	cuota_p = Math.round(cuota*166.386);
	interes_p = Math.round(interes*166.386);
	
	document.financiacion.cuota.value = cuota;
	document.financiacion.interes.value = interes;
	document.financiacion.cuota_p.value = cuota_p;
	document.financiacion.interes_p.value = interes_p;
}