function BrowserCheck() {
	var b = navigator.appName;
	if (b == "Netscape") this.b = "NS";
	else if (b == "Microsoft Internet Explorer") this.b = "IE";
	else this.b = b;
	this.v = parseInt(navigator.appVersion);
	this.NS = (this.b == "NS" && this.v>=4);
	this.NS4 = (this.b == "NS" && this.v == 4);
	this.NS5 = (this.b == "NS" && this.v == 5);
	this.IE = (this.b == "IE" && this.v>=4);
	this.IE4 = (navigator.userAgent.indexOf('MSIE 4')>0);
	this.IE5 = (navigator.userAgent.indexOf('MSIE 5')>0);
	if (this.IE5 || this.NS5) this.VER5 = true;
	if (this.IE4 || this.NS4) this.VER4 = true;
	this.OLD = (! this.VER5 && ! this.VER4) ? true : false;
	this.min = (this.NS||this.IE);
}
is = new BrowserCheck();

function getImgXPos(imgElem) {
  if (is.NS4) return eval(imgID).y
  else {  
  	xPos = eval(imgElem).offsetLeft;
  	tempEl = eval(imgElem).offsetParent;
    	while (tempEl != null) {
    		xPos += tempEl.offsetLeft;
    		tempEl = tempEl.offsetParent;
    	}
  	return xPos;
  }
}

function getImgYPos(imgElem) {
  if (is.NS4) return eval(imgID).y
  else {
  	yPos = eval(imgElem).offsetTop;
  	tempEl = eval(imgElem).offsetParent;
  	while (tempEl != null) {
    		yPos += tempEl.offsetTop;
    		tempEl = tempEl.offsetParent;
    	}
  	return yPos;
	}
}

timer = null;
d = null;

function showZoom() {
  d.visibility = 'visible';
  clearTimeout(timer);	
}

function cancelZoom() {
  clearTimeout(timer);		
}

function zoomIn(s, n, t) {
  d = (is.VER5) ? document.getElementById(n).style : (is.NS) ? document.layers[n] : document.all[n].style;
  d.left = getImgXPos(s)-75;
  if (t==1)
    d.top  = getImgYPos(s)-100;  
  else
    d.top  = getImgYPos(s)-10;  
  // d.visibility = 'visible';
  timer = setTimeout("showZoom()", 400);
}

function zoomInBig(s, n, t) {
  d = (is.VER5) ? document.getElementById(n).style : (is.NS) ? document.layers[n] : document.all[n].style;
  d.left = getImgXPos(s);
  if (t==1)
    d.top  = getImgYPos(s)-100;  
  else
    d.top  = getImgYPos(s);  
  d.visibility = 'visible';
}

function zoomOut(n) {
  clearTimeout(timer);	
  var d = (is.VER5) ? document.getElementById(n).style : (is.NS) ? document.layers[n] : document.all[n].style;
  d.visibility = 'hidden';
}

function goIdent() {
  f = document.forms['cart'];
  f.a.value = 'ident';
  f.submit();
}

function goDeliveryForm() {
  f = document.forms['cart'];
  f.a.value = 'delf';
  f.submit();
}

function setDeliveryDate(day, month, year) {
  f = document.forms['orderForm'];
  f.r.value   = 'cart';
  f.a.value   = 'delf';
  f.del_day.value   = day;
  f.del_month.value = month;
  f.del_year.value  = year;
  f.submit();
}

function isPositiveInteger(s) 
{
	return s.match(/^\d+$/);
}

function checkQte(f) {
  var v = f.value;
  if (!isPositiveInteger(v)) {
     alert('Quantité invalide!');
     f.value='1';
  }     
}

function checkPostCode(f) {
  var v = f.value;
  if (!isPositiveInteger(v)) {
     alert('Code postal invalide!');
     f.value='';
  }     
}

function popup(u) {
   window.open(u, '_blank', 'width=400, height=280, location=0, resizable=1, menubar=0, scrollbars=0');
}

function checkEmail(emailAddr) {
// Cette fonction vérifie la bon format d'une adresse e-mail.
// Comme :
// user@domain.com ou user.perso@domain.com
var i;
// Recherche de @
i = emailAddr.indexOf("@");
if (i == -1) {
return false;
}
// Séparation du nom de l'utilisateur et du nom de domaine.
var username = emailAddr.substring(0, i);
var domain = emailAddr.substring(i + 1, emailAddr.length)
// Recherche des espaces au début du nom de l'utilisateur.
i = 0;
while ((username.substring(i, i + 1) == " ") && (i < username.length)) {
i++;
}
// Les enlève s'il en trouve.
if (i > 0) {
username = username.substring(i, username.length);
}
// Recherche d'espaces à la fin du nom de domaine.
i = domain.length - 1;
while ((domain.substring(i, i + 1) == " ") && (i >= 0)) {
i--;
}
// Les enlève s'il en trouve.
if (i < (domain.length - 1)) {
domain = domain.substring(0, i + 1);
}
// Vérifie que le nom de l'utilisateur et du domaine ne soit pas vide.
if ((username == "") || (domain == "")) {
return false;
}
// Vérifie s'il n'y a pas de caractères interdits dans le nom de l'utilisateur.
var ch;
for (i = 0; i < username.length; i++) {
ch = (username.substring(i, i + 1)).toLowerCase();
if (!(((ch >= "a") && (ch <= "z")) ||
((ch >= "0") && (ch <= "9")) ||
(ch == "_") || (ch == "-") || (ch == "."))) {
return false;
}
}
// Vérifie s'il n'y a pas de caractères interdits dans le nom de domaine
for (i = 0; i < domain.length; i++) {
ch = (domain.substring(i, i + 1)).toLowerCase();
if (!(((ch >= "a") && (ch <= "z")) ||
((ch >= "0") && (ch <= "9")) ||
(ch == "_") || (ch == "-") || (ch == "."))) {
return false;
}
}
// Ajouter ci-dessous de nouveaux noms de domaine.
// Voir tous les noms de domaine sur http://www.toulouse-renaissance.net/c_outils/c-nom-domaine.htm
//
var aSuffix = new Array("com","net","int","aero","biz","museum","name","info","coop","pro","eu","edu","org","gov","mil","bj","dz","de","ad","be","ca","bf","bi","cm","cf","cg","cd","ci","dj","fr","ga","gp","gf","lu","mg","ml","ma","mq","mr","mc","nc","pf","re","pm","sn","ch","td","tf","tn","tv","es");
var bFoundSuffix = false;
i = 0;
while (i < aSuffix.length) {
if (("." + aSuffix[i]) == domain.substring(domain.length - aSuffix[i].length - 1, domain.length)) {
return true;
}
i++;
}
// Si le nom de domaine est inconnu : return false
return false;
}
function emailOK(emailAddr) {
if (!(checkEmail(emailAddr))) {
alert("Merci de vérifier votre adresse e-mail. Elle n\'est pas dans le bon format.");
}
}
var message="Vous n'êtes pas autorisé à consulter le code de cette page";
///////////////////////////////////
function clickIE4(){
if (event.button==2){
alert(message);
return false;
}
}
function clickNS4(e){
if (document.layers||document.getElementById&&!document.all){
if (e.which==2||e.which==3){
alert(message);
return false;
}
}
}
if (document.layers){
document.captureEvents(Event.MOUSEDOWN);
document.onmousedown=clickNS4;
}
else if (document.all&&!document.getElementById){
document.onmousedown=clickIE4;
}
document.oncontextmenu=new Function("alert(message);return false")

