// JavaScript Document


//fonction Show & hide champ formulaire
jQuery(document).ready(function(){
$('div#gusRegistreInfo .inputWrapper').addClass('dnone');

 $('.Vconsul').click(function () {
 $('div#gusRegistreInfo .inputWrapper').addClass('dnone');
  $('.Vconsul').removeClass('dnone');
  $(this).prev().removeClass('dnone');
  $(this).addClass('dnone');
     }).filter(this.hash).click();
       return false;
 });

//fonction Tab produit & marque dans la home page
jQuery(document).ready(function(){
  $('#HCat div').hide();
  $('#HCat div:first').show();
  $('#HCat ul li a:first').addClass('active');

  $('#EngCat li a').click(function(){
    $('#HCat ul li a').removeClass('active');
    $(this).addClass('active');
    var currentTab = $(this).attr('href');
    $('#HCat div').hide();
    $(currentTab).show();
    return false;
    });
});


// fonction fermer popup
$(document).ready(function (){
	$('.fermer').click(function(){
    jQuery(this).parent().slideUp(200);
     return false;
    });
});



// fonction tabl détail produits
jQuery(document).ready(function(){
var tabContainers = $('div#TabProd > div');
  tabContainers.hide().filter(':first').show();
  $('div#TabProd ul li a').click(function () {
  tabContainers.hide();
  tabContainers.filter(this.hash).show();
  $('div#TabProd ul li a').removeClass('active');
  $(this).addClass('active');
  return false;
     }).filter(':first').click();
 });


// fonction Menu
jQuery(document).ready(function() {

      function addMega(){
        $(this).addClass("hovering");
        }

      function removeMega(){
        $(this).removeClass("hovering");
        }

    var megaConfig = {
         interval: 50,
         sensitivity: 900,
         over: addMega,
         timeout: 20,
         out: removeMega
    };

    $("li.mega").hoverIntent(megaConfig)

});


// fonction menu left acordient
function initMenu() {
  $('#lefmenu dl').hide();
  $('#lefmenu li a').click(
    function() {
      var checkElement = $(this).next();
      var McheckElement = $(this);
      if((checkElement.is('dl')) && (checkElement.is(':visible'))) {
        return false;
        }
      if((checkElement.is('dl')) && (!checkElement.is(':visible'))) {
      $('#lefmenu dl:visible').slideUp('normal');
        checkElement.slideDown('normal');
        $('#lefmenu li a').removeClass('active');
        $(this).addClass('active');
        return false;
        }
        if((McheckElement.is('a#Uniq'))) {
        $('#lefmenu dl:visible').slideUp('normal');
        $('#lefmenu li a').removeClass('active');
        $(this).addClass('active');
        return false;
        }

      }
    );
  }
$(document).ready(function() {initMenu();});


$(document).ready(function () {
	$('a#gusRegistre_Info').click(function (e) {
		e.preventDefault();
		$('#gusRegistreInfo').modal({
		  containerCss:{
    		padding:20,
    		width:730
    	},
        onOpen: function (dialog) {
    	dialog.overlay.fadeIn('slow', function () {
  		dialog.data.hide();
  		dialog.container.fadeIn('slow', function () {
  	   	dialog.data.slideDown('slow');
  		});
  	    });
        },
    	overlayClose:true
    });
 });

 $('a#gusRegistre_Add').click(function (e) {
		e.preventDefault();
		$('#gusRegistre').modal({
		  containerCss:{
    		padding:20,
    		width:730
    	},
        onOpen: function (dialog) {
    	dialog.overlay.fadeIn('slow', function () {
  		dialog.data.hide();
  		dialog.container.fadeIn('slow', function () {
  	   	dialog.data.slideDown('slow');
  		});
  	    });
        },
    	overlayClose:true
    });
 });

 $('a#gusRegistre_Login').click(function (e) {
		e.preventDefault();
		$('#gusLogin').modal({
		  containerCss:{
    		padding:20,
    		width:456,
            position: [50,]

    	},
        onOpen: function (dialog) {
    	dialog.overlay.fadeIn('slow', function () {
  		dialog.data.hide();
  		dialog.container.fadeIn('slow', function () {
  	   	dialog.data.slideDown('slow');
  		});
  	    });
        },
        overlayClose:true
   });
});

// popup site en contruction

 $('a#construction').click(function (e) {
		e.preventDefault();
		$('#fcont').modal({
		  containerCss:{
    		padding:20,
    		width:456,
            position: [50,]

    	},
        onOpen: function (dialog) {
    	dialog.overlay.fadeIn('slow', function () {
  		dialog.data.hide();
  		dialog.container.fadeIn('slow', function () {
  	   	dialog.data.slideDown('slow');
  		});
  	    });
        },
        overlayClose:true
   });
});
});

// fonction "select" list marque
/*jQuery(document).ready(function($) {
	$('#SelecMarque').SelectCustomizer();
    return false;
});*/

function MM_jumpMenu(targ,selObj,restore){ //v3.0
  eval(targ+".location='"+selObj.options[selObj.selectedIndex].value+"'");
  if (restore) selObj.selectedIndex=0;
};



$(document).ready(function(){

      $(".jqzoom").jqueryzoom({
        xzoom: 456, //zooming div default width(default width value is 200)
        yzoom: 310, //zooming div default width(default height value is 200)
        offset: 11, //zooming div default offset(default offset value is 10)
        position: "right", //zooming div position(default position value is "right")
        preload: 1 , // preload of images :1 by default
        lens:1 // lens over the image 1 by default

        });
     });


$(document).ready(function() {

	//Show Banner
	$("#product-img-box").show(); //Show Banner
	$("#product-img-box img").animate({ opacity: 1 }, 1 ); //Set Opacity

	//Click and Hover events for thumbnail list
	$("#thumbnails ul li a:first").addClass('active');
	$("#thumbnails ul li").click(function(){
       //Set Variables
		var imgAlt = $(this).find('img').attr("alt"); //Get Alt Tag of Image
	  	var imgTitle = $(this).find('a').attr("href"); //Get Main Image URL
        var imgJq = $(this).find('a').attr("jqimg"); //Get Alt Tag of Image

		if ($(this).is(".active")) {  //If it's already active, then...
			return false; // Don't click through
		} else {
			//Animate the Teaser
            $("#product-img-box").addClass('loading');
			$("#product-img-box img").animate({ opacity: 0}, 250, function () {
         	$("#product-img-box img").attr({ src: imgTitle , alt: imgAlt, jqimg: imgJq});
            $("#product-img-box img").load(function () {
              //$(this).css('display', 'none'); // .hide() doesn't work in Safari when the element isn't on the DOM already
              //$(this).hide();
              $('#product-img-box').removeClass('loading').append(this);
              $(this).animate({ opacity: 1}, 250 );
          }).error(function () {
              // notify the user that the image could not be loaded
          })
        });
		}


		$("#thumbnails ul li").removeClass('active'); //Remove class of 'active' on all lists
		$(this).addClass('active');  //add class of 'active' on this list only
		return false;

	}) .hover(function(){
		$(this).addClass('hover');
		}, function() {
		$(this).removeClass('hover');
	});



});


	function change_input_stye(param,hasFocus){
			//if(hasFocus == true ) {alert(param)}
			document.getElementById(param).style.color='#3A2A09';
			document.getElementById(param).style.border='2px solid #3A2A09';
			document.getElementById(param).style.backgroundColor='#ffffff';
	}

	function change_hover_style(param){
			document.getElementById(param).style.border='2px solid #0569FF';
	}


	function change_input_rtn(param,hasFocus){
			document.getElementById(param).style.border='2px solid #dddddd';
			document.getElementById(param).style.backgroundColor='#E8E8E8';
	}


	function change_out_style(param){
			document.getElementById(param).style.border='2px solid #dddddd';
			document.getElementById(param).style.backgroundColor='#E8E8E8';
	}


