// © ATELIER 33 / ALL RIGHTS RESERVED / 2001 / http://www.atelier33.com / contact@atelier33.com
// Toute copie complete ou partielle de ce code est interdite ;) -=]U-R[=-
//=============================================================================================\\
//                                          CLIENT SIDE                                        \\
//=============================================================================================\\
//VARS
//----------------------------------------------------------
function ReloadOpener(){opener.location.reload(true)}
//----------------------------------------------------------
function ReloadPage(){self.location.reload(true)}
//----------------------------------------------------------
function ResetA_AFF(){var Dis = document.Form01; Dis.A_AFFTxt.value="";}
//----------------------------------------------------------
function check_empty(text){return (text.length > 0);}
//----------------------------------------------------------
function check_email(adresse)
{
 if ((adresse == "") || (adresse.indexOf ('@') == -1) || (adresse.indexOf ('.') == -1))
      return false;
    return true;
}
//----------------------------------------------------------
function SelfMoveTo(DaX, DaY){self.moveTo(DaX, DaY)}
//----------------------------------------------------------
function MM_callJS(jsStr) {return eval(jsStr)} //v2.0
//----------------------------------------------------------
function MM_checkPlugin(plgIn, theURL, altURL, autoGo) { //v3.0
  var ok=false; document.MM_returnValue = false;
  with (navigator) if (appName.indexOf('Microsoft')==-1) ok=(plugins && plugins[plgIn]);
  else if (appVersion.indexOf('3.1')==-1) { //not Netscape or Win3.1
    if (plgIn.indexOf("Flash")!=-1 && window.MM_flash!=null) ok=window.MM_flash;
    else if (plgIn.indexOf("Director")!=-1 && window.MM_dir!=null) ok=window.MM_dir;
    else ok=autoGo; }
  if (!ok) theURL=altURL; if (theURL) window.open('phppages/main01.htm','PHP','resizable=yes,width=775,height=505');;
}
//----------------------------------------------------------
function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}
//----------------------------------------------------------
function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i>a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}
//----------------------------------------------------------
function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}
//----------------------------------------------------------
function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}
//----------------------------------------------------------
function MM_goToURL() { //v3.0
  var i, args=MM_goToURL.arguments; document.MM_returnValue = false;
  for (i=0; i<(args.length-1); i+=2) eval(args[i]+".location='"+args[i+1]+"'");}
//----------------------------------------------------------  
function MM_reloadPage(init)
 {   if (init==true) with (navigator) {if ((appName=="Netscape")&&(parseInt(appVersion)==4)) {
    document.MM_pgW=innerWidth; document.MM_pgH=innerHeight; onresize=MM_reloadPage; }}
  else if (innerWidth!=document.MM_pgW || innerHeight!=document.MM_pgH) location.reload();
}
MM_reloadPage(true);
//----------------------------------------------------------
function MM_showHideLayers() { 
  var i,p,v,obj,args=MM_showHideLayers.arguments;if(document.getElementById){
   for (i=0; i<(args.length-2); i+=3){ obj=tmt_findObj(args[i]);v=args[i+2];
  v=(v=='show')?'visible':(v='hide')?'hidden':v;
 if(obj)obj.style.visibility=v;}} else{
  for (i=0; i<(args.length-2); i+=3) if ((obj=MM_findObj(args[i]))!=null) { v=args[i+2];
    if (obj.style) { obj=obj.style; v=(v=='show')?'visible':(v='hide')?'hidden':v; }
    obj.visibility=v; }}
}
//----------------------------------------------------------
function tmt_findObj(n){
	var x,t; if((n.indexOf("?"))>0&&parent.frames.length){t=n.split("?");
	x=eval("parent.frames['"+t[1]+"'].document.getElementById('"+t[0]+"')");
	}else{x=document.getElementById(n)}return x;
}
//----------------------------------------------------------
function MM_openBrWindow(theURL,winName,features) { //v2.0
  window.open(theURL,winName,features);}
//----------------------------------------------------------
function Dem()
{
browserName = navigator.appName; browserVer = parseInt(navigator.appVersion);
if (browserName == "Microsoft Internet Explorer" && browserVer >= 4){}
else {alert("Utilisateurs de Netscape Communicator : \nFonction non disponible sur NC.\n\nNetscape users : \nUnavailable function on NC.")}
}
//----------------------------------------------------------
function Add()
{
browserName = navigator.appName; browserVer = parseInt(navigator.appVersion);
if (browserName == "Microsoft Internet Explorer" && browserVer >= 4) {window.external.AddFavorite(location.href, document.title);}
else {alert("Utilisateurs de Netscape Communicator : \nPresser Ctrl + D pour bookmarquer ce site.\n\nNetscape users :\nPress Ctrl + D")}
} 
//----------------------------------------------------------
function CheckContact()
{
   validity = true;
      
   if (!check_empty(document.Form01.M_FromNom.value))
      {alert("Indiquez votre nom, svp.");
	   document.Form01.M_FromNom.focus(); validity = false;  return validity;}
	   
   if (!check_empty(document.Form01.M_FromPre.value))
      {alert("Indiquez votre prénom, svp.");
	   document.Form01.M_FromPre.focus(); validity = false;  return validity;} 

   if (!check_empty(document.Form01.M_FromAdresse.value))
      {alert("Indiquez votre adresse, svp.");
	   document.Form01.M_FromAdresse.focus(); validity = false;  return validity;}	   

   if (!check_empty(document.Form01.M_FromTel.value))
      {alert("Indiquez votre n° de téléphone, svp.");
	   document.Form01.M_FromTel.focus(); validity = false;  return validity;}	

   if (!check_empty(document.Form01.M_FromFax.value))
      {alert("Indiquez votre n° de fax, svp.");
	   document.Form01.M_FromFax.focus(); validity = false;  return validity;}
	         
  if (!check_email(document.Form01.M_FromEmail.value))
     { validity = false; alert("Indiquez correctement votre email, svp.");
       document.Form01.M_FromEmail.focus(); return validity;} 
	   
   if (!check_empty(document.Form01.M_FromMsg.value))
      {alert("Indiquez votre message, svp.");
	   document.Form01.M_FromMsg.focus(); validity = false;  return validity;}		   
}
//----------------------------------------------------------
function CheckOffres()
{
   validity = true;
   
   if( (document.Form02.O_Ref.value == "") || (document.Form02.O_Lib.value == "") || (document.Form02.O_Code.value == ""))
     {alert("Désolé, abscence de référence, le formulaire ne peut être traité.")
	  document.Form02.M_FromNom.focus(); validity = false;  return validity;}    
      
   if (!check_empty(document.Form02.M_FromNom.value))
      {alert("Indiquez votre nom, svp.");
	   document.Form02.M_FromNom.focus(); validity = false;  return validity;}
	   
   if (!check_empty(document.Form02.M_FromPre.value))
      {alert("Indiquez votre prénom, svp.");
	   document.Form02.M_FromPre.focus(); validity = false;  return validity;} 

   if (!check_empty(document.Form02.M_FromAdresse.value))
      {alert("Indiquez votre adresse, svp.");
	   document.Form02.M_FromAdresse.focus(); validity = false;  return validity;}	   

   if (!check_empty(document.Form02.M_FromTel.value))
      {alert("Indiquez votre n° de téléphone, svp.");
	   document.Form02.M_FromTel.focus(); validity = false;  return validity;}	

   if (!check_empty(document.Form02.M_FromFax.value))
      {alert("Indiquez votre n° de fax, svp.");
	   document.Form02.M_FromFax.focus(); validity = false;  return validity;}
	         
  if (!check_email(document.Form02.M_FromEmail.value))
     { validity = false; alert("Indiquez correctement votre email, svp.");
       document.Form02.M_FromEmail.focus(); return validity;} 
	   
   if (!check_empty(document.Form02.M_FromMsg.value))
      {alert("Indiquez votre message, svp.");
	   document.Form02.M_FromMsg.focus(); validity = false;  return validity;}  		   
}
//----------------------------------------------------------
function PrintIt() {
    if (document.all) {
        if (navigator.appVersion.indexOf("5.0") == -1) {
            var OLECMDID_PRINT = 6;
            var OLECMDEXECOPT_DONTPROMPTUSER = 2;
            var OLECMDEXECOPT_PROMPTUSER = 1;
            var WebBrowser = "<OBJECT ID=\"WebBrowser1\" WIDTH=0 HEIGHT=0 CLASSID=\"CLSID:8856F961-340A-11D0-A96B-00C04FD705A2\"></OBJECT>";
            document.body.insertAdjacentHTML("beforeEnd", WebBrowser);
            WebBrowser1.ExecWB(6, 2);
            WebBrowser1.outerHTML = "";
        } else {
            self.print();
        }
    } else {
        self.print();
    }
}
//----------------------------------------------------------
function Fiche(DaID)
{
 if (DaID !="") {winFiche = window.open ('/offres/surgeles/offres_surgeles_fiche01.asp?reqid='+DaID+'','FICHE','scrollbars=yes,menubar=no,resizable=yes,status=no,width=700,height=600');}
 else           {alert("Référence manquante, la fiche ne peut être affichée.")}
}
//----------------------------------------------------------
function FicheRec(DaID)
{
 if (DaID !="") {winFiche = window.open ('/offres/recettes_volailles/recette_fiche.asp?reqid='+DaID+'','FICHE','scrollbars=yes,menubar=yes,resizable=yes,status=no,width=650,height=600');}
 else           {alert("Référence manquante, la fiche ne peut être affichée.")}
}
//----------------------------------------------------------
function Estivol()
{
 winFiche = window.open ('/charcuterie/estivol.htm','FICHE','scrollbars=yes,menubar=no,resizable=yes,status=no,width=520,height=600');
}
//----------------------------------------------------------
function Saucisses()
{
 winFiche = window.open ('/charcuterie/saucisses.htm','FICHE','scrollbars=yes,menubar=no,resizable=yes,status=no,width=520,height=600');
}