function openCGV()
 {
   // 670 / 700
   
   ie = document.all;
   str = "de/cgv.php";
   options = 'toolbar=no, location=no, personalbar=no, status=no, menubar=no, scrollbars=yes ';
   options+='titlebar=yes, alwaysRaised=yes, alwaysLowered=no, dependant=no, hotkeys=no, z-lock=no ';
   options+='resizeabe=no, width=670, height=700, screenX=0, screenY=0';
    if (ie) { cgvwin = window.open(str,'cgvwin', options);  } else
     { cgvwin = window.open(str, 'cgv', options);
       cgvwin.resizeTo(670,700);
       cgvwin.location=str;
     }

   ribwin.focus();   
 }

/* --- partie admin */

function delAddy(id)
 { 
   str  = "Möchten Sie diese Adresse löschen?";
   chaine = 'carnet.php?lg=2&clear='+id;
   if (confirm(str)) { window.location=chaine; }
 }

/* -- partie mecano ... -- */

function activeCageLeft(id)
 {
   var name = "ac[atl]"; var rot = "ac[rtl]";
   document.frm.elements[name].value = id;
   
   str = "Möchten Sie außerdem das entsprechende Gelenkauge wählen?";
   
   if (confirm(str))
    {
      document.frm.rot.value=1;
      document.frm.satl.value=1;
    }
   else
    {
      document.frm.elements[rot].value=0;
    }
    
    document.frm.submit();
 }

function activeCageRight(id)
 {
   var name = "ac[atr]"; var rot = "ac[rtr]";
   document.frm.elements[name].value = id;
   
   str = "Möchten Sie ein Gelenkauge wählen?";
   
   if (confirm(str))
    {
      document.frm.rot.value=1;
      document.frm.satr.value=1;
    }
   else
    {
      document.frm.elements[rot].value=0;
    }
    
    document.frm.submit();
 }

function activeRotuleLeft(id)
 {
   var name = "ac[rtl]";
   document.frm.elements[name].value = id;
   document.frm.submit();
 }

function activeRotuleRight(id)
 {
   var name = "ac[rtr]";
   document.frm.elements[name].value = id;
   document.frm.submit();
 }
 
function activeChapeLeft(id)
 {
   var name = "ac[atl]";
   document.frm.elements[name].value = id;
   document.frm.submit();
 }

function activeChapeRight(id)
 {
   var name = "ac[atr]";
   document.frm.elements[name].value = id;
   document.frm.submit();
 }

/* -- validation du formulaire contact -- */

function vform()
 {

   var err = "Bitte füllen Sie folgende(s) Feld(er) aus : \n\n\t";

   var fields = new Array("nom", "prenom", "email")
   var names = new Array("Name", "Vorname", "E-Mail-Adresse");

   var validok=true;

   for (i=0; i<fields.length; i++)
    {
        if ((document.frm.elements[fields[i]].value == "") ||
            (document.frm.elements[fields[i]].value == " ")) { err += names[i] + "\n\t"; validok=false; }
    }

   if (validok)
    {
      if (document.frm.email.value=="" || !checkEmail(document.frm.email.value)) { validok=false; err += "Inkorrektes Email\n\t"; }
    }

   if (validok) { document.frm.submit(); } else { alert(err); }  
 }

function checkEmail(checkString)
 {
   var newstr=""; var at=false; var dot=false;
    
    if (checkString.indexOf("@") != -1) { at = true; } else if (checkString.indexOf(".") != -1) { dot = true; }
        
    for (var i = 0; i < checkString.length; i++) 
     {
       ch = checkString.substring(i, i + 1)
       if ((ch >= "A" && ch <= "Z") || (ch >= "a" && ch <= "z")
                || (ch == "@") || (ch == ".") || (ch == "_")
                || (ch == "-") || (ch >= "0" && ch <= "9")) {
                newstr += ch;
                if (ch == "@") {
                    at=true;
                }
                if (ch == ".") {
                    dot=true;
                }
        }
    }
    
    if ((at == true) && (dot == true)) { return true; } else { return false; }
 }

function MM_openBrWindow(theURL,winName,features) { //v2.0
  window.open(theURL,winName,features);
}

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 launch(str)
 { ie = document.all;
   options = 'toolbar=no, location=no, personalbar=no, status=no, menubar=no, scrollbars=yes ';
   options+='titlebar=yes, alwaysRaised=yes, alwaysLowered=no, dependant=no, hotkeys=no, z-lock=no ';
   options+='resizeabe=no, width=400, height=500, screenX=0, screenY=0';
    if (ie) { ribwin = window.open(str,'touthawin', options);  } else
     { ribwin = window.open(str, 'touthawin', options);
       ribwin.resizeTo(400,500);
       ribwin.location=str;
     }

   ribwin.focus();
 }
 
 

