
var slide = 0;
var slided = 1;
var cantidad = 10;


$("document").ready(function(){

	$(".hide_foto").css("height","170px");
	$("#hide_foto_0").show();
	$("#link_tube_1").show();
	$("#hide_foto_a_0").show();
	$("#hide_foto_b_0").show();
	slide++;
	slided++;

	var timer1 = setInterval(function(){
		$(".hide_foto").hide();
		$("#hide_foto_"+slide).show();
		$("#hide_foto_a_"+slide).show();
		$("#hide_foto_b_"+slide).show();
		if(slide == cantidad-1){ slide = 0;}
		else { slide++;}
	},4000);
	
	var timer0 = setInterval(function(){
		$(".link_tube").hide();
		if(slided > 5) { slided = 1;}
		$("#link_tube_"+slided).show();
		slided++;
	},4000);

	$(".link_tube, .link_tube2").click(function(){
		$("#vuela").show();
		$("#vuela").css("z-index","51111111");
		$("#vuela").html("");
		var url = $(this).attr("rel");
		var html = '<object width="425" height="344"><param id="flash_movie_1" name="movie" value="'+url+'"></param><param name="allowFullScreen" value="true"></param><param name="allowscriptaccess" value="always"></param><embed id="flash_movie_2" src="'+url+'" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" width="425" height="344"></embed></object><a href="javascript:;" onclick="cierra();">Cerrar</a>';
		$("#vuela").html(html);
	});
	
	/* *************** *******/
		$('a[name=modal]').click(function(e) {
		e.preventDefault();
		var id = $(this).attr('modal');
		var maskHeight = $(document).height();
		var maskWidth = $(window).width();
		$('#mask').css({'width':maskWidth,'height':maskHeight});
		$('#mask').fadeIn(1000);
		$('#mask').fadeTo("slow",0.8);
		var winH = $(window).height();
		var winW = $(window).width();
		$(id).fadeIn(2000);
        var altura = $(id).css('top');
        $('html').animate({ scrollTop: altura }, "fast");
	});

	$('.window .close, .window_basket .close, .window_barcelona .close').click(function (e) {
		e.preventDefault();
		$('#mask').hide();
		$('.window').hide();
		$('.window_basket').hide();
		$('.window_barcelona').hide();
	});

	$('#mask').click(function () {
		$(this).hide();
		$('.window').hide();
		$('.window_basket').hide();
		$('.window_barcelona').hide();
		$('body').css({'height':'auto','overflow':'visible'});
	});
	/* ************************ *******/
});
	
function cierra(){ $("#vuela").hide(); }
function cierra2(){ $("#vuela2").hide(); }

function switchUltimasListado2(){
	try{
		var obj = $('.cont_com');
		var mas = $('#mas_hide_c');
		var clo = $('#close_hide_c');
		if(obj.css('height')=='850px'){
			obj.css('height','1700px');
			mas.hide();
			clo.show();
			return;
		}
		obj.css('height','850px');
		mas.show();
		clo.hide();
	}
	catch(e){}
}

function switchUltimasListado(){
	try	{
		var obj = $('.scrollagenda');
		var mas = $('#mas_hide');
		var clo = $('#close_hide');
		if(obj.css('height')=='420px'){
			obj.css('height','auto');
			mas.hide();
			clo.show();
			return;
		}
		obj.css('height','420px');
		mas.show();
		clo.hide();
	}
	catch(e){}
}
function popUp(url){
	window.open(url,'_blank', 'height=100,width=330,status=yes');
}
function changeImagen(i){
	try{
		i = i==18 ? i = 1 : ++i;
		$("#fullsize").find('img').attr('src','/resources/fullsize/'+i+'.jpg');
		setTimeout('changeImagen('+i+')',3000);
	}catch(e){}
}
function go2scroll(id){
    var altura = $(id).offset().top;
    $('html').animate({ scrollTop: altura }, "fast");
}

