// JavaScript Document

function creerFlash(swf, largeur, hauteur, couleur) {
	document.write("<object type=\"application/x-shockwave-flash\" width=\""+largeur+"\" height=\""+hauteur+"\"  data=\""+swf+"\" align=\"middle\">\n");
	document.write("<param name=\"allowScriptAccess\" value=\"sameDomain\" />\n");
	document.write("<param name=\"movie\" value=\""+swf+"\" /><param name=\"quality\" value=\"high\" />");
	if(couleur !="transparent"){
		document.write("<param name=\"bgcolor\" value=\""+couleur+"\" />");
	}else{
		document.write("<param name=\"wmode\" value=\"transparent\">");
	}
	document.write("</object>\n");
}


// Fonctionnalités AJAX vérif formulaire
url = document.location.href;
xend = url.lastIndexOf("/") + 1;
var base_url = url.substring(0, xend);
var ajax_get_error = false;
function ajax_do (url) {
   if (url.substring(0, 4) != 'http') {
      url = base_url + url;
   }
   var jsel = document.createElement('SCRIPT');
   jsel.type = 'text/javascript';
   jsel.src = url;
   document.body.appendChild (jsel);
   return true;
}
function ajax_get (url, el1, el2, el3) {
   if (typeof(el1) == 'string') {
      el1 = document.getElementById(el1);
   }
   if (typeof(el2) == 'string') {
      el2 = document.getElementById(el2);
   }
   if (typeof(el3) == 'string') {
      el3 = document.getElementById(el3);
   }
   if (el1 == null || el2 == null || el3 == null) { return false; }
   if (url.substring(0, 4) != 'http') {
      url = base_url + url;
   }
   getfile_url = base_url + 'getfile.php?url=' + escape(url) + '&el1=' + escape(el1.id) + '&el2=' + escape(el2.id) + '&el3=' + escape(el3.id);
   ajax_do (getfile_url);
   return true;
   
}

function submit_form() {
   // on set les variables
   var nom = document.getElementById('nom').value;
   var prenom = document.getElementById('prenom').value;
   var email = document.getElementById('email').value;
   var telephone = document.getElementById('telephone').value;
   var organisation = document.getElementById('organisation').value;
   
   //on envoie vers le fichier contact_forum-check.php
   url = 'contact-check.php?nom=' + escape(nom) + '&prenom=' + escape(prenom) + '&email=' + escape(email) + '&telephone=' + escape(telephone) + '&organisation=' + escape(organisation);
   
   // on renvoie les résultats dans le div id result
   ajax_get (url, 'resultnom', 'resultprenom', 'resultemail');
}