// Variables

// Funciones
var status = "true";

ver=parseInt(navigator.appVersion)
ie4=(ver>3  && navigator.appName!="Netscape")?1:0
ns4=(ver>3  && navigator.appName=="Netscape")?1:0
ns3=(ver==3 && navigator.appName=="Netscape")?1:0
//alert(navigator.appName);
//alert(ns4);

 

function checkSong() { 
alert("checkSong-song");
song(0,1);
//javascript:song(0,1);
}




function openMap(theURL,features) { //v2.0
  window.open(theURL,'Mapa',features, true );
}
function emptyvalidation(entered, alertbox)
{
with (entered) {
  if (value==null || value=="")
  { 
     if (alertbox!="") {
        alert(alertbox);
     } 
  
     return false;
  }

  else {
    return true;
  }
}
}

function song(songnumer, level) {
// alert("news level: " + level);
//playSound(number);
if (level == 1 ) {
  path = "../";
} else if (level == 2 ){
  path = "../../";
} else if (level == 3 ){
  path = "../../../";
}
else {
  path = "../../../../";
}

  if ( status == "true" ) {
//alert("F1");  
     playSound(songnumer, level);
//alert("F2");  	 
	 if ( songnumer== 0) {
//alert("F3");  	 
		 MM_swapImage('Image10','', path + 'images/track1b.gif',1);
	 	 status = "played0"; // "false0";
	 } else {
//alert("F4");  	 	 
		 MM_swapImage('Image11','',path + 'images/track1b.gif',1); 
 	 	 status = "played1"; // "false1";
	 }
  }


  else {
   	 if ( status == "played0" ) { // Se habia hecho play de la cancion0
//alert("status es played0");	 
		 if ( songnumer== 0) { // Hizo stop de la cancion0
//alert("hizo stop de la cancion0");	 		 
 	         stopSound();
			 MM_swapImage('Image10','',path + 'images/track1a.gif',1);
			 status = "stopped0"; // "true0";
		 } else { // Hizo play de la cancion1
			 playSound(1, level);
			 MM_swapImage('Image10','',path + 'images/track1a.gif',1);			 
			 MM_swapImage('Image11','',path + 'images/track1b.gif',1);
			 status = "played1"; // "true1";		 
		 }
	 }
   	 else if ( status == "played1" ) { // Se habia hecho play de la cancion1
//alert("status es played1");	 	 
		 if ( songnumer== 0) { // Hizo play de la cancion0
			 playSound(0, level);
			 MM_swapImage('Image10','',path + 'images/track1b.gif',1);
			 MM_swapImage('Image11','',path + 'images/track2a.gif',1);			 
			 status = "played0"; // "true0";
		 } else { // Hizo stop de la cancion1
//alert("hizo stop de la cancion1");	 	 		 
  	         stopSound();
			 MM_swapImage('Image11','',path + 'images/track2a.gif',1);
			 status = "stopped1"; //"true1";		 
		 }
	 }

   	 else if ( status == "stopped0" ) { // Se habia hecho stop de la cancion0
//alert("status es stopped0");	 	 	 
		 if ( songnumer== 0) { // Hizo play de la cancion0
			 playSound(0, level);
			 MM_swapImage('Image10','',path + 'images/track2a.gif',1);
			 status = "played0";
		 } else { // Hizo play de la cancion1
  	         playSound(1);
			 MM_swapImage('Image10','',path + 'images/track1a.gif',1);
			 MM_swapImage('Image11','',path + 'images/track1b.gif',1);
			 status = "played1";		 
		 }
	 }
	 
   	 else if ( status == "stopped1" ) { // Se habia hecho stop de la cancion0
//alert("status es stopped1");	 	 	 
		 if ( songnumer== 0) { // Hizo play de la cancion0
//alert("hizo play de la cancion0"); 	 	 		 
			 playSound(0, level);
			 MM_swapImage('Image10','',path + 'images/track1b.gif',1);
			 status = "played0";
		 } else { // Hizo play de la cancion1
  	         playSound(1, level);
			 MM_swapImage('Image10','',path + 'images/track1a.gif',1);
			 MM_swapImage('Image11','',path + 'images/track1b.gif',1);
			 status = "played1";		 
		 }
	 }
	 

/*
   	 else if ( status == "played1" ) { // Se habia hecho stop de la cancion1
alert("status es played1 - Se habia hecho play de la cancion1");	 	 
		 if ( songnumer== 0) { // Hizo play de la cancion0
alert("hizo play de la cancion 0");	 	 		 
			 playSound(0);
			 MM_swapImage('Image10','','../../images/track1b.gif',1);
			 MM_swapImage('Image11','','../../images/track2a.gif',1);
			 status = "false0";
		 } else { // Hizo stop de la cancion1
alert("hizo stop de la cancion 1");	 	 		 		 
  	         stopSound();
			 MM_swapImage('Image11','','../../images/track2a.gif',1);
			 status = "stopped1";		 
		 }
	 }
*/	 
}
}

function playSound(song, level) {
	//alert("newf");
	if (level == 1 ) {
	  path = "../";
	} else if (level == 2 ){
	  path = "../../";
	}
	else {
	  path = "../../../";
	}

	if ( song == 0) {
	  //songfile = '../sounds/danzarinf.mp3';
	  songfile = path + 'sounds/danzarinf.mp3';
	//alert(songfile);
	  }
	else {
	  songfile = path + 'sounds/primaveraporteniaf.mp3';
	//alert(songfile);  
	}  

	 if (ie4) { //alert("ie4"); 
		document.all['BGSOUND_ID'].src=songfile;
	 }
	 //document.all['BGSOUND_ID'].src='../sounds/danzarinf.mp3'; } 
	 if ((ns4||ns3)
//  && navigator.javaEnabled()
//  && navigator.mimeTypes['audio/x-midi']
//  && self.document.guitar.IsReady()
 )
	 {
	 document.all['BGSOUND_ID'].src=songfile;
	 //alert("PL2");
	 document.getElementById('guitar').play();
//	  self.document.guitar.play()
	 }

}

function stopSound() {
//alert("hizo stopSound sin param");
 if (ie4) { //alert("will stop.mp3"); 
 document.all['BGSOUND_ID'].src='../sounds/stop.mp3'; } 
 if ((ns4||ns3)
  && navigator.javaEnabled()
  && navigator.mimeTypes['audio/x-midi']
 )
 {
  self.document.guitar.stop()
 }
}

function translatedText(textid, locale) {

  index = 0;

  if (locale=="de") {
    index=1;
  }
  else if (locale=="es") {
    index=2;
  }

  Errors = {
  
      EmptyName_en: "The name can not be empty.",
      EmptyName_de: "Der Vorname kann nicht leer bleiben.",
      EmptyName_es: "El Nombre no puede ser vacío.",

      EmptyLastName_en: "The Last Name can not be empty.",
      EmptyLastName_de: "Der Nachname kann nicht leer bleiben.",
      EmptyLastName_es: "El Apellido no puede ser vacío.",

      EmptyEmail_en: "The Email can not be empty.",
      EmptyEmail_de: "Die Emailadresse kann nicht leer bleiben.",
      EmptyEmail_es: "La Dirección de Email no puede ser vacía.",

      InvalidEmail_en: "The Email is not valid.",
      InvalidEmail_de: "Die Emailadresse ist nicht gültig.",
      InvalidEmail_es: "La Dirección de email no es válida.",

      EmptyResidenceCountry_en: "The Residence Country can not be empty.",
      EmptyResidenceCountry_de: "Sie müssen ein Land auswählen.",
      EmptyResidenceCountry_es: "Debe elegir el País de Residencia.",

      EmptyEnquiry_en: "The Enquiry can not be empty.",
      EmptyEnquiry_de: "Sie müssen eine Frage angeben.",
      EmptyEnquiry_es: "Debe ingresar su Consulta.",

      LongEnquiry_en: "The Enquiry can not be empty.",
      LongEnquiry_de: "Die Frage darf bis zu",
      LongEnquiry_es: "La Consulta puede tener hasta",

      Has_en: "he Enquiry can not be empty.",
      Has_de: "Sie hat",
      Has_es: "Tiene",

      Characters_en: "The Enquiry can not be empty.",
      Characters_de: "Zeichen",
      Characters_es: "Caracteres",

      EmptyWebTitle_en: "The Enquiry can not be empty.",
      EmptyWebTitle_de: "Sie müssen den Titel der Site angeben.",
      EmptyWebTitle_es: "Debe ingresar el Título del Sitio.",

      EmptyUrl_en: "The Enquiry can not be empty.",
      EmptyUrl_de: "DE The name can not be empty.",
      EmptyUrl_es: "La dirección Web no puede ser vacía.",

      InvalidUrl_en: "The Enquiry can not be empty.",
      InvalidUrl_de: "Die Webadresse kann nicht leer bleiben.",
      InvalidUrl_es: "La Dirección Web del Sitio no es Válida.",

      LongRemarks_en: "The Enquiry can not be empty.",
      LongRemarks_de: "Der Kommentar darf bis zu",
      LongRemarks_es: "El Comentario puede tener hasta",

      KeyEqual_en: "Please enter the key again. It must be the same as the above one",
      KeyEqual_de: "Das Schlüsselwort müss die selbe sein als der Site gibt",
      KeyEqual_es: "Por favor reingrese la palabra clave. Debe ser la misma a la que figura arriba",

//FALTA TRADUCIR
      EmptyFromDate_es: "Debe ingresar la Fecha Desde.",
	  EmptyFromDate_en: "You must fill in the Arrival Date.",
      EmptyToDate_es: "Debe ingresar la Fecha Hasta.",
	  EmptyToDate_en: "You must fill in the Departure Date",
      EmptyAddress_es: "Se debe ingresar la Dirección.",
	  EmptyAddress_en: "You have to complete the Address.",
      EmptyImageFile_es: "Se debe ingresar la Foto1 de la Propiedad.",
      EmptyPhoneNumber_es: "El Teléfono no puede ser vacío.",	  
      EmptyPhone_es: "El Teléfono no puede ser vacío.",
	  EmptyPhone_en: "The phone must be filled in.",
      EmptyOwnerCountry_es: "Se debe elegir un País",
      EmptyOwnerCountry_en: "You have to choose a Country",
	  EmptyPassengers_es: "Se debe elegir la Cantidad de Pasajeros",
	  EmptyPassengers_en: "You have to complete the Number of Passengers.",	  
	  EmptyChildren_es: "Se debe elegir la Cantidad de Menores",
	  EmptyChildren_en: "You have to complete the Number of Children.",	  	  
      EmptyHowContactUs_es: "Se debe indicar como se Contactaron con Hotspot.",
	  EmptyHowContactUs_en: "You have to indicate how you contacted HotSpot.",
      EmptyStreet_es: "La calle no puede ser vacía.",
      EmptyCity_es: "La ciudad no puede ser vacía.",
      EmptyArea_es: "El Area no puede ser vacía.",
      EmptyPropertyCountry_es: "Se debe elegir el Pais de la Propiedad.",
	  EmptyPropertyCountry_en: "You have to complete the Country of the Apartement.",
      EmptyType_es: "Se debe elegir el Tipo de la Propiedad",
      EmptyType_en: "You have to specify the Apartement's Type",	  
      EmptyStorey_es: "Se debe indicar la Cantidad de Ambientes.",	  
	  EmptyStorey_en: "You have to specify the Quantity of Rooms.",	  
      LongDescription_es: "La Descripción de la Propiedad puede tener hasta",
	  LongDescription_en: "The Description of the Property can have up to",
      EmptyCode_es: "Se debe indicar el Código",	  
      EmptyZone_es: "Se debe indicar la Zona",	  
      EmptyLocation_es: "Se debe indicar la Ubicación",	  
      EmptySummaryDescription_es: "Se debe indicar la Descripción Sumarizada",	  
      EmptyExtendedDescription_es: "Se debe indicar la Descripción Extendedida",	  	  
      EmptySummaryDescriptionEn_es: "Se debe indicar la Descripción Sumarizada del Inglés",	  
      EmptyExtendedDescriptionEn_es: "Se debe indicar la Descripción Extendedida del Inglés",	  	  
      EmptyGuests_es: "Se debe indicar la Capacidad",	  
      EmptyBalcony_es: "Se debe indicar el Balcón",	  
      EmptyArea_es: "Se debe indicar la Superficie",	  
      EmptyView_es: "Se debe indicar la Vista",
      LongSummaryDescription_es: "La Descripción Sumarizada puede tener hasta",
      LongExtendedDescription_es: "La Descripción Extendida puede tener hasta",	  
      LongSummaryDescriptionEn_es: "La Descripción Sumarizada del Inglés puede tener hasta",
      LongExtendedDescriptionEn_es: "La Descripción Extendida del Inglés puede tener hasta",	  
      FromDateLowerThanToDate_es: "La Fecha In debe ser anterior o igual a la Fecha Out.",
	  FromDateLowerThanToDate_en: "The Arrival Date must be equal or prior to the Departure Date.",
      FromDateLowerThanToday_es: "La Fecha In debe ser la misma o posterior al Día de Hoy.",
	  FromDateLowerThanToday_en: "The Arrival Date must be equal or prior than today.",
	  EmptyNewProjectImageFile_es: "Se debe ingresar la Foto de la Maqueta del Edificio.",	  	  
      EmptyZip_es: "Se debe ingresar el Código Postal."
      

   }
   return Errors[textid + "_" + locale];



}

function compareDates (value1, value2) {
   var date1, date2;
   var month1, month2;
   var year1, year2;

   date1 = value1.substring (0, value1.indexOf ("-"));
   month1 = value1.substring (value1.indexOf ("-")+1, value1.lastIndexOf ("-"));
   year1 = value1.substring (value1.lastIndexOf ("-")+1, value1.length);

   date2 = value2.substring (0, value2.indexOf ("-"));
   month2 = value2.substring (value2.indexOf ("-")+1, value2.lastIndexOf ("-"));
   year2 = value2.substring (value2.lastIndexOf ("-")+1, value2.length);

//alert("month1: " + month1 + " date1: " + date1 + "year1: " + year1);
//alert("month2: " + month2 + " date2: " + date2 + "year2: " + year2);

   if (year1 > year2) return 1;
   else if (year1 < year2) return -1;
   else if (month1 > month2) return 1;
   else if (month1 < month2) return -1;
   else if (date1 > date2) return 1;
   else if (date1 < date2) return -1;
   else return 0;
} 


function emailvalidation(entered, alertbox)
{
with (entered)
{
apos=value.indexOf("@");
dotpos=value.lastIndexOf(".");
lastpos=value.length-1;
if (apos<1 || dotpos-apos<2 || lastpos-dotpos>3 || lastpos-dotpos<2) 
{if (alertbox) {alert(alertbox);} return false;}
else {return true;}
}
}


function urlValidation(entered, alertbox)
{
with (entered)
{
   var defaultUrl = "http://www.";
   var validUrl= /http:\/\/www./;

   if ( entered.value==defaultUrl || validUrl.test(entered.value) == false) {
	alert(alertbox);
	return false;
   }
   else { 
        return true;
   }
}
}


function emptyvalidation(entered, alertbox)
{
with (entered) {
  if (value==null || value=="")
  { 
     if (alertbox!="") {
        alert(alertbox);
     } 
  
     return false;
  }

  else {
    return true;
  }
}
}

/*
function maxlengthvalidation(entered, alertbox, len)
{
with (entered)
{
if (value.length > len)
{alert(alertbox); return false;}
else {return true;}
}
}
*/


function maxlengthvalidation(entered, alertbox, len, informlength, locale)
{
with (entered)
{
if (value.length > len)
{
 errormsg=translatedText(alertbox, locale);
 errormsg+=" ";
 errormsg+=len
 errormsg+=" ";
 errormsg+=translatedText("Characters", locale);
 errormsg+=".";

 if (informlength=="true") {
   errormsg+= " ( ";
   errormsg+= translatedText("Has", locale);
   errormsg+=" ";
   errormsg+= value.length;
   errormsg+=" ";
   errormsg+=translatedText("Characters", locale);
   errormsg+= " ) ";
 }

 alert(errormsg); 
 return false;
}
else {return true;}
}
}



// Validacion de Listas de Seleccion, no puede quedar seleccionado
// el primer Item (que es el default, como Seleccione su Pais )
function selectionListIndex(entered, alertbox)
{
   with (entered) {
      if (value == "-1") { 
        alert(alertbox); 
        return false;
      }
      else {
        return true;
     }
   }
}






// Validación del Formulario de Contacto por Formulario
function contactFormValidation(thisform, locale)
{
   with (thisform) {
	//Nombre
	if (emptyvalidation(name,translatedText("EmptyName", locale))==false) {name.focus(); return false;};

	//Apellido
	if (emptyvalidation(lastname,translatedText("EmptyLastName", locale))==false) {lastname.focus(); return false;};

	//Email
	if (emptyvalidation(email,translatedText("EmptyEmail", locale))==false) {email.focus(); return false;};
	if (emailvalidation(email,translatedText("InvalidEmail", locale))==false) {email.focus(); return false;};

	// Pais
	if (selectionListIndex(country,translatedText("EmptyResidenceCountry", locale))==false) {country.focus(); return false;};

	// Consulta
	if (emptyvalidation(enquiry,translatedText("EmptyEnquiry", locale))==false) {enquiry.focus(); return false;};
	if (maxlengthvalidation(enquiry, "LongEnquiry", 200, "true", locale)==false) 	 	{enquiry.focus(); return false;};
   }
}



// Validación del Formulario de Agregar Enlace
function linkFormValidation(thisform, locale)
{
   with (thisform) {
	//Nombre
	if (emptyvalidation(name,translatedText("EmptyName", locale))==false) {name.focus(); return false;};

	//Apellido
	if (emptyvalidation(lastname,translatedText("EmptyLastName", locale))==false) {lastname.focus(); return false;};

	//Email
	if (emptyvalidation(email,translatedText("EmptyEmail", locale))==false) {email.focus(); return false;};
	if (emailvalidation(email,translatedText("InvalidEmail", locale))==false) {email.focus(); return false;};

	// Pais
	if (selectionListIndex(country,translatedText("EmptyResidenceCountry", locale))==false) {country.focus(); return false;};

	// Título del Sitio
	if (emptyvalidation(webtitle,translatedText("EmptyWebTitle", locale))==false) {webtitle.focus(); return false;};

	// Dirección Web
	if (emptyvalidation(url,translatedText("EmptyUrl", locale))==false) {url.focus(); return false;};
	if (urlValidation(url,translatedText("InvalidUrl", locale))==false) {url.focus(); return false;};

	// Comentarios
	if (maxlengthvalidation(remarks, "LongRemarks", 200, "true", locale)==false) 	 	{remarks.focus(); return false;};

   }
}








// Reserva
function validateBooking(thisform, locale)
{
   with (thisform) {


	//Nombre y Apellido
	if (emptyvalidation(name,translatedText("EmptyName", locale))==false) {name.focus(); return false;};


	//Email
	if (emptyvalidation(email,translatedText("EmptyEmail", locale))==false) {email.focus(); return false;};
	if (emailvalidation(email,translatedText("InvalidEmail", locale))==false) {email.focus(); return false;};

	// Fechas
	if (emptyvalidation(fromdate,translatedText("EmptyFromDate", locale))==false) {return false;};
	if (emptyvalidation(todate,translatedText("EmptyToDate", locale))==false) {return false;};


// La Fecha desde debe ser mayor o igual a la actual
var CurrentDay = new Date();
//alert ("HARA COMPARACION CON EL DIA DE HOY - hoy es " + Today );

// Arma la Fecha de Hoy
var Today = ""
if ( CurrentDay.getDate() < 10 ) {
  Today = "0";
}
Today = Today + CurrentDay.getDate();
Today = Today + "-";
if ( ( CurrentDay.getMonth()+1) < 10 ) {
  Today =  Today + "0";
}
Today = Today + (CurrentDay.getMonth()+1);
Today = Today + "-";
Today = Today + CurrentDay.getYear();

if ( compareDates(Today, fromdate.value) == 1 ) {
  alert (translatedText("FromDateLowerThanToday", locale)); // "La Fecha In debe ser el día de hoy o un día posterior");
  return false;
}



// La fecha Desde debe ser mayor o igual a la del dia actual
//alert( "TODATE: " + todate.value );
//alert( "RESULTADO COMPARACION: " + compareDates(fromdate.value, todate.value) );
if ( compareDates(fromdate.value, todate.value) == 1 ) {
  //alert( "ACA" );
  alert ( translatedText("FromDateLowerThanToDate", locale) );
  //fromdate.focus();
  return false;
}


//  alert ( "Reserva sera false");
//  return false;


// NUEVO JULIO 2007
// Pasajeros
if (selectionListIndex(passengers,translatedText("EmptyPassengers", locale))==false) {passengers.focus(); return false;};

//Menores
if (selectionListIndex(children,translatedText("EmptyChildren", locale))==false) {children.focus(); return false;};

// Pais de la Reserva
if (selectionListIndex(bookingcountry,translatedText("EmptyOwnerCountry", locale))==false) {bookingcountry.focus(); return false;};

// FINAL JULIO 2007

	// Comentarios
	if (maxlengthvalidation(remarks, "LongRemarks", 200, "true", locale)==false) {remarks.focus(); return false;};

   }
}

function validateModifyProperty(thisform, locale) {
	rc= validateNewProperty(thisform, locale, 'update');
	if (rc==false) {
	   return false;
	}  

// 6-8-2008 Pone en 0 los que son checked ( esto es porque si estaba en 
// desactivado y pasa a activado, no cambia el value , que queda en 1 lo cual es erroneo
if ( thisform.tv.checked == 1 ) {
//  alert ("tv checked");
  thisform.tv.value = "0";
}
if ( thisform.dvd.checked == 1 ) {
  thisform.dvd.value = "0";
}
if ( thisform.allowinternet.checked == 1 ) {
  thisform.allowinternet.value = "0";
}
if ( thisform.heating.checked == 1 ) {
  thisform.heating.value = "0";
}
if ( thisform.airconditioning.checked == 1 ) {
  thisform.airconditioning.value = "0";
}
if ( thisform.musicequipment.checked == 1 ) {
  thisform.musicequipment.value = "0";
}
if ( thisform.phone.checked == 1 ) {
  thisform.phone.value = "0";
}
if ( thisform.microwave.checked == 1 ) {
  thisform.microwave.value = "0";
}
if ( thisform.fridge.checked == 1 ) {
  thisform.fridge.value = "0";
}
if ( thisform.toaster.checked == 1 ) {
  thisform.toaster.value = "0";
}
if ( thisform.washingmachine.checked == 1 ) {
  thisform.washingmachine.value = "0";
}



with (thisform) {	 
	// Valida Tema Fotos, debe seleccionar una sola cosa
	i = 0;
    if ( imagefile.value!="") {
		 //alert("imagefile!=vacio, vale: " + imagefile);
	     i++; 
	 }
    if ( imagefilerename.value!="") {
		 //alert("imagefilerename!=vacio, vale: " + imagefilerename);	
	     i++; 
	 }
    
	if (deleteimagefile.checked == true) {
    //if ( deleteimagefile.value=="true") {
		 //alert("deleteimagefile!=vacio");
		 deleteimagefile.value="true"; // Para que ande el programa
	     i++; 
	 }	 
//alert (deleteimagefile.value) 	 

    if ( i>1)
    {
        alert("Para la primera foto debe elegir una nueva imagen, cambiar el número, borrarla o no hacer nada. Se están eligiendo al menos dos acciones");
		imagefile.focus();
		return false;
    } 

    // Foto2
	// Valida Tema Fotos, debe seleccionar una sola cosa
	i = 0;
    if ( imagefile2.value!="") {
		//alert("imagefile2!=vacio, vale: " + imagefile);
	     i++; 
	 }
    if ( imagefilerename2.value!="") {
		 //alert("imagefilerename2!=vacio, vale: " + imagefilerename);	
	     i++; 
	 }

	if (deleteimagefile2.checked == true) {
		 //alert("deleteimagefile2!=vacio");		
		 deleteimagefile2.value="true"; // Para que ande el programa		 
	     i++; 
	 }	 
    if ( i>1)
    {
        alert("Para la foto2 debe elegir una nueva imagen, cambiar el número, borrarla o no hacer nada. Se están eligiendo al menos dos acciones");
		imagefile2.focus();
		return false;
    } 

    // Foto3
	// Valida Tema Fotos, debe seleccionar una sola cosa
	i = 0;
    if ( imagefile3.value!="") {
		//alert("imagefile!=vacio, vale: " + imagefile);
	     i++; 
	 }
    if ( imagefilerename3.value!="") {
		 //alert("imagefilerename!=vacio, vale: " + imagefilerename);	
	     i++; 
	 }

	if (deleteimagefile3.checked == true) {
		 //alert("deleteimagefile!=vacio");
		 deleteimagefile3.value="true"; // Para que ande el programa		 
	     i++; 
	 }	 
    if ( i>1)
    {
        alert("Para la foto3 debe elegir una nueva imagen, cambiar el número, borrarla o no hacer nada. Se están eligiendo al menos dos acciones");
		imagefile3.focus();
		return false;
    } 

    // Foto4
	// Valida Tema Fotos, debe seleccionar una sola cosa
	i = 0;
    if ( imagefile4.value!="") {
		//alert("imagefile!=vacio, vale: " + imagefile);
	     i++; 
	 }
    if ( imagefilerename4.value!="") {
		 //alert("imagefilerename!=vacio, vale: " + imagefilerename);	
	     i++; 
	 }

	if (deleteimagefile4.checked == true) {
		 //alert("deleteimagefile!=vacio");
		 deleteimagefile4.value="true"; // Para que ande el programa		 
	     i++; 
	 }	 
    if ( i>1)
    {
        alert("Para la foto4 debe elegir una nueva imagen, cambiar el número, borrarla o no hacer nada. Se están eligiendo al menos dos acciones");
		imagefile4.focus();
		return false;
    } 

    // Foto5
	// Valida Tema Fotos, debe seleccionar una sola cosa
	i = 0;
    if ( imagefile5.value!="") {
		//alert("imagefile!=vacio, vale: " + imagefile);
	     i++; 
	 }
    if ( imagefilerename5.value!="") {
		 //alert("imagefilerename!=vacio, vale: " + imagefilerename);	
	     i++; 
	 }

	if (deleteimagefile5.checked == true) {
		 //alert("deleteimagefile!=vacio");
		 deleteimagefile5.value="true"; // Para que ande el programa		 
	     i++; 
	 }	 
    if ( i>1)
    {
        alert("Para la foto5 debe elegir una nueva imagen, cambiar el número, borrarla o no hacer nada. Se están eligiendo al menos dos acciones");
		imagefile5.focus();
		return false;
    } 

    // Foto6
	// Valida Tema Fotos, debe seleccionar una sola cosa
	i = 0;
    if ( imagefile6.value!="") {
		//alert("imagefile!=vacio, vale: " + imagefile);
	     i++; 
	 }
    if ( imagefilerename6.value!="") {
		 //alert("imagefilerename!=vacio, vale: " + imagefilerename);	
	     i++; 
	 }

	if (deleteimagefile6.checked == true) {
		 //alert("deleteimagefile!=vacio");
		 deleteimagefile6.value="true"; // Para que ande el programa		 
	     i++; 
	 }	 
    if ( i>1)
    {
        alert("Para la foto6 debe elegir una nueva imagen, cambiar el número, borrarla o no hacer nada. Se están eligiendo al menos dos acciones");
		imagefile6.focus();
		return false;
    } 

    // Foto7
	// Valida Tema Fotos, debe seleccionar una sola cosa
	i = 0;
    if ( imagefile7.value!="") {
		//alert("imagefile!=vacio, vale: " + imagefile);
	     i++; 
	 }
    if ( imagefilerename7.value!="") {
		 //alert("imagefilerename!=vacio, vale: " + imagefilerename);	
	     i++; 
	 }

	if (deleteimagefile7.checked == true) {
		 //alert("deleteimagefile!=vacio");
		 deleteimagefile7.value="true"; // Para que ande el programa		 
	     i++; 
	 }	 
    if ( i>1)
    {
        alert("Para la foto7 debe elegir una nueva imagen, cambiar el número, borrarla o no hacer nada. Se están eligiendo al menos dos acciones");
		imagefile7.focus();
		return false;
    } 

    // Foto8
	// Valida Tema Fotos, debe seleccionar una sola cosa
	i = 0;
    if ( imagefile8.value!="") {
		//alert("imagefile!=vacio, vale: " + imagefile);
	     i++; 
	 }
    if ( imagefilerename8.value!="") {
		 //alert("imagefilerename!=vacio, vale: " + imagefilerename);	
	     i++; 
	 }

	if (deleteimagefile8.checked == true) {
		 //alert("deleteimagefile!=vacio");
		 deleteimagefile8.value="true"; // Para que ande el programa		 		
	     i++; 
	 }	 
    if ( i>1)
    {
        alert("Para la foto8 debe elegir una nueva imagen, cambiar el número, borrarla o no hacer nada. Se están eligiendo al menos dos acciones");
		imagefile8.focus();
		return false;
    } 

    // Foto9
	// Valida Tema Fotos, debe seleccionar una sola cosa
	i = 0;
    if ( imagefile9.value!="") {
		//alert("imagefile!=vacio, vale: " + imagefile);
	     i++; 
	 }
    if ( imagefilerename9.value!="") {
		 //alert("imagefilerename!=vacio, vale: " + imagefilerename);	
	     i++; 
	 }

	if (deleteimagefile9.checked == true) {
		 //alert("deleteimagefile!=vacio");
		 deleteimagefile9.value="true"; // Para que ande el programa		 		
	     i++; 
	 }	 
    if ( i>1)
    {
        alert("Para la foto9 debe elegir una nueva imagen, cambiar el número, borrarla o no hacer nada. Se están eligiendo al menos dos acciones");
		imagefile9.focus();
		return false;
    } 
	
/*		 
	(eval("document.zonas.zona[0].checked") == false) &&
        (eval("document.zonas.zona[1].checked") == false))
    {
        alert("Debe elegir la zona correspondiente a la emisión de su Tarjeta de Crédito");
		document.zonas.zona[0].focus();
		return false;
    } 
*/

return true;	
}
	 
}

// Nueva propiedad
function validateNewProperty(thisform, locale, process)
{
//alert("NEWV2");
   with (thisform) {
	//Codigo
	if (emptyvalidation(code,translatedText("EmptyCode", locale))==false) {code.focus(); return false;};

	//Direccion
	if (emptyvalidation(address,translatedText("EmptyAddress", locale))==false) {address.focus(); return false;};

	//Teléfono
	if (emptyvalidation(phonenumber,translatedText("EmptyPhoneNumber", locale))==false) {phonenumber.focus(); return false;};

	//Foto
	//PORE AHORA NO VA PORQUE EN MODIFICACION NOVA
	if ( process == 'new') {
		if (emptyvalidation(imagefile,translatedText("EmptyImageFile", locale))==false) {imagefile.focus(); return false;};
	}	

	//Codigo
	if (emptyvalidation(code,translatedText("EmptyCode", locale))==false) {code.focus(); return false;};

	//Zona
	if (selectionListIndex(zone,translatedText("EmptyZone", locale))==false) {zone.focus(); return false;};

	//Ubicacion
	if (emptyvalidation(location,translatedText("EmptyLocation", locale))==false) {location.focus(); return false;};

	// Summary Description
	if (emptyvalidation(summarydescription,translatedText("EmptySummaryDescription", locale))==false) {summarydescription.focus(); return false;};
	if (maxlengthvalidation(summarydescription, "LongSummaryDescription", 250, "true", locale)==false) 	 	{summarydescription.focus(); return false;};

	// Extended Description
	if (emptyvalidation(extendeddescription,translatedText("EmptyExtendedDescription", locale))==false) {extendeddescription.focus(); return false;};
	if (maxlengthvalidation(extendeddescription, "LongExtendedDescription", 500, "true", locale)==false) 	 	{extendeddescription.focus(); return false;};

//Ingles
	// Summary Description
	if (emptyvalidation(summarydescriptionen,translatedText("EmptySummaryDescriptionEn", locale))==false) {summarydescriptionen.focus(); return false;};
	if (maxlengthvalidation(summarydescriptionen, "LongSummaryDescriptionEn", 250, "true", locale)==false) 	 	{summarydescriptionen.focus(); return false;};

	if (emptyvalidation(extendeddescriptionen,translatedText("EmptyExtendedDescriptionEn", locale))==false) {extendeddescriptionen.focus(); return false;};
	if (maxlengthvalidation(extendeddescriptionen, "LongExtendedDescriptionEn", 500, "true", locale)==false) 	 	{extendeddescriptionen.focus(); return false;};
// Fin Ingles


	//Capacidad
	if (emptyvalidation(guests,translatedText("EmptyGuests", locale))==false) {guests.focus(); return false;};

	//Area
	if (emptyvalidation(area,translatedText("EmptyArea", locale))==false) {area.focus(); return false;};



// Informacion del Dueño
	//Nombre
	if (emptyvalidation(name,translatedText("EmptyName", locale))==false) {name.focus(); return false;};

//Apellido
if (emptyvalidation(lastname,translatedText("EmptyLastName", locale))==false) {lastname.focus(); return false;};

// Pais del Dueño
if (selectionListIndex(ownercountry,translatedText("EmptyOwnerCountry", locale))==false) {ownercountry.focus(); return false;};

// Telefono
if (emptyvalidation(phone2,translatedText("EmptyPhone", locale))==false) {phone2.focus(); return false;};

//Email
if (emptyvalidation(email,translatedText("EmptyEmail", locale))==false) {email.focus(); return false;};
if (emailvalidation(email,translatedText("InvalidEmail", locale))==false) {email.focus(); return false;};


// Contact us
if (selectionListIndex(howcontactus,translatedText("EmptyHowContactUs", locale))==false) {howcontactus.focus(); return false;};

// Fin Informacion del Dueño

   }
}



// Julio 2007
function validateAddLink(thisform)
{
   with (thisform) {

	// Título del Sitio
	if (emptyvalidation(sitetitle,translatedText("EmptyWebTitle", locale))==false) {sitetitle.focus(); return false;};

	// Dirección Web
	if (emptyvalidation(url,translatedText("EmptyUrl", locale))==false) {url.focus(); return false;};
	if (urlValidation(url,translatedText("InvalidUrl", locale))==false) {url.focus(); return false;};

	// Descripción
	if (emptyvalidation(remarks, "Se debe ingresar la Descripción")==false) {remarks.focus(); return false;};


	//Email
	if (emptyvalidation(email,translatedText("EmptyEmail", locale))==false) {email.focus(); return false;};
	if (emailvalidation(email,translatedText("InvalidEmail", locale))==false) {email.focus(); return false;};

   }
}




// Nueva propiedad de Dueño
function validateNewOwnerProperty(thisform, locale)
{
   with (thisform) {
	//Nombre
	if (emptyvalidation(name,translatedText("EmptyName", locale))==false) {name.focus(); return false;};

//Apellido
if (emptyvalidation(lastname,translatedText("EmptyLastName", locale))==false) {lastname.focus(); return false;};

// Pais del Dueño
if (selectionListIndex(ownercountry,translatedText("EmptyOwnerCountry", locale))==false) {ownercountry.focus(); return false;};

// Telefono
if (emptyvalidation(phone,translatedText("EmptyPhone", locale))==false) {phone.focus(); return false;};

//Email
if (emptyvalidation(email,translatedText("EmptyEmail", locale))==false) {email.focus(); return false;};
if (emailvalidation(email,translatedText("InvalidEmail", locale))==false) {email.focus(); return false;};


// Contact us
if (selectionListIndex(howcontactus,translatedText("EmptyHowContactUs", locale))==false) {howcontactus.focus(); return false;};

// Cantidad de Ambientes
if (selectionListIndex(storeys,translatedText("EmptyStorey", locale))==false) {storeys.focus(); return false;};

// Propiedad
// Calle
//if (emptyvalidation(street,translatedText("EmptyStreet", locale))==false) {street.focus(); return false;};
if (emptyvalidation(address,translatedText("EmptyAddress", locale))==false) {address.focus(); return false;};

// Ciudad
//if (emptyvalidation(city,translatedText("EmptyCity", locale))==false) {city.focus(); return false;};

// Area
//if (emptyvalidation(area,translatedText("EmptyArea", locale))==false) {area.focus(); return false;};

// Pais de la Propiedad
// JULIO 2007 NO VA MAS if (selectionListIndex(propertycountry,translatedText("EmptyPropertyCountry", locale))==false) {propertycountry.focus(); return false;};

// Tipo de la Propiedad
if (selectionListIndex(type,translatedText("EmptyType", locale))==false) {type.focus(); return false;};


// Falta longitud de la Descripcion
if (maxlengthvalidation(description, "LongDescription", 200, "true", locale)==false) {description.focus(); return false;};

// Septiembre 2007
if (key1.value!=key2.value ) {
  alert (translatedText("KeyEqual", locale) );
  key2.focus();
  return false;
}


   }
}





// Agosto 2007
function validateAppraisal(thisform, locale)
{

   with (thisform) {
	//Nombre
	if (emptyvalidation(name,translatedText("EmptyName", locale))==false) {name.focus(); return false;};

	//Email
	if (emptyvalidation(email,translatedText("EmptyEmail", locale))==false) {email.focus(); return false;};
	if (emailvalidation(email,translatedText("InvalidEmail", locale))==false) {email.focus(); return false;};
	}
	
	return true;	
}	



function validateSearch(thisform, locale)
{
   return validateAppraisal(thisform, locale);
}	





function validateNewProject(thisform, locale)
{
 alert("validateNewProject");
   with (thisform) {
		//Direccion
		if (emptyvalidation(address,translatedText("EmptyAddress", locale))==false) {address.focus(); return false;};
	
		//Email
		if (emptyvalidation(imagefile,translatedText("EmptyNewProjectImageFile", locale))==false) {imagefile.focus(); return false;};	
	}
	return true;	
}	



function RunFoo()
{
   document.write('<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=5,0,0,0" width="700" height="400">\n');
        document.write('<param name=movie value="images/indexes.swf">\n');
        document.write('<param name=quality value=high>\n');
        document.write('<embed src="images/indexes.swf" quality=high pluginspage="http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash" type="application/x-shockwave-flash" width="700" height="400">\n');
        document.write('</embed>\n'); 
      document.write('</object>\n');
	  
}


function RunFooSale()
{
   document.write('<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=5,0,0,0" width="700" height="400">\n');
        document.write('<param name=movie value="images/indexessale.swf">\n');
        document.write('<param name=quality value=high>\n');
        document.write('<embed src="images/indexessale.swf" quality=high pluginspage="http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash" type="application/x-shockwave-flash" width="700" height="400">\n');
        document.write('</embed>\n'); 
      document.write('</object>\n');
	  
}




function validateNewApartement(thisform, locale, process)
{
	//alert("SEPT 2007");
   with (thisform) {
	//Codigo
	if (emptyvalidation(code,translatedText("EmptyCode", locale))==false) {code.focus(); return false;};

	if ( process == 'new') {
		if (emptyvalidation(imagefile,translatedText("EmptyImageFile", locale))==false) {imagefile.focus(); return false;};
	}	

  }
}


function validateModifyApartement(thisform, locale) {
// alert("NOV 2007");
	rc= validateNewApartement(thisform, locale, 'update');
	if (rc==false) {
	   return false;
	}  
}



// Faltaba 15 Noviembre 2008
function validateModifyProject(thisform, locale) {
 alert("validateModifyProject");
 return false;
}

/*
 alert("validateModifyProject");
	rc= validateNewProject(thisform, locale, 'update');
	if (rc==false) {
	   return false;
	}  
	
// 15-11-2008 Pone en 0 los que son checked ( esto es porque si estaba en 
// desactivado y pasa a activado, no cambia el value , que queda en 1 lo cual es erroneo
if ( laundry.tv.checked == 1 ) {
  alert ("laundry checked");
  laundry.tv.value = "0";
}


if ( thisform.dvd.checked == 1 ) {
  thisform.dvd.value = "0";
}
if ( thisform.allowinternet.checked == 1 ) {
  thisform.allowinternet.value = "0";
}
if ( thisform.heating.checked == 1 ) {
  thisform.heating.value = "0";
}
if ( thisform.airconditioning.checked == 1 ) {
  thisform.airconditioning.value = "0";
}
if ( thisform.musicequipment.checked == 1 ) {
  thisform.musicequipment.value = "0";
}
if ( thisform.phone.checked == 1 ) {
  thisform.phone.value = "0";
}
if ( thisform.microwave.checked == 1 ) {
  thisform.microwave.value = "0";
}
if ( thisform.fridge.checked == 1 ) {
  thisform.fridge.value = "0";
}
if ( thisform.toaster.checked == 1 ) {
  thisform.toaster.value = "0";
}
if ( thisform.washingmachine.checked == 1 ) {
  thisform.washingmachine.value = "0";
}
*/	



function validateModifyNewProject(thisform, locale) {
//  alert("NOV 20072");

	/* Se debria chequear con la direccion no sea vacia, etc 
	rc= validateNewProject(thisform, locale, 'update');
	if (rc==false) {
	   return false;
	}  
    */
	
	// 15-11-2008 Pone en 0 los que son checked ( esto es porque si estaba en 
	// desactivado y pasa a activado, no cambia el value , que queda en 1 lo cual es erroneo
	if ( thisform.pool.checked == 1 ) {
	  // alert ("laundry checked");
	  thisform.pool.value = "0";
	}
	if ( thisform.laundry.checked == 1 ) {
	  // alert ("laundry checked");
	  thisform.laundry.value = "0";
	}
	if ( thisform.solarium.checked == 1 ) {
	  // alert ("laundry checked");
	  thisform.solarium.value = "0";
	}
	if ( thisform.sum.checked == 1 ) {
	  // alert ("laundry checked");
	  thisform.sum.value = "0";
	}
	if ( thisform.sauna.checked == 1 ) {
	  // alert ("laundry checked");
	  thisform.sauna.value = "0";
	}
	if ( thisform.gym.checked == 1 ) {
	  // alert ("laundry checked");
	  thisform.gym.value = "0";
	}
	if ( thisform.garage.checked == 1 ) {
	  // alert ("laundry checked");
	  thisform.garage.value = "0";
	}
	if ( thisform.vigilance.checked == 1 ) {
	  // alert ("laundry checked");
	  thisform.vigilance.value = "0";
	}
	if ( thisform.jacuzzi.checked == 1 ) {
	  // alert ("laundry checked");
	  thisform.jacuzzi.value = "0";
	}
	if ( thisform.deposit.checked == 1 ) {
	  // alert ("laundry checked");
	  thisform.deposit.value = "0";
	}

 
}


