// JavaScript Document
var ajaxManager = $.manageAjax({manageType: 'queue', maxReq: 2, blockSameRequest: true}); 
	
function onload(){
	$.ajaxSetup({
	  url: 		"Request/request.php",
	  global: 	false,
	  type: 	"GET",
	  dataType:	'html'
	});
}

$( function(){
	onload();
});

var alpha_letters = ' ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz_-';
var alpha_name = ' ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyzÊÔÛÈÉèéûîÎáçàêùú-\'';
var alpha_num = ' ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyzÊÔÛÈÉèéûîÎáçàêùú0123456789_-\'';
var alpha_numbers = '0123456789';
var alpha_tel = '0123456789+ ';
var alpha_special = '-';
var alpha_email='0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz@._-+';
var alpha_password='0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz@._-+$*&%';
var alpha_numlet='0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz.- ';
var alpha_vehicle	= ' 0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ';
function alpha(e,allow) {

var k;
//var evtobj=window.event? event : e;
k=document.all?parseInt(e.keyCode): parseInt(e.which);
//alert(k);
      if (k!=13 && k!=8 && k!=0){
            //alert(allow.indexOf(String.fromCharCode(k))!=-1);
            if ((e.ctrlKey==false) && (e.altKey==false)) {
                  return (allow.indexOf(String.fromCharCode(k).toUpperCase())!=-1);
            } else {
                  return true;
            }
      } else {
            return true;
      }
}

function isNumberKey(evt)
{
 var charCode = (evt.which) ? evt.which : event.keyCode
    if (charCode > 31 && (charCode < 48 || charCode > 57)) return false;
    return true;
}

function validateEmail(emailStr) 
{
	/* The following variable tells the rest of the function whether or not
	to verify that the address ends in a two-letter country or well-known
	TLD.  1 means check it, 0 means don't. */
	var checkTLD=1;
	/* The following is the list of known TLDs that an e-mail address must end with. */
	var knownDomsPat=/^(com|net|org|edu|int|mil|gov|arpa|biz|aero|name|coop|info|pro|museum)$/;
	/* The following pattern is used to check if the entered e-mail address
	fits the user@domain format.  It also is used to separate the username
	from the domain. */
	var emailPat=/^(.+)@(.+)$/;
	/* The following string represents the pattern for matching all special
	characters.  We don't want to allow special characters in the address. 
	These characters include ( ) < > @ , ; : \ " . [ ] */
	var specialChars="\\(\\)><@,;:'\\\\\\\"\\.\\[\\]";
	/* The following string represents the range of characters allowed in a 
	username or domainname.  It really states which chars aren't allowed.*/
	var validChars="\[^\\s" + specialChars + "\]";
	/* The following pattern applies if the "user" is a quoted string (in
	which case, there are no rules about which characters are allowed
	and which aren't; anything goes).  E.g. "jiminy cricket"@disney.com
	is a legal e-mail address. */
	var quotedUser="(\"[^\"]*\")";
	/* The following pattern applies for domains that are IP addresses,
	rather than symbolic names.  E.g. joe@[123.124.233.4] is a legal
	e-mail address. NOTE: The square brackets are required. */
	var ipDomainPat=/^\[(\d{1,3})\.(\d{1,3})\.(\d{1,3})\.(\d{1,3})\]$/;
	/* The following string represents an atom (basically a series of non-special characters.) */
	var atom=validChars + '+';
	/* The following string represents one word in the typical username.
	For example, in john.doe@somewhere.com, john and doe are words.
	Basically, a word is either an atom or quoted string. */
	var word="(" + atom + "|" + quotedUser + ")";
	// The following pattern describes the structure of the user
	var userPat=new RegExp("^" + word + "(\\." + word + ")*$");
	/* The following pattern describes the structure of a normal symbolic
	domain, as opposed to ipDomainPat, shown above. */
	var domainPat=new RegExp("^" + atom + "(\\." + atom +")*$");
	/* Finally, let's start trying to figure out if the supplied address is valid. */
	/* Begin with the coarse pattern to simply break up user@domain into
	different pieces that are easy to analyze. */
	var matchArray=emailStr.match(emailPat);
	if (matchArray==null) 
	{
		/* Too many/few @'s or something; basically, this address doesn't
		even fit the general mould of a valid e-mail address. */
		
		return false;
	}
	var user=matchArray[1];
	var domain=matchArray[2];
	// Start by checking that only basic ASCII characters are in the strings (0-127).
	for (i=0; i<user.length; i++) 
	{
		if (user.charCodeAt(i)>127) 
		{
			return false;
		}
	}
	for (i=0; i<domain.length; i++) 
	{
		if (domain.charCodeAt(i)>127) 
		{
			return false;
		}
	}
	// See if "user" is valid 
	if (user.match(userPat)==null) 
	{
		// user is not valid
		return false;
	}
	/* if the e-mail address is at an IP address (as opposed to a symbolic
	host name) make sure the IP address is valid. */
	var IPArray=domain.match(ipDomainPat);
	if (IPArray!=null) 
	{
		// this is an IP address
	
		for (var i=1;i<=4;i++) 
		{
			if (IPArray[i]>255) 
			{
				return false;
	   		}
		}
		return true;
	}
	// Domain is symbolic name.  Check if it's valid.
	var atomPat=new RegExp("^" + atom + "$");
	var domArr=domain.split(".");
	var len=domArr.length;
	for (i=0;i<len;i++) 
	{
		if (domArr[i].search(atomPat)==-1) 
		{
			return false;
	   	}
	}
	/* domain name seems valid, but now make sure that it ends in a
	known top-level domain (like com, edu, gov) or a two-letter word,
	representing country (uk, nl), and that there's a hostname preceding 
	the domain or country. */
	if (checkTLD && domArr[domArr.length-1].length!=2 && 
	domArr[domArr.length-1].search(knownDomsPat)==-1) 
	{
		return false;
	}
	// Make sure there's a host name preceding the domain.
	if (len<2) 
	{
		return false;
	}
	// If we've gotten this far, everything's valid!
	return true;
}


/*Sending data function*/
function sendinfo(url, response){	
		//$("#test").html("<img src='img/loading.gif'>");	
		ajaxManager.add({ 
			cache:		true,		
			success: function(res, status) { 							
				eval(response)(res, status);
			}, 
			url:url			
		});
}

function changeimage(id, im){
	document.getElementById(id).src = im;	
}

function validnews(lg, tp){
	var valid = true;
	if($('#txtemail').val() == ''){		
		if(lg == 'fr'){
			alert("Veuillez entrer votre adresse email!");			
		}
		else{
			alert("Please enter your email valid!");			
		}
		valid = false;
		$('#txtemail').focus();
		return false;
	}
	if(!validateEmail($('#txtemail').val())){
		if(lg == 'fr'){
			alert("Adresse email n'est pas valide!");			
		}
		else{
			alert("Please enter a  valid email address!");			
		}
		valid = false;
		$('#txtemail').val('');
		$('#txtemail').focus();
		return false;	
	}
	if(valid){
		var eml = $('#txtemail').val();		
		var url = "requete.php?task=newsletter&eml="+eml+"&lg="+lg+"&tp="+tp;
		sendinfo(url, "callnewsletter");
	}
}

function callnewsletter(res, status){
	alert(res);
	$('#txtemail').val('');
	$('#txtemail').focus();
	return false;	
}

function validmessage(lg, dest, site){	
	var valid = true;
	if($('#txtnom').val() == ''){		
		if(lg == 'fr'){
			alert("Veuillez entrer votre nom!");			
		}
		else{
			alert("Please enter your name!");			
		}
		valid = false;
		$('#txtnom').focus();
		return false;
	}
	if($('#txtmesemail').val() == ''){		
		if(lg == 'fr'){
			alert("Veuillez entrer votre adresse email!");			
		}
		else{
			alert("Please enter your email valid!");			
		}
		valid = false;
		$('#txtmesemail').focus();
		return false;
	}
	if(!validateEmail($('#txtmesemail').val())){
		if(lg == 'fr'){
			alert("Adresse email n'est pas valide!");			
		}
		else{
			alert("Please enter a  valid email address!");			
		}
		valid = false;
		$('#txtmesemail').val('');
		$('#txtmesemail').focus();
		return false;	
	}	
	if($('#txtobjet').val() == ''){		
		if(lg == 'fr'){
			alert("Veuillez entrer objet du message!");			
		}
		else{
			alert("Please enter subject of the message!");			
		}
		valid = false;
		$('#txtobjet').focus();
		return false;
	}
	if($('#txtmessage').val() == ''){		
		if(lg == 'fr'){
			alert("Veuillez entrer votre message!");			
		}
		else{
			alert("Please enter your message!");			
		}
		valid = false;
		$('#txtmessage').focus();
		return false;
	}
	if(valid){
		var val = dest+";"+$("#txtnom").val()+";"+$("#txtmesemail").val()+";"+$("#txtsociete").val()+";"+$("#txtobjet").val()+";"+$("#txtmessage").val()+";"+lg+";"+$("#txttel").val()+";"+$("#txtfax").val()+";"+site;		
		var url = "requete.php?task=sendmsg&val="+val;
		if(lg == 'fr'){
			$('#formcontact').html("<p align='center'><img src='img/loading.gif' border='0'> <br />Envoie de message en cour.</p>");
		}
		else{
			$('#formcontact').html("<p align='center'><img src='img/loading.gif' border='0'> <br />Sending message.</p>");	
		}		
		sendinfo(url, "callsendmsg");		
	}
}

function callsendmsg(res, status){
	$('#formcontact').html(res);
}

function encour(lg){
	if(lg == 'fr'){
		alert("Page en cours de réalisation.");			
	}
	else{
		alert("Page under construction!");			
	}
	return false;
}

function clearValue(field){
	document.getElementById(field).value = "";
}

function submitsearch(lg){
	var valid = true;
	if($('#query').val() == ''){		
		if(lg == 'fr'){
			alert("Veuillez entrer votre mot de recherche!");			
		}
		else{
			alert("Please enter your search word!");			
		}
		valid = false;
		$("#query").focus();
		return false;
	}
	if (valid){		
		document.search.submit();		
	}
}

function afournir(){
	alert('à fournir');
	return false;	
}

function showhide(cid, uid, toshow, tohide){
	if($(cid).attr('checked') == true){
		$(toshow).show(500);
		$(uid).removeAttr('checked');
		$(tohide).hide(500);
	}
	else{
		$(toshow).hide(500);
		$(cid).removeAttr('checked');
		$(uid).removeAttr('checked');
		$(tohide).hide(500);
	}
}

function clrtext(id){
	$(id).val('');
}

function checkdeux(thetrue, thefalse, chk, notchk){
	if($(thetrue).attr('checked') == true){
		$(thefalse).removeAttr('checked');	
		$(chk).attr('checked', true);
		$(notchk).removeAttr('checked');
	}
	else{
		$(thetrue).removeAttr('checked');	
		$(thefalse).removeAttr('checked');	
		$(chk).removeAttr('checked');	
		$(notchk).removeAttr('checked');	
	}	
}

function validthedate(id, lg, fld){
	if(!$(id).val() == ''){
		var thedate = $(id).val();
		var url = "requete.php?task=valdate&par="+thedate+"&lg="+lg+"&fld="+fld;
		//alert(url);
		sendinfo(url, "calldate");
	}
	else{
		if(lg == 'fr'){
			alert("Veuillez choisir une date valide");	
		}
		else{
			alert("Please choose a valide date");	
		}
		$(id).focus();
		return false;		
	}
}

function calldate(res, status){
	if(res != 1){
		var sep = res.split(";");		
		alert(sep[0]);
		var fld = "#"+sep[1];
		$(fld).focus();
	}
}

function confdelete(resform,lg, fld){
	if(lg == 'fr'){
		if(confirm("Effacer")){
			/*if(resform == 'bondecommande'){
				document.bondecommande.reset();
				$(fld).focus();
			}*/	
			return true;
			$(fld).focus();
		}
		else{
			return false;	
		}
	}
	else{
		if(confirm("Reset form")){
			return true;
			$(fld).focus();
		}
		else{
			return false;	
		}	
	}
}

function shownumlogo(id, divshow, logoval){
	if($(id).attr('checked') == true){
		$(divshow).show(500);		
		$(logoval).html('500 &euro;')
		$("#recap2").html(500);
	}
	else{
		$(divshow).hide(500);		
		$(logoval).html('')
		$("#recap2").html('');
		document.getElementById("selnumlogo").selectedIndex = 0;
	}
}

function resetlogoval(id,logoval){
	var num = parseInt($(id).val());
	var sum;	
	switch(num)
	{
		case 1:
			sum = 500;
		  break;
		case 2:
			sum = 900;
		  break;
		case 3:
			sum = 1200;
		  break;
		case 4:
			sum = 1400;			
		  break;
		default:
		  	sum = 500;
	}	
	$(logoval).html(sum+" &euro;");	
	/*$("#recap2").html(sum);	*/	
}

function shownumatelier(id, divshow, atelval, att1, att2, att3, att4){
	if($(id).attr('checked') == true){
		$(divshow).show(500);		
		$(atelval).html('1500 &euro;')
		$("#recap3").html(500);		
		$(att1).show(500);	
	}
	else{
		$(divshow).hide(500);		
		$(atelval).html('')
		$("#recap3").html('');
		$(att1).hide(500);
		$(att2).hide(500);
		$(att3).hide(500);
		$(att4).hide(500);
		$("#txtatel1theme").val('');
		$("#txtatel2theme").val('');
		$("#txtatel3theme").val('');
		$("#txtatel4theme").val('');
		document.getElementById("selateljour1").selectedIndex = 0;
		document.getElementById("selateljour2").selectedIndex = 0;
		document.getElementById("selateljour3").selectedIndex = 0;
		document.getElementById("selateljour4").selectedIndex = 0;
		document.getElementById("seltimeatel1").selectedIndex = 0;
		document.getElementById("seltimeatel2").selectedIndex = 0;
		document.getElementById("seltimeatel3").selectedIndex = 0;
		document.getElementById("seltimeatel4").selectedIndex = 0;
		$("#txtatel1inter").val('');
		$("#txtatel2inter").val('');
		$("#txtatel3inter").val('');
		$("#txtatel4inter").val('');
		document.getElementById("selnumatelier").selectedIndex = 0;
	}
}

function resetatelierval(id,atelval){
	var num = parseInt($(id).val());
	var sum;	
	switch(num)
	{
		case 1:
			sum = 1500;
			$("#atelier1").show(500);
			$("#atelier2").hide(500);
			$("#atelier3").hide(500);
			$("#atelier4").hide(500);
			$("#txtatel2theme").val('');
			$("#txtatel3theme").val('');
			$("#txtatel4theme").val('');
			document.getElementById("selateljour2").selectedIndex = 0;
			document.getElementById("selateljour3").selectedIndex = 0;
			document.getElementById("selateljour4").selectedIndex = 0;
			document.getElementById("seltimeatel2").selectedIndex = 0;
			document.getElementById("seltimeatel3").selectedIndex = 0;
			document.getElementById("seltimeatel4").selectedIndex = 0;
			$("#txtatel2inter").val('');
			$("#txtatel3inter").val('');
			$("#txtatel4inter").val('');
		  break;
		case 2:
			sum = 2700;
			$("#atelier1").show(500);
			$("#atelier2").show(500);
			$("#atelier3").hide(500);
			$("#atelier4").hide(500);			
			$("#txtatel3theme").val('');
			$("#txtatel4theme").val('');			
			document.getElementById("selateljour3").selectedIndex = 0;
			document.getElementById("selateljour4").selectedIndex = 0;			
			document.getElementById("seltimeatel3").selectedIndex = 0;
			document.getElementById("seltimeatel4").selectedIndex = 0;			
			$("#txtatel3inter").val('');
			$("#txtatel4inter").val('');
		  break;
		case 3:
			sum = 4000;
			$("#atelier1").show(500);
			$("#atelier2").show(500);
			$("#atelier3").show(500);
			$("#atelier4").hide(500);			
			$("#txtatel4theme").val('');			
			document.getElementById("selateljour4").selectedIndex = 0;			
			document.getElementById("seltimeatel4").selectedIndex = 0;			
			$("#txtatel4inter").val('');
		  break;
		case 4:
			sum = 5000;
			$("#atelier1").show(500);
			$("#atelier2").show(500);
			$("#atelier3").show(500);
			$("#atelier4").show(500);
		  break;
		default:
		  	sum = 1500;
			$("#atelier1").show(500);
			$("#atelier2").hide(500);
			$("#atelier3").hide(500);
			$("#atelier4").hide(500);
	}	
	$(atelval).html(sum+" &euro;");	
	/*$("#recap3").html(sum);	*/
}

function checkfinsc(id){
	if($(id).attr('checked') == false){
		$("#prepubic").removeAttr('checked');
		$("#atelconf").removeAttr('checked');
		$("#atelconf2").removeAttr('checked');
		$('#prepubic').attr("disabled", true);
		$('#atelconf').attr("disabled", true);
		$('#atelconf2').attr("disabled", true);
		$("#logonum").hide(500);
		document.getElementById("selnumlogo").selectedIndex = 0;
		$("#logoval").html('');
		$("#recap2").html('');
		$("#tableatelier").hide(500);
		document.getElementById("selnumatelier").selectedIndex = 0;
		$("#totalatelier").html('');
		$("#recap3").html('');
		$("#atelier1").hide(500);
		$("#atelier2").hide(500);
		$("#atelier3").hide(500);
		$("#atelier4").hide(500);
		$("#txtatel1theme").val('');
		$("#txtatel2theme").val('');
		$("#txtatel3theme").val('');
		$("#txtatel4theme").val('');
		document.getElementById("selateljour1").selectedIndex = 0;
		document.getElementById("selateljour2").selectedIndex = 0;
		document.getElementById("selateljour3").selectedIndex = 0;
		document.getElementById("selateljour4").selectedIndex = 0;
		document.getElementById("seltimeatel1").selectedIndex = 0;
		document.getElementById("seltimeatel2").selectedIndex = 0;
		document.getElementById("seltimeatel3").selectedIndex = 0;
		document.getElementById("seltimeatel4").selectedIndex = 0;
		$("#txtatel1inter").val('');
		$("#txtatel2inter").val('');
		$("#txtatel3inter").val('');
		$("#txtatel4inter").val('');
		$("#confpar1").hide(500);
		$("#confpar2").hide(500);
		$("#confpar3").hide(500);
		$("#confpar4").hide(500);
		$("#txtconfopt1").val('');
		$("#txtconf2opt1").val('');
		$("#txtconf3opt1").val('');
		$("#txtconf4opt1").val('');
		document.getElementById("selconf1op1").selectedIndex = 0;
		document.getElementById("selconf2op1").selectedIndex = 0;
		document.getElementById("selconf3op1").selectedIndex = 0;
		document.getElementById("selconf4op1").selectedIndex = 0;
		document.getElementById("selheurecon1op1").selectedIndex = 0;
		document.getElementById("selheurecon2op1").selectedIndex = 0;
		document.getElementById("selheurecon3op1").selectedIndex = 0;
		document.getElementById("selheurecon4op1").selectedIndex = 0;
		$("#confop2").hide(500);
		$("#conf2op2").hide(500);
		$("#conf3op2").hide(500);
		$("#conf4op2").hide(500);
		$("#txtconfopt2").val('');
		$("#txtconf2opt2").val('');
		$("#txtconf3opt2").val('');
		$("#txtconf4opt2").val('');
		document.getElementById("seljourconf1opt2").selectedIndex = 0;
		document.getElementById("seljourconf2opt2").selectedIndex = 0;
		document.getElementById("seljourconf3opt2").selectedIndex = 0;
		document.getElementById("seljourconf4opt2").selectedIndex = 0;
		document.getElementById("selheurconf1opt2").selectedIndex = 0;
		document.getElementById("selheurconf2opt2").selectedIndex = 0;
		document.getElementById("selheurconf3opt2").selectedIndex = 0;
		document.getElementById("selheurconf4opt2").selectedIndex = 0;
		$("#txtintrconf1opt2").val('');
		$("#txtintrconf2opt2").val('');
		$("#txtintrconf3opt2").val('');
		$("#txtintrconf4opt2").val('');
		document.getElementById("selnumconfopt1").selectedIndex = 0;
		$("#numconfopt1").html('');
		$("#tableconfop1").hide(500);
		document.getElementById("selnumconfopt2").selectedIndex = 0;
		$("#numconfopt2").html('');
		$("#tableconfop2").hide(500);
		/*$("#recap1").html(0);
		$("#recap2").html(0);
		$("#recap3").html(0);
		$("#recap4").html(0);
		$("#recap5").html(0);
		$("#recap6").html(0);
		$("#avaloir1").html(0);
		$("#avaloir2").html(0);
		$("#balance").html(0);*/		
	}
	else{
		$("#prepubic").removeAttr('disabled');
		$("#atelconf").removeAttr('disabled');
		$("#atelconf2").removeAttr('disabled');
		/*$("#recap1").html(200);
		$("#recap2").html(0);
		$("#recap3").html(0);
		$("#recap4").html(200);
		$("#recap5").html(0);
		var newsum = 200 + (200 * (19.6 / 100));
		var ttc = newsum.toFixed(2);
		var aval1 = ttc * (30 / 100)
		$("#recap6").html(ttc);
		$("#avaloir1").html(aval1.toFixed(2));
		var bal = ((ttc - aval1) / 2);
		$("#avaloir2").html(bal.toFixed(2));
		$("#balance").html(bal.toFixed(2));		*/
	}
}

function showvalues(id){
	if($(id).attr('checked') == true){
		$("#tableconfop1").show(500);
		$("#numconfopt1").val('0 &euro;');
		$("#tableconfop2").show(500);	
		$("#numconfopt2").val('0 &euro;');
	}
	else{
		$("#tableconfop1").hide(500);
		$("#numconfopt1").val('');
		$("#tableconfop2").hide(500);	
		$("#numconfopt2").val('');
	}
}

function resetconfopt1val(id){
	var num = parseInt($(id).val());
	var sum;	
	switch(num)
	{
		case 0:
			sum = 0;
			$("#confpar1").hide(500);
			$("#confpar2").hide(500);
			$("#confpar3").hide(500);
			$("#confpar4").hide(500);
			$("#txtconfopt1").val('');
			$("#txtconf2opt1").val('');
			$("#txtconf3opt1").val('');
			$("#txtconf4opt1").val('');
			document.getElementById("selconf1op1").selectedIndex = 0;
			document.getElementById("selconf2op1").selectedIndex = 0;
			document.getElementById("selconf3op1").selectedIndex = 0;
			document.getElementById("selconf4op1").selectedIndex = 0;
			document.getElementById("selheurecon1op1").selectedIndex = 0;
			document.getElementById("selheurecon2op1").selectedIndex = 0;
			document.getElementById("selheurecon3op1").selectedIndex = 0;
			document.getElementById("selheurecon4op1").selectedIndex = 0;
		  break;
		case 1:
			sum = 2000;
			$("#confpar1").show(500);
			$("#confpar2").hide(500);
			$("#confpar3").hide(500);
			$("#confpar4").hide(500);			
			$("#txtconf2opt1").val('');
			$("#txtconf3opt1").val('');
			$("#txtconf4opt1").val('');			
			document.getElementById("selconf2op1").selectedIndex = 0;
			document.getElementById("selconf3op1").selectedIndex = 0;
			document.getElementById("selconf4op1").selectedIndex = 0;			
			document.getElementById("selheurecon2op1").selectedIndex = 0;
			document.getElementById("selheurecon3op1").selectedIndex = 0;
			document.getElementById("selheurecon4op1").selectedIndex = 0;
		  break;
		case 2:
			sum = 3500;
			$("#confpar1").show(500);
			$("#confpar2").show(500);
			$("#confpar3").hide(500);
			$("#confpar4").hide(500);						
			$("#txtconf3opt1").val('');
			$("#txtconf4opt1").val('');						
			document.getElementById("selconf3op1").selectedIndex = 0;
			document.getElementById("selconf4op1").selectedIndex = 0;						
			document.getElementById("selheurecon3op1").selectedIndex = 0;
			document.getElementById("selheurecon4op1").selectedIndex = 0;
		  break;
		case 3:
			sum = 5000;
			$("#confpar1").show(500);
			$("#confpar2").show(500);
			$("#confpar3").show(500);
			$("#confpar4").hide(500);									
			$("#txtconf4opt1").val('');									
			document.getElementById("selconf4op1").selectedIndex = 0;									
			document.getElementById("selheurecon4op1").selectedIndex = 0;
		  break;		
		  break;
		case 4:
			sum = 6800;
			$("#confpar1").show(500);
			$("#confpar2").show(500);
			$("#confpar3").show(500);
			$("#confpar4").show(500);																									
		  break;
		default:
		  	sum = 0;
			$("#confpar1").hide(500);
			$("#confpar2").hide(500);
			$("#confpar3").hide(500);
			$("#confpar4").hide(500);
			$("#txtconfopt1").val('');
			$("#txtconf2opt1").val('');
			$("#txtconf3opt1").val('');
			$("#txtconf4opt1").val('');
			document.getElementById("selconf1op1").selectedIndex = 0;
			document.getElementById("selconf2op1").selectedIndex = 0;
			document.getElementById("selconf3op1").selectedIndex = 0;
			document.getElementById("selconf4op1").selectedIndex = 0;
			document.getElementById("selheurecon1op1").selectedIndex = 0;
			document.getElementById("selheurecon2op1").selectedIndex = 0;
			document.getElementById("selheurecon3op1").selectedIndex = 0;
			document.getElementById("selheurecon4op1").selectedIndex = 0;
	}	
	$("#numconfopt1").html(sum + " &euro;");	
	/*var oldsum = parseInt($("#recap4").html());
	$("#recap4").html((sum + oldsum));*/
}

function resetconfopt2val(id){
	var num = parseInt($(id).val());
	var sum;	
	switch(num)
	{
		case 0:
			sum = 0;
			$("#confop2").hide(500);
			$("#conf2op2").hide(500);
			$("#conf3op2").hide(500);
			$("#conf4op2").hide(500);
			$("#txtconfopt2").val('');
			$("#txtconf2opt2").val('');
			$("#txtconf3opt2").val('');
			$("#txtconf4opt2").val('');
			document.getElementById("seljourconf1opt2").selectedIndex = 0;
			document.getElementById("seljourconf2opt2").selectedIndex = 0;
			document.getElementById("seljourconf3opt2").selectedIndex = 0;
			document.getElementById("seljourconf4opt2").selectedIndex = 0;
			document.getElementById("selheurconf1opt2").selectedIndex = 0;
			document.getElementById("selheurconf2opt2").selectedIndex = 0;
			document.getElementById("selheurconf3opt2").selectedIndex = 0;
			document.getElementById("selheurconf4opt2").selectedIndex = 0;
			$("#txtintrconf1opt2").val('');
			$("#txtintrconf2opt2").val('');
			$("#txtintrconf3opt2").val('');
			$("#txtintrconf4opt2").val('');
		  break;
		case 1:
			sum = 2500;
			$("#confop2").show(500);
			$("#conf2op2").hide(500);
			$("#conf3op2").hide(500);
			$("#conf4op2").hide(500);			
			$("#txtconf2opt2").val('');
			$("#txtconf3opt2").val('');
			$("#txtconf4opt2").val('');			
			document.getElementById("seljourconf2opt2").selectedIndex = 0;
			document.getElementById("seljourconf3opt2").selectedIndex = 0;
			document.getElementById("seljourconf4opt2").selectedIndex = 0;
			document.getElementById("selheurconf2opt2").selectedIndex = 0;
			document.getElementById("selheurconf3opt2").selectedIndex = 0;
			document.getElementById("selheurconf4opt2").selectedIndex = 0;			
			$("#txtintrconf2opt2").val('');
			$("#txtintrconf3opt2").val('');
			$("#txtintrconf4opt2").val('');
		  break;
		case 2:
			sum = 4500;
			$("#confop2").show(500);
			$("#conf2op2").show(500);
			$("#conf3op2").hide(500);
			$("#conf4op2").hide(500);						
			$("#txtconf3opt2").val('');
			$("#txtconf4opt2").val('');						
			document.getElementById("seljourconf3opt2").selectedIndex = 0;
			document.getElementById("seljourconf4opt2").selectedIndex = 0;			
			document.getElementById("selheurconf3opt2").selectedIndex = 0;
			document.getElementById("selheurconf4opt2").selectedIndex = 0;						
			$("#txtintrconf3opt2").val('');
			$("#txtintrconf4opt2").val('');	
		  break;
		case 3:
			sum = 6500;
			$("#confop2").show(500);
			$("#conf2op2").show(500);
			$("#conf3op2").show(500);
			$("#conf4op2").hide(500);									
			$("#txtconf4opt2").val('');									
			document.getElementById("seljourconf4opt2").selectedIndex = 0;						
			document.getElementById("selheurconf4opt2").selectedIndex = 0;									
			$("#txtintrconf4opt2").val('');	
		  break;		
		  break;
		case 4:
			sum = 7800;
			$("#confop2").show(500);
			$("#conf2op2").show(500);
			$("#conf3op2").show(500);
			$("#conf4op2").show(500);																					
		  break;
		default:
		  	sum = 0;
			$("#confop2").hide(500);
			$("#conf2op2").hide(500);
			$("#conf3op2").hide(500);
			$("#conf4op2").hide(500);
			$("#txtconfopt2").val('');
			$("#txtconf2opt2").val('');
			$("#txtconf3opt2").val('');
			$("#txtconf4opt2").val('');
			document.getElementById("seljourconf1opt2").selectedIndex = 0;
			document.getElementById("seljourconf2opt2").selectedIndex = 0;
			document.getElementById("seljourconf3opt2").selectedIndex = 0;
			document.getElementById("seljourconf4opt2").selectedIndex = 0;
			document.getElementById("selheurconf1opt2").selectedIndex = 0;
			document.getElementById("selheurconf2opt2").selectedIndex = 0;
			document.getElementById("selheurconf3opt2").selectedIndex = 0;
			document.getElementById("selheurconf4opt2").selectedIndex = 0;
			$("#txtintrconf1opt2").val('');
			$("#txtintrconf2opt2").val('');
			$("#txtintrconf3opt2").val('');
			$("#txtintrconf4opt2").val('');
	}	
	$("#numconfopt2").html(sum+" &euro;");	
	/*var oldsum = parseInt($("#recap4").html());
	$("#recap4").html((sum + oldsum));	*/
}

function cleardataconf1(id){
	if($(id).attr('checked') == false){
		$("#confpar1").hide(500);
		$("#confpar2").hide(500);
		$("#confpar3").hide(500);
		$("#confpar4").hide(500);
		$("#txtconfopt1").val('');
		$("#txtconf2opt1").val('');
		$("#txtconf3opt1").val('');
		$("#txtconf4opt1").val('');
		document.getElementById("selconf1op1").selectedIndex = 0;
		document.getElementById("selconf2op1").selectedIndex = 0;
		document.getElementById("selconf3op1").selectedIndex = 0;
		document.getElementById("selconf4op1").selectedIndex = 0;
		document.getElementById("selheurecon1op1").selectedIndex = 0;
		document.getElementById("selheurecon2op1").selectedIndex = 0;
		document.getElementById("selheurecon3op1").selectedIndex = 0;
		document.getElementById("selheurecon4op1").selectedIndex = 0;
		$("#confop2").hide(500);
		$("#conf2op2").hide(500);
		$("#conf3op2").hide(500);
		$("#conf4op2").hide(500);
		$("#txtconfopt2").val('');
		$("#txtconf2opt2").val('');
		$("#txtconf3opt2").val('');
		$("#txtconf4opt2").val('');
		document.getElementById("seljourconf1opt2").selectedIndex = 0;
		document.getElementById("seljourconf2opt2").selectedIndex = 0;
		document.getElementById("seljourconf3opt2").selectedIndex = 0;
		document.getElementById("seljourconf4opt2").selectedIndex = 0;
		document.getElementById("selheurconf1opt2").selectedIndex = 0;
		document.getElementById("selheurconf2opt2").selectedIndex = 0;
		document.getElementById("selheurconf3opt2").selectedIndex = 0;
		document.getElementById("selheurconf4opt2").selectedIndex = 0;
		$("#txtintrconf1opt2").val('');
		$("#txtintrconf2opt2").val('');
		$("#txtintrconf3opt2").val('');
		$("#txtintrconf4opt2").val('');
		document.getElementById("selnumconfopt1").selectedIndex = 0;
		$("#numconfopt1").html('');
		$("#tableconfop1").hide(500);
		document.getElementById("selnumconfopt2").selectedIndex = 0;
		$("#numconfopt2").html('');
		$("#tableconfop2").hide(500);
	}
}

function adjustsum(){
	var suminscrire=0, sumlogo=0, sumatelier=0, sumconf1=0, sumconf2=0;	
	if($("#chkdfp2").attr('checked') == true){
		suminscrire	 = 200;
	}
	if($("#prepubic").attr('checked') == true){
		var numlogo = parseInt($("#selnumlogo").val());		
		switch (numlogo){
			case 1:
				sumlogo = 500;
			 	break
			case 2:
				sumlogo = 900;
			  	break;
			case 3:
				sumlogo = 1200;
				break;
			case 4:
				sumlogo = 1400;
				break;
			default:
				sumlogo = 500;
		}		
	}
	if($("#atelconf").attr('checked') == true){
		var numatelier = parseInt($("#selnumatelier").val());
		switch (numatelier){
			case 1:
				sumatelier = 1500;
			 	break
			case 2:
				sumatelier = 2700;
			  	break;
			case 3:
				sumatelier = 4000;
				break;
			case 4:
				sumatelier = 5000;
				break;
			default:
				sumatelier = 1500;
		}		
	}
	if($("#atelconf2").attr('checked') == true){
		var numconf1 = parseInt($("#selnumconfopt1").val());
		switch (numconf1){
			case 0:
				sumconf1 = 0;
				break;
			case 1:
				sumconf1 = 2000;
			 	break
			case 2:
				sumconf1 = 3500;
			  	break;
			case 3:
				sumconf1 = 5000;
				break;
			case 4:
				sumconf1 = 6800;
				break;
			default:
				sumconf1 = 0;
		}
		var numconf2 = parseInt($("#selnumconfopt2").val());
		switch (numconf2){
			case 0:
				sumconf2 = 0;
				break;
			case 1:
				sumconf2 = 2500;
			 	break
			case 2:
				sumconf2 = 4500;
			  	break;
			case 3:
				sumconf2 = 6500;
				break;
			case 4:
				sumconf2 = 7800;
				break;
			default:
				sumconf2 = 0;
		}		
	}
	
	//Recaputilatif
	$("#recap1").html(suminscrire.toFixed(2));
	$("#recap2").html(sumlogo.toFixed(2));
	$("#recap3").html(sumatelier.toFixed(2));	
	$("#recap4").html((sumconf1 + sumconf2).toFixed(2));
	var ttlht = suminscrire + sumlogo + sumatelier + sumconf1 + sumconf2;
	$("#recap5").html(ttlht.toFixed(2));
	var ttc = ttlht + (ttlht * (19.6 / 100));
	var vat = ttlht * (19.6 / 100);
	$("#vatamount").html(vat.toFixed(2));
	$("#recap6").html(ttc.toFixed(2));
	
	//Avaloir 30%
	var fraisinscrire =suminscrire + (suminscrire * (19.6/100));
	$("#inscrip").html(fraisinscrire.toFixed(2));
	var avaloir1 = (ttc - fraisinscrire) / 2;
	$("#avaloir1").html(avaloir1.toFixed(2));
	
	//Avaloir 50% & balance
	//var avaloir2 = ttc * (50 / 100);
	//$("#avaloir2").html(avaloir2.toFixed(2));
	$("#balance").html(((ttc - fraisinscrire) / 2).toFixed(2));
}

function setvalident(){
	$('#txtident').val($('#txtmail').val());	
}

function validbdc(lg){
	var valid = true;
	if($('#txtsociete').val() == ''){		
		if(lg == 'fr'){
			alert("Veuillez entrer le nom de votre societé!");			
		}
		else{
			alert("Please state your company!");			
		}
		valid = false;
		$('#txtsociete').focus();
		return false;
	}
	/*if($('#txtfonction').val() == ''){		
		if(lg == 'fr'){
			alert("Veuillez spécifier le fonction de votre societé!");			
		}
		else{
			alert("Please state the function of your company!");			
		}
		valid = false;
		$('#txtfonction').focus();
		return false;
	}
	if($('#selcontact').val() == 0){		
		if(lg == 'fr'){
			alert("Veuillez choisir un contact!");			
		}
		else{
			alert("Please choose a contact!");			
		}
		valid = false;
		$('#selcontact').focus();
		return false;
	}
	if($('#txtnom').val() == ''){		
		if(lg == 'fr'){
			alert("Veuillez spécifier votre nom!");			
		}
		else{
			alert("Please enter your surname!");			
		}
		valid = false;
		$('#txtnom').focus();
		return false;
	}
	if($('#txtprenom').val() == ''){		
		if(lg == 'fr'){
			alert("Veuillez spécifier votre prénom!");			
		}
		else{
			alert("Please enter your other names!");			
		}
		valid = false;
		$('#txtprenom').focus();
		return false;
	}
	if($('#txtadr1').val() == ''){		
		if(lg == 'fr'){
			alert("Veuillez spécifier votre adresse!");			
		}
		else{
			alert("Please enter your address!");			
		}
		valid = false;
		$('#txtadr1').focus();
		return false;
	}
	if($('#txtcp').val() == ''){		
		if(lg == 'fr'){
			alert("Veuillez spécifier votre code postal!");			
		}
		else{
			alert("Please enter your postal code!");			
		}
		valid = false;
		$('#txtcp').focus();
		return false;
	}
	if($('#txtville').val() == ''){		
		if(lg == 'fr'){
			alert("Veuillez spécifier votre ville!");			
		}
		else{
			alert("Please enter your town!");			
		}
		valid = false;
		$('#txtville').focus();
		return false;
	}
	if($('#txttel').val() == ''){		
		if(lg == 'fr'){
			alert("Veuillez entrer votre numéro de téléphone!");			
		}
		else{
			alert("Please enter your phone number!");			
		}
		valid = false;
		$('#txttel').focus();
		return false;
	}
	if($('#txtmail').val() == ''){		
		if(lg == 'fr'){
			alert("Veuillez entrer votre adresse email!");			
		}
		else{
			alert("Please enter your email address!");			
		}
		valid = false;
		$('#txtmail').focus();
		return false;
	}
	if(!validateEmail($('#txtmail').val())){		
		if(lg == 'fr'){
			alert("Adresse email n'est pas valide!");			
		}
		else{
			alert("Invalid email address!");			
		}
		valid = false;
		$('#txtmail').focus();
		return false;
	}
	if($('#txtmdp').val() == ''){		
		if(lg == 'fr'){
			alert("Veuillez entrer un mot de passe!");			
		}
		else{
			alert("Please enter a password!");			
		}
		valid = false;
		$('#txtmdp').focus();
		return false;
	}
	if($('#txtmdp2').val() == ''){		
		if(lg == 'fr'){
			alert("Veuillez confirmer votre mot de passe!");			
		}
		else{
			alert("Please confirm your password!");			
		}
		valid = false;
		$('#txtmdp2').focus();
		return false;
	}
	if(!($('#txtmdp').val() == '') == ($('#txtmdp2').val() == '')){		
		if(lg == 'fr'){
			alert("Mot de passe sont différent!");			
		}
		else{
			alert("Password are different!");			
		}
		valid = false;
		$('#txtmdp').val('');
		$('#txtmdp2').val('');
		$('#txtmdp').focus();
		return false;
	}
	if($('#txttva').val() == ''){		
		if(lg == 'fr'){
			alert("Veuillez entrer votre numéro de TVA!");			
		}
		else{
			alert("Please enter your VAT number!");			
		}
		valid = false;
		$('#txttva').focus();
		return false;
	}*/
	var i = 1;
	var num = 0;
	for(i=1;i<8;i++){
		var thechk = "#chk"+i;
		if($(thechk).attr('checked') == false) {
			num = num+1;			
		}
	}
	if (num > 6){
		if(lg == 'fr'){
			alert("Veuillez cocher au moins une case pour le fonction de la societé!");			
		}
		else{
			alert("Please choose a function type of your company!");			
		}
		valid = false;
		$('#chk1').focus();
		return false;
	}
	i = 1;
	num = 0;
	for(i=1;i<8;i++){
		var thechk = "#chksg"+i;
		if($(thechk).attr('checked') == false) {
			num = num+1;			
		}
	}
	if (num > 6){
		if(lg == 'fr'){
			alert("Veuillez cocher au moins une case pour l'instalation de votre stand!");			
		}
		else{
			alert("Please choose at least one type for your stand installation!");			
		}
		valid = false;
		$('#chksg1').focus();
		return false;
	}
	if($("#chkdfp1").attr('checked') == false && $("#chkdfp2").attr('checked') == false) {
		if(lg == 'fr'){
			alert("Veuillez choisir une formule d'inscription!");			
		}
		else{
			alert("Please choose your type of subscription!");			
		}
		valid = false;
		$('#chkdfp1').focus();
		return false;
	}
	//Atelier
	if($("#atelconf").attr('checked') == true) {
		var num = parseInt($("#selnumatelier").val());
		switch (num){
			case 1:
				if($('#txtatel1theme').val() == ''){		
					if(lg == 'fr'){
						alert("Veuillez entrer le thême de l'atelier numéro 1.");			
					}
					else{
						alert("Please enter title for the 1st workshop!");			
					}
					valid = false;
					$('#txtatel1theme').focus();
					return false;
				}
				if($('#txtatel1inter').val() == ''){		
					if(lg == 'fr'){
						alert("Veuillez entrer l'intervenant de l'atelier numéro 1.");			
					}
					else{
						alert("Please specify the speaker for the 1st workshop!");			
					}
					valid = false;
					$('#txtatel1inter').focus();
					return false;
				}
				break;
			case 2:
				if($('#txtatel1theme').val() == ''){		
					if(lg == 'fr'){
						alert("Veuillez entrer le thême de l'atelier numéro 1.");			
					}
					else{
						alert("Please enter title for the 1st workshop!");			
					}
					valid = false;
					$('#txtatel1theme').focus();
					return false;
				}
				if($('#txtatel1inter').val() == ''){		
					if(lg == 'fr'){
						alert("Veuillez entrer l'intervenant de l'atelier numéro 1.");			
					}
					else{
						alert("Please specify the speaker for the 1st workshop!");			
					}
					valid = false;
					$('#txtatel1inter').focus();
					return false;
				}
				if($('#txtatel2theme').val() == ''){		
					if(lg == 'fr'){
						alert("Veuillez entrer le thême de l'atelier numéro 2.");			
					}
					else{
						alert("Please enter title for the 2nd workshop!");			
					}
					valid = false;
					$('#txtatel2theme').focus();
					return false;
				}
				if($('#txtatel2inter').val() == ''){		
					if(lg == 'fr'){
						alert("Veuillez entrer l'intervenant de l'atelier numéro 2.");			
					}
					else{
						alert("Please specify the speaker for the 2nd workshop!");			
					}
					valid = false;
					$('#txtatel2inter').focus();
					return false;
				}	
				break;
			case 3:
				if($('#txtatel1theme').val() == ''){		
					if(lg == 'fr'){
						alert("Veuillez entrer le thême de l'atelier numéro 1.");			
					}
					else{
						alert("Please enter title for the 1st workshop!");			
					}
					valid = false;
					$('#txtatel1theme').focus();
					return false;
				}
				if($('#txtatel1inter').val() == ''){		
					if(lg == 'fr'){
						alert("Veuillez entrer l'intervenant de l'atelier numéro 1.");			
					}
					else{
						alert("Please specify the speaker for the 1st workshop!");			
					}
					valid = false;
					$('#txtatel1inter').focus();
					return false;
				}
				if($('#txtatel2theme').val() == ''){		
					if(lg == 'fr'){
						alert("Veuillez entrer le thême de l'atelier numéro 2.");			
					}
					else{
						alert("Please enter title for the 2nd workshop!");			
					}
					valid = false;
					$('#txtatel2theme').focus();

					return false;
				}
				if($('#txtatel2inter').val() == ''){		
					if(lg == 'fr'){
						alert("Veuillez entrer l'intervenant de l'atelier numéro 2.");			
					}
					else{
						alert("Please specify the speaker for the 2nd workshop!");			
					}
					valid = false;
					$('#txtatel2inter').focus();
					return false;
				}	
				if($('#txtatel3theme').val() == ''){		
					if(lg == 'fr'){
						alert("Veuillez entrer le thême de l'atelier numéro 3.");			
					}
					else{
						alert("Please enter title for the 3rd workshop!");			
					}
					valid = false;
					$('#txtatel3theme').focus();
					return false;
				}
				if($('#txtatel3inter').val() == ''){		
					if(lg == 'fr'){
						alert("Veuillez entrer l'intervenant de l'atelier numéro 3.");			
					}
					else{
						alert("Please specify the speaker for the 3rd workshop!");			
					}
					valid = false;
					$('#txtatel3inter').focus();
					return false;
				}
				break;
			case 4:
				if($('#txtatel1theme').val() == ''){		
					if(lg == 'fr'){
						alert("Veuillez entrer le thême de l'atelier numéro 1.");			
					}
					else{
						alert("Please enter title for the 1st workshop!");			
					}
					valid = false;
					$('#txtatel1theme').focus();
					return false;
				}
				if($('#txtatel1inter').val() == ''){		
					if(lg == 'fr'){
						alert("Veuillez entrer l'intervenant de l'atelier numéro 1.");			
					}
					else{
						alert("Please specify the speaker for the 1st workshop!");			
					}
					valid = false;
					$('#txtatel1inter').focus();
					return false;
				}
				if($('#txtatel2theme').val() == ''){		
					if(lg == 'fr'){
						alert("Veuillez entrer le thême de l'atelier numéro 2.");			
					}
					else{
						alert("Please enter title for the 2nd workshop!");			
					}
					valid = false;
					$('#txtatel2theme').focus();
					return false;
				}
				if($('#txtatel2inter').val() == ''){		
					if(lg == 'fr'){
						alert("Veuillez entrer l'intervenant de l'atelier numéro 2.");			
					}
					else{
						alert("Please specify the speaker for the 2nd workshop!");			
					}
					valid = false;
					$('#txtatel2inter').focus();
					return false;
				}	
				if($('#txtatel3theme').val() == ''){		
					if(lg == 'fr'){
						alert("Veuillez entrer le thême de l'atelier numéro 3.");			
					}
					else{
						alert("Please enter title for the 3rd workshop!");			
					}
					valid = false;
					$('#txtatel3theme').focus();
					return false;
				}
				if($('#txtatel3inter').val() == ''){		
					if(lg == 'fr'){
						alert("Veuillez entrer l'intervenant de l'atelier numéro 3.");			
					}
					else{
						alert("Please specify the speaker for the 3rd workshop!");			
					}
					valid = false;
					$('#txtatel3inter').focus();
					return false;
				}
				if($('#txtatel4theme').val() == ''){		
					if(lg == 'fr'){
						alert("Veuillez entrer le thême de l'atelier numéro 4.");			
					}
					else{
						alert("Please enter title for the 4th workshop!");			
					}
					valid = false;
					$('#txtatel4theme').focus();
					return false;
				}
				if($('#txtatel4inter').val() == ''){		
					if(lg == 'fr'){
						alert("Veuillez entrer l'intervenant de l'atelier numéro 4.");			
					}
					else{
						alert("Please specify the speaker for the 4th workshop!");			
					}
					valid = false;
					$('#txtatel4inter').focus();
					return false;
				}
				break;
			default:
				if($('#txtatel1theme').val() == ''){		
					if(lg == 'fr'){
						alert("Veuillez entrer le thême de l'atelier numéro 1.");			
					}
					else{
						alert("Please enter title for the 1st workshop!");			
					}
					valid = false;
					$('#txtatel1theme').focus();
					return false;
				}
				if($('#txtatel1inter').val() == ''){		
					if(lg == 'fr'){
						alert("Veuillez entrer l'intervenant de l'atelier numéro 1.");			
					}
					else{
						alert("Please specify the speaker for the 1st workshop!");			
					}
					valid = false;
					$('#txtatel1inter').focus();
					return false;
				}
		}		
	}
	//Conference 1
	if($("#atelconf2").attr('checked') == true) {
		var num = parseInt($("#selnumconfopt1").val());
		switch (num){
			case 1:
				if($('#txtconfopt1').val() == ''){		
					if(lg == 'fr'){
						alert("Veuillez entrer le thême de la conférence numéro 1.");			
					}
					else{
						alert("Please enter title for the 1st workshop!");			
					}
					valid = false;
					$('#txtconfopt1').focus();
					return false;
				}
				break;
			case 2:
				if($('#txtconfopt1').val() == ''){		
					if(lg == 'fr'){
						alert("Veuillez entrer le thême de la conférence numéro 1.");			
					}
					else{
						alert("Please enter title for the 1st workshop!");			
					}
					valid = false;
					$('#txtconfopt1').focus();
					return false;
				}
				if($('#txtconf2opt1').val() == ''){		
					if(lg == 'fr'){
						alert("Veuillez entrer le thême de la conférence numéro 2.");			
					}
					else{
						alert("Please enter title for the 2nd workshop!");			
					}
					valid = false;
					$('#txtconf2opt1').focus();
					return false;
				}
				break;
			case 3:
				if($('#txtconfopt1').val() == ''){		
					if(lg == 'fr'){
						alert("Veuillez entrer le thême de la conférence numéro 1.");			
					}
					else{
						alert("Please enter title for the 1st workshop!");			
					}
					valid = false;
					$('#txtconfopt1').focus();
					return false;
				}
				if($('#txtconf2opt1').val() == ''){		
					if(lg == 'fr'){
						alert("Veuillez entrer le thême de la conférence numéro 2.");			
					}
					else{
						alert("Please enter title for the 2nd workshop!");			
					}
					valid = false;
					$('#txtconf2opt1').focus();
					return false;
				}
				if($('#txtconf3opt1').val() == ''){		
					if(lg == 'fr'){
						alert("Veuillez entrer le thême de la conférence numéro 3.");			
					}
					else{
						alert("Please enter title for the 3rd workshop!");			
					}
					valid = false;
					$('#txtconf3opt1').focus();
					return false;
				}
				break;
			case 4:
				if($('#txtconfopt1').val() == ''){		
					if(lg == 'fr'){
						alert("Veuillez entrer le thême de la conférence numéro 1.");			
					}
					else{
						alert("Please enter title for the 1st workshop!");			
					}
					valid = false;
					$('#txtconfopt1').focus();
					return false;
				}
				if($('#txtconf2opt1').val() == ''){		
					if(lg == 'fr'){
						alert("Veuillez entrer le thême de la conférence numéro 2.");			
					}
					else{
						alert("Please enter title for the 2nd workshop!");			
					}
					valid = false;
					$('#txtconf2opt1').focus();
					return false;
				}
				if($('#txtconf3opt1').val() == ''){		
					if(lg == 'fr'){
						alert("Veuillez entrer le thême de la conférence numéro 3.");			
					}
					else{
						alert("Please enter title for the 3rd workshop!");			
					}
					valid = false;
					$('#txtconf3opt1').focus();
					return false;
				}
				if($('#txtconf4opt1').val() == ''){		
					if(lg == 'fr'){
						alert("Veuillez entrer le thême de la conférence numéro 4.");			
					}
					else{
						alert("Please enter title for the 4th workshop!");			
					}
					valid = false;
					$('#txtconf4opt1').focus();
					return false;
				}
				break;
			default:
		}
	}
	//Conference 2
	if($("#atelconf2").attr('checked') == true) {
		var num = parseInt($("#selnumconfopt2").val());
		switch (num){
			case 1:
				if($('#txtconfopt2').val() == ''){		
					if(lg == 'fr'){
						alert("Veuillez entrer le thême de la conférence numéro 1.");			
					}
					else{
						alert("Please enter title for the 1st workshop!");			
					}
					valid = false;
					$('#txtconfopt2').focus();
					return false;
				}
				if($('#txtintrconf1opt2').val() == ''){		
					if(lg == 'fr'){
						alert("Veuillez entrer l'intervenant de la conférence numéro 1.");			
					}
					else{
						alert("Please enter the speaker for the 1st workshop!");			
					}
					valid = false;
					$('#txtintrconf1opt2').focus();
					return false;
				}
				break;
			case 2:
				if($('#txtconfopt2').val() == ''){		
					if(lg == 'fr'){
						alert("Veuillez entrer le thême de la conférence numéro 1.");			
					}
					else{
						alert("Please enter title for the 1st workshop!");			
					}
					valid = false;
					$('#txtconfopt1').focus();
					return false;
				}
				if($('#txtintrconf1opt2').val() == ''){		
					if(lg == 'fr'){
						alert("Veuillez entrer l'intervenant de la conférence numéro 1.");			
					}
					else{
						alert("Please enter the speaker for the end workshop!");			
					}
					valid = false;
					$('#txtintrconf1opt2').focus();
					return false;
				}
				if($('#txtconf2opt2').val() == ''){		
					if(lg == 'fr'){
						alert("Veuillez entrer le thême de la conférence numéro 2.");			
					}
					else{
						alert("Please enter title for the 2nd workshop!");			
					}
					valid = false;
					$('#txtconf2opt2').focus();
					return false;
				}				
				if($('#txtintrconf2opt2').val() == ''){		
					if(lg == 'fr'){
						alert("Veuillez entrer l'intervenant de la conférence numéro 2.");			
					}
					else{
						alert("Please enter the speaker for the 2nd workshop!");			
					}
					valid = false;
					$('#txtintrconf2opt2').focus();
					return false;
				}
				break;
			case 3:
				if($('#txtconfopt2').val() == ''){		
					if(lg == 'fr'){
						alert("Veuillez entrer le thême de la conférence numéro 1.");			
					}
					else{
						alert("Please enter title for the 1st workshop!");			
					}
					valid = false;
					$('#txtconfopt1').focus();
					return false;
				}
				if($('#txtintrconf1opt2').val() == ''){		
					if(lg == 'fr'){
						alert("Veuillez entrer l'intervenant de la conférence numéro 1.");			
					}
					else{
						alert("Please enter the speaker for the 1st workshop!");			
					}
					valid = false;
					$('#txtintrconf1opt2').focus();
					return false;
				}
				if($('#txtconf2opt2').val() == ''){		
					if(lg == 'fr'){
						alert("Veuillez entrer le thême de la conférence numéro 2.");			
					}
					else{
						alert("Please enter title for the 2nd workshop!");			
					}
					valid = false;
					$('#txtconf2opt2').focus();
					return false;
				}
				if($('#txtintrconf2opt2').val() == ''){		
					if(lg == 'fr'){
						alert("Veuillez entrer l'intervenant de la conférence numéro 2.");			
					}
					else{
						alert("Please enter the speaker for the 2nd workshop!");			
					}
					valid = false;
					$('#txtintrconf2opt2').focus();
					return false;
				}
				if($('#txtconf3opt2').val() == ''){		
					if(lg == 'fr'){
						alert("Veuillez entrer le thême de la conférence numéro 3.");			
					}
					else{
						alert("Please enter title for the 3rd workshop!");			
					}
					valid = false;
					$('#txtconf3opt2').focus();
					return false;
				}								
				if($('#txtintrconf3opt2').val() == ''){		
					if(lg == 'fr'){
						alert("Veuillez entrer l'intervenant de la conférence numéro 3.");			
					}
					else{
						alert("Please enter the speaker for the 3rd workshop!");			
					}
					valid = false;
					$('#txtintrconf3opt2').focus();
					return false;
				}
				break;
			case 4:
				if($('#txtconfopt2').val() == ''){		
					if(lg == 'fr'){
						alert("Veuillez entrer le thême de la conférence numéro 1.");			
					}
					else{
						alert("Please enter title for the 1st workshop!");			
					}
					valid = false;
					$('#txtconfopt1').focus();
					return false;
				}
				if($('#txtintrconf1opt2').val() == ''){		
					if(lg == 'fr'){
						alert("Veuillez entrer l'intervenant de la conférence numéro 1.");			
					}
					else{
						alert("Please enter the speaker for the 1st workshop!");			
					}
					valid = false;
					$('#txtintrconf1opt2').focus();
					return false;
				}
				if($('#txtconf2opt2').val() == ''){		
					if(lg == 'fr'){
						alert("Veuillez entrer le thême de la conférence numéro 2.");			
					}
					else{
						alert("Please enter title for the 2nd workshop!");			
					}
					valid = false;
					$('#txtconf2opt2').focus();
					return false;
				}
				if($('#txtintrconf2opt2').val() == ''){		
					if(lg == 'fr'){
						alert("Veuillez entrer l'intervenant de la conférence numéro 2.");			
					}
					else{
						alert("Please enter the speaker for the 2nd workshop!");			
					}
					valid = false;
					$('#txtintrconf2opt2').focus();
					return false;
				}
				if($('#txtconf3opt2').val() == ''){		
					if(lg == 'fr'){
						alert("Veuillez entrer le thême de la conférence numéro 3.");			
					}
					else{
						alert("Please enter title for the 3rd workshop!");			
					}
					valid = false;
					$('#txtconf3opt2').focus();
					return false;
				}
				if($('#txtintrconf3opt2').val() == ''){		
					if(lg == 'fr'){
						alert("Veuillez entrer l'intervenant de la conférence numéro 3.");			
					}
					else{
						alert("Please enter the speaker for the 3rd workshop!");			
					}
					valid = false;
					$('#txtintrconf3opt2').focus();
					return false;
				}
				if($('#txtconf4opt2').val() == ''){		
					if(lg == 'fr'){
						alert("Veuillez entrer le thême de la conférence numéro 4.");			
					}
					else{
						alert("Please enter title for the 4th workshop!");			
					}
					valid = false;
					$('#txtconf4opt2').focus();
					return false;
				}												
				if($('#txtintrconf4opt2').val() == ''){		
					if(lg == 'fr'){
						alert("Veuillez entrer l'intervenant de la conférence numéro 4.");			
					}
					else{
						alert("Please enter the speaker for the 4th workshop!");			
					}
					valid = false;
					$('#txtintrconf4opt2').focus();
					return false;
				}
				break;
			default:
		}
	}
	/*if(valid){
		return true;	
	}*/
}

function checkemail(lg, table){
	if(!$('#txtmail').val() == ''){
		var email = $('#txtmail').val();
		var url = "requete.php?task=checkemail&eml="+email+"&lg="+lg+"&tbl="+table;
		$("#loademail").html("<img src='img/pro_loading.gif'>");
		sendinfo(url, "callcheckemail");
	}
}

function callcheckemail(res, status){
	var sep = res.split(";");
	if(sep[0] == 0){
		alert(sep[1]);	
		$("#txtmail").val('');
		$("#txtmail").focus();
		$("#loademail").html("");
	}
	else{
		$("#loademail").html("");
		$("#chkemail").show(500);
	}
}

function showhidecondition(op){
	if(op == 'hide'){
		$("#lesconditions").show(500);
		$("#condition").html('<a href="javascript:;" onclick="showhidecondition(\'show\');">Lire les conditions g&eacute;n&eacute;rales</a>');
	}
	else{
		$("#lesconditions").hide(500);
		$("#condition").html('<a href="javascript:;" onclick="showhidecondition(\'hide\');">Lire les conditions g&eacute;n&eacute;rales</a>');
	}	
}

function chknumber(lg){
	if($("#txtpercent").val() > 100){
		if(lg == 'fr'){
			alert("Entrer invalide. Valeur n'est peut pas être plus que 100%.");			
		}
		else{
			alert("Invalid entry.  Value cannot be greater than 100%");			
		}
		valid = false;
		$('#txtpercent').val('');
		$('#txtpercent').focus();
		return false;	
	}
}

function validlogin(lg){
	var valid = true;
	if(!$('#loginemail').val() == ''){
		var email 	= $('#loginemail').val();
		var mdp		= $('#loginmdp').val();
		var url 	= "requete.php?task=validvislogin&eml="+email+"&mdp="+mdp+"&lg="+lg;
		sendinfo(url, "callloginvisiteur");
		$("#loginbutton").html("<img src='img/vis_loader.gif'>");
		return false;
	}
}
function callloginvisiteur(res, status){
	var sep = res.split(";");
	if(sep[0] == 1){
		window.location.reload()
	}
	else{
		alert(sep[1]);
		$('#loginemail').focus()
		$("#loginbutton").html('<input type="submit" class="submit" name="btnlogin" id="btnlogin" value="[ valider ]" />');
	}	
}
function connexion_visiteur(op){
	if(op == 'hide'){
		$("#identify").show(500);
		$("#mdplogin").hide(500);
		$("#linklogin1").html('<a href="javascript:;" onclick="connexion_visiteur(\'show\');">SE CONNECTER</a>');
		$("#linklogin2").html('<a href="javascript:;" onclick="connexion_visiteur(\'show\');"><img src="img/logind.gif" height="12" width="18" border="0" /></a>');
	}
	else{
		$("#identify").hide(500);
		$("#mdplogin").hide(500);
		$("#linklogin1").html('<a href="javascript:;" onclick="connexion_visiteur(\'hide\');">SE CONNECTER</a>');
		$("#linklogin2").html('<a href="javascript:;" onclick="connexion_visiteur(\'hide\');"><img src="img/loginr.gif" height="12" width="18" border="0" /></a>');
	}
}

function motdepasseoublie(op){
	if(op == 'hide'){		
		$("#mdplogin").show(500);
		$("#requetemdp").html('<img src="img/mdp_oublie.gif" height="11" width="8" /><a href="javascript:;" onclick="motdepasseoublie(\'show\')">j&rsquo;ai  perdu mon mot de passe</a>');		
	}
	else{		
		$("#mdplogin").hide(500);
		$("#requetemdp").html('<img src="img/mdp_oublie.gif" height="11" width="8" /><a href="javascript:;" onclick="motdepasseoublie(\'hide\')">j&rsquo;ai  perdu mon mot de passe</a>');		
	}
}

function motdepassepresse(op){
	if(op == 'hide'){		
		$("#mdplogin").show(500);
		$("#requetemdp").html('<img src="img/fl_partenaire.gif" width="12" height="9"> <a href="javascript:;" onclick="motdepassepresse(\'show\')">j&rsquo;ai perdu mon mot de passe</a>');		
	}
	else{		
		$("#mdplogin").hide(500);
		$("#requetemdp").html('<img src="img/fl_partenaire.gif" width="12" height="9"> <a href="javascript:;" onclick="motdepassepresse(\'hide\')">j&rsquo;ai perdu mon mot de passe</a>');		
	}
}

function funcmdpoublie(lg){
	var valid = true;
	if(!$('#oubleemail').val() == ''){
		var email 	= $('#oubleemail').val();	
		var url 	= "requete.php?task=forgotmail&eml="+email+"&lg="+lg;
		sendinfo(url, "callmdpoublie");
		$("#boutonenvoie").html("<img src='img/vis_loader.gif'>");
		return false;
	}
}
function callmdpoublie(res, status){
	var sep = res.split(";")
	if(sep[0] == 0){
		alert(sep[1]);
		$("#mdplogin").hide(500);
		$("#boutonenvoie").html('<input type="submit" name="btnoublie" id="btnoublie" value="[ Me l\'envoyer ]" />');
	}
	else{
		alert(sep[1]);
		$('#oubleemail').val();
		$('#oubleemail').focus();	
		$("#boutonenvoie").html('<input type="submit" name="btnoublie" id="btnoublie" value="[ Me l\'envoyer ]" />');
	}	
}

function logout_visiteur(lg){
	if(lg == 'fr'){
		if(confirm("Déconnexion ?")){
			var url = "requete.php?task=logoutvisiteur";
			sendinfo(url, "calllogoutvisiteur");
		}
		else{
			return false;	
		}
	}
	else{
		if(confirm("Logout?")){
			var url = "requete.php?task=logoutvisiteur";
			sendinfo(url, "calllogoutvisiteur");
		}
		else{
			return false;	
		}	
	}
}

function calllogoutvisiteur(){
	window.location.reload()
}

function deleteInstituts(lg, id){
	if(lg == 'fr'){
		if(confirm("Annuler cette réservation ?")){
			var url = "requete.php?task=deleteinstituts&id="+id+"&lg="+lg;
			sendinfo(url, "callldeleteinstituts");
		}
		else{
			return false;	
		}
	}
	else{
		if(confirm("Cancel this registration?")){
			var url = "requete.php?task=deleteinstituts&id="+id+"&lg="+lg;
			sendinfo(url, "callldeleteinstituts");
		}
		else{
			return false;	
		}	
	}
}

function callldeleteinstituts(res, status){
	window.location.href="pro_ins_de_beaute.php?lg="+res+"&mnu=2&&nav=2";						  
}

/*function valid_presse(lg){
	var valid = true;
	if((!$('#txtmail').val() == '') && (!$('#txtpass').val() == '')){
		var email 	= $('#txtmail').val();
		var mdp		= $('#txtpass').val();
		var url 	= "requete.php?task=validpresselogin&eml="+email+"&mdp="+mdp+"&lg="+lg;
		sendinfo(url, "callloginpresse");
		$(".validlogin").html("<img src='../img/loading.gif'>");
		return false;
	}
}
function callloginpresse(res, status){
	var sep = res.split(";");
	if(sep[0] == 1){
		window.location.href="conference.php";
	}
	else{
		alert(sep[1]);
		$('#txtmail').focus()
		$(".validlogin").html('<input type="submit" name="btnsubmit" id="btnsubmit" value="[ Valider ]">');
		return false;
	}	
}

function forgotpressemail(lg){
	var valid = true;
	if(!$('#oubleemail').val() == ''){
		var email 	= $('#oubleemail').val();	
		var url 	= "requete.php?task=forgotpressemail&eml="+email+"&lg="+lg;
		sendinfo(url, "callmdppresse");
		$(".validlogin3").html("<img src='img/loading.gif'>");
		return false;
	}
}

function callmdppresse(res, status){
	var sep = res.split(";")
	if(sep[0] == 0){
		alert(sep[1]);
		$("#mdplogin").hide(500);
		$('#oubleemail').val('');
		$(".validlogin3").html('<input type="submit" name="btnoublie" id="btnoublie" value="[ Me l\'envoyer ]" />');
	}
	else{
		alert(sep[1]);
		$('#oubleemail').val('');
		$('#oubleemail').focus();	
		$(".validlogin3").html('<input type="submit" name="btnoublie" id="btnoublie" value="[ Me l\'envoyer ]" />');
	}	
}

function logout_presse(lg){
	if(lg == 'fr'){
		if(confirm("Déconnexion ?")){
			var url = "requete.php?task=logoutpresse";
			sendinfo(url, "calllogoutpresse");
		}
		else{
			return false;	
		}
	}
	else{
		if(confirm("Logout?")){
			var url = "requete.php?task=logoutpresse";
			sendinfo(url, "calllogoutpresse");
		}
		else{
			return false;	
		}	
	}
}

function calllogoutpresse(){
	window.location.reload()
}*/

function sendquestion(){
	if(!$("#txt_question").val() == ''){
		var quest = $("#txt_question").val();
		var user = $("#txtuser").val();
		var url = "requete.php?task=sendquestionpresse&qst="+quest+"&usr="+user;
		$("#question_presse").html('<div align="center"><img src="img/ajaxLoader.gif"><br><p>Envoie de question en cours...</p></div>');
		sendinfo(url, "callsendquestion");
	}
	else{
		alert("Veuillez entrer votre question.");
		$("#txt_question").focus();
		return false;		
	}
}
function callsendquestion(res, status){
	$("#question_presse").hide(500);
	var sep = res.split("*");
	alert(sep[0]);		
	$("#question_presse").html(sep[1]);
	$("#question_presse").show(500);
}

function changecontents(){	
	var url = "requete.php?task=getvideo";
	$("#video_presse_container").html('<div class="loading"><img src="img/ajaxLoader.gif"><br><p style="text-align:center;">Téléchangement de vidéo en cours...</p></div>');
	sendinfo(url, "callgetvideo");
}

function callgetvideo(res, status){	
	$("#video_presse_container").html(res);
	//$("#question_presse").show(500);
}

function getquestions(){
	var url = "requete.php?task=calldisplayquestions";	
	sendinfo(url, "calldisplayquestions");
}

function calldisplayquestions(res, status){
	//alert(res);
	var sep = res.split("^");
	$("#test").html(sep[1]);
	$("#displayhere").html(sep[0]);
}

function loadpage(pg){
	if(!pg == ''){		
		var load = window.open(pg,'','scrollbars=1,menubar=1,height=600,width=800,resizable=yes,toolbar=1,location=no,status=no');	
	}
	else{
		return false;	
	}
}

function usermustlogin(){
	alert("Veuillez-vous vous identifier pour pouvoir s'inscrire au conférence de votre choix.");
	$("#identify").show(500);
	$("#mdplogin").hide(500);
	$("#linklogin1").html('<a href="javascript:;" onclick="connexion_visiteur(\'show\');">SE CONNECTER</a>');
	$("#linklogin2").html('<a href="javascript:;" onclick="connexion_visiteur(\'show\');"><img src="img/logind.gif" height="12" width="18" border="0" /></a>');
	$("#loginemail").focus();
}

//conf = Conference principal
//jour = le jour de la conference
//num = le numero de conference ----- BD - C'est n'est pas en ordre alphabe...
function accepterinscription(conf, jour, num, user){
	//alert(conf+"-"+jour+"-"+num+"-"+user);
	if(confirm("Voulez-vous inscrire à cette conférence ?")){
		var val = conf+"-"+jour+"-"+num+"-"+user;
		var url = "requete.php?task=addconference&val="+val;
		sendinfo(url, "callconferenceadded");		
	}
	else{
		return false;	
	}
	
}

function callconferenceadded(res, status){
	var sep = res.split("^");
	if(sep[0] == 0){
		alert(sep[1]);
		return false;
	}
	else if (sep[0] == 1){
		alert(sep[1]);
		return false;
	}
	else if(sep[0] == 2){
		alert(sep[1]);
		funcreload();
	}
	else if(sep[0] == 3){
		alert(sep[1]);
		return false;
	}
}

function funcreload(){
	window.location.reload();	
}

function shwhidenews(op){	
	if(op == "show"){		
		$("#newsarchieve")	.show(500);
		$("#news2").html('<a href="javascript:;" onClick="shwhidenews(\'hide\')">Fermer</a>');
	}
	else{	
		$("#newsarchieve")	.hide(500);
		$("#news2").html('<a href="javascript:;" onClick="shwhidenews(\'show\')">Archives</a>');
	}
}