function InscriptionNews(){CreateLayerWaiting();$.ajax({type:"get",url:"ajax.php",data:'inscription_newsletter&'+$('#inscription_newsletter').serialize(),complete:gestionReponseInscriptionNews});}
function gestionReponseInscriptionNews(xhr)
{if(xhr.status==200)
{RemoveLoading();alert(xhr.responseText);}
else
alert('erreur');RemoveLayerWaiting();}
function exitpopupWindow(){$('#divModal').fadeOut("slow").remove();RemoveLayerWaiting();}
function popupMessage(message){$.nyroModalManual({content:message,bgColor:'#000000',minWidth:400,minHeight:300,zIndexStart:9999});}
function popupWindow(url){if(document.URL.split(/\/+/g)[1]!=url.split(/\/+/g)[1]){if(url&&url.indexOf('http://www.youtube.com/watch?v=')==0){$.nyroModalManual({type:'swf',height:355,width:425,zIndexStart:9999,url:url.replace(new RegExp("watch\\?v=","i"),'v/')});}
else{$.nyroModalManual({zIndexStart:9999,type:'iframe',minWidth:600,minHeight:600,url:url});}}
else{var hash=url.split('#')[1];url=url.split('#')[0];$.nyroModalManual({ajax:{url:url},zIndexStart:9999,endShowContent:function(elts,settings){if(hash!=undefined){var anchor=$('div[id=nyroModalFull] a[name='+hash.toLowerCase()+']');if(anchor.length>0){$('div[id=nyroModalContent]').animate({scrollTop:anchor.position().top},1000);}}}});}}
function MajOptions(xhr){}
$.maxZIndex=$.fn.maxZIndex=function(opt){var def={inc:10,group:"*"};$.extend(def,opt);var zmax=0;$(def.group).each(function(){var cur=parseInt($(this).css('z-index'));zmax=cur>zmax?cur:zmax;});if(!this.jquery)
return zmax;return this.each(function(){zmax+=def.inc;$(this).css("z-index",zmax);});};function CreateLayerWaiting(){var $el=$('<div></div>',{id:'_overlay'}).addClass('ui-widget-overlay')
.appendTo(document.body)
.css({width:$(document).width(),height:$(document).height(),zIndex:$.maxZIndex()});CreateLoading();}
function RemoveLayerWaiting(){$('#_loadingIMG').remove();if($('#_overlay').length){$('#_overlay').fadeOut("slow",function(){$(this).remove();$('select._RemoveSelectForLayer').show().removeClass('_RemoveSelectForLayer');});}}
function CreateLoading(){var objBody=$('body');objBody.append('<img id="_loadingIMG" src="images/loading.gif">');if($('#_overlay').length)
var zindex=parseInt($('#_overlay').css('z-index'))+1;else
var zindex=9001;$('#_loadingIMG').css({'position':'absolute','z-index':zindex,'top':$('html').scrollTop()+($(window).height()-$('#_loadingIMG').height())/2,'left':($('html').width()-$('#_loadingIMG').width())/2});if(jQuery.browser.opera)
$('#_loadingIMG').css('top','45%');}
function RemoveLoading(){$('#_loadingIMG').remove();}
function MouseOver($this){$this.style.cursor="pointer";}
function MouseOut($this){$this.style.cursor="";}
(function($){$.fn.slideImage2=function(options){var defaults={url_new_image:null,speed:2000,loading:false,callback:undefined,callback_data:null};var opts=$.extend(defaults,options);var newImage=new Image();newImage.src=opts.url_new_image;$(newImage).bind("load",{actual_image:this,newImage_src:newImage,callback:opts.callback,callback_data:opts.callback_data},function(e){e.preventDefault();actual_image=$(e.data.actual_image);newImage_src=e.data.newImage_src;actual_image.eq(0).clone()
.attr({src:newImage_src.src})
.css({display:'none',width:newImage_src.width,height:newImage_src.height})
.appendTo(actual_image.parent())
.siblings('img')
.Center();$("<div id='next'></div>").appendTo('body');actual_image.parent().cycle({next:'#next',timeout:0,after:function(){}});$('#next').click();});};$.fn.Center=function(vertical){if(vertical==undefined){vertical=true;}
return this.each(function(i){var _this=$(this);var mw=(_this.parent().outerWidth(true)-_this.outerWidth(true))/2;_this.css({'margin-left':parseInt(mw)});if(vertical){var mh=(_this.parent().height()-_this.height())/2;_this.css({'margin-top':parseInt(mh)});}});};$.fn.centerXY=function(){return this.each(function(i){var _this=$(this);var _this_parent=_this.parent();var ah=_this.height();var ph=_this_parent.height();var mh=(ph-ah)/2;_this_parent.css('text-align','center');_this.css('margin-top',parseInt(mh));});};$.fn.slideImage=function(options){var defaults={url_new_image:null,speed:2000,loading:false,callback:undefined,callback_data:null};var opts=$.extend(defaults,options);var newImage=new Image();newImage.src=opts.url_new_image;$(newImage).bind("load",{actual_image:this,newImage_src:newImage,callback:opts.callback,callback_data:opts.callback_data},function(e){e.preventDefault();var actual_image=e.data.actual_image.eq(0);var newImage_src=e.data.newImage_src;var position=actual_image.position();actual_image.after(actual_image.eq(0).clone())
.next().stop()
.attr({src:newImage_src.src})
.css({opacity:0,position:'absolute',left:position.left-(newImage_src.width-actual_image.width())/2-$('body').position().left,top:position.top-(newImage_src.height-actual_image.height())/2,width:newImage_src.width,height:newImage_src.height})
.animate({opacity:1},opts.speed);actual_image.animate({opacity:0},function(){e.data.actual_image.next().css({position:'',left:'',top:''});e.data.actual_image.remove();if(e.data.callback)
e.data.callback(e.data.callback_data);});});};$.fn.vAlign=function(){return this.each(function(i){var ah=$(this).height();var ph=$(this).parent().height();var mh=(ph-ah)/2;$(this).css('margin-top',mh);});};})(jQuery);function changeImg_end_animation(e){$('#imgPrincipale').attr({'href':e.urlImageBig});ChgtImgEnCours=false;}
var ChgtImgEnCours=false;function changeImg(ImageProduit,urlImageBig,urlAJAX){if(($('#imgPrincipale').attr('href')!=urlImageBig)&&!ChgtImgEnCours){ChgtImgEnCours=true;$('#imgPrincipale img').eq(0).slideImage({url_new_image:ImageProduit,speed:1000,callback:changeImg_end_animation,callback_data:{urlImageBig:urlImageBig}});}}
function preloadImg(image){var img=new Image();img.src=image;}
function box_shopping_cart_update(_box){$('.Header .corps .panier .nbBoites').html(_box);}
function box_header_freeport_update(_box){$('.Header .freeport').html(_box);}
$(document).ready(function(){var $loading=$('<img src="./images/loading.gif" alt="loading">');$("a[ref='popupWindow'], a.popupWindow").bind({mouseover:function(){$(this).css({cursor:'pointer'});},click:function(e){e.preventDefault();if(document.URL.split(/\/+/g)[1]!=this.href.split(/\/+/g)[1]){var $this=$(this);var horizontalPadding=30;var verticalPadding=30;$('<iframe src="'+this.href+'" />').dialog({title:($this.attr('title'))?$this.attr('title'):$this.children('title').text(),zIndex:10000,width:800,height:500,modal:true,autoResize:true,overlay:{opacity:0.7,background:"black"}}).width(800-horizontalPadding).height(500-verticalPadding);}
else{var $dialog=$('<div>').append($loading.clone());$dialog.load($(this).attr('href'),function(){$(this).dialog({title:$(this).children('title').text(),zIndex:10000,width:700,height:500,autoResize:true,modal:true});});}}});preloadImg('images/ajaxLoader.gif');preloadImg('images/close_nyroModal.gif');preloadImg('images/prev_nyroModal.gif');preloadImg('images/next_nyroModal.gif');preloadImg('images/loading.gif');});
