$(function(){
  keyPressFunction();
  //setEventForCodePostal();
//$('.png').pngFix( );


/* Traitement pour l iphone */

/*if(navigator.platform == 'iPhone' || navigator.platform == 'iPad'){
		$('body').addclass('iphone');
		centrerPage();
	}*/


/*NoFlash();*/



if($('.list_effet li').length > 0)
  {
    
    $('.croquis li a').click(function(){
    
    //desactiver();
    $(".list_effet li h2 a.hover").removeClass('hover');
    
    local_tab = $(this).attr('href');
    
    element = $(local_tab);
    
    $('a', element).addClass('hover');
    $(".list_effet li p").slideUp();
    $('p',element).slideDown();
    addOnTitle($(element).find('img'));
    $('a',element).addClass('hover');
    $(element).addClass('on');
    
    return false;
  });
  
  }

});


//	Gestion de KeyPress
function keyPressFunction(){
  if($('.skin_list').length){
    var lastKeyPressed = '';
    var keyCounter = 0;
    $('body').keypress(function(event){
      var keyPressed = String.fromCharCode(event.which).toUpperCase();
      if(lastKeyPressed != keyPressed || lastKeyPressed == ''){
        lastKeyPressed = keyPressed;
        keyCounter=0;
      }else{
        keyCounter++;
      }
      $('a',$($('.skin_list:visible')[0])).removeClass('active');
      var keyIndex = -1;
      $('a',$($('.skin_list:visible')[0])).each(function(){
        var countrie = $(this).text();
        var firstKey = countrie.substring(0,1).toUpperCase();
        /*if(keyIndex != -1){
					keyIndex = -1;
					keyCounter = 0;
					activeShowItem(keyCounter, keyIndex, countrie, $(this));
				}*/
        if(keyPressed == firstKey){
          keyIndex++;
          activeShowItem(keyCounter, keyIndex, countrie, $(this));
        }
      })
    });
  }
}

//	Active Item & afficher details
function activeShowItem(keyCounter, keyIndex, countrie, me){
  if(keyCounter == keyIndex){
    me.addClass('active');
    $('.choose_option',me.parents('.skin_select')).text(countrie);
    var onClick = me.attr('onclick');
    setTimeout(onClick,0);
    var ulContainerHeight = parseInt($(me.parents('.skin_list')[0]).height());
    var liHeight = parseInt($(me.parents('li')[0]).height());
    var liIndex = $('li',me.parents('ul')).index(me.parents('li'));
    var ulHeight = $('li',me.parents('ul')).length*liHeight;
    if(ulHeight > ulContainerHeight){
      var ulContainerPadding = parseInt($(me.parents('.skin_list')[0]).css('padding-top'));
      var ulContainerBorder = parseInt($(me.parents('.skin_list')[0]).css('border-bottom-width'));
      ulContainerHeight = ulContainerHeight+ulContainerPadding-ulContainerBorder;
      var liHeights = liHeight*liIndex;
      if(liHeights > ulContainerHeight){
        if(liIndex < $('li',me.parents('ul')).length){
          me.parents('ul')[0].scrollTo(liHeights);
        }else{
          me.parents('ul')[0].scrollTo(ulHeight - ulContainerHeight);
        }
      }else{
        me.parents('ul')[0].scrollTo(0);
      }
    }
  }
}

var URL_DEBUG = "/frontend_dev.php";
//var URL_DEBUG = "/index.php";

var current = 0;
var delail;
/* v&eacute;rfier le format de la date */
function date_valide(val){
  var regex = new RegExp("[/-]");
  var date = val.split(regex);
  var nbJours = new Array('',31,28,31,30,31,30,31,31,30,31,30,31);
  var result = true;
  if ( date['2']%4 == 0 && date['2']%100 > 0 || date['2']%400 == 0 )
    nbJours['2'] = 29;
  if( isNaN(date['2']) )
    result=false;
  if ( isNaN(date['1']) || date['1'] > 12 || date['1'] < 1 )
    result=false;
  if ( isNaN(date['0']) || date['0'] > nbJours[Math.round(date['1'])] || date['0'] < 1 )
    result=false;
  var date_regexp = /^(\d{1,2}\/){2}\d{4}$/;
  if (!val.match(date_regexp) || !result)
    return false;
  return true;
}

/* le format du chiffre */
function formatNumbers(code){
  stat=code.match(/^[0-9]{5}$/i);
  return stat;
}

function eventsActualiteShow(id){
  $('.list_actualite > li').hide();
  $('li#actu_'+id).show();
  $('li#actu_'+id).addClass('current');
  current = $('.list_actualite > li.current').index();
  displayNav();
  $('.actualite_nav a.right').click(function(){
    if(current<$('.list_actualite > li').length-1){
      if ($.browser.msie){
        if($('#player_Flash',$('.list_actualite > li').eq(current)).length){
          window['player_Flash'].stopVideo();
        }
      }else{
        if($('#player_Flash',$('.list_actualite > li').eq(current)).length){
          document['player_Flash'].stopVideo();
        }
      }
      current++;
      $('.list_actualite li').hide();
      $('.list_actualite > li').eq(current).show("slow");
    }
    displayNav();
    return false;
  })

  $('.actualite_nav a.left').click(function(){
    if(current>0){
      if ($.browser.msie){
        if($('#player_Flash',$('.list_actualite > li').eq(current)).length){
          window['player_Flash'].stopVideo();
        }
      }else{
        if($('#player_Flash',$('.list_actualite > li').eq(current)).length){
          document['player_Flash'].stopVideo();
        }
      }
      current--;
      $('.list_actualite li').hide();
      $('.list_actualite > li').eq(current).show("slow");
    }
    displayNav();
    return false;
  })
}

function displayNav(){
  $('.list_actualite > li.current').removeClass('current');
  var len = $('.list_actualite > li').length-1;
  if(current==0) $('.actualite_nav a.left').hide();
  else $('.actualite_nav a.left').show();

  if(current==len) $('.actualite_nav a.right').hide();
  else $('.actualite_nav a.right').show();
}

var currentImgCollection = 0;
function eventsListeCollection(){
  $('h2 a','.list_collection li').eq(0).addClass('hover');
  $('.list_collection li .slide').hide();
  $('.slide','.list_collection li').eq(0).slideDown();

  $(".list_collection li a").click(function(){
    if(!$(this).hasClass('hover')){
      //var img1 = $('.list_collection h2 a.hover img').attr('src').replace("-on", "-off");
      //$('.list_collection h2 a.hover img').attr('src',img1);

      $('.list_collection li .slide').slideUp('slow');
      $("ul.list_collection .hover").removeClass("hover");
      $(this).addClass('hover');
      $(this).parents('h2').next().slideDown('slow');

      //var img = $('img',$(this)).attr('src').replace("-off", "-on");
      //$('img',$(this)).attr('src',img);

    }
    return false;
  });

  // collection invisibles
  $('.vignette_list a').mouseenter(function(){
    var src = $(this).attr('rel');
    var title = $('img',$(this)).attr('alt');
    var link = $(this).attr('href');
    $('.collection-left .image img').animate({
      opacity: 0
    }, 50,function(){
      $('.collection-left .image img').attr('src',src);
      $('.collection-left .image img').attr('alt',title);
      $('.legend_image p').html(title);
      $('.legend_image a,.collection-left .image a').attr('href',link);
    }).animate({
      opacity:1
    }, 50);
    currentImgCollection = $('.vignette_list a').index($(this));
    displayNavCollection();
    return false;
  })

  displayNavCollection();

  // nav collections
  $('.collection-left .nav .next').click(function(){
    navNext();
    clearInterval(delail);
    setDelail();
    return false;
  });

  // nav collections
  $('.collection-left .nav .prev').click(function(){
    navPrev();
    clearInterval(delail);
    setDelail();
    return false;
  });

  // nav collection (auto)
  if($('.auto-collection').length){
    setDelail();
  }

  // function delail
  function setDelail(){
    delail = setInterval(function(){
      if(currentImgCollection==($('.vignette_list li').length-1)){
        currentImgCollection = -1;
      }
      navNext();
    },3000);
  }
}

// nav next
function navNext(){
  if(currentImgCollection<$('.vignette_list li').length-1){
    currentImgCollection++;
    var src = $('.vignette_list a').eq(currentImgCollection).attr('rel');
    var title = $('.vignette_list a img').eq(currentImgCollection).attr('alt');
    var link = $('.vignette_list a').eq(currentImgCollection).attr('href');
    $('.collection-left .image img').animate({
      opacity: 0.5
    }, 200,function(){
      $('.collection-left .image img').attr('src',src);
      $('.collection-left .image img').attr('alt',title);
      $('.legend_image p').html(title);
      $('.legend_image a,.collection-left .image a').attr('href',link);
    }).animate({
      opacity:1
    }, 200);
  }
  displayNavCollection();
}

// nav prev
function navPrev(){
  if(currentImgCollection>0){
    currentImgCollection--;
    var src = $('.vignette_list a').eq(currentImgCollection).attr('rel');
    var title = $('.vignette_list a img').eq(currentImgCollection).attr('alt');
    var link = $('.vignette_list a').eq(currentImgCollection).attr('href');
    $('.collection-left .image img').animate({
      opacity: 0
    }, 200,function(){
      $('.collection-left .image img').attr('src',src);
      $('.collection-left .image img').attr('alt',title);
      $('.legend_image p').html(title);
      $('.legend_image a,.collection-left .image a').attr('href',link);
    }).animate({
      opacity:1
    }, 200)
  }
  displayNavCollection();
}

function displayNavCollection(){
  var len = $('.vignette_list li').length-1;
  if(currentImgCollection==0) $('.collection-left .nav .prev').hide();
  else $('.collection-left .nav .prev').show();

  if(currentImgCollection==len) $('.collection-left .nav .next').hide();
  else $('.collection-left .nav .next').show();
}

function addOnTitle(obj){
  $(".list_effet li,#nav_langues ul li").each(function(){
    var _this = this;
    //var srcImg = $($('img',_this)[0]).attr('src').replace("-on", "-off");
    //$($('img',_this)[0]).attr('src',srcImg);
  })

//  var src = obj.attr('src');
//  src = src.replace("-off", "-on");
//  $(obj).attr('src',src);
}

// functions
$(function(){
  /* le menu principal */
  mainNavEvent();

  hoverFooterElement(); //le hover sur liens "Footer"
  if($('.img_bg_r_col_r').length){
    $('.produi1').bind('mouseleave',function(){
      $('#coll_bou div').hide();
      $('#coll_bou div:first').show();
    });

  }

  if($('#nav_langues').length){
    /*$('#nav_langues .slide_box > ul').hide();*/
    $('#nav_langues .slide_box .tt_choose').addClass('on');

    $('#nav_langues .slide_box .tt_choose').mouseenter(function(){
      $(this).next().slideDown();
    })

    $('#nav_langues').mouseleave(function(){
      $(this).find('ul').slideUp();
    })

    $("#nav_langues ul li").mouseenter(function(){


      //addOnTitle($($("img",this)[0]));
      /**/
      var src = $('img',$(this)).attr('src');
      if(!$('ul',this).length) {
        src = src.replace("-off", "-on");
        $('img',$(this)).attr('src',src);
      }


    });
    $("#nav_langues ul li").mouseleave(function(){
      var _this = this;
      var srcImg = $($('img',_this)[0]).attr('src').replace("-on", "-off");
      $($('img',_this)[0]).attr('src',srcImg);
    });

    $("#nav_langues ul > li > a").mouseenter(function(){
      if($('ul',$(this).parent('li')).length){
        $('ul',$(this).parent('li')).show();
      }
    });

    $("#nav_langues ul > li").mouseleave(function(){
      if($('ul',$(this)).length){
        $('ul',$(this)).hide();
      }
    });

  }

  eventsListeCollection();

  //
  $('h2 a','.list_effet li').eq(0).addClass('hover');
  $('.list_effet li p').slideUp();
  $('p','.list_effet li').eq(0).slideDown();

  $(".list_effet li h2").click(function(){
    //desactiver();
    $(".list_effet li h2 a.hover").removeClass('hover');
    $('a',this).addClass('hover');
    $(".list_effet li p").slideUp();
    $(this).next('p').slideDown();
    addOnTitle($(this).find('img'));
    $('a',this).addClass('hover');
    $(this).parent('li').addClass('on');
  });

  // newsletter
  $('.inpu_newsletter').focus(function(){
    $(this).val("");
  });

  //validation formulaire
  $(".popup_form  p.items .btn-envoyer").click(function() {
    $(".popup_form  p.items").removeClass("erreur");
    $('.popup_form .inputtext').each(function(){
      if(!$(this).val()){
        $(this).parents("p").addClass("erreur");
      }
    });

    if(!($('.popup_form .textarea').text())){
      $('.popup_form .textarea').parents("p").addClass("erreur");
    }
    return false;
  });
  displayNavCollection2();
  if($('.collection li').length) timer = setTimeout("diapoAuto()",3000);

  $('.nav .nextPush').click(function(){
    var index = $('.collection li.current').index();
    var cpt = $('.collection li').length;
    $('.collection  li').fadeOut();
    $('.collection  li.current').removeClass('current');
    index++;
    if(index == cpt) index = 0;
    $($('.collection li')[index]).addClass('current');
    $('.collection  li.current').fadeIn();
    $('.legend_image p').text($('.collection  li.current img').attr('alt'));
    $('.legend_image a').attr('href',$('.collection  li.current a').attr('href'));
    clearTimeout(timer);
    timer = setTimeout("diapoAuto()",3000);
    displayNavCollection2();
    return false;
  });
  $('.nav .prevPush').click(function(){
    var index = $('.collection li.current').index();
    var cpt = $('.collection li').length;
    $('.collection  li').fadeOut();
    $('.collection  li.current').removeClass('current');
    index--;
    $($('.collection li')[index]).addClass('current');
    $('.collection  li.current').fadeIn();
    $('.legend_image p').text($('.collection  li.current img').attr('alt'))
    $('.legend_image a').attr('href',$('.collection  li.current a').attr('href'));
    clearTimeout(timer);
    timer = setTimeout("diapoAuto()",3000);
    displayNavCollection2();
    return false;
  });

  //validation formulaire Contact
  $(".btnenvoyer").not("#validNewLetters").click(function(){
    $(".ct_erreur").removeClass("ct_erreur");
    $(".pinpnews,.txtnnews").bind("click focus",function(){
      $(this).removeClass("ct_erreur");
    });
    bool = true;
    $(".pinpnews").each(function(){
      me=$(this);
      if(!$('.required',me).val() && $('.required',me).val()!= undefined){
        me.addClass("ct_erreur");
        bool=false;
      }
      // if(!verfierEmail($("#email",me).val())){
      // me.addClass("ct_erreur");
      // bool=false;
      // }

      if(!verfierEmail($("#email",me).val()) && $("#email",me).val()!=undefined){
        $('#email').parents('.pinpnews').addClass("ct_erreur");
        bool=false;
      }
    /*if( $("#date_naissance",me).val()!=undefined){

						if(!date_valide($("#date_naissance",me).val())){
							$('#date_naissance').parents('.pinpnews').addClass("ct_erreur");
						bool=false;
						}
					}*/
    /*if($("#code_postal",me).val()!=undefined){
						if(!formatNumbers($("#code_postal",me).val())){
							$('#code_postal').parents('.pinpnews').addClass("ct_erreur");
							bool=false;
						}
					}*/
    });

    if(!$('.txtnnews').val()){
      $('.txtnnews').parents('.pinpnews').addClass("ct_erreur");
      bool=false;
    }

    return bool;

  });



  $("#sendtomail").bind('click',function(){
    var bol=true;
    if( $("#Emailnewsletter").val() == 'Votre email' )
      $("#Emailnewsletter").val('');
    /*$("#Emailnewsletter").click(function(){
				$(this).parents("span").removeClass("ct_erreur");

			})
			if(!verfierEmail($("#Emailnewsletter").val())){
				$("#Emailnewsletter").parents("span").addClass("ct_erreur");
					bol=false;
			}*/
    return bol;
  });

  /* valider la formulaire de News letters */
  //  $("#validNewLetters").click(function(){
  //    var bol=true;
  //    $(".pinpnews").bind("click focus",function(){
  //      $(this).removeClass("ct_erreur");
  //    });
  //
  //
  //    $(".pinpnews").each(function(){
  //
  //      if(!$("input",$(this)).val() && $("input",$(this)).val()!=undefined){
  //        $(this).addClass("ct_erreur");
  //        bol=false;
  //      }
  //
  //    });
  //
  //    if($("#in_mail").val()!=undefined ){
  //      if(!verfierEmail($("#in_mail").val())){
  //        $("#in_mail").parents(".pinpnews").addClass("ct_erreur");
  //        bol=false;
  //      }
  //    }
  //    return bol;
  //  });

  $(".bloc_share > a").bind('mouseenter',function(){
    $(this).hide();
    $('ul',$(this).parent('.bloc_share')).show();
  })

  $(".bloc_share").bind('mouseleave',function(){
    $('.bloc_share > ul').hide();
    $('.bloc_share > a').show();
  })

  // select skin
  selectSkin();
  $('.skin_list').hide();

});

function desactiver() {
  $(".list_effet li").removeClass('on');
  $('.list_effet li p').slideUp();
  $("ul.list_effet .hover").removeClass("hover");
}

/*   Caroussel collection  */
/*function showdiapo() {
	clearTimeout(timer);
	timer = setTimeout("diapoAuto()",3000);

}*/

/* dipo automatique */
function diapoAuto(){
  var index = $('.collection li.current').index();
  var cpt = $('.collection li').length;
  $('.collection  li').fadeOut();
  $('.collection  li.current').removeClass('current');
  index++;
  if(index == cpt) index = 0;
  $($('.collection li')[index]).addClass('current');
  $('.collection  li.current').fadeIn();
  $('.legend_image p').text($('.collection  li.current img').attr('alt'));
  $('.legend_image a').attr('href',$('.collection  li.current a').attr('href'));
  clearTimeout(timer);
  timer = setTimeout("diapoAuto()",3000);
  displayNavCollection2();

}
/*navigation caroussel collection */
function displayNavCollection2(){
  var index = $('.collection li.current').index();
  var len = $('.collection li').length - 1;
  if(index == 0){
    $('.nav .nextPush').show();
    $('.nav .prevPush').hide();
  }
  else if(index == len) $('.nav .nextPush').hide();
  else {
    $('.nav .prevPush').show();
    $('.nav .nextPush').show();
  }

}

/* le click & le rollover  menu principale */
function mainNavEvent(){
  $('#main_menu .title > a').unbind('click');
  $('#main_menu .title > a').bind('click',function(){
    if($(this).parent().hasClass('open')){
      $(this).next().slideUp();
      $(this).parent().removeClass('open');
    }else{
      $('#main_menu ul').slideUp();
      $('li.open').removeClass('open');
      $(this).parent().addClass('open');
      $(this).next().slideDown();
    }
    return false;
  });
}

/* valider E-mail */
function changerCollectionBoutique(id) {
  $(".bg_r_col_r").hide();
  $('#collection_'+id).show();
}


function getPopUp(url, title, w, h){
  var popUpObj = window.open( url,
    '',
    "toolbar=no," +
    "scrollbars=no," +
    "location=no," +
    "statusbar=no," +
    "menubar=no," +
    "resizable=0," +
    "directories=no," +
    "status=no," +
    "width=650," +
    "height=350," +
    "top=" + (screen.height-h)/2 + "," +
    "left=" + (screen.width-w)/2
    );


  popUpObj.focus();
}

function getPopUpShare(url){
  var publish = {
    method: 'stream.publish',
    attachment: {
      name: $("#ligne_nom").val(),
      caption: url,
      description: $("#ligne_description").val(),
      href: url,
      media: [{
        type: 'image',
        href: url,
        src: 'http://'+$("#packshot").val()
      }]
    },
    action_links: [{
      text: 'Fiche produit',
      href: url
    }],
    user_prompt_message: 'Share the response of Statistic of the friends?'
  };
  FB.ui(publish, function(response) {
    if (response && response.post_id) {
    //alert('Post was published.');
    }
    else {
  //alert('Post was not published.');
  }
  });
}
//
//function getCountries(id_pays, id_zone){
//  $('#ville_selected').val(id_pays);
//  $.ajax({
//    type: "POST",
//    url: URL_DEBUG+"/nos_produits/countries",
//    data: "id_pays="+id_pays,
//    success: function(msg){
//      $('#'+id_zone).html(msg);
//      if( msg == '' ){
//        $('#'+id_zone).html('');
//      }
//      selectZindex();
//      selectSkin();
//      setEventForCodePostal()
//    }
//  });
//}
//
//function getVilles(id_country, id_zone){
//  $.ajax({
//    type: "POST",
//    url: URL_DEBUG+"/nos_produits/villes",
//    data: "id_country="+id_country,
//    success: function(msg){
//      $('#'+id_zone).html(msg);
//      selectSkin();
//      setEventForCodePostal();
//    }
//  });
//}
//function setEventForCodePostal(){
//  $('#code_postal').unbind().bind('focus',function(){
//    $(this).val('');
//  })
//  $('#submitOfCodePostal').unbind().bind('click',function(){
//    if($('#code_postal').val()  && $('#code_postal').val()!="Code postal" && $('#ville_selected').val()){
//      $.ajax({
//        type: "POST",
//        url: URL_DEBUG+"/nos_produits/getPointsVente",
//        data: "code_postal="+$('#code_postal').val() + "&id_pays=" + $('#ville_selected').val(),
//        success: function(msg){
//          $('#point_vente').html(msg);
//          //GetPointVenteMap();
//          $('.Pane').jScrollPane();
//          selectSkin();
//        }
//      });
//    }
//    return false;
//  });
//}
//function getPointsVente(id_ville, id_zone){
//  $.ajax({
//    type: "POST",
//    url: URL_DEBUG+"/nos_produits/getPointsVente",
//    data: "id_ville="+id_ville,
//    success: function(msg){
//      $('#point_vente').html(msg);
//      //GetPointVenteMap();
//      $('.Pane').jScrollPane();
//      selectSkin();
//    }
//  });
//}
//function getPointsVenteById(id_point_vente, id_zone){
//  $.ajax({
//    type: "POST",
//    url: URL_DEBUG+"/nos_produits/getPointsVente",
//    data: "id_point_vente="+id_point_vente,
//    success: function(msg){
//      $('#point_vente').html(msg);
//    }
//  });
//}


function verfierEmail(email){
  var reg = new RegExp('^[a-z0-9]+([_|\.|-]{1}[a-z0-9]+)*@[a-z0-9]+([_|\.|-]-{1}[a-z0-9]+)*[\.]{1}[a-z]{2,6}$', 'i');
  if(reg.test(email))
    return true;
  else
    return false;
}




function getListeAcheterEnligne(id_pays, id_zone){
  $.ajax({
    type: "POST",
    url: URL_DEBUG+"/nos_produits/getAcheterEnligne",
    data: "id_pays="+id_pays,
    success: function(msg){
      $('#'+id_zone).html(msg);
      $('.Pane').jScrollPane();
    }
  });

}

function hoverFooterElement(){
  if($('#footer a.current').length){
    var src = $('#footer a.current img').attr('src');
    src = src.replace("_off", "_on");
    $('#footer a.current img').attr('src',src);
  }

  $('#footer a').hover(function(){
    if(!$(this).hasClass('current')) {
      var src = $('img',this).attr('src');
      src = src.replace("_off", "_on");
      $('img',this).attr('src',src);
    }

  },function(){
    if(!$(this).hasClass('current')) {
      var src = $('img',this).attr('src');
      src = src.replace("_on", "_off");
      $('img',this).attr('src',src);
    }
  });
}


function selectSkin(){
  if($('.skin_select').length){
    selectZindex();

    $('.skin_list ul').each(function(){
      if($(this).height()>170 && $(this).hasClass('s_pane')){
        $(this).height(170+'px');
      }
    })

    if($('.s_pane').length){
      $('.s_pane').jScrollPane();
    }

    $('.choose_option').unbind('click');
    
    $('.choose_option').bind('click',function(){
      if(!$(this).hasClass('opened')){
        $(this).removeClass('opened');
        $('.skin_list').hide();
        $(this).next().slideDown('normal');
        $(this).addClass('opened');
        addScrolPane($(this).next());
      }else{
        $(this).next().slideUp('normal');
        $(this).removeClass('opened');
      }
      return false;
    });

    // clique sur un e option
    $('.skin_list li a').click(function(){
      $('.choose_option', $(this).parents('.skin_select')).html($(this).text());

      
      $(this).parents('.skin_list').slideUp();
      
      $('.choose_option').removeClass('opened');  
      
      
      return false;
    });
  }
//
  $(document).click(function(e){
    if(!$(e.target).parents('.skin_select').length){
      if($('.skin_list').is(":visible")) $('.skin_list').slideUp();
      $('.choose_option').removeClass('opened');
    }
  });

}

function addScrolPane(obj){
  if($('ul',obj).height() > 170){
    $('ul',obj).height(220+'px');
    $('ul',obj).jScrollPane();
  }
}

function selectZindex()
{
  if($('.pinpnews').length){
    var len = $('.pinpnews').length;
    $('.skin_select').each(function(i,obj){
      $(this).parent('.pinpnews').css({
        'z-index':(len-i)
      })
    })
  }

  if($('.select_list_bloc').length){
    var len = $('.skin_select').length;
    $('.skin_select').each(function(i,obj){
      $(this).css({
        'z-index':(len-i)
      })
    })
  }
}




function centrerPage(){
  var top = ($(document).height()-$('#page').height())/2
  $("#page").css({
    paddingTop: top + "px"
  });
}

/* Remplacer le flash */
function NoFlash() {
  $('.no_flash').hide();
  if(navigator.platform == 'iPhone' || navigator.platform == 'iPad'){
    $('.no_flash').show();
  }
}


