// · · · · · · · · · · · · · · · · · · · · · Adobe Dreamweaver 
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];}
}

// · · · · · · · · · · · · · · · · · · · · · Global Red 
function swapDisplay(object, displaied){ //v1.1
	var obj = document.getElementById(object);
	if (displaied == undefined) {
		if (obj.style.display == 'block') { obj.style.display = 'none'; } else { obj.style.display = 'block'; }
	} else {
		if (displaied) { obj.style.display = 'block'; } else { obj.style.display = 'none'; }
	}
}
function swapDisplayAll(object, displaied, el_type) {
	if (el_type == undefined) el_type = 'div';
	var list = document.getElementsByTagName(el_type);
	for (i = 0; i < list.length; i++) {
		if (list[i].id.substr(0, object.length) == object) {
			swapDisplay(list[i].id, displaied);
		}
	}
}
function bodyOffHeight(){ //v1.0
	var h = (document.body.scrollHeight)+'px';
	document.getElementById('bodyOff').style.height= h;
}
function bodyOff(){ //v1.0
	var w = (document.body.scrollWidth)+'px';
	var h = (document.body.scrollHeight)+'px';
	document.getElementById('body_off').style.width= w;
	document.getElementById('body_off').style.height= h;
}
// JQUERY 
$(document).ready(function(){		   
	// Menu - hide & Show					   
	$("#menu_b_hide").click(function(){
		$("#menu").animate({opacity: "0",top: "-50"}, 800)
		$("#menu_b_show").animate({opacity: "1", top: "0"}, 1000)
		return false;
		}
	);
	$("#menu_b_show").click(function(){
		$("#menu").animate({opacity: "1",top: "0"}, 800)
		$("#menu_b_show").animate({opacity: "0",top: "-50"}, 1000)
		return false;
		}
	);
	// Util Menu - hide & Show					   
	$("#utilmenu_b_hide").click(function(){
		$("#util_menu").animate({opacity: "0",top: "-50"}, 800)
		$("#utilmenu_avanced").animate({opacity: "1", top: "0"}, 1000)
		return false;
		}
	);
	$("#utilmenu_b_show").click(function(){
		$("#util_menu").animate({opacity: "1",top: "0"}, 800)
		$("#utilmenu_avanced").animate({opacity: "0",top: "-460"}, 1000)
		return false;
		}
	);
	// Description - hide & Show					   
	$("#list a").hover(
		function() {
			$(this).children(".description").stop(true,true).fadeIn(400);
		},
		function () {
			$(this).children(".description").stop(true,true).fadeOut(1000);
			//$(this).children(".description");
		}
	);
	
	/*$("#list a").hover(
		function() {
			$(this).children(".description").show();
		},
		function () {
			$(this).children(".description").hide();
		}
	);
	$(".description").mouseover(
		function() {
			$(this).show();
		}
	);*/
	$(".description").hide();
	
	// List_Promo Description - hide & Show					   
	$("#photos_list a").hover(
		function() {
			$(this).children(".description").stop(true,true).fadeIn(400); // $(this).children(".description").show();
		},
		function () {
			$(this).children(".description").stop(true,true).fadeOut(1000); // $(this).children(".description").hide();
		}
	);
	$(".description").mouseover(
		function() {
			$(this).show();
		}
	);
	$(".description").hide();
	
	// Wins pager-left - hide & Show					   
	/*$("#content a").mouseup(
		function() {
			$(this).next("#win_selector").stop(true,true).fadeIn(400);
		},
		function () {
			$(this).next("#win_selector").stop(true,true).fadeOut(1000);
			//$(this).children(".description");
		}
	);
	$("#win_selector img#bClose1").mouseup(
		function () {
			$(this).parent("#win_selector").animate({ opacity: "hide" }, "slow");
		}
	);*/
	$("#content .pager-left").click(function(e) {
		switch(e.target.id){
		case "win_selector1":  
            //change status & style menu  
            $("#win_selector1").addClass("active");  
            $("#win_selector2").removeClass("active");  
            $("#win_selector3").removeClass("active");  
            //display selected division, hide others  
            $("div.win1").fadeIn(400);  
            $("div.win2").css("display", "none");  
            $("div.win3").css("display", "none");  
        break;
		case "win_selector2":  
            //change status & style menu  
            $("#win_selector1").removeClass("active");  
            $("#win_selector2").addClass("active");  
            $("#win_selector3").removeClass("active");  
            //display selected division, hide others  
            $("div.win1").css("display", "none");  
            $("div.win2").fadeIn(400);  
            $("div.win3").css("display", "none");  
        break;
		case "win_selector3":  
            //change status & style menu  
            $("#win_selector1").removeClass("active");  
            $("#win_selector2").removeClass("active");  
            $("#win_selector3").addClass("active");  
            //display selected division, hide others  
            $("div.win1").css("display", "none");  
            $("div.win2").css("display", "none");  
            $("div.win3").fadeIn(400);  
        break;
		}
		return false;
	});
	$(".bClose1").click(
		function () {
			$("div.win1").stop(true,true).fadeOut();
			$("div.win2").stop(true,true).fadeOut();
			$("div.win3").stop(true,true).fadeOut();
		}
	);
	// Form_Recommend - hide & Show					   
	$("#win_recomend").click(function() {
			$("#recomend").toggle();	
		}
	);
	//Win mini-calendar hide & show
	$(".calendar").click(function() {
			$("#win_calendar1").toggle();	
		}
	);
	
	// No usar win_calendar1
	
	$("#utilmenu_b_hide").click(function() {
			$("#win_calendar1").hide();
			return false;
		}
	);
	//Utilmenu Advanced Win mini-calendar hide & show
	$(".from_calendar_ico").click(function() {
			$("#win_calendar2").toggle();	
		}
	);
	
	// No usar win_calendar2
	
	$("#utilmenu_b_show").click(function() {
			$("#win_calendar2").hide();
			return false;
		}
	);
	$(".to_calendar_ico").click(function() {
			$("#win_calendar2").hide();
			return false;
		}
	);
	$(".to_calendar_ico").click(function() {
			$("#win_calendar3").toggle();	
		}
	);
	
	// No usar win_calendar3
	
	$("#utilmenu_b_show").click(function() {
			$("#win_calendar3").hide();
			return false;
		}
	);
	$(".from_calendar_ico").click(function() {
			$("#win_calendar3").hide();
			return false;
		}
	);
	//Villa Win mini-calendar hide & show
	$(".rv_from_calendar_ico").click(function() {
			$("#win_calendar4").toggle();	
		}
	);
	$("#win_calendar4 .win_bClose1").click(function() {
			$("#win_calendar4").toggle();
			return false;
		}
	);
	$(".rv_to_calendar_ico").click(function() {
			$("#win_calendar4").hide();
			return false;
		}
	);
	$(".rv_to_calendar_ico").click(function() {
			$("#win_calendar5").toggle();	
		}
	);
	$("#win_calendar5 .win_bClose1").click(function() {
			$("#win_calendar5").toggle();
			return false;
		}
	);
	$(".rv_from_calendar_ico").click(function() {
			$("#win_calendar5").hide();
			return false;
		}
	);
// Google maps - hide & Show					   
	$("#win_mapa1").click(function(){
		$("#body_off").show();
		$("#body_off").fadeTo(500, 0.80);
		//$("#body_off").fadeIn(500);
		$("#win_map").fadeIn(500);
		return false;
		}
	);
	$("#body_off").click(function(){
		//$("#body_off").fadeOut(200);
		$("#body_off").hide();
		$("#body_off").fadeTo(200, 0.00);
		$("#win_map").fadeOut(200);
		return false;
		}
	);
	$(".bClose1").click(function(){
		$("#body_off").hide();
		$("#body_off").fadeTo(200, 0.00);
		$("#win_map").fadeOut(200);
		return false;
		}
	);
// Capa agradecimiento - hide & Show					   
	
	// No usar $("#win_thanks1").click

	$("#body_off").click(function(){
		//$("#body_off").fadeOut(200);
		$("#body_off").hide();
		$("#body_off").fadeTo(200, 0.00);
		$("#win_thanks").fadeOut(200);
		return false;
		}
	);
	$(".bClose2").click(function(){
		$("#body_off").hide();
		$("#body_off").fadeTo(200, 0.00);
		$("#win_thanks").fadeOut(200);
		return false;
		}
	);
	//Init body_off
	$("#body_off").css("height", $(document).height());
	// No usar $("#body_off").fadeTo
	$("#win_map").hide();
	// No usar $("#win_thanks").hide
});


// Google maps
function galleryHide() {
	//$("#body_off").fadeOut(200);
	$("#body_off").fadeTo(200, 0.00, hide);
	$("#win_map").fadeOut(200);
	function hide() {
		  $("#body_off").hide();
	}
};
// Capa agradecimiento
function galleryHide() {
	//$("#body_off").fadeOut(200);
	$("#body_off").fadeTo(200, 0.00, hide);
	$("#win_thanks").fadeOut(200);
	function hide() {
		  $("#body_off").hide();
	}
};