﻿// Fichier JScript
function CreateFlash(id, chemin, width, height, vars){
    //id : id de l'element dans lequel on va ecrire le flash
    var d = document.getElementById(id);
    var flash = '<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0" width="' + width + '" height="' + height + '">' +
    '<param name="movie" value="' + chemin + '" />' +
    '<param name="quality" value="high" />' +
    '<param name="wmode" value="transparent" />' +
    '<param name="flashvars" value="' + vars + '">' +
    '<embed src="' + chemin + '" quality="high" pluginspage="http://www.macromedia.com/go/getflashplayer" wmode="transparent" type="application/x-shockwave-flash" flashvars="' + vars + '" width="' + width + '" height="' + height + '"></embed></object>'
	d.innerHTML = flash
}
function afficheMaxi(chemin){
	i1 = new Image;
	i1.src = chemin;
	html = '<HTML><HEAD><TITLE>Image</TITLE></HEAD><BODY LEFTMARGIN=0 MARGINWIDTH=0 TOPMARGIN=0 MARGINHEIGHT=0><CENTER><IMG SRC="'+chemin+'" BORDER=0 NAME=imageTest onLoad="window.resizeTo(document.imageTest.width+14,document.imageTest.height+32)"></CENTER></BODY></HTML>';
	popupImage = window.open('','_blank','toolbar=0,location=0,directories=0,menuBar=0,scrollbars=0,resizable=1');
	popupImage.document.open();
	popupImage.document.write(html);
	popupImage.document.close()
}



var _TBMessage, _TBEmail, _TBNom, _TBPrenom, _TBSociete, _TBAdresse, _TBCode, _TBVille  

function verifForm() {
    if(!verifChamp(document.getElementById("ctl00$ContentPlaceHolder1_TBNom"))){_TBNom=false}else{_TBNom=true}        
    if(!verifChamp(document.getElementById("ctl00_ContentPlaceHolder1_TBPrenom"))){_TBPrenom=false}else{_TBPrenom=true}
    if(!verifChamp(document.getElementById("ctl00_ContentPlaceHolder1_TBSociete"))){_TBSociete=false}else{_TBSociete=true}
    if(!verifChamp(document.getElementById("ctl00_ContentPlaceHolder1_TBAdresse"))){_TBAdresse=false}else{_TBAdresse=true}
    if(!verifChamp(document.getElementById("ctl00_ContentPlaceHolder1_TBCode"))){_TBCode=false}else{_TBCode=true}
    if(!verifChamp(document.getElementById("ctl00_ContentPlaceHolder1_TBVille"))){_TBVille=false}else{_TBVille=true}
    if(!verifChamp(document.getElementById("ctl00_ContentPlaceHolder1_TBPays"))){_TBPays=false}else{_TBPays=true}
    if(!verifChamp(document.getElementById("ctl00_ContentPlaceHolder1_TBTelephone"))){_TBTelephone=false}else{_TBTelephone=true}
    if(!verifChamp(document.getElementById("ctl00_ContentPlaceHolder1_TBMessage"))){_TBMessage=false}else{_TBMessage=true}
    if(!verifMail(document.getElementById("ctl00_ContentPlaceHolder1_TBEmail"))){_TBEmail=false}else{_email=true}

    if(_TBMessage==false || _TBEmail==false || _TBNom==false || _TBPrenom==false || _TBSociete==false || _TBAdresse==false || _TBCode==false || _TBVille==false || _TBTelephone==false || _TBPays==false )return false
   return true
}

function valign(c){
    c.style.marginTop = ((c.height/2) *-1)  + 'px'
}


function verifMail(c){
	if (!c.value){
		c.className = 'champcontacterreur'; return false}
	else if(c.value.search(/^[_a-z0-9-]+(\.[_a-z0-9-]+)*@[a-z0-9-]+(\.[a-z0-9]+)*$/) == -1){
		c.className = 'champcontacterreur'; return false}
	else{
		c.className = 'champcontact'; return true}
}

function verifChamp(c){
	if (!c.value){
		c.className = 'champcontacterreur'; return false}
	else{
		c.className = 'champcontact'; return true}
}
