/*
* Le code qui suit sert ?'affichage d'un texte qui d?le pour la page des acc?professionnels
*/
size=53;
x = 3*size;
place = 0;
texteDef = '';
texte = '';
i=0;

function defile() {
	document.defil.reset();
	texte = document.defil.defilbox.value;
	texteDef = texte;
	defileRecursion();
}

function defileRecursion() {
	texteDef = texteDef.substring(1,texteDef.length);
	while(texteDef.length < x)
		{
		texteDef += "   -   " + texte;
		}
	document.defil.defilbox.value = texteDef;
	tempo2 = setTimeout("defileRecursion()", 150)
}

/**/

function validate_required(field,alerttxt)
{
	with (field)
	{
		if (value==null||value=="") {
			alert(alerttxt);
			return false;
		}
		else {
			return true;
		}
	}
}	

function validate_logonform(thisform, language)
{
	with (thisform)
	{
		var userMsg="";
		var pwdMsg="";
		var txt="";
		
		switch(language) {
		case "fr":
			userMsg="Veuillez entrer votre nom utilisateur";
			pwdMsg="Veuillez entrer votre mot de passe";
			txt="L'acces est exclusivement reserve a nos clients et partenaires.\nPour toute information reportez-vous a la rubrique Contact.";
			break;
		case "en":
			userMsg="Please enter your user name";
			pwdMsg="Please enter your password";
			txt="Access is exclusively dedicated to our customers and partners.\nFor more information see contact column.";
			break;
		case "es":
			userMsg="Please enter your user name";
			pwdMsg="Please enter your password";
			txt="Access is exclusively dedicated to our customers and partners.\nFor more information see contact column.";
			break;
		case "de":
			userMsg="Please enter your user name";
			pwdMsg="Please enter your password";
			txt="Access is exclusively dedicated to our customers and partners.\nFor more information see contact column.";
			break;
		default:
			userMsg="Veuillez entrer votre nom utilisateur";
			pwdMsg="Veuillez entrer votre mot de passe";
			txt="L'acces est exclusivement reserve a nos clients et partenaires.\nPour toute information reportez-vous a la rubrique Contact.";
			break;
		}
		
		if (validate_required(user,userMsg)==false) {
			user.focus();
			return false;
		}
		if (validate_required(password,pwdMsg)==false) {
			password.focus();
			return false;
		}
		alert(txt);
		return false;
	}
}

/*** Gestion d'une popup modale pour l'affichage d'un message de sécurité ***/
var modalWindow
// if modal window is open, then close it
function closeModalWindow() 
{
if (modalWindow && !modalWindow.closed) 
{
modalWindow.close()
modalWindow = false
return modalWindow
}
}

// This function opens a small window
function popUpWindow(msg) 
{
// assemble HTML for new window
var newTags = "<HTML><HEAD><TITLE>Sécurité Aexxdis</TITLE></HEAD>"
newTags += "<BODY BGCOLOR='#FFFFFF'>"
newTags += "<form><input TYPE='button' value='Ok' name='closeup' onClick='opener.closeModalWindow()'></form></center>"
newTags += msg + "<P>"
newTags += "</BODY></HTML>"
if (!modalWindow || modalWindow.closed) 
{
modalWindow = window.open ("","", "toolbar=no,width=500,height=400,directories=no,status=no,scrollbars=yes,resize=yes,menubar=no")
if (!modalWindow.opener) 
{
modalWindow.opener = window
}
// write HTML to modal window
modalWindow.document.write(newTags)
modalWindow.document.close()  // end of writing to modal window
} 
else 
{
// window is already open; rewrite this window
modalWindow.document.write(newTags)
modalWindow.document.close()  // end of writing to modal window
modalWindow.focus()
}
}
/**********/

var numberOfMenus = 10;
var activeMenu = null; //defines which menu is currently open

//runs at onload of window        
function initialize() {
    userEventsInit(); //set up all user events
    montre();
}

/*
* Menu d?ulant
*/
function montre(id) {
    //userEventsInit(); //set up all user events
	var d = document.getElementById(id);
		for (var i = 1; i<=10; i++) {
			if (document.getElementById('smenu'+i)) {document.getElementById('smenu'+i).style.display='none';}
		}
	if (d) {d.style.display='block';}
}
/**/

function menuOver() {
    document.onclick = null;
    if (window.event != null) window.event.cancelBubble=true; // IE requires this
}

function menuOut() {
    document.onclick = eventHideMenu;
    if (window.event != null) window.event.cancelBubble=true; // IE requires this
}

//turns on the display for nav menus
function eventShowMenu(e) {
    if (activeMenu != null) eventHideMenu();
    activeMenu = "menu"+this.id.substring(3,this.id.length)
    obj = document.getElementById(activeMenu);
    if (obj != null) obj.style.visibility = "visible";
    if (document.all) document.onclick = eventHideMenu; // IE requires this
    if (window.event != null) window.event.cancelBubble=true; // IE requires this
}

//hides nav menus and pop ups
function eventHideMenu() {
    document.onclick = null;
    if (activeMenu != null) {
        obj = document.getElementById(activeMenu);
        obj.style.visibility = "hidden";
    }
}

//nav events
function userEventsInit() {
    for (i=1; i < numberOfMenus + 1; i++) {
	    obj = document.getElementById("nav"+i);
	    if (obj != null) {
		    obj.onclick = eventShowMenu;
	    }
	
	    obj = document.getElementById("menu"+i);
	    if (obj != null) {
		    obj.onmouseover = menuOver;
		    obj.onmouseout = menuOut;
	    }
    }
 }
