function SubmitAccmSearch(){
	var error=false;

	var provincia = document.buscadorAlojamientos['provincia'].value;
	var categoria = document.buscadorAlojamientos['categoria'].value

	if ( (provincia=="0") && (categoria=="0") && (document.getElementById('ciudad').value=="") && (document.getElementById('nombre').value=="") ){
			alert('Al menos debes seleccionar un parametro de busqueda');
			error=true;
	}
	if ( (document.getElementById('ciudad').value!="")  ){
		if (document.getElementById('ciudad').value.length<4){
			alert('En el campo ciudad debes ingresar por lo menos 4 letras.');
			error=true;
		}
	}
	if ( (document.getElementById('nombre').value!="")  ){
		if (document.getElementById('nombre').value.length<4){
			alert('En el campo nombre debes ingresar por lo menos 4 letras.');
			error=true;
		}
	}
	if (!error){
		document.buscadorAlojamientos.submit();
	}
}
function SubmitPaquetes(){
	var error=false;
	if (!error){
		document.buscadorPaquete.submit();
	}
}

function buscarAlojamientos(){
		ChangeObjectVisibility("buscadorAlojamientos",true);
		ChangeObjectVisibility("buscadorPaquetes",false);
}

function buscarPaquetes(){
	ChangeObjectVisibility("buscadorAlojamientos",false);
	ChangeObjectVisibility("buscadorPaquetes",true);
}


function ChangeObjectVisibility(objetoDIV,condicion){
	var objeto=GetLayerStyle(objetoDIV);
	if(objeto){
		if(condicion){
			objeto.display="block";
		}else{
			objeto.display="none";
		}
		return true;
	}else{
		return false;
	}
}

function GetLayerStyle(_2a){
	if(document.getElementById&&document.getElementById(_2a)){
		return document.getElementById(_2a).style;
	}else{
		if(document.all&&document.all(_2a)){
			return document.all(_2a).style;
		}else{
			if(document.layers&&document.layers[_2a]){
				return document.layers[_2a];
			}else{
				return false;
			}
		}
	}
}
	
function ShowContent(_16){
	var _17=document.getElementById(_16);
	var _18=document.getElementById("lnk_"+_16);
	if(document.getElementById("img_"+_16)!=null){
		var _19=document.getElementById("img_"+_16);
	}
	if(_17.style.display=="none"){
		_17.style.display="block";
		if(document.getElementById("img_"+_16)!=null){
			_19.src="/_en/images/icon_h3_show.gif";
		}
		if(_18){
			_18.className="linkArr";
		}
	}else{
		_17.style.display="none";
		if(document.getElementById("img_"+_16)!=null){
			_19.src="/_en/images/icon_h3_hide.gif";
		}
		if(_18){
			_18.className="activeArr";
		}		
	}
}

function init(){

	if (document.getElementById('sb_starting')){	
		Calendar.setup({inputField:"sb_starting", ifFormat:"%d/%m/%Y", showsTime:false,timeFormat:"24", button:"sb_btn_starting", singleClick:true, step:1});
	}
}

function changeTab(nombreTab,numero){
	
	// OCULTO TODAS LAS PESTAÑAS
	document.getElementById('tabGeneral').style.display="none";
	document.getElementById('tabHabitaciones').style.display="none";
	document.getElementById('tabFotos').style.display="none";
	document.getElementById('tabLlegar').style.display="none";
	document.getElementById('tabContacto').style.display="none";
	
/*	// NO MARCO NINGUN TAB
	document.getElementById('menuTab1').className="first";
	document.getElementById('menuTab2').className="gg";
	document.getElementById('menuTab3').className="";
	document.getElementById('menuTab4').className="gg";
	document.getElementById('menuTab5').className="";
	document.getElementById('menuTab6').className="gg";
	document.getElementById('menuTab7').className="";
	document.getElementById('menuTab8').className="gg";
	document.getElementById('menuTab9').className="";
	document.getElementById('menuTab10').className="g";
*/	

	document.getElementById(nombreTab).style.display="block"
			
/*	//ME FIJO SI NO ES LA PRIMERA
	if (numero!=1){
		var menuTab0=document.getElementById('menuTab' + (numero-1) );
		var menuTab=document.getElementById('menuTab' + numero);
		menuTab0.className="gb";
		menuTab.className="active";
	}
	else{
		var menuTab=document.getElementById('menuTab' + numero);
		menuTab.className="firstActive";
	}
	
	var menuTab2=document.getElementById('menuTab' + (numero+1) );
	menuTab2.className="bg";
	
	//ME FIJO SI NO ES LA ULTIMA
	if (numero==9){
		menuTab2.className="b";
	}
*/
}
	
function showImage(iPhoto){
	//-- hide the old image description and then show the new
	ChangeObjectVisibility('img_desc_'+currImg, false);
	ChangeObjectVisibility('img_desc_'+iPhoto, true);
	currImg = iPhoto;
}

function contactar(id){
	window.open("/contactarAlojamientoView.php?id=" + id , "Contacto",'left=250,top=250,width=505,height=335,status=no,toolbar=no,resizable=no');

}

function abrirAvisoLegal(){
	window.open("/include/avisoLegal.htm", "AvisoLegal",'left=250,top=250,width=755,height=435,status=no,toolbar=no,scrollbars=yes');
}


function mostrarCiudad(id){
	if (document.getElementById(id).style.display=="block"){
		document.getElementById(id).style.display="none";
		document.getElementById('linkCiudad').firstChild.nodeValue='Más Ciudades >>';
		
	}
	else{
		document.getElementById(id).style.display="block";
		document.getElementById('linkCiudad').firstChild.nodeValue='Ocultar <<';	
	}
}

function isEmail(string) {
	return (string.search(/^\w+((-\w+)|(\.\w+))*\@[A-Za-z0-9]+((\.|-)[A-Za-z0-9]+)*\.[A-Za-z0-9]+$/) != -1);
}

function SubmitContacto(){
	if ( (document.getElementById('de').value=="") ){
		alert('Debe ingresar su nombre');
		return false;
	}
	if (!isEmail(document.getElementById('email').value)){
		alert('El email ingresado no es valido','');
		return false;
	}

	if ( (document.getElementById('asunto').value=="")  ){
		alert('Debe completar el motivo del contacto.');
		return false;
	}
	new Ajax.Request('/contactar.php',{
			method:'post',
			parameters: $('contactarAlojamiento').serialize(true),
			onSuccess: function(transport){
				var mensajeContacto = document.getElementById("mensajeContacto");
				mensajeContacto.innerHTML="";
				mensajeContacto.style.display="none";
				var formularioContacto = document.getElementById("formularioContacto");
				formularioContacto.innerHTML= transport.responseText;
			},
			onLoading: function(){
				/*Se puede borrar, esta en el generico */
				var mensajeContacto = document.getElementById("mensajeContacto");
				mensajeContacto.style.display="block";
				mensajeContacto.innerHTML="Enviando mensaje...";  
			}
	 });
}

function verFoto(url){
/*  	
	var newImg = new Image();
    newImg.src = url;
    var height = newImg.height;
    var width = newImg.width;
*/
	window.open('/muestraFoto.php?url=' + url, "Foto",'left=250,top=250,width=300,height=200,status=no,toolbar=no,resizable=no');
}

function cambiarImagen(fotoIMG){
    
    var newImg = new Image();
    newImg.src = "http://www.clickalojamientos.com.ar/images/hotel/" + fotoIMG;;
    var height = newImg.height;
    var width = newImg.width;
 	elem = document.getElementById("fotoPrincipal");
    elem.src = "http://www.clickalojamientos.com.ar/images/hotel/" + fotoIMG;
    elem.width = newImg.width;
    if (width>430){
        elem.width =430;
    }
   
}

var currImg=1
function showImage(iPhoto){
	//-- hide the old image description and then show the new
	ChangeObjectVisibility('img_desc_'+currImg, false);
	ChangeObjectVisibility('img_desc_'+iPhoto, true);
	currImg = iPhoto;
	
	elem = document.getElementById('fotoGrande'+iPhoto);
    if (elem.width >431){
		elem.width = 430;
	}
    
}


