// fenetre popup au centre
function fenetreCentre(url,nom,largeur,hauteur,options) {
	var haut=(screen.height-hauteur)/2;
	var Gauche=(screen.width-largeur)/2;
	fencent=window.open(url,nom,"top="+haut+",left="+Gauche+",width="+largeur+",height="+hauteur+","+options);
}

// fenetre popup plein ecran
function fenetreSplash(url,nom,options) {
	var Haut=0;
	var Gauche=0;
	var Bas=0;
	var Droite=0;
	fencent=window.open(url,nom,"top="+Haut+",left="+Gauche+",width="+screen.width+",height="+screen.height+","+options);
}

// vérifie email est valide
function checkEmail(element) {
	email = document.getElementById(element).value;
	var msg = '';
	if (email!= "")	{
		indexAroba = email.indexOf('@');
		indexPoint = email.indexOf('.');
		if ((indexAroba < 0) || (indexPoint < 0)) {
			msg += "L'email doit être de la form email@fournisseur.com\n";
		}
		if(email=='email@fournisseur.com') {
			msg += "Vous devez entrer un email valide";
		}
	}
	else { msg += "Vous devez rentrer votre email !!! \n"; }
	if(msg!='') { 
		alert(msg);
		return false;
	}
	else {
		return true;
	}
}

// fonction pour lancer une anim flash
function FlashInt(swf, largeur, hauteur, couleur, nom, cat, maxImg) {
		 document.write('<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0" width="'+largeur+'" height="'+hauteur+'" id="flash" align="middle">');
		 document.write('<param name="allowScriptAccess" value="always" />');
		 document.write('<param name="allowFullScreen" value="false" />');
		 document.write('<param name="movie" value="'+swf+'" />');
		 document.write('<param name="quality" value="high" />');
		 document.write('<param name="flashvars" value="&cat='+cat+'&maxImg='+maxImg+'" />');

		 document.write('<param name="bgcolor" value="'+couleur+'" />');
		  document.write('<embed src="'+swf+'" ');
		   document.write('quality="high" ');
		   document.write('flashvars="&cat='+cat+'&maxImg='+maxImg+'"');
		   document.write('bgcolor="'+couleur+'" ');
		   document.write('width="'+largeur+'" height="'+hauteur+'" ');
		   document.write('name="'+nom+'" ');
		   document.write('align="middle" ');
		   document.write('allowScriptAccess="always" allowFullScreen="false" ');
		   document.write('type="application/x-shockwave-flash" ');
		   document.write('pluginspage="http://www.macromedia.com/go/getflashplayer" />');
		 document.write('</object>');
}
//BLINK - IE does not understand the blink css
var text_timer;
var text_visible = 1;
var text_tmp;

function blink(){

	if (text_visible){
		text_tmp = document.email_form.email.value;
		document.email_form.email.value = '';
		text_visible = false;
	}
	else{
		document.email_form.email.value = text_tmp;
		text_visible = true;
	}
}

function start_blink(){
	if (document.email_form) {
		if (document.email_form.email.value=='@'){
			text_timer = setInterval('blink()', 500);
		}
	}
}

function stop_blink(){
	if (text_timer){
		clearInterval(text_timer);
	}
}

function email_focus(){
	stop_blink();
	e = document.email_form.email;
	if (e.value == '@') e.value = '';
}

function email_blur(){
	e = document.email_form.email;
	if (e.value == '@' || e.value == ''){
		e.value = '@';
		start_blink();
	}
}
