// JavaScript para ver mas so ver menos (contactenos)
oculto1="none";
visible1="block";
	
function mostrar_info_conta(blo1,ver_off1,ver_on1) {

  document.getElementById(blo1).style.display		=visible1;
  document.getElementById(ver_off1).style.display	=oculto1;
  document.getElementById(ver_on1).style.display	=visible1;
}
 
function ocultar_info_conta(blo1,ver_off1,ver_on1) {
  document.getElementById(blo1).style.display		=oculto1;
  document.getElementById(ver_off1).style.display	=visible1;
  document.getElementById(ver_on1).style.display	=oculto1;
}


// JavaScript para ver mas so ver menos
oculto1="none";
visible1="block";
	
function mostrar_info(blo1,ver_off1,ver_on1) {
  document.getElementById(blo1).style.display		=visible1;
  document.getElementById(ver_off1).style.display	=visible1;
  document.getElementById(ver_on1).style.display	=oculto1;
}
 
function ocultar_info(blo1,ver_off1,ver_on1) {
  document.getElementById(blo1).style.display		=oculto1;
  document.getElementById(ver_off1).style.display	=oculto1;
  document.getElementById(ver_on1).style.display	=visible1;
}

// JavaScript para ver los tags
OCULTO="none";
VISIBLE="block";
function mostrar(cor) {
  document.getElementById(cor).style.display=VISIBLE;
}
function ocultar(cor) {
  document.getElementById(cor).style.display=OCULTO;
}

// JavaScript Document
<!--
function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}
//-->
<!-- 
function closebar(){
		//document.cookie="remainclosed=1";
		document.getElementById("topbar").style.visibility="hidden";
		document.getElementById("topbaritem").style.visibility="hidden";
		document.getElementById("topbaritem11").style.visibility="hidden";
		document.getElementById("topbaritem21").style.visibility="hidden";
		document.getElementById("topbaritem22").style.visibility="hidden";
		document.getElementById("topbaritem23").style.visibility="hidden";
		document.getElementById("topbaritem24").style.visibility="hidden";
		document.getElementById("rela_topbaritem11").style.visibility="hidden";		
		//document.getElementById("topbar").style.display="none";
}
//-->






/******************************************INICIO CODIGO PARA POPUP ************************************/
<!--
var win= null;
function OpenNewWindow(mypage,w,h,myname){
	var winl = (screen.width-w)/2;
	var wint = (screen.height-h)/2;
	settings='height='+h+',width='+w+',top='+wint+',left='+winl+',scrollbars=no,toolbar=no,location=no,status=no,menubar=no,resizable=no,dependent=no'
	win=window.open(mypage,myname,settings)
if(parseInt(navigator.appVersion) >= 4){win.window.focus();}
}
function fixedsize(thepage) {
	netscape = (navigator.appName == "Netscape");
	n4 = netscape && (parseInt(navigator.appVersion) >= 4);
	explorer = (navigator.appName == "Microsoft Internet Explorer");
	ie = explorer && (parseInt(navigator.appVersion) >= 4);
	ie4 = explorer && (parseInt(navigator.appVersion) == 4);
	ie5 = explorer && (navigator.appVersion.indexOf('MSIE 5') > 0);
	mac = navigator.userAgent.indexOf('Mac') > 0;
	win = navigator.userAgent.indexOf('Win') > 0;
	if (mac) {
	  newwin=window.open(thepage,"","resizable=yes")
	//  if (document.all){
		newwin.moveTo(0,0);
		newwin.resizeTo(screen.width,screen.height); 
	//  }
	}
	else {
	  if (ie) {
		window.open(thepage,"","fullscreen=yes,toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=no,copyhistory=no");
	  } else {
		newwin=window.open(thepage)
		if (document.all){
		  newwin.moveTo(0,0);
		  newwin.resizeTo(screen.width,screen.height);
		}
	  }
	}
}
/******************************************INICIO CODIGO PARA HOTEL ************************************/


<!--
function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function viewMap(n) {
    thisMovie("gallery"+n).showMap();
}
function viewBiggerMap() {
    thisMovie("citymap").showBiggerMap();
}
function thisMovie(movieName) {
    if (navigator.appName.indexOf("Microsoft") != -1) {
        return window[movieName]
    }
    else {
        return document[movieName]
    }
}

function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}
//-->



/******************************DESTINO HOTELS********************************************/
function closebar(){
		//document.cookie="remainclosed=1";
		document.getElementById("topbar").style.visibility="hidden";
		document.getElementById("topbaritem").style.visibility="hidden";
		document.getElementById("topbaritem11").style.visibility="hidden";
		document.getElementById("topbaritem21").style.visibility="hidden";
		document.getElementById("topbaritem22").style.visibility="hidden";
		document.getElementById("topbaritem23").style.visibility="hidden";
		document.getElementById("topbaritem24").style.visibility="hidden";
		document.getElementById("rela_topbaritem11").style.visibility="hidden";		
//document.getElementById("topbar").style.display="none";
}

/******************************VALIDA TEXTO EMAILS********************************************/
function isEmailAddress(theElement, nombre_del_elemento )
{
var s = theElement.value;
//var filter=/^[A-Za-z][A-Za-z0-9_]*@[A-Za-z0-9_]+\.[A-Za-z0-9_.]+[A-za-z]$/;
var filter=/^([0-9a-zA-Z]([-.\w]*[0-9a-zA-Z])*@([0-9a-zA-Z][-\w]*[0-9a-zA-Z]\.)+[a-zA-Z]{2,9})$/;

if (s.length == 0 ) return true;
if (filter.test(s))
return true;
else
alert("Ingrese una direccion de correo valida");
theElement.focus();
return false;
}

/******************************VALIDA CONTACTENOS********************************************/


function tour_virtual(laurl, pWindowName) {
	var winwin;	
	var attrib;
    attrib = 'directories=no,status=yes,toolbar=no,menubar=no,scrollbars=yes';
    attrib = attrib + ',resizable=yes,location=no,maximize=yes';
    attrib = attrib + ',width=' + (screen.availWidth - 12).toString();
    attrib = attrib + ',height=' + (screen.availHeight - 122).toString();	
	attrib = attrib + ',screenX=0,screenY=0,left=0,top=0';

//	attrib += 'toolbar=no,menubar=no,scrollbars=yes,resizable=yes,location=no,maximize=yes';
//   sOptions = sOptions + ',screenX=0,screenY=0,left=0,top=0';
	
	winwin=window.open(laurl, pWindowName, attrib);
	winwin.focus();
	winwin.moveTo(0,0);
	winwin.resizeTo( screen.availWidth, screen.availHeight );
}

/**Calendario JQ**/

$(function() {
	if($.datepicker){
		$( "#datepicker" ).datepicker( "option", "showAnim", "fadeIn");
		$( "#datepicker" ).datepicker();
		var date = new Date();
		var m = date.getMonth(), d = date.getDate()+1, y = date.getFullYear();
		d2 = date.getDate()+2;			

		$( "#txtCI_1" ).datepicker( "option", "showAnim", "fadeIn");
		$( "#txtCI_1" ).datepicker({ minDate: new Date(y, m, d),dateFormat: 'dd-mm-yy', showOtherMonths: false,
			selectOtherMonths: false,constrainInput: true });
		$( "#txtCI_1" ).datepicker();
		$( "#txtCO_1" ).datepicker( "option", "showAnim", "fadeIn");
		$( "#txtCO_1" ).datepicker({ minDate: new Date(y, m, d2),dateFormat: 'dd-mm-yy', showOtherMonths: false,
			selectOtherMonths: false });			
		
		$( "#txtCI_2" ).datepicker( "option", "showAnim", "fadeIn");
		$( "#txtCI_2" ).datepicker({ minDate: new Date(y, m, d),dateFormat: 'dd-mm-yy', showOtherMonths: false,
			selectOtherMonths: false });
		$( "#txtCI_2" ).datepicker();
		$( "#txtCO_2" ).datepicker( "option", "showAnim", "fadeIn");
		$( "#txtCO_2" ).datepicker({ minDate: new Date(y, m, d2),dateFormat: 'dd-mm-yy', showOtherMonths: false,
			selectOtherMonths: false });	

		$( "#txtCI_3" ).datepicker( "option", "showAnim", "fadeIn");
		$( "#txtCI_3" ).datepicker({ minDate: new Date(y, m, d),dateFormat: 'dd-mm-yy', showOtherMonths: false,
			selectOtherMonths: false });
		$( "#txtCI_3" ).datepicker();
		$( "#txtCO_3" ).datepicker( "option", "showAnim", "fadeIn");
		$( "#txtCO_3" ).datepicker({ minDate: new Date(y, m, d2),dateFormat: 'dd-mm-yy', showOtherMonths: false,
			selectOtherMonths: false });	
		
		
		$( "#txtCI_4" ).datepicker( "option", "showAnim", "fadeIn");
		$( "#txtCI_4" ).datepicker({ minDate: new Date(y, m, d),dateFormat: 'dd-mm-yy', showOtherMonths: false,
			selectOtherMonths: false });
		$( "#txtCI_4" ).datepicker();
		$( "#txtCO_4" ).datepicker( "option", "showAnim", "fadeIn");
		$( "#txtCO_4" ).datepicker({ minDate: new Date(y, m, d2),dateFormat: 'dd-mm-yy', showOtherMonths: false,
			selectOtherMonths: false });	
		
		$( "#txtCI_5" ).datepicker( "option", "showAnim", "fadeIn");
		$( "#txtCI_5" ).datepicker({ minDate: new Date(y, m, d),dateFormat: 'dd-mm-yy', showOtherMonths: false,
			selectOtherMonths: false });
		$( "#txtCI_5" ).datepicker();
		$( "#txtCO_5" ).datepicker( "option", "showAnim", "fadeIn");
		$( "#txtCO_5" ).datepicker({ minDate: new Date(y, m, d2),dateFormat: 'dd-mm-yy', showOtherMonths: false,
			selectOtherMonths: false });	
		
		$( "#txtCI_6" ).datepicker( "option", "showAnim", "fadeIn");
		$( "#txtCI_6" ).datepicker({ minDate: new Date(y, m, d),dateFormat: 'dd-mm-yy', showOtherMonths: false,
			selectOtherMonths: false });
		$( "#txtCI_6" ).datepicker();
		$( "#txtCO_6" ).datepicker( "option", "showAnim", "fadeIn");
		$( "#txtCO_6" ).datepicker({ minDate: new Date(y, m, d2),dateFormat: 'dd-mm-yy', showOtherMonths: false,
			selectOtherMonths: false });
			
	}
	//Definiendo para la galeria de imagenes
	if($.Lightbox){
		$.Lightbox.construct({
			"show_linkback":    false,
			"download_link":	false,
			"show_helper_text": false,
			"show_extended_info" : true
			});
			
		}
	});
	



	function changeDateCO(id){
		var currCI_date = $( "#txtCI_"+id ).val();
		if(currCI_date!=""){
		var arrayCI_date = currCI_date.split("-");
		var dci = parseFloat(arrayCI_date[0]);
		var mci = parseFloat(arrayCI_date[1]);
		var yci = parseFloat(arrayCI_date[2]);

		 $('#txtCO_'+id).datepicker("setDate", new Date(yci,mci-1,dci+1) );
		}else{
			//$('#txtCI_1').val('Check-In');
			$('#txtCO_'+id).val('Check-out');
		}
	}
	
	function changeDateCOEsp(id){
		var currCI_date = $( "#txtCI_"+id ).val();
		if(currCI_date!=""){
			var arrayCI_date = currCI_date.split("-");
			var dci = parseFloat(arrayCI_date[0]);
			var mci = parseFloat(arrayCI_date[1]);
			var yci = parseFloat(arrayCI_date[2]);
	
			$('#txtCO_'+id).datepicker("setDate", new Date(yci,mci-1,dci+1) );
		}else{
			$('#txtCO_'+id).val('Salida');
		}
	}
	
	function validateSearch(id){
		$('#form_busqueda'+id).submit();
	}
	
	//changeDateCOEsp
	
		function promotion(idioma){
		switch(idioma){
			case 1: 
			location.href="http://www.casa-andina.com/peru/ofertas/ofertas.php";	
			break;
			case 2:
			location.href="http://www.casa-andina.com/peru/ofertas/ofertas.php";	
			break;
		}
	 }
	 
	function closeProm(idioma){
		switch(idioma){
			case 1: 
			//document.getElementById("promotion_esp").visibility="hidden";	
			document.getElementById("promotion_esp").style.display="none";	
			break;
			case 2:
			document.getElementById("promotion_eng").style.display="none";	
			break;
		}
		
	}
	/***/
	//onclick="_gaq.push(['_link', this.href]); return false;"

	function closeTA(){
		$("#flyer-ta").css('display','none');
	}
	
	function goReservations(lang){
		location.href="https://reservations.casa-andina.com/rr1.php?xi="+lang;	
	}
/*
 * Script para menu izquierdo, en caso de hotels 
 * 
 */
$(document).ready(function(){
	var filePath = window.location.pathname;
	var fileName = filePath.substr(filePath.lastIndexOf("/")+1);
	var l = $("#menuLeft ul li a").length;
	var ml = $("#multimediaLeft ul li a").length;
	
	$("#menuLeft ul li a").hover(
			function () {
				var indx = $("#menuLeft ul li.active").index();
				var clss = $(this).index('#menuLeft ul li a');
				
				if(indx!=clss){
					$(this).prepend($("<span>&gt; </span>"));
				}
			  }, 
			  function () {
			    $(this).find("span:last").remove();
	});
	activeMenu = function(pos,idtag){
		$(idtag+" ul li").eq(pos).prepend($("<span>&gt; </span>"));
		$(idtag+" ul li").eq(pos).addClass('active');
	}
	
	//activando menu
	for(i=0;i<l;i++){
		var n = $("#menuLeft ul li a").eq(i).attr('href');
		if(n==fileName){
			activeMenu(i,"#menuLeft");
		}
	}
	
	//Efecto de flecha en menu Multimedia
	$("#multimediaLeft ul li a").hover(
			function () {
				var floatbox = $("#multimediaLeft ul li a.lnk_Floatbox").length - 1;
				var indx = $("#multimediaLeft ul li.active").index();
				var clss = $(this).index('#multimediaLeft ul li a') - floatbox;
				if(indx!=clss){
					$(this).prepend($("<span>&gt; </span>"));
				}
			  }, 
			  function () {
			    $(this).find("span:last").remove();
	});
	
	//activando menu multimedia
	for(i=0;i<ml;i++){
		var n = $("#multimediaLeft ul li a").eq(i).attr('href');
		if(n==fileName){
			var floatbox = $("#multimediaLeft ul li a.lnk_Floatbox").length - 1;
			var pos = (i - floatbox);
			activeMenu(pos,"#multimediaLeft");
		}
	}
	
});	



/*
$(function(){
    $.Lightbox.construct({
        "show_linkback":    false,
    	"download_link":	false,
    	"show_helper_text": false,
		"show_extended_info" : true,
        });
    });*/

