jQuery.noConflict();

// Read the QS to get the current language
function getQSParam(ParamName) {
  	var QS = window.location.toString(); 
  	var indSta = QS.indexOf(ParamName); 
	var valore = QS.substring(indSta+ParamName.length+1,indSta+ParamName.length+2);
  	return valore;
}

jQuery(document).ready(function() {
	
	// External Links
	jQuery('a[rel="external"]').click( function() {
		window.open( jQuery(this).attr('href') );
	    return false;
	});
	
	
	// => Flash Header HP
	jQuery("#new_teaser").flash({
	    src: '/Flash/banner_HOME-SMALL_' + (getQSParam("intLangID") == 1 ? "it" : "en") + '.swf',
	    width: 470,
	    height: 260,
		wmode: 'transparent',
		flashvars: { langid: getQSParam("intLangID") }
	}, { 
		version: 8 
	});
	
	
	/* => Flash Header HP
	jQuery("#inedicola_teaser").flash({
	    src: '/Flash/585-banner_HOMEPAGE_' + (getQSParam("intLangID") == 1 ? "it" : "en") + '.swf',
	    width: 785,
	    height: 320,
		wmode: 'transparent',
		flashvars: { langid: getQSParam("intLangID") }
	}, { 
		version: 8 
	});*/
	
	// => Flash Blow
	jQuery("#flashcontent2").flash({
	    src: 'main.swf',
	    width: 390,
	    height: 221,
		wmode: 'transparent'
	}, { 
		version: 8 
	});
	
	// => Flash Yoox
	jQuery("#flashcontent-yoox").flash({
	    src: '/Flash/box_interni_new2.swf',
	    width: 390,
	    height: 340
	}, { 
		version: 8 
	});
	
	// => NAVIGATION ROLL DOWN
	var navigationHeight = jQuery("#navigation").height();
	jQuery("#navigation").height(0).show();
	jQuery("#navigationwrapper").hover(
		function(){
			jQuery("#navigation").stop(true,false).animate({ height: navigationHeight  }, 400 );
		},
		function(){
			jQuery("#navigation").stop(true,false).animate({ height: 0 }, 400 );
		}
	);
	
	// Change link for Interni Magazine new issuu
	jQuery("div.footercolumnfirst ul li:first > a").attr("href","/Site/PageFlip,intLangID," + (getQSParam("intLangID") == 1 ? "it" : "en") + ".html");
	
	// Add Limited Edition to Main Nav
	jQuery("div.footercolumnfirst ul li:last").after(
		"<li><a href='/Site/PageFlip-Limited,intLangID,1.html' class='submenu'>In&Out Door</a></li>"
	);
	
	// => Cufon
	Cufon.replace('#navbar a',{ hover: true });
	Cufon.replace('#MagazineNav a',{ hover: true });
	Cufon.replace('.home_section h2');
	Cufon.replace('.interni_system h2');
	Cufon.replace('h2');
	Cufon.replace('h3.MagNum');
	Cufon.replace('#MagazineNavInterni a');
});

