// JavaScript Document
jQuery(document).ready(function(){
			
		 //global replacement
     Cufon.replace('div.Header div.Menu ul li a', { fontFamily: 'Nimbus Sans D OT', hover: true, hoverables: { li: true, a: true } });
     Cufon.replace('div.Main h1', { fontFamily: 'Classico URW T OT' });
     
		 //news replacement
		 Cufon.replace('div.Main div.NewsBox div.NewsInside div.NewsItem a', { fontFamily: 'Nimbus Sans D OT', hover: true, hoverables: { a: true } });
     Cufon.replace('div.Main div.PromoBox h2.Promotions', { fontFamily: 'Nimbus Sans D OT' });
     Cufon.replace('div.Main div.PromoBox a', { fontFamily: 'Nimbus Sans D OT', hover: true, hoverables: { a: true } });
     
     /* mainmenu onload */
     $("div.Header div.Menu ul.secondLevel").each(function(){
          var parLeft = $("div.Header div.Menu ul.secondLevel").parent("li").position();
          var thisLeft = (parLeft.left-251);
          $(this).css("left", "-"+thisLeft+"px");
     });
     $("div.Header div.Menu li.active").children('ul').show();
     
     /* spec footer */
     $("div.Layout.Gray").each(function(){
          $("div.Footer").hide();
          $("div.FooterHP").show();
     });
     
     	
     /* mainmenu hover */
		 $("div.Header div.Menu ul.firstLevel > li > a").hover(function() {
		        if ( $(".Layout").hasClass("Home")==false ){
		 
     				  $("div.Header div.Menu ul.secondLevel").hide();
     					if ( $(this).parent().children("ul.secondLevel").length ) {
     							$("div.Home div.Header div.MenuSecondRow").slideDown('fast');
     							$(this).parent().children("ul.secondLevel").show();
     					} 
				      }
                
		        }
		        

			);
			
			
			
		 /* leftmenu onload */
		 $("div.LeftColumn div.Menu ul.thirdLevel").hide();
		 $("div.LeftColumn div.Menu li.active").children('ul').slideDown(800);	

		 /*varianty onload*/
     swapVariety( $("div.Varieties li:first") );
     
     /*varianty swap event*/
			$("div.Varieties li").click(
				function() {
				  swapVariety(this);
				}
			);
			
			/*prvni odstavec produktu*/
			$("div.RightColumn div.Inner div.ProductColumn div.Body p:first").addClass('Red');
			
			/*prodlouzeni vysky produktoveho sloupce*/
			$("div.ProductColumn").height( $("div.Inner").height() );
			/*prodlouzeni vysky promo sloupce*/
			$("div.PromoBox").height( $("div.Main").height()-101 );
			
});

function swapVariety(variety) {
		boxView = $("div.BoxView");
		preparationView = $("div.PreparationView");
		
		currentImg = boxView.children("img");
// 		currentImg.fadeOut();
		currentImg.remove();
		
		currentPrep = preparationView.children('div.Preparation');
// 		currentPrep.fadeOut();
		currentPrep.remove();
		
		newImage = $(variety).children('img').clone();
		boxView.append(newImage);
		newImage.fadeIn();
		
		newPrep = $(variety).children('div.Preparation').clone();
		preparationView.append(newPrep);
		newPrep.fadeIn();
}



