$(function() {
	$('#galeriaPiscinas a').lightBox();
});

jQuery.fn.simpleSlide = function(a){

	a				= a || {};
	a.duration		= a.duration || 5000;
	a.transition	= a.transition || 1000;

	var	c	= $(this);

	$(c).css("position","relative");

	$("img",$(c))
		.css({
			'position'	: 'absolute',
			'top'		: '0px',
			'left'		: '0px',
			'z-index'	: '8'
			})
		.find(":first")
			.addClass("slide-active")
			.css('z-index','10');

	setInterval(function(){

			var $active = $("img.slide-active",$(c));

			if($active.length == 0) $active = $("img:last",$(c));

			var $next	= $active.next().length ? $active.next() : $("img:first",$(c));

			$active
				.addClass("slide-last-active")
				.css('z-index','9');

			$next
				.css({opacity: 0.0})
				.addClass("slide-active")
				.css('z-index','10')
				.animate({opacity: 1.0}, a.transition, function(){
					$active
						.removeClass('slide-active slide-last-active')
						.css('z-index','8');
				});
		}, a.duration);

}

$(document).ready(function(){
	$("#boxImg_intro").simpleSlide();
});

$(document).ready(function(){
	$("#restoBox").simpleSlide();
});

$(document).ready(function(){
	$("#LalaBox").simpleSlide();
});

$(document).ready(function(){
	$("#buffeteBox").simpleSlide();
});

$(document).ready(function(){
	$("#boxImgPiscinas").simpleSlide();
});

$(document).ready(function(){
	$("#boxImgHotel").simpleSlide();
});

$(document).ready(function(){
	$("#boxImgHosteria").simpleSlide();
});

function toggleMenu(nuevo) {
	 //----Oculto todos----- 
	 for (i=1; i < 6; i++)
       	document.getElementById("Navegador"+i).style.display = "none"; //preparo para actualizar menu mostrando inicio
	 for (j=1; j < 13; j++)
       	document.getElementById("Contenido"+j).style.display = "none"; //preparo para mostrar contenido poniendo en blanco
	 //-----Muestro nuevo------ 
   	 if(nuevo < 6 ){
		document.getElementById("Navegador"+nuevo).style.display = "block";} // muestro menu actualizado
	 document.getElementById("Contenido"+nuevo).style.display = "block"; // muestro contenido actualizado
}

function toggleSubMenu(nuevo) {
	//----Oculto anterior------ 
	for (i=1; i < 13; i++)
      	document.getElementById("Contenido"+i).style.display = "none"; //preparo para mostrar contenido poniendo en blanco
	//-----Muestro actual------ 
	document.getElementById("Contenido"+nuevo).style.display = "block";
}

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() {
    $("#showcase").showcase({
        //css: {width: "", height: "" },  
        animation: { type: "fade" },
        images: [
        { url:"obj_img/home/imagen_1_final.jpg", description: "Termas Concordia - Relax en Armonía"},
        { url:"obj_img/home/imagen_2_final.jpg", description: "Termas Concordia - Naturaleza Pura"},
        { url:"obj_img/home/imagen_3_final.jpg", description: "Termas Concordia - Un lugar diferente"},
        { url:"obj_img/home/imagen_4_final.jpg", description: "Termas Concordia - Unicas por Naturaleza"}
		        ],
 
     navigator: { position: "top-right", orientation: "vertical", autoHide: true,
                 css: { padding:"6px", margin: "12px 0px 0px 0px" },
                 item: {
                     css: { height:"8px", width:"8px", "-moz-border-radius": "8px", "-webkit-border-radius": "8px",
                            backgroundColor: "Transparent", borderColor:"#878787" },
                     cssHover: { backgroundColor: "#ababab" },
                     cssSelected: { backgroundColor: "#dadada", borderColor: "#dadada" }
                 }
    },          

        titleBar: { /*enabled:false*/ css: { backgroundColor: "#2c546f", color: "Black", fontSize: "1.4em", opacity: "0.75" } }
    });
});

var color = 0;
var suma = 10;
function overlay(){
 elem = document.getElementById("overlay");
 elem.style.display="none";
 //elem.style.visibility="hidden";
 obj = document.getElementById("global");
 obj.style.display = "block";
 color += suma;
if (!(color>=110)){
obj.style.filter = 'alpha(opacity='+color+')';
			 obj.style.opacity = color /100;
			 obj.style.MozOpacity = color /100;
			 obj.style.KHTMLOpacity = color /100;
      		 window.setTimeout("overlay();", 100);
				  }
}

