

jQuery.noConflict();


function setFooterPosition(){
      mainHeight = jQuery('.main').height();
      colmainHeight = jQuery('.col-main').height() + jQuery('.footer').height();
      headerContainerHeight = jQuery('.header-container').height();
      newsHeight = jQuery('.newsContainer').height();
      
      jQuery('.slidesContainer').height(mainHeight - 10);
      
      jQuery('.logos-julbo').css('top', -500);
      
      if(newsHeight < colmainHeight) jQuery('.newsContainer').height(mainHeight - headerContainerHeight);
       
      
      if(colmainHeight >= mainHeight) {
        
        jQuery('.footer').removeClass('footerBottom0');
      }
      else{
         jQuery('.footer').addClass('footerBottom0');
      } 
      
      //if(mainHeight > 300) jQuery('.topButton').css('top', mainHeight - 100);
      //else jQuery('.topButton').css('top', 200);

}

function hover(){
  alert('1');
}


jQuery(document).ready(function() {

    

    jQuery('form').attr('autocomplete','off');

    jQuery('#mainMenu li > ul').hide();

    Cufon.replace('.main h1');
    Cufon.replace('.page-title h1');
    
    Cufon.replace('h2');
    Cufon.replace('.page-title h2'); 
    Cufon.replace('#mainMenu a', {	hover: true });
    Cufon.replace('.page-title h1');
    Cufon.replace('.product-collateral h2');
    
    Cufon.now();
    
    jQuery('#topButton').click(function() {
        jQuery('.topButton').animate({opacity: 0}, { queue: false, duration: 100 });
        jQuery('.main-container').animate({scrollTop: 0}, { queue: false, duration: 500 });
        
        return false; 
    });
    
    jQuery('.main-container').scroll(function(obj) {

      //jQuery('.topButton').css('top', jQuery('.main-container').scrollTop() + 200);
      if(jQuery(this).scrollTop() > 0) jQuery('.topButton').animate({opacity: 1 , top: jQuery(this).scrollTop() + 300}, { queue: false, duration: 500 });
      else jQuery('.topButton').animate({opacity: 0}, { queue: false, duration: 500 });
    });
    
    
    currentSlide = 0;
    
    slides 	=  	[		//Slideshow Images
														{image : '/skin/frontend/default/tingerlaat/images/slides/slide-1.jpg'},
														{image : '/skin/frontend/default/tingerlaat/images/slides/slide-2.jpg'},
														{image : '/skin/frontend/default/tingerlaat/images/slides/slide-3.jpg'}
												];
	  colors 	=  	['','d2242e', 'DB5C00', '1e9dd5'];
												
		imagepath		=	'/skin/frontend/default/tingerlaat/images/', //Default image path
    										
    setFooterPosition();
    if(jQuery('.cms-home')) jQuery(function($){
				$.supersized({
				
					//Functionality
					slideshow               :   1,		//Slideshow on/off
					autoplay				:	0,		//Slideshow starts playing automatically
					start_slide             :   1,		//Start slide (0 is random)
					random					: 	0,		//Randomize slide order (Ignores start slide)
					slide_interval          :   3000,	//Length between transitions
					transition              :   6, 		//0-None, 1-Fade, 2-Slide Top, 3-Slide Right, 4-Slide Bottom, 5-Slide Left, 6-Carousel Right, 7-Carousel Left
					transition_speed		:	500,	//Speed of transition
					new_window				:	1,		//Image links open in new window/tab
					pause_hover             :   0,		//Pause slideshow on hover
					keyboard_nav            :   1,		//Keyboard navigation on/off
					performance				:	1,		//0-Normal, 1-Hybrid speed/quality, 2-Optimizes image quality, 3-Optimizes transition speed // (Only works for Firefox/IE, not Webkit)
					image_protect			:	1,		//Disables image dragging and right click with Javascript
					image_path       : imagepath,

					//Size & Position
					min_width		        :   1024,		//Min width allowed (in pixels)
					min_height		        :   768,		//Min height allowed (in pixels)
					vertical_center         :   1,		//Vertically center background
					horizontal_center       :   1,		//Horizontally center background
					fit_portrait         	:   1,		//Portrait images will not exceed browser height
					fit_landscape			:   0,		//Landscape images will not exceed browser width
					
					//Components
					navigation              :   1,		//Slideshow controls on/off
					thumbnail_navigation    :   1,		//Thumbnail navigation
					slide_counter           :   0,		//Display slide numbers
					slide_captions          :   0,		//Slide caption (Pull from "title" in slides array)
					slides                  :   slides
												
				}); 
		    });
		    
		 jQuery('#plus-de-news').click(function() {
		 height = jQuery('.slidesContainer').height() + 20;
        jQuery('.main-container').animate({scrollTop: '+=' + height  + 'px'}, 400);

      });
      
       jQuery('#retourSlides').click(function() {
       height = jQuery('.slidesContainer').height() + 20;
        jQuery('.main-container').animate({scrollTop: '-=' + height + 'px'}, 400);

      });
      
      jQuery('#nextslide').click(function() {
          jQuery('.navSlide').hide();
          
          
          
          if(currentSlide < slides.length) currentSlide++;
          else currentSlide = 1;

          jQuery('#accroche').css('background', 'transparent url('+imagepath+'slides/accroche-'+currentSlide+'.png) no-repeat left top');
          jQuery('.navSlide' + currentSlide).show();
          jQuery('.navSlide' + currentSlide + ' img.visuSlide').attr('src', imagepath + 'slides/visu-produit-' + currentSlide + '.png');
          jQuery('.navSlide' + currentSlide + ' a.linkSlide').css('color', '#' + colors[currentSlide]);
          jQuery('.navSlide' + currentSlide + ' a.loupeSlide').css('background-color', '#' + colors[currentSlide]);
      });
      
      jQuery('#nextslide').click();
      
      
      jQuery('.product-name').each(function(){
        var me = jQuery(this);
        me.html( me.html().replace(/(^\w+)/,'$1<br />') );
      }); 
      
      
      jQuery(".super-attribute-select").selectBox();
      
      jQuery(".clearSports").height(jQuery(".sports").height() + 100);
      if(!jQuery("body.cms-index-index").length) jQuery('#supersized-loader').hide(); 
      
      
      jQuery('li.item').hover(
        function(){jQuery(this).find('.product-shop').show();},
          function(){
          jQuery(this).find('.product-shop').hide();
          }
        );
      
});


jQuery(window).resize(function() {
     setFooterPosition();
});
     
