$(function() {
	jQuery('a[@rel*=lightbox]').lightBox({
	overlayBgColor: '#000',
	overlayOpacity: 0.0,
	imageBtnClose: '/interactiva/img/interactiva/lightbox-btn-close.gif',
	imageBtnPrev: '/interactiva/img/interactiva/lightbox-btn-prev.gif',
	imageBtnNext: '/interactiva/img/interactiva/lightbox-btn-next.gif',
	containerResizeSpeed: 350,
	txtImage: 'Imagen',
	txtOf: 'de'
	});
});

function ocultoPie(){
	jQuery("#Footer01").slideUp("fast");
	jQuery("#Footer02").slideUp("fast");
	jQuery("#Footer03").slideUp("fast");
	jQuery("#Footer04").slideUp("fast");
	jQuery("#Footer05").slideUp("fast");
}
function openComents(){
	jQuery("#comentarios").slideToggle("fast");
}

function mycarousel_initCallback(carousel){
	// Disable autoscrolling if the user clicks the prev or next button.
	carousel.buttonNext.bind('click', function() {
		carousel.startAuto(0);
	});

	carousel.buttonPrev.bind('click', function() {
		carousel.startAuto(0);
		});

	// Pause autoscrolling if the user moves with the cursor over the clip.
	carousel.clip.hover(function() { carousel.stopAuto(); }, function() {
		carousel.startAuto();
	});
};

jQuery().ready(function(){
		jQuery('#navigation').accordion({ 
		active: '.selected', 
		header: '.accordion', 
		navigation: true, 
		event: 'click', 
		fillSpace: false,
		autoheight: false,
		animated: 'bounceslide' //false easeslide bounceslide
	});
	jQuery("#mycarousel").jcarousel({ wrap: 'last', scroll: 3, initCallback: mycarousel_initCallback });
	jQuery(".Fsecc").bind("mouseenter", function () {
		ocultoPie();
		var domEl = "#Footer"+jQuery(this).get(0).id;
		jQuery(domEl).slideDown("fast");
	});
	jQuery(".Fsecc").bind("mouseleave", function () {
		ocultoPie();
	});
	jQuery('#enlace2').nyroModal({
		bgColor: '#cc3333'
	});

	jQuery(".ICONFUENTEUP").click(function (){
		actual = parseInt(jQuery("#contenidoArt").css("font-size"))+2
		if(actual>20){actual = 20;}
		jQuery("#contenidoArt").css("fontSize",actual+"px");
	});
	jQuery(".ICONFUENTEDOWN").click(function (){
		actual = parseInt(jQuery("#contenidoArt").css("font-size"))-2
		if(actual<10){actual = 10;}
		jQuery("#contenidoArt").css("fontSize",actual+"px");
	});
	jQuery(".ICONPRINT").click(function (){
		window.print();
	});
	jQuery(".ICONENVIO").click(function (){
		jQuery("#envioamigo").slideToggle("fast");
	});
	jQuery("#enlace_papel").click(function (){
		jQuery(".anuncio_papel").show("slow");
		jQuery(".anuncio_online").hide();
		return false;
	});
	jQuery("#enlace_online").click(function (){
		jQuery(".anuncio_papel").hide();
		jQuery(".anuncio_online").show("slow");
		return false;
	});
	jQuery("#MagazineId").change(function (){
		var selected = jQuery('#MagazineId').val(); 
		if(selected == "interactiva"){
			jQuery("#rates_interactiva").show("slow");
			jQuery("#rates_estrategias").hide();
			jQuery("#rates_control").hide();
		}
		if(selected == "estrategias"){
			jQuery("#rates_interactiva").hide();
			jQuery("#rates_estrategias").show("slow");
			jQuery("#rates_control").hide();
		}
		if(selected == "control"){
			jQuery("#rates_interactiva").hide();
			jQuery("#rates_estrategias").hide();
			jQuery("#rates_control").show("slow");
		}
		jQuery(".anuncio_papel").show("slow");
		jQuery(".anuncio_online").hide();
	});
	jQuery(".ratesPijama").hover(
		function () {
			jQuery(this).addClass("ratesPijamaOn");
		}, 
		function () {
			jQuery(this).removeClass("ratesPijamaOn");
		}
	);
	jQuery("#sumarySelect").change(function (){
		var sumaryUrl= jQuery('#sumarySelect').val(); //gets the value of the drop down
		var html = jQuery.ajax({url: sumaryUrl, data: {forceDownload:true}, async: false}).responseText; 
		if(html){
			jQuery("#sumaryContainer").html(html);
		}
	});
	jQuery(".nivel1").click(function (){				 
		jQuery(".nivel2").slideUp("fast");
		jQuery(".nivel3").slideUp("fast");
		jQuery(this).nextAll().slideDown("fast");
		jQuery(".nivel1").css("color","#777");
		jQuery(".nivel2open").css("color","#777");
		jQuery(this).css("color","#378284");
		return false;
	});
	jQuery(".nivel2open").click(function (){
		jQuery(".nivel3").slideUp("fast");
		jQuery(this).next().slideDown("fast");
		jQuery(".nivel2open").css("color","#777");
		jQuery(this).css("color","#378284");
		return false;
	});
	jQuery(".nivel2openv2").click(function (){
		jQuery(".nivel3").slideUp("fast");
		//alert(jQuery("#"+this.rel).css('display'));
		if(jQuery("#"+this.rel).css('display') == 'block'){
			jQuery("#"+this.rel).slideUp("fast");
		}else{
			jQuery("#"+this.rel).slideDown("fast");
		}
		
		return false;
	});
});