/**
 * Propriété exclusive ALBATROS INFORMATIQUE 
 */
var lastaction = '';
var actsubmenu = 0;
var stand_id = null;
var lastnouveauteshall = '';
var lastnouveautespdt = '';
var lastobjalpha = '';
var lastobjkeyword = '';
var winactive = '';
var winactiveS = '';
var compteurinitflash = 0;
var wantoconnectasvisiteur = 0;
/* Hack pour contexte */
var wanttowatchstand = 0;
var wstand_id = null;
var widdetailstand = null;
var whall_id = null;
var wobj = null;

function initXhr(){
	if(window.XMLHttpRequest) // Firefox 
	   xhr_object = new XMLHttpRequest(); 
	else if(window.ActiveXObject) // Internet Explorer 
	   xhr_object = new ActiveXObject("Microsoft.XMLHTTP"); 
	else { // XMLHttpRequest non supporté par le navigateur 
	   alert("Votre navigateur ne supporte pas les objets XMLHTTPRequest..."); 
	   return false; 
	}
	return xhr_object;
}

function loadSalonFromJS(){
	var xhr_object;
	xhr_object = initXhr();
	if (!xhr_object){return;}
	url = urlbase + '/application/ajaxget.php?action=obtain_salon&id='+salon;
	xhr_object.open('GET', url, true);
	xhr_object.onreadystatechange = function() { 
			if (xhr_object.readyState == 4) {
				var viewer  = document.getElementsByName('AIFlashApplication')[0];
    			viewer.loadSalonToAS(xhr_object.responseText);
				return ;
			}
	};
    xhr_object.send(null);
    return;
}
function loadReceptionCenterFromJS(){
	var xhr_object;
	xhr_object = initXhr();
	if (!xhr_object){return;}
	url = urlbase + '/application/ajaxget.php?action=obtainReceptionCenter';
	xhr_object.open('GET', url, true);
	xhr_object.onreadystatechange = function() { 
			if (xhr_object.readyState == 4) {
				var viewer  = document.getElementsByName('AIReceptionCenterViewer')[0];
    			viewer.loadReceptionCenterToAS(xhr_object.responseText);
				return ;
			}
	};
    xhr_object.send(null);
    return;
}
function gotoHallJS(id){
	if ((id == null)|(id == '')){
		window.location = urlbase + 'application/index.php?flash=AIHallViewer&hall_id='+hall_id;
		return
	}
	window.location = urlbase + 'application/index.php?flash=AIHallViewer&hall_id='+id;
	return;
}
function gotoSalonJS(text){
	if (text == ''){
		parent.window.location = '/application/index.php';
	}else{
		parent.window.location = text + '/application/index.php';
	}
}
function gotoReceptionCenterJS(){
	var xhr_object;
	xhr_object = initXhr();
	if (!xhr_object){return;}
	url = urlbase + 'application/ajaxget.php?action=getReceptionCenterUrl';
	xhr_object.open('GET', url, true);
	xhr_object.onreadystatechange = function() { 
			if (xhr_object.readyState == 4) {
				window.location = xhr_object.responseText;
				return ;
			}
	};
    xhr_object.send(null);
    return;
}
function loadHallFromJS(){
	var xhr_object;
	xhr_object = initXhr();
	if (!xhr_object){return;}
	url = urlbase + 'application/ajaxget.php?action=obtain_hall&id='+hall_id;
	xhr_object.open('GET', url, true);
	xhr_object.onreadystatechange = function() { 
			if (xhr_object.readyState == 4) {
				var viewer  = document.getElementsByName('AIFlashApplication')[0];
    			viewer.loadHallToAS(xhr_object.responseText);
				return ;
			}
	};
    xhr_object.send(null);
    return;
}
function loadProductFromJS(id,std) {
	hidevideo(); //cas de prévis en admin
	
	try{
		focusThisDiv(document.getElementById('win-stand-produit_'+id),'2100');
	}catch(e){
		var xhr_object;
		xhr_object = initXhr();
		if (!xhr_object){return;}
		//Pour accès direct au produit
		if (hall_id != '' & hall_id != 0){
			url = urlbase + 'application/ajaxget.php?action=obtain_product&id='+id + '&stand_id=' + stand_id + '&hall_id='+hall_id;
		}else{
			url = urlbase + 'application/ajaxget.php?action=obtain_product&id='+id + '&stand_id=' + stand_id;
		}
		xhr_object.open('GET', url, true);
		xhr_object.onreadystatechange = function() { 
				if (xhr_object.readyState == 4) {
					var newdiv = document.createElement('div');
				    var divIdName = 'win-stand-produit_' + id;
					newdiv.setAttribute('id',divIdName);
	  			    newdiv.innerHTML = xhr_object.responseText;
					document.getElementById('stand').appendChild(newdiv);  
					newdiv.setAttribute('class','win-stand-produit');
					newdiv.setAttribute('onmouseover',"focusThisDiv(this,2100)\;");
					new Draggable(divIdName); //fenetre draggable
					myinitdecal = countwarrproductwin();
					decaltop = 20;
					decalleft = 20;
					warrwinproduct[id] = "on";
					mydoc = document.getElementById('win-stand-produit_'+id);
					if (myinitdecal > 0){
						mydoc.style.top = mydoc.offsetTop + ((myinitdecal) * decaltop) + 'px';
						mydoc.style.left = mydoc.offsetLeft + ((myinitdecal) * decalleft) + 'px';
					}
					focusThisDiv(mydoc,'2100');
					return ;
				}
		};
	    xhr_object.send(null);
	}
    return;
}
function loadStandByIdFromJS(id,hall_id){
	var xhr_object;
	xhr_object = initXhr();
	if (!xhr_object){return;}
	if (hall_id != '' & hall_id != 0){
		url = urlbase + 'application/ajaxget.php?action=obtain_stand&id='+id+'&hall_id='+hall_id;
	}else{
		url = urlbase + 'application/ajaxget.php?action=obtain_stand&id='+id;
	}
	stand_id = id;
	xhr_object.open('GET', url, true);
	xhr_object.onreadystatechange = function() { 
			if (xhr_object.readyState == 4) {
				var viewer  = document.getElementsByName('AIFlashApplication')[0];
				try{
					viewer.loadStandToAs(xhr_object.responseText);
					compteurinitflash = 0;
				}catch(e){
					if (compteurinitflash == 10){return;}
					compteurinitflash = compteurinitflash+1; 
					loadStandByIdFromJS(id,hall_id);//Création d'une boucle pour laisser le temps de chargenemt du flash
				}
				return ;
			}
	};
    xhr_object.send(null);
    return;
}
function doConnection(email,password){
	var xhr_object;
	xhr_object = initXhr();
	if (!xhr_object){return;}
	url = urlbase + 'application/ajaxpost.php?action=doConnection';
	xhr_object.open('POST', url, true);
	xhr_object.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
	xhr_object.onreadystatechange = function() { 
		if (xhr_object.readyState == 4) {
			if (xhr_object.responseText == 'OK') {
				//renvoi ok uniquement sinon display old flash login
				hideInscription();
				refreshZoneConnexion();
				if (wanttowatchstand > 0){
					wstand_id = wanttowatchstand;
					wanttowatchstand = 0;
					showStand(wstand_id,widdetailstand,whall_id,wobj);
					wstand_id = null;
					widdetailstand = null;
					whall_id = null;
					wobj = null;
				}
			}else{
				alert(errconnexionauthent);
			}
			return ;
		}
	};
	xhr_object.send('email='+email+'&pwd='+password);
}
function doConnectionExposant(login,password){
	var xhr_object;
	xhr_object = initXhr();
	if (!xhr_object){return;}
	url = urlbase + 'application/ajaxpost.php?action=loginverify';
	xhr_object.open('POST', url, true);
	xhr_object.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
	xhr_object.onreadystatechange = function() { 
		if (xhr_object.readyState == 4) {
			if (xhr_object.responseText != 'KO' & xhr_object.responseText != '') {
				hideAccesexposant();
				refreshZoneConnexion();
				window.open(xhr_object.responseText,"","");
			}else{
				alert(errconnexionauthent);
			}
			return ;
		}
	};
	xhr_object.send('login='+document.getElementById('exposant_compte').value+'&password='+document.getElementById('exposant_pass').value+'&ajax=1');
}
function doDeconnexion(){
	var xhr_object;
	xhr_object = initXhr();
	if (!xhr_object){return;}
	url = urlbase + 'application/ajaxget.php?action=deconnexion&ajax=1';
	xhr_object.open('GET', url, true);
	xhr_object.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
	xhr_object.onreadystatechange = function() { 
		if (xhr_object.readyState == 4) {
			hideAccesExposantDeconnexion();
			hideaccesvisiteurdeconnexion();
			refreshZoneConnexion();
			if (wantoconnectasvisiteur ==1){
				wantoconnectasvisiteur = 0;
				showInscription();
			}
			return ;
		}
	};
	xhr_object.send(null);
}
function isConnected(){
	var xhr_object;
	xhr_object = initXhr();
	if (!xhr_object){return;}
	url = urlbase + 'application/ajaxget.php?action=isConnected';
	xhr_object.open('GET', url, false);
	xhr_object.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
	xhr_object.send();
	if (xhr_object.responseText == 'KO'){
		showInscription();
	}
	return xhr_object.responseText;
}
function isEnteredInStandFromJS(){
	var xhr_object;
	xhr_object = initXhr();
	if (!xhr_object){return;}
	url = urlbase + 'application/ajaxget.php?action=isEnteredInStand';
	xhr_object.open('GET', url, true);
	xhr_object.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
	xhr_object.onreadystatechange = function() { 
		if (xhr_object.readyState == 4) {
			var viewer  = document.getElementsByName('AIFlashApplication')[0];
			viewer.isEnteredInStandToAS(xhr_object.responseText);
			return ;
		}
	};
	xhr_object.send();
}
function sendRegistration(){
	var myform = document.getElementById('form-inscription');
	var email = myform.inscription_email.value;
	var password = myform.inscription_pass.value;
	var confirm_password = myform.inscription_confirmpass.value;
	var name = myform.inscription_nom.value;
	var firstname = myform.inscription_prenom.value;
	var societe = myform.inscription_societe.value;
	var ville = myform.inscription_ville.value;
	var cp = myform.inscription_cp.value;
	var pays = myform.inscription_pays.value;
	var tel = myform.inscription_tel.value;
	var login = myform.inscrit_email.value;
	var passlog = myform.inscrit_pass.value;
	if (login != '' & passlog != ''){
		doConnection(login,passlog);
		return;
	}
	if (password != confirm_password){
		alert(errpasswordconfirm);
		myform.inscription_pass.focus();
		return;
	}
	if (societe == ''){
		alert(errzoneobligempty);
		myform.inscription_societe.focus();
		return;
	}
	if (name == ''){
		alert(errzoneobligempty);
		myform.inscription_nom.focus();
		return;
	}
	if (firstname == ''){
		alert(errzoneobligempty);
		myform.inscription_prenom.focus();
		return;
	}
	if (email == ''){
		alert(errzoneobligempty);
		myform.inscription_email.focus();
		return;
	}
	if (password == ''){
		alert(errzoneobligempty);
		myform.inscription_pass.focus();
		return;
	}
	if (ville == ''){
		alert(errzoneobligempty);
		myform.inscription_ville.focus();
		return;
	}
	if (cp == ''){
		alert(errzoneobligempty);
		myform.inscription_cp.focus();
		return;
	}
	if (tel == ''){
		alert(errzoneobligempty);
		myform.inscription_tel.focus();
		return;
	}
	if (!checkTel(myform.inscription_tel.value)){
		alert(errsyntaxetel);
		return;
	}
	doRegistration(email,password,name,firstname,societe,ville,cp,pays,tel);
	return;
}
function doRegistration(email,password,name,firstname,societe,ville,cp,pays,tel){
	var xhr_object;
	xhr_object = initXhr();
	if (!xhr_object){return;}
	url = urlbase + 'application/ajaxpost.php?action=doRegistration';
	xhr_object.open('POST', url, true);
	xhr_object.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
	xhr_object.onreadystatechange = function() { 
		if (xhr_object.readyState == 4) {
			if (xhr_object.responseText == 'KOD'){
				alert(accountvisiteuralreadyexist);
				return;
			}
			if (xhr_object.responseText == 'OK'){
				alert(emailsendvisiteur);
			}
			hideInscription();
			return ;
		}
	};
	xhr_object.send('email='+email+'&password='+password+'&nom='+name+'&prenom='+firstname+'&societe='+societe+'&ville='+ville+'&cpville='+cp+'&tel='+tel+'&pays='+pays);
}
function gotoForgetPwdPage(){
	window.location = urlbase + "application/index.php?module=pwdvisiteurforgot";
}
function loadInterlocuteurs(){
	var xhr_object;
	xhr_object = initXhr();
	if (!xhr_object){return;}
	url = urlbase + 'application/ajaxget.php?action=obtain_list_commercial&stand_id='+stand_id;
	xhr_object.open('GET', url, true);
	xhr_object.onreadystatechange = function() { 
		if (xhr_object.readyState == 4) {
			if (xhr_object.responseText != 'NULL'){
			    document.getElementById("stand_interlocuteurs").className="active";
			    wininterlocuteur = document.getElementById('win-stand-interlocuteurs');
			    wininterlocuteur.style.left="30%";
			    wininterlocuteur.style.top="15%";
			    wininterlocuteur.style.display="block";
				focusThisDiv(wininterlocuteur,2100);
				document.getElementById('interlocuteurs').innerHTML = xhr_object.responseText;
			}else{
				showSendmail(); //1er BAT 10-2011
			}
			return ;
		}
	};
	xhr_object.send();
	
}
function sendCallMe(){
	text = "<MAIL>";
	text = text + '<MESSAGE><![CDATA[' + document.getElementById('rappeler-message').value + ']]></MESSAGE>';
	text = text + '</MAIL>';	var xhr_object;
	xhr_object = initXhr();
	if (!xhr_object){return;}
	url = urlbase + 'application/ajaxpost.php?action=sendcallme&id='+stand_id;
	xhr_object.open('POST', url, true);
	xhr_object.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
	xhr_object.onreadystatechange = function() { 
		if (xhr_object.readyState == 4) {
			if (xhr_object.responseText == 'OK' ){
				alert(demandsended);
				showHide('win-stand-rappeler');
			}
			return ;
		}
	};
	xhr_object.send('xml='+text);
	
}
function sendMail(){
	var xhr_object;
	/*
	 * <MAIL email=''>
	 * <MESSAGE><![CDATA[test d'intégratioin new release]]></MESSAGE>
	 * <CALL_NOW state='true'></CALL_NOW>
	 * <ASK_DOC state='true'></ASK_DOC>
	 * <ASK_RDV state='true'></ASK_RDV>
	 * <CALL_BY_PHONE state='true'>
	 * </CALL_BY_PHONE>
	 * </MAIL>
	 */
	// Me faire rappelet
	try{
		demandrappel = document.getElementById('mail_checkbox1').checked;
	}catch(e){
		demandrappel = false;
	}
	try{
		demanddoc = document.getElementById('mail_checkbox2').checked;
	}catch(e){
		demanddoc = false;
	}
	try{
		demandrdv = document.getElementById('mail_checkbox3').checked;
	}catch(e){
		demandrdv = false;
	}
	try{
		demandcontact = document.getElementById('mail_checkbox4').checked;
	}catch(e){
		demandcontact = false;
	}
	try{
		demandmessage = document.getElementById('mail-message').value;
	}catch(e){
		demandmessage = "";
	}
	xml = "<MAIL email=''>";
	xml = xml + "<MESSAGE><![CDATA["+demandmessage + "]]></MESSAGE>";
	xml = xml + "<CALL_NOW state='" + demandrappel +"'></CALL_NOW>";
	xml = xml + "<ASK_DOC state='" + demanddoc + "'></ASK_DOC>";
	xml = xml + "<ASK_RDV state='" + demandrdv + "'></ASK_RDV>";
	xml = xml + "<CALL_BY_PHONE state='" + demandcontact + "'></CALL_BY_PHONE>";
	xml = xml + "</MAIL>";
	xhr_object = initXhr();
	if (!xhr_object){return;}
	url = urlbase + 'application/ajaxpost.php?action=sendmailtoexponant&id='+stand_id;
	xhr_object.open('POST', url, true);
	xhr_object.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
	xhr_object.onreadystatechange = function() { 
		if (xhr_object.readyState == 4) {
			if (xhr_object.responseText == 'OK' ){
				alert(demandsended);
				hideSendmail();
			}
			return ;
		}
	};
	xhr_object.send('xml='+xml+'&stand_id='+stand_id);
}
function sendContactFriend(){
	text = "<MAIL email='" + document.getElementById('ami-email').value +"'>";
	text = text + '<MESSAGE><![CDATA[' + document.getElementById('ami-message').value + ']]></MESSAGE>';
	text = text + '</MAIL>';
	var xhr_object;
	xhr_object = initXhr();
	if (!xhr_object){return;}
	url = urlbase + 'application/ajaxpost.php?action=sendmailtofriend&id='+stand_id;
	xhr_object.open('POST', url, true);
	xhr_object.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
	xhr_object.send('xml='+text);
	xhr_object.onreadystatechange = function() { 
		if (xhr_object.readyState == 4) {
			myresp = xhr_object.responseText;
			if ( myresp == 'OK' ){
				alert(demandsended);
				showHide('win-stand-ami');
			}else if (myresp == 'KO'){
				alert('Vous ne semblez plus être connecté, vous allez être redirigé vers la page d\'accueil');
				window.location = '/';
			}else if (myresp == 'KONOTCONFORM'){
				alert('L\'email fourni n\'est pas conforme');
				return;
			}else if (myresp == 'KOR'){
				alert('Votre rôle ne vous permet pas d\'utiliser cette fonctionnalité, veuillez vous connecter en tant que visiteur');
				return;
			}
			return ;
		}
	};
}
function giveCard(){
	var xhr_object;
	xhr_object = initXhr();
	if (!xhr_object){return;}
	url = urlbase + 'application/ajaxpost.php?action=givecard&id=' + stand_id;
	xhr_object.open('POST', url, true);
	xhr_object.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
	xhr_object.onreadystatechange = function() { 
		if (xhr_object.readyState == 4) {
			if (xhr_object.responseText == 'OK1' | xhr_object.responseText == 'OK2' ){
				alert(givecardok);
			}
			return ;
		}
	};
	xhr_object.send();	
}
function loadArrKeyWordFromJS(lettre,obj){
	try{
		lastobjalpha.parentNode.className = "lien";
	}catch(e){}
	obj.parentNode.className += ' active';
	lastobjalpha = obj;
	var xhr_object;
	xhr_object = initXhr();
	if (!xhr_object){return;}
	url = urlbase + 'application/ajaxget.php?action=obtain_produit_by_keyword_for_exposant&kwd='+lettre +'&salon='+salon;
	xhr_object.open('GET', url, true);
	xhr_object.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
	xhr_object.onreadystatechange = function() { 
		if (xhr_object.readyState == 4) {
			myul = document.getElementById('rechercheproduits');
			myul.innerHTML = xhr_object.responseText;
			document.body.style.cursor = "auto";
			loadArrExponentByKeyWordFromJS('');
			return ;
		}
	};
	document.body.style.cursor = "wait";
	xhr_object.send();
}
function loadArrExponentByKeyWordFromJS(text,obj){
	try{
		lastobjkeyword.parentNode.className = "lien";
	}catch(e){}
	try{
		obj.parentNode.className += ' active';
		lastobjkeyword = obj;
	}catch(e){}
	var xhr_object;
	xhr_object = initXhr();
	if (!xhr_object){return;}
	url = urlbase + 'application/ajaxget.php?action=obtain_exposant_by_keyword&kwd='+text;
	xhr_object.open('GET', url, true);
	xhr_object.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
	xhr_object.onreadystatechange = function() { 
		if (xhr_object.readyState == 4) {
			myul = document.getElementById('rechercheexposants');
			myul.innerHTML = xhr_object.responseText;
			document.body.style.cursor = "auto";
			return ;
		}
	};
	document.body.style.cursor = "wait";
	xhr_object.send();	
}
function returnToHall(from){
	var xhr_object;
	xhr_object = initXhr();
	if (!xhr_object){return;}
	url = urlbase + 'application/ajaxget.php?action=obtain_hall&id='+hall_id;
	xhr_object.open('GET', url, true);
	xhr_object.send();
	if (from == 'ihm'){
		window.location=urlbase + "application/index.php?flash=AIHallViewer&hall_id="+hall_id;
		return false;
	}
}
function returnToSalon(){
	parent.window.location= urlbase + 'application';
}
function addToBriefcase(idP,idD){
	try{
		if (preview ==1){
			window.alert('Mode prévisualisation, cette fonction n\'est pas disponible');
			return;
		}
	}catch(e){} //Mode normal preview non défini
	var xhr_object;
	xhr_object = initXhr();
	if (!xhr_object){return;}
	if (hall_id != '' & hall_id != 0){
		url = urlbase + 'application/ajaxpost.php?action=addtobriefcase&stand_id=' + stand_id + '&hall_id='+hall_id;
	}else{
		url = urlbase + 'application/ajaxpost.php?action=addtobriefcase&stand_id=' + stand_id;
	}
	xhr_object.open('POST', url, true);
	xhr_object.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
	xhr_object.onreadystatechange = function() { 
		if (xhr_object.readyState == 4) {
			if (xhr_object.responseText == 'OK' ){
				alert(addtobriefcaseok);
			}
			if (xhr_object.responseText == 'KO' ){
				alert(addtobriefcaseko);
			}
			if (xhr_object.responseText == 'KOD' ){
				alert(addtobriefcasedo);
			}
			return ;
		}
	};
	xhr_object.send('idP='+idP+'&idD='+idD);
}
function checkTel(d){
	var regex = new RegExp(/[0-9]/gi);
	return regex.test(d);
}
function showMessage(text){
	alert('From AS ' + text);
}
function showDocument(url,url1){
	/* detection si swf ou flv*/
	test = /\.flv$|\.avi|\.mov/i;
	if (url1.match(test)){
		showvideo(url1);
	}else{
		window.open(url1,"","");
	}
	return false;
}
function loadArrExponentByIdHallFromJS(hall_id){
	var xhr_object;
	xhr_object = initXhr();
	if (!xhr_object){return;}
	url = urlbase + 'application/ajaxget.php?action=obtain_exposanthall&id='+hall_id;
	xhr_object.open('GET', url, true);
	xhr_object.onreadystatechange = function() { 
		if (xhr_object.readyState == 4) {
			var viewer  = document.getElementsByName('AIFlashApplication')[0];
			viewer.loadArrExponentByIdHallToAS(xhr_object.responseText);
			return ;
		}
	};
	xhr_object.send();
}
function showDbSearch(){
	closeNouveautes();
	closeInscription();
	closeMotdepasse();
	var viewer  = document.getElementsByName('AIFlashApplication')[0];
	viewer.showDbSearch();
}
function showDbIdCard(){
	showinscription();
}
function showDbContactFriend(){
	var viewer  = document.getElementsByName('AIFlashApplication')[0];
	viewer.showDbContactFriend();
}
function startTchat(id){
	var xhr_object;
	xhr_object = initXhr();
	if (!xhr_object){return;}
	url = urlbase + 'application/ajaxpost.php?action=starttchat';
	xhr_object.open('POST', url, true);
	xhr_object.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
	xhr_object.onreadystatechange = function() { 
		if (xhr_object.readyState == 4) {
			var viewer  = document.getElementsByName('AIFlashApplication')[0];
			viewer.sendStartTchatResult(xhr_object.responseText);
			return ;
		}
	};
	xhr_object.send('commerciaux_id='+id);
}
function sendTchatMessage(session,text){
	var xhr_object;
	xhr_object = initXhr();
	if (!xhr_object){return;}
	url = urlbase + 'application/ajaxpost.php?action=sendmessagetchat';
	xhr_object.open('POST', url, true);
	xhr_object.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
	xhr_object.send('sessiontchat='+session+'&text='+text);	
}
function readTchatMessage(session){
	var xhr_object;
	xhr_object = initXhr();
	if (!xhr_object){return;}
	url = urlbase + 'application/ajaxpost.php?action=readmessagetchat';
	xhr_object.open('POST', url, true);
	xhr_object.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
	xhr_object.onreadystatechange = function() { 
		if (xhr_object.readyState == 4) {
			var viewer  = document.getElementsByName('AIFlashApplication')[0];
			if (xhr_object.responseText != 'KO'){
				try{
					idtchat = document.simulpost.frame_id.value;
					parent.document.getElementById('onglettchat_' + idtchat).style.background='red';
				}catch (e){
					test = 0;
				};
			}
			if (xhr_object.responseText != 'KO'){
				window.focus();
			}
			viewer.sendReadTchatMessageResult(xhr_object.responseText);
			return ;
		}
	};
	xhr_object.send('sessiontchat='+session);		
}
function resendPassword(){
	var email = document.getElementById('oubli-email').value;
	if (email != ''){recoverPwd(email);}
	return false;
}
function recoverPwd(email){
	var xhr_object;
	xhr_object = initXhr();
	if (!xhr_object){return;}
	url = urlbase + 'application/ajaxget.php?action=recoverPwd&NoHeader=1&email='+email;
	xhr_object.open('GET', url, true);
	xhr_object.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
	xhr_object.onreadystatechange = function() { 
		if (xhr_object.readyState == 4) {
			if (xhr_object.responseText == 'OK'){
			alert(emailsendvisiteur);
			hidevisiteuroubli();
			}else{
				window.alert('Vous semblez ne plus être connecté, merci de vérifier');
				return;
			}
			return ;
		}
	};
		
	xhr_object.send();		
}
function recoverPwdExposant(lang){
	email = document.getElementById('oubli-email-exposant').value;
	var xhr_object;
	xhr_object = initXhr();
	if (!xhr_object){return;}
	url = urlbase + 'application/ajaxget.php?action=renewpasswdexposant';
	xhr_object.open('POST', url, true);
	xhr_object.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
	xhr_object.onreadystatechange = function() { 
		if (xhr_object.readyState == 4) {
			if (xhr_object.responseText == 'OK'){
			try{
				if (lang == 'gb'){
					alert(emailsendvisiteurgb);
					hidevisiteuroubli('gb');
				}else{
					alert(emailsendvisiteur);
					hidevisiteuroubli();
				}
			}catch(e){
				alert(emailsendvisiteur);
				hidevisiteuroubli();
			}
			}else{
				alert("Votre compte n'existe pas, merci de réessayer");
			}
			return ;
		}
	};
	data = 'email='+email+'&ajax=1'
	xhr_object.send(data);		
}
function stopTchat(session){
}
function waitTchat(){
}
function loadUrl(url){
	if (url != ''){
		window.location = url;
	}
	return;
}
function gotoStandExplorerByIdExponentFromJS(id){
	loadUrl(urlbase + '/application/index.php?module=index&flash=AIFrameStandExplorer&id='+id);
}
function showWarningToJS(p_message)
{
	//alert(p_message);
}
function focusFull(){
	if (document.all) 
	   { top.window.resizeTo(screen.availWidth,screen.availHeight); } 
	else if (document.layers || document.getElementById){ 
	   if (top.window.outerHeight < screen.availHeight || top.window.outerWidth <	screen.availWidth){
		   top.window.outerHeight = top.screen.availHeight; 
		   top.window.outerWidth = top.screen.availWidth; 
       } 
	}
}
function showInscription(){
	hideAllExposant();
	var xhr_object;
	xhr_object = initXhr();
	if (!xhr_object){return;}
	url = urlbase + 'application/ajaxget.php?action=getRole';
	xhr_object.open('GET', url, true);
	xhr_object.onreadystatechange = function() { 
			if (xhr_object.readyState == 4) {
				if (xhr_object.responseText == 'exposant'){
					document.getElementById('acces').style.display="block";
					document.getElementById('acces-exposant-deconnexion').style.display="block";
				}else{
					initFormInscription();
					document.getElementById('acces-visiteur-deconnexion').style.display="none";
					document.getElementById('acces').style.display="block";
					document.getElementById('acces-visiteur-inscription').style.display = 'block';
				}
				return ;
			}
	};
    xhr_object.send(null);
}
function hideInscription(){
	document.getElementById('acces').style.display="none";
	document.getElementById('acces-visiteur-inscription').style.display = 'none';
}
function showMotdepasse(){
	closeNouveautes();
	try{
		if (hall_id < 1 ){
			closeInscription();
		}
	}catch(e){ //null
		closeInscription();
	}
	document.getElementById('modal-motdepasse').style.display = 'block';
}
function closeInscription(from){
	if (from == 'ihm') {
		if (stand_id != 'null' & stand_id > 0){
			if (hall_id == 'null' | hall_id <1){
				returnToSalon();
			}else{
				returnToHall(from);
			}
			return false;
		}
	}
	document.getElementById('acces').style.display="none";
	document.getElementById('acces-visiteur-inscription').style.display = 'none';
	return false;
}
function setPub(){
	myul = document.getElementById('produitsnouveautes');
	var xhr_object;
	xhr_object = initXhr();
	if (!xhr_object){return;}
	url = urlbase + 'application/ajaxget.php?action=getPubTodisplay&id='+hall_idforpub;
	xhr_object.open('GET', url, true);
	xhr_object.onreadystatechange = function() { 
			if (xhr_object.readyState == 4) {
				var myobjectpub = eval('(' + xhr_object.responseText + ')');
				try{
					document.getElementById('pub-salon').innerHTML = myobjectpub.header;
					if (hall_idforpub != ''){
						document.getElementById('hall-pub-1').innerHTML = myobjectpub.hall[0];
						document.getElementById('hall-pub-2').innerHTML = myobjectpub.hall[1];
					}
				}catch(e){}
				return ;
			}
	};
    xhr_object.send(null);
	return false;
	
}

function getContentPublicationForSubMenu(id,zone,title){
	myul = document.getElementById('navfooter-sub-menu');
	var xhr_object;
	xhr_object = initXhr();
	if (!xhr_object){return;}
	url = urlbase + 'application/ajaxget.php?action=getContentPublicationForSubMenu&id='+id+"&zone="+zone;
	xhr_object.open('GET', url, true);
	xhr_object.onreadystatechange = function() { 
			if (xhr_object.readyState == 4) {
				var temp = xhr_object.responseText;
				var reg=new RegExp("#FROM#", "g");
				temp = temp.replace(reg,title);
				document.getElementById('navfooter-sub-menu').innerHTML = temp; 
				return ;
			}
	};
    xhr_object.send(null);
	return false;
	
}
function hideSubMenu(){
	document.getElementById('navfooter-sub').style.display="none";
}
function closeAllWin(){
    hideNouveautes();
    hideListeExposants();
    hideRecherche();
    hideWinHtml();
}
function showSubMenu(action){
    if (document.getElementById('navfooter-sub').style.display=="none"){
    	closeAllWin();
    	document.getElementById('navfooter-sub').style.display="block";
        document.getElementById('navfooter-sub-titre').innerHTML = action;
        switch (action){
	        case 'Visiter':
	        	getContentPublicationForSubMenu('2','B',action);
	        	document.getElementById('navfooter-sub').style.left = '10px';
	        	break;
	        case 'Exposer':
	        	getContentPublicationForSubMenu('1','B',action);
	        	document.getElementById('navfooter-sub').style.left = '150px';
	        	break;
        }
        lastaction = action;
    } else {
    	hideSubMenu();
    	if (lastaction != action){
    		showSubMenu(action);
    	}
    }
  } 
function doTimerPub()
{
	setPub();
	t=setTimeout("doTimerPub()",replique);
}
function showWinHtml(from,id){
	hideSubMenu();
	closeAllWin();
	document.getElementById('win-html').style.display="block";
	setContentPage(id,from);
}
function hideWinHtml(){
	document.getElementById('win-html').style.display="none";
}
function hideWinProductStand(id,idp){
	document.getElementById('stand').removeChild(document.getElementById(id));
	warrwinproduct[idp] = 'off';
	countwarrproductwin();
	//déchargement pour relecture serveur forcée si reclick
}
function countwarrproductwin(){
	var countwinp=0;
	for(var i= 0; i < warrwinproduct.length; i++)
	{
	    try{ 
		if (warrwinproduct[i] == 'on'){
			countwinp = countwinp+1;
	     }
	    }catch(e){}
	}	
	return countwinp;
}
function hideAccesVisiteurDeconnexion(){
	document.getElementById('acces-visiteur-deconnexion').style.display="none";
	document.getElementById('acces').style.display="none";
}
function setContentPage(id,from){
	var xhr_object;
	xhr_object = initXhr();
	if (!xhr_object){return;}
	url = urlbase + 'application/ajaxget.php?action=getContentPage&id='+id;
	xhr_object.open('GET', url, true);
	xhr_object.onreadystatechange = function() { 
			if (xhr_object.readyState == 4) {
				var myObject = eval('(' + xhr_object.responseText + ')');
				document.getElementById('win-780-content').innerHTML = myObject.content;
				mycontent = '<ul>';
				if (from != ''){
					mycontent = mycontent + '<li>'+from+'</li>';
				}
				mycontent = mycontent + '<li>'+myObject.title+'</li>';
				mycontent = mycontent + '</ul>';
				document.getElementById('win-780-ariane').innerHTML = mycontent;
				return ;
			}
	};
    xhr_object.send(null);
    return false;
}
/*
 * Nouveautés
 */
function showNouveautes(){
	document.getElementById("navrapide_nouveautes").className="active";
	hideSubMenu();
	winnouveautes = document.getElementById('win-nouveautes');
	winnouveautes.style.left="450px";
	winnouveautes.style.top="60px";
	winnouveautes.style.display="block";
	focusThisDiv(winnouveautes,1000);
	var xhr_object;
	myul = document.getElementById('secteurs');
	xhr_object = initXhr();
	if (!xhr_object){return;}
	url = urlbase + 'application/ajaxget.php?action=getHallToUlLi';
	xhr_object.open('GET', url, true);
	xhr_object.onreadystatechange = function() { 
			if (xhr_object.readyState == 4) {
				myul.innerHTML = xhr_object.responseText;
				document.body.style.cursor = "auto";
				return ;
			}
	};
	document.body.style.cursor = "wait";
    xhr_object.send(null);
	return false;
}
function hideNouveautes(){
	document.getElementById("navrapide_nouveautes").className=" ";
	document.getElementById('win-nouveautes').style.display="none";
}
function loadNewsForThisHall(id,obj){
	try {
		lastnouveauteshall.parentNode.className = 'lien';
		lastnouveauteshall = obj;
	}catch(e){lastnouveauteshall = obj;}
	obj.parentNode.className += ' active';
	myul = document.getElementById('produits');
	var xhr_object;
	xhr_object = initXhr();
	if (!xhr_object){return;}
	url = urlbase + 'application/ajaxget.php?action=obtain_newproductforthishall&id='+id;
	xhr_object.open('GET', url, true);
	xhr_object.onreadystatechange = function() { 
			if (xhr_object.readyState == 4) {
				myul.innerHTML = xhr_object.responseText;
				document.body.style.cursor = "auto";
				return ;
			}
	};
	document.body.style.cursor = "wait";
    xhr_object.send(null);
	return false;
}
/*
* Exposants
*/
function showListeExposants(){
    document.getElementById("navrapide_exposants").className="active";
    winexposants = document.getElementById('win-exposants');
    winexposants.style.left="400px";
    winexposants.style.top="30px";
    winexposants.style.display="block";
	focusThisDiv(winexposants,1000);
	myul = document.getElementById('liste-exposants');
	var xhr_object;
	xhr_object = initXhr();
	if (!xhr_object){return;}
	url = urlbase + 'application/ajaxget.php?action=getAllExposantByUlLi';
	xhr_object.open('GET', url, true);
	xhr_object.onreadystatechange = function() { 
			if (xhr_object.readyState == 4) {
				myul.innerHTML = xhr_object.responseText;
				document.body.style.cursor = "auto";
				return ;
			}
	};
	document.body.style.cursor = "wait";
    xhr_object.send(null);
	return false;	
}
function hideListeExposants(){
    document.getElementById("navrapide_exposants").className=" ";
	document.getElementById('win-exposants').style.display="none";
}
/*
*recherche
*/
function showRecherche(){
    document.getElementById("navrapide_recherche").className="active";	
	hideSubMenu();
	winrecherche = document.getElementById('win-recherche');
	winrecherche.style.left="350px";
	winrecherche.style.top="0px";
	winrecherche.style.display="block";
	focusThisDiv(winrecherche,1000);
	myul = document.getElementById('liste-exposants');
	var xhr_object;
	xhr_object = initXhr();
	if (!xhr_object){return;}
	url = urlbase + 'application/ajaxget.php?action=getAllExposantByUlLi';
	xhr_object.open('GET', url, true);
	xhr_object.onreadystatechange = function() { 
			if (xhr_object.readyState == 4) {
				myul.innerHTML = xhr_object.responseText;
				document.body.style.cursor = "auto";
				return ;
			}
	};
	document.body.style.cursor = "wait";
    xhr_object.send(null);
	return false;	
}
function hideRecherche(){
    document.getElementById("navrapide_recherche").className=" ";	
	document.getElementById('win-recherche').style.display="none";
}

/* Stand */
function showHide(divTarget,divactif){
	var detailstand =document.getElementById(divTarget); 
	try{
		if (detailstand.style.display=="none"){
			detailstand.style.display="block";
	      } else {
	    	  detailstand.style.display="none";
	    }
	}catch(e){
	}
}    
function showStand(standid,iddetailstand,hall_id,obj){
	//1er BAT
	/*try {
		lastnouveautespdt.parentNode.className = 'lien';
		lastnouveautespdt = obj;
	}catch(e){lastnouveautespdt = obj;}*/
	/* hack de contexte */
	widdetailstand = iddetailstand;
	whall_id = hall_id ;
	wobj = obj;
	warrwinproduct = new Array(40); //40 produits
	try{
		obj.parentNode.className += ' active';
	}catch(e){}
	if (isConnected() == 'OK'){
		stand_id = standid;
		/* chargement du stand */
		document.getElementById('stand').style.display="block";	
		loadStandByIdFromJS(stand_id,hall_id);
		/* affectation ariane */
		laodarianeforstand(stand_id,hall_id);
	}else{
		wanttowatchstand = standid;
	}
}
function laodarianeforstand(stand_id,hall_id){
	var xhr_object;
	xhr_object = initXhr();
	if (!xhr_object){return;}
	url = urlbase + 'application/ajaxget.php?action=laodarianeforstand&stand_id='+stand_id+'&hall_id='+hall_id;
	xhr_object.open('GET', url, true);
	xhr_object.onreadystatechange = function() { 
			if (xhr_object.readyState == 4) {
				mybar = document.getElementById('stand-header');
				mytitle = document.getElementById('stand-menu-exposant');
				var myObject = eval('(' + xhr_object.responseText + ')');
				mybar.innerHTML = myObject.ariane;
				mytitle.innerHTML = myObject.title;
				document.body.style.cursor = "auto";
				return ;
			}
	};
	document.body.style.cursor = "wait";
    xhr_object.send(null);
	return false;	
	
}
function hideStand(){
	stand_id = null;
	closeAllWinStand();
	document.getElementById('stand').style.display="none";
	//décharge les fenetre produits
	for(i=1;i<=50;i++){
		try{
			hideWinProductStand('win-stand-produit_'+i);
		}catch(e){}
	}
}
function closeAllWinStand(){
	hideAmi();
	hideRappeler();
	hideSendmail();
	hideInterlocuteurs();
}
function showInterlocuteurs(){
	loadInterlocuteurs();
}
function hideInterlocuteurs(){
	document.getElementById("stand_interlocuteurs").className=" ";
	document.getElementById('win-stand-interlocuteurs').style.display="none";
}
function showSendmail(){
    document.getElementById("stand_sendmail").className="active";
    document.getElementById('mail-message').value = "";
    document.getElementById('mail_checkbox1').checked = false;
    document.getElementById('mail_checkbox2').checked = false;
    document.getElementById('mail_checkbox3').checked = false;
    document.getElementById('mail_checkbox4').checked = false;
    
    winemail = document.getElementById('win-stand-mail');
    winemail.style.top="15%";
    winemail.style.left="21%";
    winemail.style.display="block";
	focusThisDiv(winemail,2100);
	//loadInterlocuteurs();
}
function showRappeler(){
	document.getElementById("stand_rappeler").className="active";
	document.getElementById('rappeler-message').value="";
	winrappeler = document.getElementById('win-stand-rappeler');
	winrappeler.style.top="17%";
	winrappeler.style.left="19%";
	winrappeler.style.display="block";
	focusThisDiv(document.getElementById('win-stand-rappeler'),2100);
}
function showAmi(){
	document.getElementById("stand_ami").className="active";
	document.getElementById('ami-email').value="";
	document.getElementById('ami-message').value="";
	winami = document.getElementById('win-stand-ami');
	winami.style.top="19%";
	winami.style.left="17%";
	winami.style.display="block";
	focusThisDiv(document.getElementById('win-stand-ami'),2100);
}
function hideSendmail(){
	document.getElementById("stand_sendmail").className=" ";
	document.getElementById('win-stand-mail').style.display="none";
}
function hideRappeler(){
	document.getElementById("stand_rappeler").className=" ";
	document.getElementById("win-stand-rappeler").style.display = 'none';
}
function hideAmi(){
	document.getElementById("stand_ami").className=" ";
	document.getElementById("win-stand-ami").style.display='none';
}
/*
 * Infobulle
*/
function hideInfoBulle(mydiv){
	document.getElementById(mydiv).style.display="none";
}
function showInfoBulle(mydiv,id,mtop,mleft){
	var detailstand =document.getElementById(mydiv); 
	try{
		if (detailstand.style.display=="none"){
			//positionne la fenetre à coté de la souris
			document.getElementById('img-hall-infobulle').src=myarrexpo[id]['img'];
			document.getElementById('hall-infobulle-texte').innerHTML='<p>' + myarrexpo[id]['desc'] + '</p>';
			document.getElementById('hall-infobulle-nom').innerHTML=myarrexpo[id]['nom'];
			bulle = document.getElementById(mydiv).style.top = mtop + 'px';
			bulle = document.getElementById(mydiv).style.left = mleft + 'px';
			detailstand.style.display="block";
	      } else {
	    	  detailstand.style.display="none";
	    }
	}catch(e){
	}
}
function hidevisiteuroubli(){
	document.getElementById('acces-visiteur-oubli').style.display="none";
}
function hideaccesvisiteurdeconnexion(){
	document.getElementById('acces-visiteur-deconnexion').style.display='none';
}
/* exposant */
function showOubliPassExposant(lang){
	try{
		if (lang == 'gb'){
			document.getElementById('acces-exposant-oubli-gb').style.display="block";
		}else{
			document.getElementById('acces-exposant-oubli').style.display="block";
		}
	}catch(e){
		document.getElementById('acces-exposant-oubli').style.display="block";
	}
}
function hideOubliPassExposant(lang){
	try{
		if (lang == 'gb'){
			document.getElementById('acces-exposant-oubli-gb').style.display="none";
		}else{
			document.getElementById('acces-exposant-oubli').style.display="none";
		}
	}catch(e){
		document.getElementById('acces-exposant-oubli').style.display="none";
	}
}
function hideAllExposant(){
	document.getElementById('acces-exposant').style.display="none";
	document.getElementById('form-exposant-inscription').style.display="none";
	document.getElementById('form-exposant-inscription-gb').style.display="none";
}
function showAccesexposant(){
	hideAllExposant();
	var xhr_object;
	xhr_object = initXhr();
	if (!xhr_object){return;}
	url = urlbase + 'application/ajaxget.php?action=getRole&fromaccessexposant=1';
	xhr_object.open('GET', url, true);
	xhr_object.onreadystatechange = function() { 
			if (xhr_object.readyState == 4) {
				if (xhr_object.responseText == 'visiteurauthent'){
					document.getElementById('acces').style.display="block";
					document.getElementById('acces-visiteur-deconnexion').style.display="block";
				}else{
					hideInscriptionexposant();
					document.getElementById('acces').style.display="block";
					document.getElementById('acces-exposant').style.display="block";
				}
				return ;
			}
	};
    xhr_object.send(null);
}
function hideAccesexposant(){
	document.getElementById('acces').style.display="none";
	document.getElementById('acces-exposant').style.display="none";
}
function hideAccesExposantDeconnexion(){
	document.getElementById('acces').style.display="none";
	document.getElementById('acces-exposant-deconnexion').style.display="none";
}
function showInscriptionexposantfr(){
	hideInscriptionexposantgb();
	hideInscriptionexposantfr();
	document.getElementById('acces-exposant-inscription').style.display="block";
	document.getElementById('form-exposant-inscription-gb').style.display="none";
	document.getElementById('form-exposant-inscription').style.display="block";
	initFormExposant();
}
function hideInscriptionexposant(){
	document.getElementById('acces-exposant-inscription').style.display="none";
	document.getElementById('acces').style.display="none";
	hideInscriptionexposantgb();
	hideInscriptionexposantfr();
}
function hideInscriptionexposantfr(){
	document.getElementById('form-exposant-inscription').style.display="none";
}
function showInscriptionexposantgb(){
	initFormExposant();
	hideInscriptionexposantfr();
	document.getElementById('form-exposant-inscription-gb').style.display="block";
}
function hideInscriptionexposantgb(){
	document.getElementById('form-exposant-inscription-gb').style.display="none";
}
function hidevideo(){
	try{
		document.getElementById('win-video').style.display="none";
	}catch(e){}
}
function showvideo(url){
	var xhr_object;
	sep = new RegExp("&","g"); 
	egal = new RegExp("=","g"); 
	url = url.replace(sep,'SEP');
	url = url.replace(egal,'EQUAL');
	action = new RegExp("actionEQUAL","g");
	url = url.replace(action,'action=');
	xhr_object = initXhr();
	if (!xhr_object){return;}
	xhr_object.open('GET', url, true);
	xhr_object.onreadystatechange = function() { 
		if (xhr_object.readyState == 4) {
			flashvars.mediaURL = xhr_object.responseText;
			document.getElementById('win-video').style.display="block";
			embedSWF();
			return ;
		}
	};
	xhr_object.send();
}
function sendRegistrationExposant(form){
	myform = document.getElementById(form);
	typestand = myform.exposant_inscription_stand.value;
	societe = myform.exposant_inscription_societe.value;
	nom_exposant= myform.exposant_inscription_nomexposant.value;
	zoneindustrielle= myform.exposant_inscription_adresse1.value;
	rue= myform.exposant_inscription_adresse2.value;
	boitepostale= myform.exposant_inscription_adresse3.value;
	codepostal= myform.exposant_inscription_codepostal.value;
	ville= myform.exposant_inscription_ville.value;
	pays= myform.exposant_inscription_pays.value;
	emailsociete= myform.exposant_inscription_emailsociete.value;
	telephonesociete= myform.exposant_inscription_telsociete.value;
	faxsociete= myform.exposant_inscription_faxsociete.value;
	civilite= myform.exposant_inscription_civilite.value;
	nomresponsable= myform.exposant_inscription_nom.value;
	prenomresponsable= myform.exposant_inscription_prenom.value;
	fonctionresponsable= myform.exposant_inscription_fonction.value;
	emailresponsable= myform.exposant_inscription_email.value;
	telresponsable= myform.exposant_inscription_tel.value;
	faxresponsable= myform.exposant_inscription_fax.value;

	if (societe == ''){
		alert(errzoneobligempty);
		myform.exposant_inscription_societe.focus();
		return;
	}
	if (nom_exposant == ''){
		alert(errzoneobligempty);
		myform.exposant_inscription_nomexposant.focus();
		return;
	}
	if (codepostal == ''){
		alert(errzoneobligempty);
		myform.exposant_inscription_codepostal.focus();
		return;
	}
	if (ville == ''){
		alert(errzoneobligempty);
		myform.exposant_inscription_ville.focus();
		return;
	}
	if (emailsociete == ''){
		alert(errzoneobligempty);
		myform.exposant_inscription_emailsociete.focus();
		return;
	}
	if (telephonesociete == ''){
		alert(errzoneobligempty);
		myform.exposant_inscription_telsociete.focus();
		return;
	}
	if (nomresponsable == ''){
		alert(errzoneobligempty);
		myform.exposant_inscription_nom.focus();
		return;
	}
	if (prenomresponsable == ''){
		alert(errzoneobligempty);
		myform.exposant_inscription_prenom.focus();
		return;
	}
	if (fonctionresponsable == ''){
		alert(errzoneobligempty);
		myform.exposant_inscription_fonction.focus();
		return;
	}
	if (emailresponsable == ''){
		alert(errzoneobligempty);
		myform.exposant_inscription_email.focus();
		return;
	}
	if (telresponsable == ''){
		alert(errzoneobligempty);
		myform.exposant_inscription_tel.focus();
		return;
	}
	doRegistrationExposant(typestand,societe,nom_exposant,zoneindustrielle,rue,boitepostale,codepostal,ville,pays,emailsociete,telephonesociete,faxsociete,civilite,nomresponsable,prenomresponsable,fonctionresponsable,emailresponsable,telresponsable,faxresponsable);
	return;
}
function doRegistrationExposant(typestand,societe,nom_exposant,zoneindustrielle,rue,boitepostale,codepostal,ville,pays,emailsociete,telephonesociete,faxsociete,civilite,nomresponsable,prenomresponsable,fonctionresponsable,emailresponsable,telresponsable,faxresponsable){
	var xhr_object;
	xhr_object = initXhr();
	if (!xhr_object){return;}
	url = urlbase + 'application/ajaxpost.php?action=doRegistrationExposant';
	xhr_object.open('POST', url, true);
	xhr_object.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
	xhr_object.onreadystatechange = function() { 
		if (xhr_object.readyState == 4) {
			if (xhr_object.responseText == 'KOD'){
				alert(accountexposantalreadyexist);
				return;
			}
			if (xhr_object.responseText == 'OK'){
				alert(inscriptionexposantok);
				hideInscription();
			}
			return ;
		}
	};
	xhr_object.send('ajax=1'+'&standref_category='+typestand+'&societe='+societe+'&nom_exposant='+nom_exposant+'&adresse_1='+zoneindustrielle+'&adresse_2='+rue+'&adresse_3='+boitepostale+'&cpville='+codepostal+'&ville='+ville+'&pays='+pays+'&email='+emailsociete+'&tel_ste='+telephonesociete+'&fax_ste='+faxsociete+'&civi_resp_stand='+civilite+'&nom_responsable='+nomresponsable+'&prenom_responsable='+prenomresponsable+'&conction_resp_stand='+fonctionresponsable+'&email_responsable='+emailresponsable+'&tel_responsable='+telresponsable+'&fax_responsable='+faxresponsable);
}
function focusThisDiv(obj,myzindex){
	if (myzindex < 2000){
	if (obj.id == winactive){
		return;
	}
	try{
		document.getElementById(winactive).style.zIndex = myzindex;
	}catch(e){} //pour l'init car winactive == null
	winactive = obj.id;
	obj.style.zIndex = myzindex+1;
	}else{
		if (obj.id == winactiveS){
			return;
		}
		try{
			document.getElementById(winactiveS).style.zIndex = myzindex;
		}catch(e){} //pour l'init car winactive == null
		winactiveS = obj.id;
		obj.style.zIndex = myzindex+1;
	}
}
function initFormInscription(){
	document.getElementById('inscription_societe').value = "";
	document.getElementById('inscription_nom').value = "";
	document.getElementById('inscription_prenom').value = "";
	document.getElementById('inscription_email').value = "";
	document.getElementById('inscription_pass').value = "";
	document.getElementById('inscription_confirmpass').value = "";
	document.getElementById('inscription_ville').value = "";
	document.getElementById('inscription_cp').value = "";
	document.getElementById('inscription_tel').value = "";
	document.getElementById('inscription_pays').value = "";
}
function initFormExposant(){
	document.getElementById('exposant-inscription-societe').value = "";
	document.getElementById('exposant-inscription-nomexposant').value = "";
	document.getElementById('exposant-inscription-adresse1').value = "";
	document.getElementById('exposant-inscription-adresse2').value = "";
	document.getElementById('exposant-inscription-adresse3').value = "";
	document.getElementById('exposant-inscription-codepostal').value = "";
	document.getElementById('exposant-inscription-ville').value = "";
	document.getElementById('exposant-inscription-emailsociete').value = "";
	document.getElementById('exposant-inscription-telsociete').value = "";
	document.getElementById('exposant-inscription-faxsociete').value = "";
	document.getElementById('exposant-inscription-nom').value = "";
	document.getElementById('exposant-inscription-prenom').value = "";
	document.getElementById('exposant-inscription-fonction').value = "";
	document.getElementById('exposant-inscription-email').value = "";
	document.getElementById('exposant-inscription-tel').value = "";
	document.getElementById('exposant-inscription-fax').value = "";
}
function refreshZoneConnexion(){
	var xhr_object;
	xhr_object = initXhr();
	if (!xhr_object){return;}
	url = urlbase + 'application/ajaxget.php?action=refreshZoneConnexion';
	xhr_object.open('POST', url, true);
	xhr_object.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
	xhr_object.onreadystatechange = function() { 
		if (xhr_object.readyState == 4) {
			document.getElementById('header').innerHTML=xhr_object.responseText;
			return ;
		}
	};
	xhr_object.send();
}
function getStyle(el,styleProp)
{
    var x = document.getElementById(el);

    if (window.getComputedStyle)
    {
        var y = document.defaultView.getComputedStyle(x,null).getPropertyValue(styleProp); 
    }  
    else if (x.currentStyle)
    {
        var y = x.currentStyle[styleProp];
    }                     

    return y;
}
function countactiveproductwin(){
	
}
