// =============================
// Check for Flash plugin
// =============================

function CA_checkPlugin() { //v4.0
  var ok=false; plgIn='Shockwave Flash';
  with (navigator) if (appName.indexOf('Microsoft')!=-1 && appVersion.indexOf('Mac')==-1) document.write(''+
	'<scr'+'ipt language="VBScript">\nOn error resume next\n'+
	'CA_dir = IsObject(CreateObject("SWCtl.SWCtl.1"))\n'+
	'CA_flash = NOT IsNull(CreateObject("ShockwaveFlash.ShockwaveFlash"))\n</scr'+'ipt>');

  with (navigator) if (appName.indexOf('Microsoft')==-1 || (plugins && plugins.length)) {
	ok=(plugins && plugins[plgIn]);
  } else if (appVersion.indexOf('3.1')==-1) { //not Netscape or Win3.1
    if (plgIn.indexOf("Flash")!=-1 && window.CA_flash!=null) ok=window.CA_flash;    
    else if (plgIn.indexOf("Director")!=-1 && window.CA_dir!=null) ok=window.CA_dir;}
	if (ok) return true;
	else return false;
}

// =============================
// Ouverture d'un popup
// =============================

function OpenNewWindow(param, title, w, h) {
	window.open(param,title,'width='+w+',height='+h+',directories=no,location=no,menubar=no,scrollbars=yes,status=no,toolbar=no,resizable=no');
}

// =============================
// Ouverture des fenetres coccinart
// =============================

function OpenWindow(id) {
	title="Coccinart";
	w = 700;
	h = 600;
	param="coccinart.php?pageID=" + id; 
	OpenNewWindow(param,title,w,h);
}


// =============================
// Affichage bare d'état
// =============================
function sbm(msg) {
	if (msg==undefined) top.status="http://www.coccinart.com";
	else top.status=msg;
    
}

// =============================
// Soumission d'un formulaire
// =============================
function submit_form() {
	if (document.forms[0].nom.value=="") {
		alert("Veuillez saisir votre nom");
		document.form1.nom.select();
		document.form1.nom.focus();
		return false;
	}
	if (document.forms[0].telephone.value=="") {
		alert("Veuillez saisir votre numéro de téléphone");
		document.form1.telephone.select();
		document.form1.telephone.focus();
		return false;
	}
	if (verify_email(document.forms[0].email.value.toLowerCase())) {
		document.form1.email.select();
		document.form1.email.focus();
		return false;
	}
	window.document.forms[0].submit();
}
// vérification de mail
function verify_email(email) {
	erreur=0
	form = document.forms[0];
	// var adresse = eval("form."+email+".value.toLowerCase()");
	var adresse = email
	var place = adresse.indexOf("@", 1);
	var point = adresse.indexOf(".", (place + 1));

	if ( (place==-1) || (point==-1)) {
		alert("Veuillez entrer une adresse e-mail valide.");
		return true;
	}
}
function confirmation (msg, action, param) {
	if (confirm(msg)) {
		window.location.href=action+'?'+param;
	} else {
		return false;;
	}
}

