/*
  onLoad
*/

$(function() {


    paginate();
    
    menuOnglets();
    desactivateLinksOnglets();
    
    accountAppear();
    accountDisappear();
                                  
    checkColor();
    checkMarque();     
    checkTailles();
    
    checkTypes(); 
    
    selectTrier();
    selectNbParPage();
    sizeClick();
    genderClick();
    marquesClick();
    colorsClick();
    typesClick();
    
    changeImage();       
    cart();         
    tailleDeroule(); 
    get3D();
    clickTailleUnique();
    selecteurArticle();

    createAccount();
    verifyAccount();
    selectShippingMethod();
    checkoutPayment();
    updateMoreQuantity();
    updateLessQuantity();
    
    fancyBoxInterface(); 
    selectedColor();
    survolCouleur();
});

/******************************
 * Début de la pagination
 ******************************/
 
function paginate()
{
    var show_per_page = $('#show_per_page').val();
    var number_of_items = $('#contentList').children().size();
    var number_of_pages = Math.ceil(number_of_items/show_per_page);
    var end = number_of_pages -1; 
    $('#current_page').val(0);
 
    var navigation_html = '<a href="javascript:go_to_page(0);">Debut</a>';
    navigation_html += '<a href="javascript:nav(-1);"><img src="images/template/previous-on.png" /></a>';
    var current_link = 0;
    while(number_of_pages > current_link){
        navigation_html += '<a class="page_link" href="javascript:go_to_page(' + current_link +')" longdesc="' + current_link +'">'+ (current_link + 1) +'</a>';
        current_link++;
    }
    navigation_html += '<a href="javascript:nav(+1);"><img src="images/template/next-on.png" /></a>';
    navigation_html += '<a href="javascript:go_to_page(' + end +')">Fin</a>';
 
    if (number_of_items > show_per_page)
    {
       $('.page_navigation').html(navigation_html);
    }
    else
    {
       $('.page_navigation').html('');
    }
    
    
    $('.page_navigation .page_link:first').addClass('active_page');
    $('#contentList').children().css('display', 'none');
    $('#contentList').children().slice(0, show_per_page).css('display', 'block');
    
    $('.nbResultat').html('Nombre de mod&#232;les trouv&#233;s : <span class="result">' + number_of_items + '</span>');
}

function nav(dir){
    if(dir==+1){
        new_page = parseInt($('#current_page').val()) + 1;
        if($('.active_page').next('.page_link').length==true){
            go_to_page(new_page);
        }
    }else if(dir==-1){
        new_page = parseInt($('#current_page').val()) - 1;
        if($('.active_page').prev('.page_link').length==true){
            go_to_page(new_page);
        }
    }
}
 
function go_to_page(page_num){
    var show_per_page = parseInt($('#show_per_page').val());
    start_from = page_num * show_per_page;
    end_on = start_from + show_per_page;
    $('#contentList').children().css('display', 'none').slice(start_from, end_on).css('display', 'block');
    $('.page_link[longdesc=' + page_num +']').addClass('active_page').siblings('.active_page').removeClass('active_page');
    $('#current_page').val(page_num);
}

/******************************
 * Fin de la pagination
 ******************************/
 
/******************************
 * Début des onglets
 ******************************/
function menuOnglets()
{
	$('#onglets li a').mouseenter(function(){

		var id = ($(this).parent().attr('class'));	
		$('.' + id + ' .hover-panel').fadeIn('fast');
		});
		
	$('#onglets li').mouseleave(function(){

		var id = ($(this).attr('class'));	
		$('.' + id + ' .hover-panel').fadeOut('fast');
	})
}

function desactivateLinksOnglets()
{
   $('a.mainCategories').click(function(){
      return false;
   });  
   $('a.mainCategories').css('cursor', 'default'); 
}

/******************************
 * Fin des onglets
 ******************************/
 
 /******************************
 * Début de Compte Client
 ******************************/
 
function accountAppear()
{
    if ($('.account_connect'))
    {
        $('#account_short').click(function(){
            $('.account_appear').toggle('slow');
            return false;
        });
    }
}

function accountDisappear()
{
    $('#close_account').click(function(){
        $('.account_appear').toggle('slow');
    });
}

/******************************
 * Fin de Compte Client
 ******************************/ 
 
 
 /******************************
 * Début Elements d'interface
 ******************************/  

function getArticlesRestants()
{
  var retour = '0';
  
  var listArticles = $('#contentList li').each(function(){
     if ($(this)) {retour += ', ' + $(this).attr('name');}
  });
    
  return retour;
}
 
function masquerCouleur(colors)
{                         
    var couleurs = colors.split('|');
    for (i=0; i < couleurs.length; i++)
    {
        if (couleurs[i] != '')
        {
            $('#' + couleurs[i]).parent().addClass("hidden");
        }
    }
}

function resetColors()
{
    $('#listColors li').removeClass("hidden");
    checkColor();
}

function masquerMarques(brands)
{   
    var marques = brands.split('|');
    for (i=0; i < marques.length; i++)
    {
        if (marques[i] != '')
        {
          $('#m_' + marques[i]).parent().addClass("hidden");
        }
    }
} 

function resetMarques()
{
    $('#tri_marque li').removeClass("hidden");
    checkMarque();
}

function masquerTypes(types)
{   
    var t = types.split('|');
    for (i=0; i < t.length; i++)
    {
        if (t[i] != '')
        {
          $('#t_' + t[i]).parent().addClass("hidden");
        }
    }
} 

function resetTypes()
{
    $('#search_type_vetement li').removeClass("hidden");
    checkTypes();
}

function masquerGenre(genre)
{   
  if (genre == 'Homme,')
  {
      $('#Femme').parent().addClass("hidden");
  }
  else if (genre == 'Femme,')
  {
      $('#Homme').parent().addClass("hidden");
  }
}

function resetGenres()
{
    $('#content_gender li').removeClass("hidden");
    checkGenre();
} 

function masquerTaille(tailles)
{
    // on masque toutes les tailles
    $('#searchSize li').addClass("hidden");
    var t = tailles.split('|');
    var text = '';
    for (i=0; i < t.length; i++)
    {
        if (t[i] != '')
        {
          // pour chaque lien du box attributes
          $('#searchSize li a').each(function(){
              // on récupère l'id
              var id = $(this).attr('id'); 
              var tab = id.split('|');
              // on affiche la taille renvoyée
              if (jQuery.inArray(t[i], tab) >= 0)
              {
                  $(this).parent().removeClass("hidden");
              }
          });
        }
    }
}

function resetTailles()
{
    $('#searchSize li').removeClass("hidden");
    checkTailles();
} 

function selectTrier()
{
  $('a.tri').click(function(){ 
  
  	var trier = $(this).attr("trier")
  	
    $('a.tri').removeClass("ok_select");
    $(this).addClass("ok_select");
    
    switch (trier)
    {
    case '4': $('#contentListBlock').html($('.nouveaute').html());
    		break;
    
    case '1': $('#contentListBlock').html($('.croissant').html()); 
     		break;
    
    case '2': $('#contentListBlock').html($('.decroissant').html());    		
    		break;
    }  
    
    paginate();  
  });
}

function selectNbParPage()
{
  $('a.pages').click(function(){ 
    $('#show_per_page').val($(this).attr("nbPages"));
    $('a.pages').removeClass("ok_select");
    $(this).addClass("ok_select");
    paginate();
  });
}

function updateParametres()
{                                         
    
}


function colorsClick()
{
      $('#searchColors #listColors li a').click(function(){
      
      // on récupère la sauvegarde
      var colors = $('#colors').val();
      
      var couleur = $(this).attr('id') + '|';
         
      //la couleur existe déjà
      if(colors.indexOf(couleur) >= 0 )
      {              
          // on la supprime
          colors = colors.replace(couleur, "");
          $(this).removeClass("checked");
      }
      else
      {
          // sinon on l'ajoute
          colors += $(this).attr('id') + '|'; 
          $(this).addClass("checked"); 
      }
      
      // on sauvegarde
      $('#colors').val(colors);
      
      if (!colors)
      {   	
  			getArticlesFromInterface();  
  		  paginate();
      }
      
      else
    	{
    		  getArticlesFromInterface();
    	}
    });
}

function marquesClick()
{
      $('#searchMarques #tri_marque li a').click(function(){
      
      
    	var marques = $('#marques').val();
    	var marque = $(this).attr('marque') + '|';
                
    	if (marques.indexOf(marque) >= 0)
    	{
      		marques = marques.replace(marque, "");
      		$(this).removeClass("checked");
    	}
    	else
    	{
      		marques += $(this).attr('marque') + '|';
      		$(this).addClass("checked"); 
    	}
                 
    	$('#marques').val(marques);

		if(!marques)
		{	
			getArticlesFromInterface();	
    	paginate();
		}
		else
		{
        getArticlesFromInterface();
		}
    });
}

function genderClick()
{
    $('#searchStyle li a').click(function(){
    
        var genres = $('#genre').val();
        var genre = $(this).attr('id') + '|'
        
        if (genres.indexOf(genre) >= 0)
        {
          genres = genres.replace(genre, "");
          $(this).removeClass("checked");
        }
        else
        {
          genres += $(this).attr('id') + '|';
          $(this).addClass("checked"); 
        }
                    
        $('#genre').val(genres);
                    
        getArticlesFromInterface();    
    });
}


function sizeClick()
{
  
    $('#searchAttributes #searchSize li a').click(function(){
       
    var tailles = $('#tailles').val();
    var taille = $(this).attr('id') + '|';
                
    if (tailles.indexOf(taille) >= 0)
    {
      tailles = tailles.replace(taille, "");
      $(this).removeClass("checked");
    }
    else
    {
      tailles += $(this).attr('id') + '|';
      $(this).addClass("checked"); 
    }
                
    $('#tailles').val(tailles);
                
    getArticlesFromInterface();
    });

}

function typesClick()
{
    $('.search_type_vetement li a').click(function(){
    
        var types = $('#types').val();
        var type = $(this).attr('type') + '|'
        
        if (types.indexOf(type) >= 0)
        {
          types = types.replace(type, "");
          $(this).removeClass("checked");
        }
        else
        {
          types += $(this).attr('type') + '|';
          $(this).addClass("checked"); 
        }
                    
        $('#types').val(types);
                    
        getArticlesFromInterface();
    
    });
}


function selectedColor()
{
  nbCouleurs = $('#colorModel').children().size();
  couleurSelectionnee = $('#colorClick').val();
  
  premiereCouleur = $('#colorModel').children(0).children(0).attr('id');
  
  // si aucune couleur n'est sélectionnée, on met la couleur par défaut
  if (couleurSelectionnee == '') { $('#colorClick').html(premiereCouleur);}
}

function survolCouleur()
{
  $('#colorModel li').mouseover(function(){
  
     $('#colorModel li').removeClass("color_select");
     $('#colorModel li').addClass("color_unselect");
     
     $(this).addClass("color_select");
     $(this).removeClass("color_unselect");
     
     // on place la dans la sélection
     $('#colorClick').html($(this).children(0).attr('id'));
  });
}


function fermerMiniPanier()
{
    $('#mini_cart').removeClass("block");
    $('#mini_cart').addClass("hidden");
}

function afficherMiniPanier()
{
    $('#mini_cart').removeClass("hidden");
    $('#mini_cart').addClass("block");
    $('#mini_cart').css('left', (jQuery(window).width() - 300)/ 2);
    $('#mini_cart').css('top', (jQuery(window).height() - 300)/ 2);
}

function updatePanierDroite()
{
    // article dans le panier
    var c_article = $('#count_nb_article').val();
    
    if (c_article == 0)
    {
        $('.nb_articles_caddy').html('1 article');
    }
    else
    {
        var new_count = parseInt(c_article) + 1;
        $('.nb_articles_caddy').html(new_count + ' articles');
    }

}
 
 /******************************
 * Fin Elements d'interface
 ******************************/     
 
 
 /******************************
 * Début appels Ajax
 ******************************/    
function getArticlesFromInterface()
{ 
  var articles_id = $('#save_articles_id').val();
  var marques = $('#marques').val();
  var tailles = $('#tailles').val();
  var genre = $('#genre').val();
  var colors = $('#colors').val();
  var types = $('#types').val();
  $('#contentList').css("opacity", "0.2");
    $('#wait').removeClass("hidden");
    $.ajax({
        type : "POST",
        url : "getSelectedArticles.php",
        data : "&articles_id=" + articles_id + "&marques=" + marques + "&tailles=" + tailles + "&genre=" + genre + "&colors=" + colors + "&types=" + types,
        success : function(data_ok){
           $('.expandedArticles').html(data_ok);
           paginate();   
           
        },
        complete : function(data_ok) {
          $('#contentList').css("opacity", "1");
          $('#wait').addClass("hidden");
        }
    });
}

function checkMarque()
{
    var listArticles = getArticlesRestants();
    if (listArticles != null)
    {
      $.ajax({
        type : "POST",
        url : "getManufacturers.php",
        data : "&articles_id=" + listArticles,
        success : function(data_ok){
            masquerMarques(data_ok);
        }
      });
    }
}


function checkColor()
{
    var listArticles = getArticlesRestants();
    if (listArticles != null)
    {
      $.ajax({
        type : "POST",
        url : "productsColors.php",
        data : "&colors_articles_id=" + listArticles,
        success : function(data_ok){
            masquerCouleur(data_ok);
        }
      });
    }
}

function checkTypes()
{
    var listArticles = getArticlesRestants();
    if (listArticles != null)
    {
      $.ajax({
        type : "POST",
        url : "getTypesVetement.php",
        data : "&articles_id=" + listArticles,
        success : function(data_ok){
            masquerTypes(data_ok);
        }
      });
    }
}

function checkGenre()
{
    var listArticles = getArticlesRestants();
    if (listArticles != null)
    {
      $.ajax({
        type : "POST",
        url : "getGenre.php",
        data : "&articles_id=" + listArticles,
        success : function(data_ok){
            masquerGenre(data_ok);
        }
      });
    }
}

function checkTailles()
{
    var listArticles = getArticlesRestants();
    if (listArticles != null)
    {
      $.ajax({
        type : "POST",
        url : "getSizes.php",
        data : "&articles_id=" + listArticles,
        success : function(data_ok){
            masquerTaille(data_ok);
        }
      });
    }
}

function addToMiniCart()
{
  $.ajax({
        type : "POST",
        url : "mini_cart.php",
        data : "&products_id=" + $('#products_id').val() + '&att_id=' + $('#att').val(),
        success : function(){
           afficherMiniPanier();
           updatePanierDroite();
        }
  });
}

 
/******************************
 * Fin appels Ajax
 ******************************/         
 
/******************************
 * Début éléments d'interface
 ******************************/

/*
'height'          : ((jQuery(window).height() ) - 75),
*/ 
 
function get3D()
{
  $("a.vue3DSwf").mousedown(function() {
     		
		$(this).fancybox({
		          'padding'		      : 0,
		          'title'			      : "Cliquez et passez la souris sur l'image pour faire tourner l'article",
			        'height'          : 500,
      		    'autoScale'     	: false,  
      		    'transitionIn'		: 'none',
      				'transitionOut'		: 'none',
      				'type'				    : 'swf'
    });

	return false;
  });
}

function zoomIndex()
{

    $('.productImage img').mouseenter(function(){
    
      $(this).animate({ 
        width: "150",
        height: "225"
      }, 500 );
      
    }).mouseleave(function(){
    
      $(this).animate({ 
        width: "120",
        height: "180"
      }, 500 );
    
    })
    ;
}

function clickTailleUnique()
{
    var attribut = $('.tailleUnique').attr('id');

    if (attribut == 20)
    {
      $('#att').val(attribut);
      $('#articlePrice').html($('#att'+ attribut).val());
      taille = $('#taille' + attribut).val();
      $('#sizeSelection').html(taille);
      $('#productSizeSelection').css("display", "block");
      $('#listProductSizes li.available').removeClass("active");
      $('.tailleUnique').addClass("active");
      var dispo = $('.tailleUnique').attr("dispo");
      
      if (dispo == 0) {$('#dispo_produit').html(' | <span="en_stock">En stockExp&#233;dition sous 24/48h</span>');}
      if (dispo == 1) {$('#dispo_produit').html(' | Exp&#233;dition sous 5 &#224; 10 jours');}
      if (dispo == 2) {$('#dispo_produit').html(' | Exp&#233;dition sous 15 jours');}
    }
    
}

function changeImage()
{
    $('#moreImagesList a').mouseover(function(){
      $('#fullImage a').attr('href', $(this).attr('href'));
      $('#fullImage img').attr('src', $(this).attr('href'));
      return false;
    });
    
}

function cart()
{
    $('.cartButton').mouseover(function(){
    
      $(this).addClass("cartButtonOver");
      $(this).removeClass("cartButton");
      
      if ($('#att').val() == '')
      {
          $('#toolTipCart').addClass("block");
          $('#toolTipCart').removeClass("hidden");
      }
      
      }).mouseout(function(){
      
      $(this).addClass("cartButton");
      $(this).removeClass("cartButtonOver");
      $('#toolTipCart').addClass("hidden");
      $('#toolTipCart').removeClass("block");
    });

}

function tailleDeroule()
{
  $('#listProductSizes li.available').mouseover(function(){
    $(this).addClass("over");
    
    // on affiche la dispo
    if ($('#att').val() == '')
    {
        attribut = $(this).attr('id');
    }
    else
    {
        attribut = $('#att').val();
    }
    $('#articlePrice').html($('#att'+ attribut).val());
    taille = $('#taille' + attribut).val();
    $('#sizeSelection').html(taille);
    var dispo = $(this).attr("dispo");
    
    if (dispo == 0) {$('#dispo_produit').html(' | <span class="en_stock">En stock Exp&#233;dition sous 24/48h</span>');}
    if (dispo == 1) {$('#dispo_produit').html(' | Exp&#233;dition sous 5 &#224; 10 jours');}
    if (dispo == 2) {$('#dispo_produit').html(' | Exp&#233;dition sous 15 jours');}
    
    
  }).mouseout(function(){
    $(this).removeClass("over");
    
  }).click(function(){
    taille = $(this).html();
    $('#mini_cart .details .sizeChoosen').html('Taille : ' + taille);
    attribut = $(this).attr('id');
    $('#att').val(attribut);
    $('#articlePrice').html($('#att'+ attribut).val());
    
    $('#listProductSizes li.available').removeClass("active");
    $(this).addClass("active");
    var dispo = $(this).attr("dispo");
    if (dispo == 0) { $('.en_stock').addClass('green'); }
  });
}

function verifySize()
{
  if ($('#att').val() == '')
  {
      $('#toolTipCart').addClass("block");
      $('#toolTipCart').removeClass("hidden");
  }
  else
  {  
  
    // $('#cart_quantity').submit();  
    addToMiniCart();         
    
  }

}

function resetInterface()
{
    $('#att').val('');
    $('#listProductSizes li.available').removeClass("active");
}

function selecteurArticle()
{
  $("li.listing").mouseover(function(){
    	$(this).css('border', '3px solid #ddd');
    }).mouseout(function(){
      $(this).css('border', '3px solid #fff');
    })
}

/*
function checkPrice(att)
{
    var price = $('#att' + att).val();
    $('p.prix').html(price);
}
*/
 
/******************************
 * Fin éléments d'interface
 ******************************/ 
 
/******************************
 * Début panier
 ******************************/  

function updateLessQuantity()
{
  $('.lessQty').click(function(){
    var id = $(this).attr('id');
    var nb = parseInt($('#ca' + id).val());
    if (nb > 1)
    {
      $('#ca' + id).val(nb - 1);
      $('#cart_quantity').submit(); 
    }
    else
    {
      suppr = parseInt(id.substr(5, 5));
      $('#cart_delete' + suppr).attr('checked', true);
      $('#cart_quantity').submit();
    }
      
  });
}

function updateMoreQuantity()
{
  $('.moreQty').click(function(){
    var id = $(this).attr('id');
    var nb = parseInt($('#c' + id).val());
    $('#c' + id).val(nb + 1);
    $('#cart_quantity').submit();
  });
}


function checkoutPayment() 
{
  $('#processCheckOutSubmit').click(function(){
    if ($('#conditionChk:checked').val() == undefined)
    {
          alert("Pour continuer, vous devez accepter les conditions générales de ventes.");
          return false;
    }
  });
}

function selectShippingMethod()
{
   $('.shipping_choice').click(function(){
   
      var c_id = $(this).attr('id');
      $('#ship' + c_id).attr('checked', true);
      $('#checkoutShippingMethod').submit();
      
   });
}

function verifyAccount()
{
    
    $('#createAccount .bouton').click(function(){
        
        var creerCompte = false;

        if ($('#password').val().length == 0)
        {
            $('#error_password').html('<img src="images/template/error.gif" alt="erreur" />6 caract&egrave;res minimum.');
            $('#password').focus();
            $('#password').select();
        }
        else if ($('#password').val() != $('#confirmation').val())
        {
            $('#error_confirm').html('<img src="images/template/error.gif" alt="erreur" />Les mots de passe sont diff&eacute;rents.');
            $('#password').focus();
            $('#password').select();
        }
        else if ($('#lastname').val().length < 2)
        {
            $('#error_lastname').html('<img src="images/template/error.gif" alt="erreur" />Veuillez entrer votre nom svp.');
        }
        else if ($('#firstname').val().length < 2)
        {
            $('#error_firstname').html('<img src="images/template/error.gif" alt="erreur" />Veuillez entrer votre pr&eacute;nom svp.');
        }
        else if ($('#street_address').val().length < 1)
        {
            $('#error_address').html('<img src="images/template/error.gif" alt="erreur" />Veuillez entrer votre adresse svp.');
        }
        else if ($('#postcode').val().length < 1)
        {
            $('#error_postcode').html('<img src="images/template/error.gif" alt="erreur" />Veuillez entrer votre code postal svp.');
        }
        else if ($('#city').val().length < 1)
        {
            $('#error_city').html('<img src="images/template/error.gif" alt="erreur" />Veuillez entrer votre localit&eacute; svp.');
        }
        else
        {
           creerCompte = true;    
        }

        return creerCompte;

    });
    
}

function createAccount()
{
    $('#password').blur(function(){
        
        if ($('#password').val().length < 6)
        {
            $('#erreur_formulaire').val('1');
            $('#error_password').html('<img src="images/template/error.gif" alt="erreur" />6 caract&egrave;res minimum.');
            $('#password').focus();
            $('#password').select();
        }
        else
        {
            $('#erreur_formulaire').val('0');
            $('#error_password').html('');
        }
        
    });
    
    $('#password').focus(function(){
        $('#password').select();
    });
    
    $('#confirmation').blur(function(){
        if ($('#erreur_formulaire').val() != 1) 
        {
            if ($('#password').val() != ($('#confirmation').val()) || $('#password').val().length < 6)
            {
                $('#erreur_formulaire').val('1');
                $('#error_confirm').html('<img src="images/template/error.gif" alt="erreur" />Les mots de passe sont diff&eacute;rents.');
                $('#password').focus();
                $('#password').select();
            }
            else
            {
                $('#erreur_formulaire').val('0');
                $('#error_confirm').html('');
            }        
        }
    });
    
    $('#confirmation').focus(function(){
        $('#confirmation').select();
    });
    
    $('#lastname').blur(function(){
        if ($('#erreur_formulaire').val() != 1) 
        {
           if ($('#lastname').val().length < 2)
           {
                $('#erreur_formulaire').val('1');
                $('#error_lastname').html('<img src="images/template/error.gif" alt="erreur" />Veuillez entrer votre nom svp.');
                $('#lastname').focus();
                $('#lastname').select();    
           }
           else
           {
                $('#erreur_formulaire').val('0');
                $('#error_lastname').html('');
           }
        }
    });
    
    $('#firstname').blur(function(){
        if ($('#erreur_formulaire').val() != 1) 
        {
           if ($('#firstname').val().length < 2)
           {
                $('#erreur_formulaire').val('1');
                $('#error_firstname').html('<img src="images/template/error.gif" alt="erreur" />Veuillez entrer votre pr&eacute;nom svp.');
                $('#firstname').focus();
                $('#firstname').select();    
           }
           else
           {
                $('#erreur_formulaire').val('0');
                $('#error_firstname').html('');
           } 
        }
    });
}
  
    
/******************************
 * Fin panier
 ******************************/      


/******************************
 * Début fancyBox
 ******************************/  
function fancyBoxInterface()
{
    var options = {
	    zoomWidth: 380,
	    zoomHeight: 480,
      xOffset: 50,
      yOffset: 0,
      position: "right",
      showEffect : 'fadein',  
      hideEffect: 'fadeout'  
    };
	
  	$("#fullImage a").jqzoom(options);   

    $('a.popup_img').lightBox();

    $("a.pTaille").fancybox({
    		'width'				: '50%',				
    		'height'			: '75%;',
	        'autoScale'     	: false,
	        'transitionIn'		: 'none',
			'transitionOut'		: 'none',
			'type'				: 'iframe'
		});
		
	$("li.unavailable").click(function(){
  			$("a.pTaille").fancybox({
						"hideOnContentClick": false,
						'width'				: '50%',				
    					'height'			: '75%;',
	        			'autoScale'     	: false,
	        			'transitionIn'		: 'none',
						'transitionOut'		: 'none',
						'type'				: 'iframe'
			  }).trigger("click");	
	
  });
  $(".popup_petit").fancybox({
    				'width'				: '35%',
    				'height'			: '90%',
    		    'autoScale'     	: false,
    		    'transitionIn'		: 'none',
    				'transitionOut'		: 'none',
    				'type'				: 'iframe'
  });
			
  $(".popup_grand").fancybox({
      				'width'				: '90%',
      				'height'			: '90%',
      		        'autoScale'     	: false,
      		        'transitionIn'		: 'none',
      				'transitionOut'		: 'none',
      				'type'				: 'iframe'
  });
  
  $(".popup_taille").fancybox({
      				'width'				: '60%',
      				'height'			: '90%',
      		        'autoScale'     	: false,
      		        'transitionIn'		: 'none',
      				'transitionOut'		: 'none',
      				'type'				: 'iframe'
  });
  
  $('#achat_products').bind("click", function(){
    if ($("input[@type=radio][@checked]").length > 0) {

        return true;

    }
    else {

        alert('Veuillez choisir votre taille SVP.');
        return false;

    }
  });
  
    
}
 
/******************************
 * Fin fancyBox
 ******************************/      
