﻿// Copyright Malek Chtioui 2008 (Sté MONOProg)
// Site     : www.monoprog.com
// Phone    : +216-98292345
// Fax      : +216-276669
// Mail     : admin@monoprog.com

function $(pcn){var pcx,pcd=document;if(!(pcx=pcd[pcn])&&pcd.all)pcx=pcd.all[pcn];if(!pcx&&pcd.getElementById)pcx=pcd.getElementById(pcn);return pcx;};function Auto_Ref(){if(typeof(autoref)!='undefined'){clearTimeout(autoref);};__doPostBack('RefBnt','');};function dbtip(telem,tt){if(!$('DbTip')){var el1=document.createElement('div');el1.id='DbTip';el1.className="dbtip";document.body.appendChild(el1);};if(!$('DbCad')){var el=document.createElement('div');el.id='DbCad';el.className="dbcad";document.body.appendChild(el);};var PosEle=getXY(telem);var tcad=$('DbCad');tcad.style.left=(PosEle[0]-4)+"px";tcad.style.top=(PosEle[1]-4)+"px";tcad.style.width=telem.offsetWidth+"px";tcad.style.height=telem.offsetHeight+"px";tcad.style.display='block';var ttip=$('DbTip');var str="<div class='dbtipt'>"+tt+"</div><div class='dbtipm'>";str+="L : "+telem.offsetWidth+"px<br>";str+="H : "+telem.offsetHeight+"px<br>";str+="</div>";ttip.innerHTML=str;ttip.style.left=(PosEle[0]-2)+"px";ttip.style.top=(PosEle[1]-2)+"px";ttip.style.display='block';telem.onmouseleave=function(){ttip.style.display='none';tcad.style.display='none';telem.onmouseleave=null;};};function Open_Pop_Up(URL,Title){window.open(URL,Title,'menubar=no, toolbars=no, directories=no, status=no, resizable=yes, scrollbars=no, width=600, height=400');};function wdwidth(){var myWidth=0,myHeight=0;if(typeof(window.innerWidth)=='number'){myWidth=window.innerWidth;myHeight=window.innerHeight;}else if(document.documentElement&&(document.documentElement.clientWidth||document.documentElement.clientHeight)){myWidth=document.documentElement.clientWidth;myHeight=document.documentElement.clientHeight;}else if(document.body&&(document.body.clientWidth||document.body.clientHeight)){myWidth=document.body.clientWidth;myHeight=document.body.clientHeight;};return{x:myWidth,y:myHeight};};function autoSize(){var cc1=wdwidth();var newx=document.getElementById("mdiv").offsetWidth;var newy=document.getElementById("mdiv").offsetHeight;if(newx>screen.width){newx=screen.width-100;};if(newy>screen.height){newy=screen.height-140;};window.resizeBy(newx-cc1.x,newy-cc1.y);var cc2=wdwidth();window.moveTo(((screen.width-cc2.x)/2)-15,((screen.height-cc2.y)/2)-30);self.focus();};function Admin_ShowHide(Element_ID,Action){var Eid=$(Element_ID);if(Eid){switch(Action){case"Show":Eid.style.display="";break;case"Hide":Eid.style.display="none";break;default:if(Eid.style.display=="none"){Eid.style.display="";}else{Eid.style.display="none";};};};};function UpdateEditorFormValue(){for(i=0;i<parent.frames.length;++i)if(parent.frames[i].FCK)parent.frames[i].FCK.UpdateLinkedField();};function print_commande(num,type){Open_Pop_Up("/mods/other/bc_print.aspx?n="+num+"&t="+type,"bon_de_commande");};function getXY(el){if(el.parentNode===null)return false;var parent=null;var pos=[];var box;if(el.getBoundingClientRect){box=el.getBoundingClientRect();var scrollTop=document.documentElement.scrollTop||document.body.scrollTop;var scrollLeft=document.documentElement.scrollLeft||document.body.scrollLeft;return[box.left+scrollLeft,box.top+scrollTop];}else if(document.getBoxObjectFor){box=document.getBoxObjectFor(el);pos=[box.x,box.y];}else{pos=[el.offsetLeft,el.offsetTop];parent=el.offsetParent;if(parent!=el){while(parent){pos[0]+=parent.offsetLeft;pos[1]+=parent.offsetTop;parent=parent.offsetParent;};};var ua=navigator.userAgent.toLowerCase();if(ua.indexOf('opera')!=-1||(ua.indexOf('safari')!=-1&&this.style.position=='absolute')){pos[1]-=document.body.offsetTop;};};if(el.parentNode){parent=el.parentNode;}else{parent=null;};while(parent&&parent.tagName!='BODY'&&parent.tagName!='HTML'){pos[0]-=parent.scrollLeft;pos[1]-=parent.scrollTop;if(parent.parentNode){parent=parent.parentNode;}else{parent=null;};};return pos;};var ixf={'clock':null,'count':1};function crossfade(){if(ixf.clock==null){ixf.obj=arguments[0];ixf.src=arguments[1];if(typeof ixf.obj.style.opacity!='undefined'){ixf.type='w3c';}else if(typeof ixf.obj.style.MozOpacity!='undefined'){ixf.type='moz';}else if(typeof ixf.obj.style.KhtmlOpacity!='undefined'){ixf.type='khtml';}else if(typeof ixf.obj.filters=='object'){ixf.type=(ixf.obj.filters.length>0&&typeof ixf.obj.filters.alpha=='object'&&typeof ixf.obj.filters.alpha.opacity=='number')?'ie':'none';}else{ixf.type='none';};if(typeof arguments[3]!='undefined'&&arguments[3]!=''){ixf.obj.alt=arguments[3];};if(ixf.type!='none'){ixf.newimg=document.getElementsByTagName('body')[0].appendChild((typeof document.createElementNS!='undefined')?document.createElementNS('http://www.w3.org/1999/xhtml','img'):document.createElement('img'));ixf.newimg.className='idupe';ixf.newimg.src=ixf.src;ixf.newimg.style.left=ixf.getRealPosition(ixf.obj,'x')+'px';ixf.newimg.style.top=(ixf.getRealPosition(ixf.obj,'y')+((ixf.obj.height/2)-(ixf.newimg.height/2)))+'px';ixf.length=parseInt(arguments[2],10)*1000;ixf.resolution=parseInt(arguments[2],10)*20;ixf.clock=setInterval('ixf.crossfade()',ixf.length/ixf.resolution);}else{ixf.obj.src=ixf.src;};};};ixf.crossfade=function(){ixf.count-=(1/ixf.resolution);if(ixf.count<(1/ixf.resolution)){clearInterval(ixf.clock);ixf.clock=null;ixf.count=1;ixf.obj.src=ixf.src;};switch(ixf.type){case'ie':ixf.obj.filters.alpha.opacity=ixf.count*100;ixf.newimg.filters.alpha.opacity=(1-ixf.count)*100;break;case'khtml':ixf.obj.style.KhtmlOpacity=ixf.count;ixf.newimg.style.KhtmlOpacity=(1-ixf.count);break;case'moz':ixf.obj.style.MozOpacity=(ixf.count==1?0.9999999:ixf.count);ixf.newimg.style.MozOpacity=(1-ixf.count);break;default:ixf.obj.style.opacity=(ixf.count==1?0.9999999:ixf.count);ixf.newimg.style.opacity=(1-ixf.count);};ixf.newimg.style.visibility='visible';ixf.newimg.style.left=ixf.getRealPosition(ixf.obj,'x')+'px';ixf.newimg.style.top=(ixf.getRealPosition(ixf.obj,'y')+((ixf.obj.height/2)-(ixf.newimg.height/2)))+'px';if(ixf.count==1){ixf.newimg.parentNode.removeChild(ixf.newimg);};};ixf.getRealPosition=function(){this.pos=(arguments[1]=='x')?arguments[0].offsetLeft:arguments[0].offsetTop;this.tmp=arguments[0].offsetParent;while(this.tmp!=null){this.pos+=(arguments[1]=='x')?this.tmp.offsetLeft:this.tmp.offsetTop;this.tmp=this.tmp.offsetParent;};return this.pos;};function addLL(functionToAdd){if(typeof window.addEventListener!='undefined'){window.addEventListener('load',functionToAdd,false);}else if(typeof window.document.addEventListener!='undefined'){window.document.addEventListener('load',functionToAdd,false);}else if(typeof window.attachEvent!='undefined'){window.attachEvent('onload',functionToAdd);}else{if(typeof window.onload!='function'){window.onload=functionToAdd;}else{var oldFunction=window.onload;window.onload=function(){oldFunction();functionToAdd();};};};};function Change_Picture(imgf,to_pic){var imgt=$(to_pic);if(imgf&&imgt){imgt.alt=imgf.alt;crossfade(imgt,imgf.src,'1','');};};function ZoomProduct(TPic){a1=TPic.src;a1=a1.substring(a1.indexOf("images/arts/")+12);Open_Pop_Up("/mods/other/zoom.aspx?i="+a1,'image');};function show_help(rh){Open_Pop_Up("/mods/other/help.aspx?ref="+rh,'help');};var dXoffset;var dYoffset;var orgxpos;var orgypos;var RewPas=12;var Dragging=false;var rewinding;var mondiv=null;var ProdId;function mouseCoords(ev){if(ev.pageX||ev.pageY){return{x:ev.pageX,y:ev.pageY};};var scrollLeft=document.documentElement.scrollLeft||document.body.scrollLeft;var scrollTop=document.documentElement.scrollTop||document.body.scrollTop;return{x:ev.clientX+scrollLeft,y:ev.clientY+scrollTop};};function StartXDrag(obj,ProdID,e){Xdeldiv();ProdId=ProdID;mondiv=document.createElement("div");mondiv.id="MyDDDiv";mondiv.style.position='absolute';mondiv.className="dragdivoff";var PosEle=getXY(obj);mondiv.style.left=PosEle[0]+"px";mondiv.style.top=PosEle[1]+"px";orgxpos=PosEle[0];orgypos=PosEle[1];e=e||window.event;co=mouseCoords(e);dXoffset=co.x-PosEle[0];dYoffset=co.y-PosEle[1];mondiv.innerHTML='<img src="'+obj.src+'" alt="'+obj.alt+'" style="width:'+obj.offsetWidth+'px;height:'+obj.offsetHeight+'px;" />';document.body.appendChild(mondiv);Dragging=true;document.onmousemove=XDrag;document.onmouseup=XDrop;return false;};function is_inCont(cont,mx,my){DC=$(cont);if(DC){var PosE=getXY(DC);if((mx>PosE[0]&&mx<(PosE[0]+DC.offsetWidth))&&(my>PosE[1]&&my<(PosE[1]+DC.offsetHeight))){return true;};};return false;};function XDrag(e){e=e||window.event;if(e.button<=1&&Dragging){co=mouseCoords(e);mondiv.style.left=(co.x-dXoffset)+"px";mondiv.style.top=(co.y-dYoffset)+"px";var mondivclass="dragdivoff";DrgC1=$("DragCont1");if(DrgC1){if(is_inCont("DragCont1",co.x,co.y)){DrgC1.className="dragconton";mondivclass="dragdivon";}else{DrgC1.className="";};};DrgC2=$("DragCont2");if(DrgC2){if(is_inCont("DragCont2",co.x,co.y)){DrgC2.className="dragconton";mondivclass="dragdivon";}else{DrgC2.className="";};};mondiv.className=mondivclass;return false;};};function XDrop(e){Dragging=false;document.onmousemove=null;document.onmouseup=null;e=e||window.event;co=mouseCoords(e);if(is_inCont("DragCont1",co.x,co.y)){Xdeldiv();$("DragCont1").className="";$(x1a2bID).value=ProdId;if($(x1a2bID).onchange)$(x1a2bID).onchange();}else if(is_inCont("DragCont2",co.x,co.y)){Xdeldiv();$("DragCont2").className="";$(k1a2bID).value=ProdId;if($(k1a2bID).onchange)$(k1a2bID).onchange();}else{rewindit();};};function Xdeldiv(){clearTimeout(rewinding);if(mondiv){document.body.removeChild(mondiv);};mondiv=null;Dragging=false;document.onmousemove=null;document.onmouseup=null;};function rewindit(){PosE=getXY(mondiv);xmodified=false;if((PosE[0]-orgxpos)>RewPas){mondiv.style.left=(PosE[0]-RewPas)+"px";xmodified=true;};if((orgxpos-PosE[0])>RewPas){mondiv.style.left=(PosE[0]+RewPas)+"px";xmodified=true;};if((PosE[1]-orgypos)>RewPas){mondiv.style.top=(PosE[1]-RewPas)+"px";xmodified=true;};if((orgypos-PosE[1])>RewPas){mondiv.style.top=(PosE[1]+RewPas)+"px";xmodified=true;};if(xmodified){rewinding=setTimeout("rewindit()",2);}else{Xdeldiv();};};function center_elem(elem){var sTop=document.documentElement.scrollTop||document.body.scrollTop;var sLeft=document.documentElement.scrollLeft||document.body.scrollLeft;elem.style.marginLeft=sLeft+parseInt("-"+parseInt(elem.offsetWidth/2))+"px";elem.style.marginTop=sTop+parseInt("-"+parseInt(elem.offsetHeight/2))+"px";};var MessPop_TO;function ShowMessagePopUp(texte,s_e){HideMessagePopUp();var messdiv=document.createElement("div");messdiv.id="MessDiv";messdiv.className="messagepopup"+s_e;messdiv.innerHTML=texte;document.body.appendChild(messdiv);center_elem(messdiv);MessPop_TO=setTimeout("HideMessagePopUp()",3000);};function HideMessagePopUp(){if($("MessDiv")){clearTimeout(MessPop_TO);document.body.removeChild($("MessDiv"));}};var PopX1_TO;function PopX1(Dl){if(typeof x1_ID!='undefined'){PopX1_Hide();var x1pdiv=document.createElement("div");x1pdiv.id="popx1div";x1pdiv.className="modx1_popindic";document.body.appendChild(x1pdiv);var PE=getXY($(x1_ID));var PC=getXY(x1pdiv);x1pdiv.style.left=(PC[0]+PE[0])+"px";x1pdiv.style.top=(PC[1]+PE[1])+"px";PopX1_TO=setTimeout("PopX1_Hide()",Dl*1000);};};function PopX1_Hide(){if($("popx1div")){clearTimeout(PopX1_TO);document.body.removeChild($("popx1div"));};};function ReplaceTBwHTML(iid,tid,rep_id){if($(iid)&&$(tid)){$(iid).style.visibility='hidden';$(iid).style.display='none';var oFCKeditor=new FCKeditor(tid,"700px","200px","Mini",rep_id);oFCKeditor.ReplaceTextarea();};};var LBPanierCountID;function GetXmlHttp(){var oXmlHttp=false;if(!oXmlHttp&&typeof XMLHttpRequest!='undefined'){oXmlHttp=new XMLHttpRequest();};return oXmlHttp;};function AddP2Basket(pid,options,qte,perso){var persotxt='';if(perso!=''){var clines=perso.split('¦');var oss;for(var i=0;i<clines.length;i++){oss=clines[i].split('¨');persotxt+=oss[0]+" "+$(oss[1]).value+"\r\n";};};var oXmlHttp=GetXmlHttp();oXmlHttp.open("POST",AjaxFcs+"add_to_panier.aspx",true);oXmlHttp.setRequestHeader("Content-Type","application/x-www-form-urlencoded");oXmlHttp.onreadystatechange=function(){if(oXmlHttp.readyState==4){Mod3_Count=$(LBPanierCountID);if(oXmlHttp.responseText!=""){var OXrep=oXmlHttp.responseText;if(OXrep.length<10){ShowMessagePopUp("Produit ajouté au panier avec succès.",'s');if(Mod3_Count){Mod3_Count.innerHTML=OXrep;};}else{ShowMessagePopUp(OXrep,'e');if(Mod3_Count){Mod3_Count.innerHTML="X";};};}else{ShowMessagePopUp("ERREUR Ajax.",'e');if(Mod3_Count){Mod3_Count.innerHTML="X";};};};};oXmlHttp.send("pid="+pid+"&ops="+options+"&qte="+qte+"&perso="+persotxt);};function AddP2B_ParseOps(pid,options,qte,perso){var rep='';if(options!=''){var ops=options.split(';');var oss;for(var i=0;i<ops.length;i++){oss=ops[i].split(',');rep+=oss[0]+','+$(oss[1]).value;if(i<(ops.length-1))rep+=";";};};AddP2Basket(pid,rep,qte,perso);};function UpdateLnkV(lnk,type){var oXmlHttp=GetXmlHttp();oXmlHttp.open("POST",AjaxFcs+"updatelnkv.aspx",true);oXmlHttp.setRequestHeader("Content-Type","application/x-www-form-urlencoded");oXmlHttp.send("lnk="+lnk+"&type="+type);};function Fill_Articles(iThis,LBid,APage,Tbh1,Tbh2){LB=$(LBid);LB.options.length=0;$(Tbh1).value='';$(Tbh2).value='-1';if(iThis.value!=''){var oXmlHttp=GetXmlHttp();oXmlHttp.open("POST",APage,true);oXmlHttp.setRequestHeader("Content-Type","application/x-www-form-urlencoded");oXmlHttp.onreadystatechange=function(){if(oXmlHttp.readyState==4){if(oXmlHttp.responseText!=""){LB.options.length=0;var ops=oXmlHttp.responseText.split('¦');var oss;for(var i=0;i<ops.length;i++){LB.options.length=LB.options.length+1;oss=ops[i].split('¨');LB.options[LB.options.length-1].text=oss[1];LB.options[LB.options.length-1].value=oss[0];};if(LB.options.length>0){LB.selectedIndex=0;$(Tbh2).value="0";$(Tbh1).value=oXmlHttp.responseText;};};};};oXmlHttp.send("chr="+iThis.value);};};var hoverClass="xmenu-hover";var topmostClass="xmenu";var userAgent=navigator.userAgent;var versionOffset=userAgent.indexOf("MSIE");var isIE=(versionOffset>=0);var isPreIE7=false;var fullVersionIE="";var majorVersionIE="";if(isIE){fullVersionIE=parseFloat(userAgent.substring(versionOffset+5,userAgent.length));majorVersionIE=parseInt(''+fullVersionIE);isPreIE7=majorVersionIE<7;};function Hover__AspNetMenu(element){AddClass__CssFriendlyAdapters(element,hoverClass);if(isPreIE7){var child=element.firstChild;while(child){if(child.tagName=="UL"){var grandchild=child.firstChild;while(grandchild){if(grandchild.tagName=="LI"){if((typeof(grandchild.iFrameFormElementMask)!="undefined")&&(grandchild.iFrameFormElementMask!=null)){grandchild.iFrameFormElementMask.style.display="block";var w=grandchild.offsetWidth;if((grandchild.offsetWidth==0)&&(typeof(element.iFrameFormElementMask)!="undefined")&&(element.iFrameFormElementMask!=null)&&(element.iFrameFormElementMask.style.width.length>0)){w=element.iFrameFormElementMask.style.width;};grandchild.iFrameFormElementMask.style.width=w;var h=grandchild.offsetHeight+5;if((grandchild.offsetHeight==0)&&(typeof(element.iFrameFormElementMask)!="undefined")&&(element.iFrameFormElementMask!=null)&&(element.iFrameFormElementMask.style.height.length>0)){h=element.iFrameFormElementMask.style.height;};grandchild.iFrameFormElementMask.style.height=h;};};grandchild=grandchild.nextSibling;};};child=child.nextSibling;};};};function Unhover__AspNetMenu(element){RemoveClass__CssFriendlyAdapters(element,hoverClass);if(isPreIE7){var child=element.firstChild;while(child){if(child.tagName=="UL"){var grandchild=child.firstChild;while(grandchild){if(grandchild.tagName=="LI"){if((typeof(grandchild.iFrameFormElementMask)!="undefined")&&(grandchild.iFrameFormElementMask!=null)){grandchild.iFrameFormElementMask.style.display="none";};};grandchild=grandchild.nextSibling;};};child=child.nextSibling;};};};function SetHover__AspNetMenu(){var menus=document.getElementsByTagName("ul");for(var i=0;i<menus.length;i++){if(menus[i].className==topmostClass){var items=menus[i].getElementsByTagName("li");for(var k=0;k<items.length;k++){items[k].onmouseover=function(){Hover__AspNetMenu(this);};items[k].onmouseout=function(){Unhover__AspNetMenu(this);};if(isPreIE7&&((typeof(items[k].iFrameFormElementMask)=="undefined")||(items[k].iFrameFormElementMask==null))){var iFrameFormElementMask=document.createElement("IFRAME");iFrameFormElementMask.scrolling="no";iFrameFormElementMask.src="javascript:false;";iFrameFormElementMask.frameBorder=0;iFrameFormElementMask.style.display="none";iFrameFormElementMask.style.position="absolute";iFrameFormElementMask.style.filter="progid:DXImageTransform.Microsoft.Alpha(style=0,opacity=0)";iFrameFormElementMask.style.zIndex=-1;items[k].insertBefore(iFrameFormElementMask,items[k].firstChild);items[k].iFrameFormElementMask=iFrameFormElementMask;};};};};};if(isPreIE7){addLL(SetHover__AspNetMenu);};function CanHaveClass__CssFriendlyAdapters(element){return((element!=null)&&(element.className!=null));};function HasAnyClass__CssFriendlyAdapters(element){return(CanHaveClass__CssFriendlyAdapters(element)&&(element.className.length>0));};function HasClass__CssFriendlyAdapters(element,specificClass){return(HasAnyClass__CssFriendlyAdapters(element)&&(element.className.indexOf(specificClass)>-1));};function AddClass__CssFriendlyAdapters(element,classToAdd){if(HasAnyClass__CssFriendlyAdapters(element)){if(!HasClass__CssFriendlyAdapters(element,classToAdd)){element.className=element.className+" "+classToAdd;};}else if(CanHaveClass__CssFriendlyAdapters(element)){element.className=classToAdd;};};function AddClassUpward__CssFriendlyAdapters(startElement,stopParentClass,classToAdd){var elementOrParent=startElement;while((elementOrParent!=null)&&(!HasClass__CssFriendlyAdapters(elementOrParent,topmostClass))){AddClass__CssFriendlyAdapters(elementOrParent,classToAdd);elementOrParent=elementOrParent.parentNode;};};function SwapClass__CssFriendlyAdapters(element,oldClass,newClass){if(HasAnyClass__CssFriendlyAdapters(element)){element.className=element.className.replace(new RegExp(oldClass,"gi"),newClass);};};function SwapOrAddClass__CssFriendlyAdapters(element,oldClass,newClass){if(HasClass__CssFriendlyAdapters(element,oldClass)){SwapClass__CssFriendlyAdapters(element,oldClass,newClass);}else{AddClass__CssFriendlyAdapters(element,newClass);};};function RemoveClass__CssFriendlyAdapters(element,classToRemove){SwapClass__CssFriendlyAdapters(element,classToRemove,"");};function RemoveClassUpward__CssFriendlyAdapters(startElement,stopParentClass,classToRemove){var elementOrParent=startElement;while((elementOrParent!=null)&&(!HasClass__CssFriendlyAdapters(elementOrParent,topmostClass))){RemoveClass__CssFriendlyAdapters(elementOrParent,classToRemove);elementOrParent=elementOrParent.parentNode;};};function Gallgo(eid,pid){var cimg=$(pid);var PC=getXY(cimg);var NewP_L=PC[0]-(parseInt(cimg.width)*0.02);var NewP_T=PC[1]-(parseInt(cimg.height)*0.02);var newimg=$("gallzpic");if(!newimg){newimg=document.createElement("img");newimg.id="gallzpic";};newimg.src=cimg.src;newimg.className="galltdimg";newimg.style.position="absolute";newimg.style.width=(parseInt(cimg.width)*1.04)+"px";newimg.style.height=(parseInt(cimg.height)*1.04)+"px";newimg.style.left=NewP_L+"px";newimg.style.top=NewP_T+"px";newimg.onclick=function(){Open_Pop_Up("/mods/other/gallerie.aspx?id="+eid,"Gallerie");};newimg.onmouseout=function(){if($("gallzpic")){document.body.removeChild($("gallzpic"));}};document.body.appendChild(newimg);};
