Cufon.replace('.menu ul:has(ul) > li   a, .title, .collection-title, .press-title, .entra_btn, .box_main_collection, .box_main_collectionbaby ',{  hover: true });
var $j = jQuery.noConflict();
// execute your scripts when the DOM is ready. this is a good habit 


$j(document).ready(function(){
							
					
$j(".main img").hide();
$j(".main img").fadeIn(1000);



// intro page


$j(".logo-intro, .img-intro, .entra_btn").hide();
$j(".img-intro, .entra_btn").fadeIn(3000);

// setTimeout(function() {
 //       $j(".logo-intro").fadeIn("slow", 1)
//    }, 1000);

$j(".logo-intro").fadeIn(3000);

$j(".entra_btn").click(function(){
$j('.intro-overlay').fadeOut(1000); // This should set the opacity to 100% on hover
});




											 
$j(".box_left ul li, .box_right ul li").append("<span></span>");



$j(".box_main_collection ul li").append("<span></span>");

$j(".box_main_collection ul li").hover(function(){
		 $j(this).find("span").hide(500); // This should set the opacity to 100% on hover
		 },function(){
		 $j(this).find("span").show(500); // This should set the opacity back to 30% on mouseout
 });

$j(".box_main_collectionbaby ul li").append("<span></span>");

$j(".box_main_collectionbaby ul li").hover(function(){
		 $j(this).find("span").hide(500); // This should set the opacity to 100% on hover
		 },function(){
		 $j(this).find("span").show(500); // This should set the opacity back to 30% on mouseout
 });



//prova

$j(".desktop_anteprime ul li").append("<span></span>");

$j(".desktop_anteprime ul li").hover(function(){
		 $j(this).find("span").hide(500); // This should set the opacity to 100% on hover
		 },function(){
		 $j(this).find("span").show(500); // This should set the opacity back to 30% on mouseout
 });

$j(".iphone_anteprime ul li").append("<span></span>");

$j(".iphone_anteprime ul li").hover(function(){
		 $j(this).find("span").hide(500); // This should set the opacity to 100% on hover
		 },function(){
		 $j(this).find("span").show(500); // This should set the opacity back to 30% on mouseout
 });
$j("li#shop").hover(function(){
		$j(".boutique_bg").toggleClass("on");					 
});
//fine

	
$j(".box_left ul li, .box_right ul li").click(function() {
	  window.location = $j(this).find("a").attr("href");
});

$j(".sub-menu-collezioni ul li").click(function() {
	  window.location = $j(this).find("a").attr("href");
});


//fine

$j(".box_left ul li, .box_right ul li").hover(function(){
		 $j(this).find("span").fadeTo(500, 0); // This should set the opacity to 100% on hover
		 },function(){
		 $j(this).find("span").fadeTo(500, 1.0); // This should set the opacity back to 30% on mouseout
 });

$j(".box_contatti").hover(function(){
		 $j(this).fadeTo(500, 1.0); // This should set the opacity to 100% on hover
		 },function(){
		 $j(this).fadeTo(500, 0.5); // This should set the opacity back to 30% on mouseout
 });

$j(".lingua").hover(function(){
		 $j(this).fadeTo(500, 1.0); // This should set the opacity to 100% on hover
		 },function(){
		 $j(this).fadeTo(500, 0.5); // This should set the opacity back to 30% on mouseout
 });

// sub menu collezioni
$j(".sub-menu-collezioni ul li").append("<span></span>");
$j(".sub-menu-collezioni ul li").hover(function(){
		 $j(this).find("span").fadeTo(500, 0); // This should set the opacity to 100% on hover
		 },function(){
		 $j(this).find("span").fadeTo(500, 1.0); // This should set the opacity back to 30% on mouseout
 });




$j("a.fancy").fancybox({});

//prova
$j(".sub-menu-press").hide();
$j("body.presscut .sub-menu-press").slideToggle(1000);

$j(".submenu-press-testi").hide();
$j(".submenu-press-testi").fadeTo(2000, 1);



//fine prova

$j(".sub-menu-collezioni").hide();
$j(".sub-menu-collezioni").fadeIn(500);

$j(".sub-menu-collezioni").hide();
$j(".sub-menu-collezioni").slideToggle(1000);



$j(".menu ul li ul").hide();



$j(".menu ul li").hover(function(){
		 $j(this).find("ul").slideDown('fast'); // This should set the opacity to 100% on hover
		 $j(this).toggleClass("active");// e aggiungi anche a questo (li) la classe "active"
		 },function(){
		 $j(this).find("ul").slideUp('slow'); // This should set the opacity back to 30% on mouseout
		 $j(this).toggleClass("active");// e aggiungi anche a questo (li) la classe "active"
		 
 });

//
//$j(".menu ul li").hover(function(){ // Quando passi sopra alla voce di menu
//	  $j(this).find("ul").slideDown('fast'); // nel caso in cui trovi un UL, tiralo giu e sbrighete pure
//	  $j(this).toggleClass("active");// e aggiungi anche a questo (li) la classe "active"
//	  }, function(){ // else ... altrimenti
//		$j(this).parent().find("ul").slideUp('slow'); //When the mouse hovers out of the subnav, move it back up
//	  $j(this).parent()
//});



/* gallery */

	var basic_4 = new ImageFlow();
	basic_4.init({ ImageFlowID: 'collection-slider', 
                   reflections: false, 
                   reflectionP: 0.0, 
                   slider: true,
                   captions: false,
				   scrollbarP: 1,
				   sliderWidth: 130,
				   circular: true,
				   startID: 3,
				   opacity: true,
				   onClick: false

				    });	
	
	$j(".slider_presscut").easySlider({
		auto: false,
		continuous: true,
		speed: 		1500,
		pause: 2000


		
	});
	
	/* Codice prodotto (Edit: Cr@zyMind - Minds2Code) */
	$j("#collection-slider img").click(function() {
		var imgPath = $j(this).attr("src");
		var startPos = parseInt(imgPath.lastIndexOf('/')) + 5;
		var code = imgPath.substring(startPos, imgPath.length - 4);
		
		$j("#code").html("COD. " + code.replace('+', ','));
	});
	
	setTimeout (function() { 
		$j("#collection-slider img").each(function(index) {
			if ($j(this).css('opacity') == 1)
			{
				var imgPath = $j(this).attr("src");;
				var startPos = parseInt(imgPath.lastIndexOf('/')) + 5;
				var code = imgPath.substring(startPos, imgPath.length - 4);
				
				$j("#code").html("COD. " + code.replace('+', ','));
				return false;
			}
		});
	},1900);  
});




