jQuery(function($){$.datepicker.regional['fr']={closeText:'Fermer',prevText:'&#x3c;Préc',nextText:'Suiv&#x3e;',currentText:'Courant',monthNames:['Janvier','Février','Mars','Avril','Mai','Juin','Juillet','Août','Septembre','Octobre','Novembre','Décembre'],monthNamesShort:['Jan','Fév','Mar','Avr','Mai','Jun','Jul','Aoû','Sep','Oct','Nov','Déc'],dayNames:['Dimanche','Lundi','Mardi','Mercredi','Jeudi','Vendredi','Samedi'],dayNamesShort:['Dim','Lun','Mar','Mer','Jeu','Ven','Sam'],dayNamesMin:['Di','Lu','Ma','Me','Je','Ve','Sa'],weekHeader:'Sm',dateFormat:'dd/mm/yy',firstDay:1,isRTL:false,showMonthAfterYear:false,yearSuffix:''};$.datepicker.setDefaults($.datepicker.regional['fr'])});function is_numeric(num){var exp=new RegExp("^[0-9-.]*$","g");return exp.test(num)}function trim(myString){return myString.replace(/^\s+/g,'').replace(/\s+$/g,'')}function Load(target,div,param){$.post('Ajax-'+target,param,function(data){if(div!=null)$(div).html(data)})}function Delete(target,div,primary){$.post('Ajax-'+target,{action:'delete',primary:primary},function(data){if(div!=null)$(div).html(data)})}function Inscription(div){email=$(div).find('input[name=email]');prenom=$(div).find('input[name=prenom]');nom=$(div).find('input[name=nom]');cgu=$(div).find('input[name=cgu]');flag=true;if(email.val()==''){email.animate({borderTopColor:'#ff0000',borderBottomColor:'#ff0000',borderLeftColor:'#ff0000',borderRightColor:'#ff0000'},'600');flag=false}else email.css('border','');if(prenom.val()==''){prenom.animate({borderTopColor:'#ff0000',borderBottomColor:'#ff0000',borderLeftColor:'#ff0000',borderRightColor:'#ff0000'},'600');flag=false}else prenom.css('border','');if(nom.val()==''){nom.animate({borderTopColor:'#ff0000',borderBottomColor:'#ff0000',borderLeftColor:'#ff0000',borderRightColor:'#ff0000'},'600');flag=false}else nom.css('border','');if(cgu.val()==''){cgu.animate({borderTopColor:'#ff0000',borderBottomColor:'#ff0000',borderLeftColor:'#ff0000',borderRightColor:'#ff0000'},'600');flag=false}else cgu.css('border','');return flag}function AjouterClient(tr){societe=$(tr).find('input[name=societe]');nom=$(tr).find('input[name=nom]');prenom=$(tr).find('input[name=prenom]');adresse=$(tr).find('input[name=adresse]');adresse2=$(tr).find('input[name=adresse2]');cdpost=$(tr).find('input[name=cdpost]');ville=$(tr).find('input[name=ville]');type_client=$(tr).find('select[name=type_client]');$.post('Ajax-Client',{action:'insert',societe:societe.val(),nom:nom.val(),prenom:prenom.val(),adresse:adresse.val(),adresse2:adresse2.val(),cdpost:cdpost.val(),ville:ville.val(),type_client:type_client.val()},function(data){$('#Clients').html(data)})}function AjouterRecette(tr){date=$(tr).find('input[name=date]');piece=$(tr).find('input[name=piece]');id_client=$(tr).find('select[name=id_client]');client=$(tr).find('input[name=client]');nature=$(tr).find('input[name=nature]');montant=$(tr).find('input[name=montant]');id_type_paiement=$(tr).find('select[name=id_type_paiement]');etat=$(tr).find('select[name=etat]');type=$(tr).find('select[name=type]');$.post('Ajax-Recette',{action:'insert',date:date.val(),piece:piece.val(),id_client:id_client.val(),client:client.val(),nature:nature.val(),montant:montant.val(),id_type_paiement:id_type_paiement.val(),type:type.val(),etat:etat.val()},function(data){$('#Recettes').html(data)})}function AjouterAchat(tr){date=$(tr).find('input[name=date]');piece=$(tr).find('input[name=piece]');fournisseur=$(tr).find('input[name=fournisseur]');nature=$(tr).find('input[name=nature]');montant=$(tr).find('input[name=montant]');id_type_paiement=$(tr).find('select[name=id_type_paiement]');etat=$(tr).find('select[name=etat]');$.post('Ajax-Achat',{action:'insert',date:date.val(),piece:piece.val(),fournisseur:fournisseur.val(),nature:nature.val(),montant:montant.val(),id_type_paiement:id_type_paiement.val(),etat:etat.val()},function(data){$('#Achats').html(data)})}function AjouterLigne(tr,id_document){designation=$(tr).find('input[name=designation]');quantite=$(tr).find('input[name=quantite]');prix_unitaire=$(tr).find('input[name=prix_unitaire]');$.post('Ajax-Ligne',{action:'insert',designation:designation.val(),quantite:quantite.val(),prix_unitaire:prix_unitaire.val(),id_document:id_document},function(data){$('#Lignes').html(data)})}function FacturetoRecette(id_document_facture){$.post('Ajax-Recette',{action:'insert',id_document_facture:id_document_facture},function(data){$('.Content').html(data);$('#Menu .menu a.actif').removeClass('actif');$('#Menu .menu a[href=Recettes]').addClass('actif')})}function ChangeMdp(){$.post('Ajax-MotPasse',null,function(data){Popup(data,'Changer mon mot de passe')})}function SendMdp2(form){$.post('Ajax-MotPasse',{mdp:$(form).find('input[name=mdp]').val(),mdp1:$(form).find('input[name=mdp1]').val(),mdp2:$(form).find('input[name=mdp2]').val()},function(data){Popup(data,'Changer mon mot de passe')})}function MdpOublie(data){$.post('Ajax-MotPasseOublie',null,function(data){Popup(data,'Récupération de mot de passe oublié')})}function SendMdp(form){$.post('Ajax-MotPasseOublie',{EmailOublie:$(form).find('input[name=e]').val()},function(data){Popup(data,'Récupération de mot de passe oublié')})}function CreerAcompte(id_document,numero){$.post('Ajax-Acompte',{action:'insert',id_document:id_document,numero:numero},function(data){$('.Content').html(data)})}function InitAide(){$("body").delegate("img[help_text]","mouseover",function(e){t=$(this).attr('help_text');if(t!=""){$(this).after('<div class="Aide"><img src="./img/aide/arrow.png" />'+t+'</div>');var offset=$(this).offset();var w=parseInt($(this).width());left=parseInt(offset.left);left+=w;left+=40;$(this).parent().find('.Aide').css('left',left);$(this).parent().find('.Aide').css('top',offset.top);$(this).parent().find('.Aide').animate({opacity:'1',left:'-=20'},'500')}});$("body").delegate("img[help_text]","mouseout",function(e){$(this).parent().find('.Aide').stop();$(this).parent().find('.Aide').animate({opacity:'0',left:'+=20'},'300',function(){$(this).parent().find('.Aide').remove()})})}function InitDateInput(){$("input[name*=date]").live('click',function(){$(this).datepicker({changeMonth:true,changeYear:true,showOn:'focus'}).focus()})}function InitFocusIE(){$("body").delegate("table td input[type=text]","focus",function(e){$(this).addClass("focus")});$("body").delegate("table td input[type=text]","blur",function(e){if($(this).hasClass('focus')){$(this).removeClass('focus')}})}function InitSelect(){$("*").ajaxSuccess(function(request,settings){request.stopPropagation();_InitSelect()});_InitSelect()}function _InitSelect(){$("select:not(:._styled)").selectmenu({style:"dropdown"});$("select:not(:._styled)").addClass('_styled')}
function SHA256(s){var chrsz=8;var hexcase=0;function safe_add(x,y){var lsw=(x&0xFFFF)+(y&0xFFFF);var msw=(x>>16)+(y>>16)+(lsw>>16);return(msw<<16)|(lsw&0xFFFF)}function S(X,n){return(X>>>n)|(X<<(32-n))}function R(X,n){return(X>>>n)}function Ch(x,y,z){return((x&y)^((~x)&z))}function Maj(x,y,z){return((x&y)^(x&z)^(y&z))}function Sigma0256(x){return(S(x,2)^S(x,13)^S(x,22))}function Sigma1256(x){return(S(x,6)^S(x,11)^S(x,25))}function Gamma0256(x){return(S(x,7)^S(x,18)^R(x,3))}function Gamma1256(x){return(S(x,17)^S(x,19)^R(x,10))}function core_sha256(m,l){var K=new Array(0x428A2F98,0x71374491,0xB5C0FBCF,0xE9B5DBA5,0x3956C25B,0x59F111F1,0x923F82A4,0xAB1C5ED5,0xD807AA98,0x12835B01,0x243185BE,0x550C7DC3,0x72BE5D74,0x80DEB1FE,0x9BDC06A7,0xC19BF174,0xE49B69C1,0xEFBE4786,0xFC19DC6,0x240CA1CC,0x2DE92C6F,0x4A7484AA,0x5CB0A9DC,0x76F988DA,0x983E5152,0xA831C66D,0xB00327C8,0xBF597FC7,0xC6E00BF3,0xD5A79147,0x6CA6351,0x14292967,0x27B70A85,0x2E1B2138,0x4D2C6DFC,0x53380D13,0x650A7354,0x766A0ABB,0x81C2C92E,0x92722C85,0xA2BFE8A1,0xA81A664B,0xC24B8B70,0xC76C51A3,0xD192E819,0xD6990624,0xF40E3585,0x106AA070,0x19A4C116,0x1E376C08,0x2748774C,0x34B0BCB5,0x391C0CB3,0x4ED8AA4A,0x5B9CCA4F,0x682E6FF3,0x748F82EE,0x78A5636F,0x84C87814,0x8CC70208,0x90BEFFFA,0xA4506CEB,0xBEF9A3F7,0xC67178F2);var HASH=new Array(0x6A09E667,0xBB67AE85,0x3C6EF372,0xA54FF53A,0x510E527F,0x9B05688C,0x1F83D9AB,0x5BE0CD19);var W=new Array(64);var a,b,c,d,e,f,g,h,i,j;var T1,T2;m[l>>5]|=0x80<<(24-l%32);m[((l+64>>9)<<4)+15]=l;for(var i=0;i<m.length;i+=16){a=HASH[0];b=HASH[1];c=HASH[2];d=HASH[3];e=HASH[4];f=HASH[5];g=HASH[6];h=HASH[7];for(var j=0;j<64;j++){if(j<16)W[j]=m[j+i];else W[j]=safe_add(safe_add(safe_add(Gamma1256(W[j-2]),W[j-7]),Gamma0256(W[j-15])),W[j-16]);T1=safe_add(safe_add(safe_add(safe_add(h,Sigma1256(e)),Ch(e,f,g)),K[j]),W[j]);T2=safe_add(Sigma0256(a),Maj(a,b,c));h=g;g=f;f=e;e=safe_add(d,T1);d=c;c=b;b=a;a=safe_add(T1,T2)}HASH[0]=safe_add(a,HASH[0]);HASH[1]=safe_add(b,HASH[1]);HASH[2]=safe_add(c,HASH[2]);HASH[3]=safe_add(d,HASH[3]);HASH[4]=safe_add(e,HASH[4]);HASH[5]=safe_add(f,HASH[5]);HASH[6]=safe_add(g,HASH[6]);HASH[7]=safe_add(h,HASH[7])}return HASH}function str2binb(str){var bin=Array();var mask=(1<<chrsz)-1;for(var i=0;i<str.length*chrsz;i+=chrsz){bin[i>>5]|=(str.charCodeAt(i/chrsz)&mask)<<(24-i%32)}return bin}function Utf8Encode(string){string=string.replace(/\r\n/g,"\n");var utftext="";for(var n=0;n<string.length;n++){var c=string.charCodeAt(n);if(c<128){utftext+=String.fromCharCode(c)}else if((c>127)&&(c<2048)){utftext+=String.fromCharCode((c>>6)|192);utftext+=String.fromCharCode((c&63)|128)}else{utftext+=String.fromCharCode((c>>12)|224);utftext+=String.fromCharCode(((c>>6)&63)|128);utftext+=String.fromCharCode((c&63)|128)}}return utftext}function binb2hex(binarray){var hex_tab=hexcase?"0123456789ABCDEF":"0123456789abcdef";var str="";for(var i=0;i<binarray.length*4;i++){str+=hex_tab.charAt((binarray[i>>2]>>((3-i%4)*8+4))&0xF)+hex_tab.charAt((binarray[i>>2]>>((3-i%4)*8))&0xF)}return str}s=Utf8Encode(s);return binb2hex(core_sha256(str2binb(s),s.length*chrsz))}
