//MENUS//
//CON JQUERY
jQuery.noConflict();

jQuery(document).ready(function(){
	jQuery('a.boton_volver').click(function(){
		history.back();
		return false;
	});
});
function hoverOn(eventObject){
	var objectChild = jQuery(eventObject).children('div.cajon_foto_contenedor').children('img.cajon_fotocolor');
	jQuery(objectChild).fadeOut("fast");
}
function hoverOff(eventObject){
	var objectChild = jQuery(eventObject).children('div.cajon_foto_contenedor').children('img.cajon_fotocolor');
	jQuery(objectChild).fadeIn("fast"); 
}


jQuery(document).ready(function(){													
	jQuery('a.cajon .cajon_fotocolor').each(function(){
		var rel = jQuery(this).attr("rel");
		var src = jQuery(this).attr("src");
		var width = jQuery(this).width();
		var height = jQuery(this).height();
		jQuery(this).attr("rel",src).attr("src",rel);
		jQuery(this).wrap('<div class="cajon_foto_contenedor"></div>').parent().css("background-image","url("+src+")");												 
	});	
	jQuery('a.cajon .cajon_foto_contenedor:has(.cajon_fotocolor_grande)').addClass("cajon_foto_contenedor_grande");
	jQuery('a.cajon .cajon_foto_contenedor:has(.cajon_fotocolor_mas_grande)').addClass("cajon_foto_contenedor_mas_grande");
	jQuery('a.cajon .cajon_foto_contenedor:has(.cajon_peu)').addClass("cajon_foto_contenedor_peu");
	jQuery('a.cajon .cajon_foto_contenedor:has(.cajon_banner)').addClass("cajon_foto_contenedor_banner");
});

jQuery(document).ready(function(){
	jQuery('a.cajon').hover(function(){hoverOn(this)},function(){hoverOff(this)});		
});
function PreloadImg(){
	var img = new Image();
	img.src="im/content/foto02.jpg";
	img.src="im/content/foto03.jpg";
	img.src="im/content/foto04.jpg";
	img.src="im/content/foto05.jpg";
	img.src="im/content/foto06.jpg";
	img.src="im/content/foto07.jpg";
	img.src="im/content/foto08.jpg";
}
var img = 1;
function slideshowHome(i){
	img ++;
	if(img>8){
		img = 1;	
	}
	jQuery('img#slideshow').ImageSwitch({
		Type: "FadeIn", // Type of effect to run the function
		NewImage: "im/content/foto0"+img+".jpg", //The new image will be loaded in
		EffectOriginal: true,
		Speed: 1000, //Speed of the effect
	});	
}
jQuery(document).ready(function(){
		PreloadImg();						
});
jQuery(document).everyTime(3000, function(i) {
  slideshowHome(i);
},0);


