function addLoadEvent(func) {
  var oldonload = window.onload;
  if (typeof window.onload != 'function') {
    window.onload = func;
  } else {
    window.onload = function() {
      oldonload();
      func();
    }
  }
}

function menu() {
	if (window.attachEvent) { 
		// IE does not do :hover on <li> ==> add a class onmouseover
		sfHover("tabNavigation");
		sfHover("targetsUL");
		
	} 
	var span1 = document.getElementById("linkConfecid");
	if (span1) {
		span1.onmouseover=function() {this.className="linkConfecHover";}
		span1.onmouseout=function() {this.className="linkConfec";}
	}
	var span2 = document.getElementById("linkDessertsid");
	if (span2) {
		span2.onmouseover=function() {this.className="linkDessertsHover";}
		span2.onmouseout=function() {this.className="linkDesserts";}
	}
	var span3 = document.getElementById("linkPastryid");
	if (span3) {
		span3.onmouseover=function() {this.className="linkPastryHover";}
		span3.onmouseout=function() {this.className="linkPastry";}
	}
	
}

function sfHover(id) {
	var BUA = navigator.userAgent;
	var BIE = BUA.indexOf("MSIE");
	var BIsIE = BIE>=0;

	var ul = document.getElementById(id);
	if(ul) {
		var lis = ul.getElementsByTagName('li');
		for(i=0;i<lis.length;i++) {
			if(lis[i].parentNode == ul) {
				// enkel die LIs die subitems hebben
				lis[i].onmouseover=function() {this.className+=" sfhover";}
				lis[i].onmouseout=function() {this.className=this.className.replace(new RegExp(" sfhover\\b"), "");}
							
				//all is normal till here. If we're using IE then this tells any first level item to have a width of 1px
				//lis[i].style.width = '1px';
			}
		}
	}
}

function search() {
	var searchlnk = document.getElementById("searchlink");
	if(searchlnk) {
		searchlnk.onclick = function() {
			document.searchform.submit();
			return false;
		}
	}
}

function show_popup(url,theWidth,theHeight) {
	theTop = (screen.height-theHeight*1.5)/2;
	theLeft = (screen.width-theWidth)/2;
	winopts = "toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=auto,resizable=yes,copyhistory=0,width="+theWidth+",height="+theHeight+",top="+theTop+",left="+theLeft;
	smallwindow=window.open(url,"Detail",winopts);
	smallwindow.focus();
}

function applicationtable_popups() {
	var links=document.getElementsByTagName("a");
	for(i=0;i<links.length;i++) {
		if (links[i].className.indexOf("iconlink") >= 0) {
			links[i].onclick=function() {
				show_popup(this.href,430,400);
				return false;
			}
		}
	}	
}

function validate_friendform(theForm) {
	var msg = ""
	if(theForm.sender.value == lbl_send2friend_namesender) {
		msg += "-" + lbl_send2friend_namesender + " \n";	
	}
	if(theForm.email.value == "") {
		msg += "-" + lbl_send2friend_email_receiver + "\n";	
	}
	if (msg != "") {
		msg = lbl_send2friend_mandatory + " : \n" + msg;
		alert(msg);
		return false;
	}
	return true;
}

function send2friend() {
	var frm = document.send2friendform;
	if (frm) {
		frm.onsubmit = function() {
			return validate_friendform(this);
		}
	}
	var lnk = document.getElementById("sendtofriend");
	if(lnk) {
		lnk.onclick = function() {
			show_popup(this.href,430,330);
			return false;
		}
	}
	var lnk2 = document.getElementById("sendtofriendlink");
	if(lnk2) {
		lnk2.onclick = function() {
			doSendToFriend();
			return false;
		}
	}
}

function doSendToFriend() {
	if (validate_friendform(this.document.send2friendform)){
		this.document.send2friendform.submit();
	}
}

function navigationLeftAbove() {
	var active_segment = "N";
	var test_horeca_active = document.getElementById("Horeca");
	if (test_horeca_active) {
		active_segment = "H";
	}
	var test_confectionery_active = document.getElementById("Confectionery");
	if (test_confectionery_active) {
		active_segment = "C";
	}
	var test_pastry_active = document.getElementById("Pastry"); 
	if (test_pastry_active) {
		active_segment = "P";
	}
	var lnk_hor = document.getElementById("linkhoreca");
	var lnk_pas = document.getElementById("linkpastry");
	var lnk_con = document.getElementById("linkconfectionery");
	if(lnk_hor && lnk_pas && lnk_con) {
		lnk_hor.onmouseover = function() {
			// confectionery is actief
			if (active_segment == "C") {
				lnk_pas.style.left = "75px";
			}
		}
		lnk_hor.onmouseout = function() {
			// confectionery is actief
			if (active_segment == "C") {
				lnk_pas.style.left = "";
			}
		}
		lnk_pas.onmouseover = function() {
			// horeca is actief
			if (active_segment == "H") {
				lnk_hor.style.left = "-20px";
			}
		}
		lnk_pas.onmouseout = function() {
			// horeca is actief
			if (active_segment == "H") {
				lnk_hor.style.left = "";
			}
		}
		lnk_con.onmouseover = function() {
			// niks is actief
			if (active_segment == "N") {
				lnk_hor.style.left = "-15px";
				lnk_pas.style.left = "46px";
			}
			// horeca is actief
			if (active_segment == "H") {
				lnk_hor.style.left = "-35px";
				lnk_pas.style.left = "46px";
			}
			// pastry is actief
			if (active_segment == "P") {
				lnk_hor.style.left = "-20px";
				lnk_pas.style.left = "10px";
			}
		}
		lnk_con.onmouseout = function() {
			// niks is actief
			if (active_segment == "N") {
				lnk_hor.style.left = "";
				lnk_pas.style.left = "";
			}
			// horeca is actief
			if (active_segment == "H") {
				lnk_hor.style.left = "";
				lnk_pas.style.left = "";
			}
			// pastry is actief
			if (active_segment == "P") {
				lnk_hor.style.left = "";
				lnk_pas.style.left = "";
			}
		}
	}
}

function academies() {
	var form1 = document.advisorsform;
	if(form1) {
		form1.onsubmit = function() {
			document.advisorsform.action = document.advisorsform.s_country.value;
			document.advisorsform.submit();
		}
	}
	var form2 = document.coursesform;
	if(form2) {
		form2.onsubmit = function() {
			document.coursesform.action = document.coursesform.s_country.value;
			document.coursesform.submit();
		}
	}
	var sel = document.getElementById("adv_country_select");
	if(sel) {
		sel.onchange = function() {
			document.advisorsform.action = document.advisorsform.s_country.value;
			document.advisorsform.submit();
		}
	}
	var lnk = document.getElementById("advisors_golink");
	if(lnk) {
		lnk.onclick = function() {
			document.advisorsform.action = document.advisorsform.s_country.value;
			document.advisorsform.submit();
			return false;
		}
	}
	var lnk2 = document.getElementById("courses_golink");
	if(lnk2) {
		lnk2.onclick = function() {
			document.coursesform.action = document.coursesform.s_country.value;
			document.coursesform.submit();
			return false;
		}
	}
	
}

function ambassadors() {
	var sel = document.getElementById("country_select");
	if(sel) {
		sel.onchange = function() {
			document.ambassadorsform.submit();
		}
	}
}

function press() {
	var sel = document.getElementById("presscountry_select");
	if(sel) {
		sel.onchange = function() {
			document.pressform.submit();
		}
	}
}

function fairs() {
	var sel = document.getElementById("fairscountry_select");
	if(sel) {
		sel.onchange = function() {
			document.fairsform.submit();
		}
	}
}

function moviescheck() {
	var form = document.wachtwoordform;
	if (form) {
		form.onsubmit = function() {
			return (validateWachtwoord(this)) ;
		}		
	}
	var form2 = document.loginform;
	if (form2) {
		form2.onsubmit = function() {
			return (validateLogin(this)) ;
		}		
	}
	var form3 = document.inscriptform;
	if (form3) {
		form3.onsubmit = function() {
			return (validateInscription(this)) ;
		}		
		form3.activity.onchange = function() {
			do_showSpecify(this.value);
		}
	}
	var lnk = document.getElementById("registermovielink");
	if(lnk) {
		lnk.onclick = function() {
			doSend();
			return false;
		}
	}
	var lnk2 = document.getElementById("loginlink");
	if(lnk2) {
		lnk2.onclick = function() {
			doLogin();
			return false;
		}
	}
	var lnk3 = document.getElementById("passwordlink");
	if(lnk3) {
		lnk3.onclick = function() {
			doPassword();
			return false;
		}
	}
}

function doPassword(){
	if (validateWachtwoord(this.document.wachtwoordform)){
		this.document.wachtwoordform.submit();
	}
}

function doLogin(){
	if (validateLogin(this.document.loginform)){
		this.document.loginform.submit();
	}
}

function doSend(){
	if (validateInscription(this.document.inscriptform)){
		this.document.inscriptform.submit();
	}
}

function validateInscription (form){
	var msg = "";
	var error = 0;
	var str = form.email.value;
	if (form.lastname.value.length == 0){
		error++;
		msg += "\n- " + lbl_film_name;
	}//if
	if (form.gender.value.length == 0){
		error++;
		msg += "\n- " + lbl_film_gender;
	}//if
	if (form.firm.value.length == 0){
		error++;
		msg += "\n- " + lbl_film_firm;
	}//if
	if (form.activity.value.length == 0){
		error++;
		msg += "\n- " + lbl_film_typefirm;
	}//if
	if (form.activity.value.length > 0 && form.activity.value == "others"){
		if (form.activity2.value.length == 0) {
			error++;
			msg += "\n- " + lbl_film_typefirm;
		}	
	}//if
	if (form.country.value.length == 0){
		error++;
		msg += "\n- " + lbl_film_country;
	}//if
	if (form.thislang.value.length == 0){
		error++;
		msg += "\n- " + lbl_film_language;
	}//if
	if(!checkemail()){
		error++;
		msg += "\n- " + lbl_film_email;
	}//if
	if (form.password.value.length == 0){
		error++;
		msg += "\n- " + lbl_film_password;
	}//if
	if(error) {
		alert(lbl_film_fillout + ": " + msg);
		return false;
	}//if
	return true ;
}

function checkemail(){
	var str=this.document.inscriptform.email.value
	var filter=/^([\w-]+(?:\.[\w-]+)*)@((?:[\w-]+\.)*\w[\w-]{0,66})\.([a-z]{2,6}(?:\.[a-z]{2})?)$/i
	if (filter.test(str)) return true; else return false;
}//checkemail



function validateLogin(theForm) {
	if(theForm.gebruikersnaam.value=="" || theForm.wachtwoord.value=="") {
		alert(lbl_film_filloutemailandpassword);
		return false;
	}
	return true;
}


function validateWachtwoord(form) {
	var msg;
	msg = "";
	if (form.email.value == ""){
		msg += "- " + lbl_film_email + "\n";
	}
	if (msg != ""){
		msg = lbl_film_fillout +" : \n" + msg;
		alert(msg);
		return false;
	}
	return true;
}



function toolscheck() {
	var form = document.toolsWachtwoordform;
	if (form) {
		form.onsubmit = function() {
			return (validateToolsWachtwoord(this)) ;
		}		
	}
	var form2 = document.toolsLoginform;
	if (form2) {
		form2.onsubmit = function() {
			return (validateToolsLogin(this)) ;
		}		
	}
	var form3 = document.toolsInscriptform;
	if (form3) {
		form3.onsubmit = function() {
			return (validateToolsInscription(this)) ;
		}		
		form3.activity.onchange = function() {
			do_showSpecify(this.value);
		}
	}
	var lnk = document.getElementById("registertoolslink");
	if(lnk) {
		lnk.onclick = function() {
			doToolsSend();
			return false;
		}
	}
	var lnk2 = document.getElementById("toolsloginlink");
	if(lnk2) {
		lnk2.onclick = function() {
			doToolsLogin();
			return false;
		}
	}
	var lnk3 = document.getElementById("toolspasswordlink");
	if(lnk3) {
		lnk3.onclick = function() {
			doToolsPassword();
			return false;
		}
	}
}

function doToolsPassword(){
	if (validateToolsWachtwoord(this.document.toolsWachtwoordform)){
		this.document.toolsWachtwoordform.submit();
	}
}

function doToolsLogin(){
	if (validateToolsLogin(this.document.toolsLoginform)){
		this.document.toolsLoginform.submit();
	}
}

function doToolsSend(){
	if (validateToolsInscription(this.document.toolsInscriptform)){
		this.document.toolsInscriptform.submit();
	}
}

function validateToolsWachtwoord(form) {
	var msg;
	msg = "";
	if (form.email.value == ""){
		msg += "- " + lbl_tools_email + "\n";
	}
	if (msg != ""){
		msg = lbl_tools_fillout +" : \n" + msg;
		alert(msg);
		return false;
	}
	return true;
}

function validateToolsLogin(theForm) {
	if(theForm.gebruikersnaam.value=="" || theForm.wachtwoord.value=="") {
		alert(lbl_tools_filloutemailandpassword);
		return false;
	}
	return true;
}

function validateToolsInscription (form){
	var msg = "";
	var error = 0;
	var str = form.email.value;
	if (form.lastname.value.length == 0){
		error++;
		msg += "\n- " + lbl_tools_name;
	}//if
	if (form.gender.value.length == 0){
		error++;
		msg += "\n- " + lbl_tools_gender;
	}//if
	if (form.firm.value.length == 0){
		error++;
		msg += "\n- " + lbl_tools_company;
	}//if
	if (form.activity.value.length == 0){
		error++;
		msg += "\n- " + lbl_tools_typefirm;
	}//if
	if (form.activity.value.length > 0 && form.activity.value == "others"){
		if (form.activity2.value.length == 0) {
			error++;
			msg += "\n- " + lbl_tools_typefirm;
		}	
	}//if
	if (form.country.value.length == 0){
		error++;
		msg += "\n- " + lbl_tools_country;
	}//if
	if (form.thislang.value.length == 0){
		error++;
		msg += "\n- " + lbl_tools_language;
	}//if
	if(!checkToolsemail()){
		error++;
		msg += "\n- " + lbl_tools_email;
	}//if
	if (form.password.value.length == 0){
		error++;
		msg += "\n- " + lbl_tools_password;
	}//if
	if (form.tel.value.length == 0){
		error++;
		msg += "\n- " + lbl_tools_tel
	}
	if(error) {
		alert(lbl_tools_fillout + ": " + msg);
		return false;
	}//if
	return true ;
}

function checkToolsemail(){
	var str=this.document.toolsInscriptform.email.value
	var filter=/^([\w-]+(?:\.[\w-]+)*)@((?:[\w-]+\.)*\w[\w-]{0,66})\.([a-z]{2,6}(?:\.[a-z]{2})?)$/i
	if (filter.test(str)) return true; else return false;
}//checkemail



function fullScreenMovie(movie) {
	var fs = window.open( "/fullscreen.dhtml?movie="+movie ,
		   "FullScreenVideo", "toolbar=no,width=640,height=370"
		 + ",status=no,resizable=yes,fullscreen=no,scrollbars=no");
	fs.focus();
}	

function doSubscribe(){
	if (validateSubscribe(this.document.subscribeform)){
		this.document.subscribeform.submit();
	}
}

function validateSubscribe (form){
	var msg = "";
	var error = 0;
	if (form.lastname.value.length == 0){
		error++;
		msg += "\n- " + lbl_subscribe_name;
	}//if
	if (form.gender.value.length == 0){
		error++;
		msg += "\n- " + lbl_subscribe_gender;
	}//if
	if (form.firm.value.length == 0){
		error++;
		msg += "\n- " + lbl_subscribe_firm;
	}//if
	if (form.activity.value.length == 0){
		error++;
		msg += "\n- " + lbl_subscribe_profession;
	}//if
	if (form.activity.value.length > 0 && form.activity.value == "others"){
		if (form.activity2.value.length == 0) {
			error++;
			msg += "\n- " + lbl_subscribe_profession;
		}	
	}//if
	if (form.country.value.length == 0){
		error++;
		msg += "\n- " + lbl_subscribe_country;
	}//if
	if (form.thislang.value.length == 0){
		error++;
		msg += "\n- " + lbl_subscribe_language;
	}//if
	if (form.email.value.length == 0){
		error++;
		msg += "\n- " + lbl_subscribe_email;
	}//if
	if(error) {
		alert(lbl_subscribe_fillout + ": " + msg);
		return false;
	}//if
	return true ;
}

function subscribecheck() {
	var lnk = document.getElementById("subscribelink");
	if(lnk) {
		lnk.onclick = function() {
			doSubscribe();
			return false;
		}
	}
	var lnk2 = document.getElementById("signoutlink");
	if(lnk2) {
		lnk2.onclick = function() {
			document.signoutform.submit();
		}
	}
	var form = document.subscribeform;
	if (form) {
		form.activity.onchange = function() {
			do_showSpecify(this.value);
		}
	}
}

function do_showSpecify(str) {
	var spec = document.getElementById("specifyactivity");
	if (spec) {
		if (str == "others") {
			spec.style.display = "block";
		}
		else {
			spec.style.display = "none";
		}
	}	
}

function show_bigimage(url) {
	theWidth = 650;
	theHeight = 400;
	theTop = (screen.height-theHeight*1.5)/2;
	theLeft = (screen.width-theWidth)/2;
	winopts = "toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=yes,resizable=yes,copyhistory=0,width="+theWidth+",height="+theHeight+",top="+theTop+",left="+theLeft;
	smallwindow=window.open(url,"Detail",winopts);
	smallwindow.focus();
}

function imagepopups() {
	var links=document.getElementsByTagName("a");
	for(i=0;i<links.length;i++) {
		if (links[i].className.indexOf("prodfoto") >= 0) {
			links[i].onclick=function() {
				show_bigimage(this.href);
				return false;
			}
		}
	}	
}

function doGoContact(language){
	this.document.theform.action = "/" + language + "/" + this.document.theform.item[this.document.theform.item.selectedIndex].value;
	this.document.theform.submit();
}

function contact() {
	var sel = document.getElementById("linkcontact");
	if(sel) {
		var taal = sel.title; 
		sel.onclick = function() {
			doGoContact(taal);
		}
	}	
	var form = document.form1;
	if (form) {
		var act = form.activity;
		if (act) {
			act.onchange = function() {
				do_showSpecify(this.value);
			}
		}	
	}
}	

function contact_country() {
	var lnk = document.getElementById("contactcountry_link");
	if(lnk) {
		lnk.onclick = function() {
			doMail();
			return false;
		}
	}
	var lnk2 = document.getElementById("contactcountry_link2");
	if(lnk2) {
		lnk2.onclick = function() {
			doMail2();
			return false;
		}
	}
}

function doMail(){
	if (checkform(this.document.form1)){
		this.document.form1.submit();
	}//if
}//doMail

function doMail2(){
	if (checkform2(this.document.form1)){
		this.document.form1.submit();
	}//if
}//doMail

function checkform (form){
	var msg = "";
	var error = 0;
	var str = form.email.value;
	
	var radio_choice = false;
	for (counter = 0; counter < form.i_have.length; counter++) {
		if (form.i_have[counter].checked)
			radio_choice = true; 
	}
	if (!radio_choice) {
		error++;
		msg += "\n- " + contactform_i_have;
	}//if
	radio_choice = false;
	for (counter = 0; counter < form.about.length; counter++) {
		if (form.about[counter].checked)
			radio_choice = true; 
	}
	if (!radio_choice) {
		error++;
		msg += "\n- " + contactform_about;
	}//if
	if (form.lastname.value.length == 0){
		error++;
		msg += "\n- " + contactform_lastname;
	}//if
	if (form.gender.value.length == 0){
		error++;
		msg += "\n- " + contactform_gender;
	}//if
	if (form.company.value.length == 0){
		error++;
		msg += "\n- " + contactform_company;
	}//if
	if (form.activity.value.length == 0){
		error++;
		msg += "\n- " + contactform_activity;
	}//if
	if (form.activity.value.length > 0 && form.activity.value == "others"){
		if (form.activity2.value.length == 0) {
			error++;
			msg += "\n- " + contactform_activity;
		}	
	}//if
	if (form.country.value.length == 0){
		error++;
		msg += "\n- " + contactform_country;
	}//if
	if (form.thislang.value.length == 0){
		error++;
		msg += "\n- " + contactform_language;
	}//if
	
	if(!checkemail2()){
		error++;
		msg += "\n- " + contactform_email;
	}//if
	if (form.tel.value.length == 0){
		error++;
		msg += "\n- " + contactform_telephone;
	}//if
	
	if(error) {
		alert(contactrequest_please_fill_out + " : " + msg);
		return false;
	}//if
	return true ;
}//checkform


function checkform2 (form){
	var msg = "";
	var error = 0;
	var str = form.email.value;
	
	if (form.lastname.value.length == 0){
		error++;
		msg += "\n- " + contactform_lastname;
	}//if
	if (form.gender.value.length == 0){
		error++;
		msg += "\n- " + contactform_gender;
	}//if
	if (form.company.value.length == 0){
		error++;
		msg += "\n- " + contactform_company;
	}//if
	if (form.activity.value.length == 0){
		error++;
		msg += "\n- " + contactform_activity;
	}//if
	if (form.activity.value.length > 0 && form.activity.value == "others"){
		if (form.activity2.value.length == 0) {
			error++;
			msg += "\n- " + contactform_activity;
		}	
	}//if
	if (form.country.value.length == 0){
		error++;
		msg += "\n- " + contactform_country;
	}//if
	if (form.thislang.value.length == 0){
		error++;
		msg += "\n- " + contactform_language;
	}//if
	
	if(!checkemail2()){
		error++;
		msg += "\n- " + contactform_email;
	}//if
	if (form.tel.value.length == 0){
		error++;
		msg += "\n- " + contactform_telephone;
	}//if
	
	if(error) {
		alert(contactrequest_please_fill_out + " : " + msg);
		return false;
	}//if
	return true ;
}//checkform

function checkemail2(){
	var str=this.document.form1.email.value
	var filter=/^([\w-]+(?:\.[\w-]+)*)@((?:[\w-]+\.)*\w[\w-]{0,66})\.([a-z]{2,6}(?:\.[a-z]{2})?)$/i
	if (filter.test(str)) return true; else return false;
}//checkemail

function dorightnav() {
	if (document.getElementById("rightNavigation")) {
		var check_segment = document.getElementById("rightNavigation").className;
	}	
	var lnk = document.getElementById("linkacademie");
	if(lnk) {
		lnk.onclick = function() {
			if (document.getElementById("academy").style.display == "block") {
				document.getElementById("academy").style.display = "none";
				if (check_segment != "segment") {
					document.cookie ='service_academie=N; path=/';
				}
				else {
					document.cookie ='service_academie_seg=N; path=/';
				}
			}
			else {
				document.getElementById("academy").style.display = "block";
				if (check_segment != "segment") {
					document.cookie ='service_academie=Y; path=/';
				}
				else {
					document.cookie ='service_academie_seg=Y; path=/';
				}
			}
			var actief = "N";
			if (this.className == "active") {
				this.className = "activeclosed";
				actief = "Y";
			}
			if (this.className == "activeclosed") {
				this.className = "active";
				actief = "Y";
			}
			if (actief == "N") {
				if (this.parentNode.className == "open" ) {
					this.parentNode.className = "";
				}
				else {
					this.parentNode.className = "open";
				}
			}	
			return false;
		}
	}
	var lnk2 = document.getElementById("linkambassadors");
	if(lnk2) {
		lnk2.onclick = function() {
			if (document.getElementById("ambassadorsnav").style.display == "block") {
				document.getElementById("ambassadorsnav").style.display = "none";
				if (check_segment != "segment") {
					document.cookie ='service_ambassadors=N; path=/';
				}
				else {
					document.cookie ='service_ambassadors_seg=N; path=/';
				}
				
			}
			else {
				document.getElementById("ambassadorsnav").style.display = "block";
				if (check_segment != "segment") {
					document.cookie ='service_ambassadors=Y; path=/';
				}
				else {
					document.cookie ='service_ambassadors_seg=Y; path=/';
				}
			}
			var actief = "N";
			if (this.className == "active") {
				this.className = "activeclosed";
				actief = "Y";
			}
			if (this.className == "activeclosed") {
				this.className = "active";
				actief = "Y";
			}
			if (actief == "N") {
				if (this.parentNode.className == "open" ) {
					this.parentNode.className = "";
				}
				else {
					this.parentNode.className = "open";
				}
			}	
			return false;
		}
	}
	var lnk3 = document.getElementById("linkcompetition");
	if(lnk3) {
		lnk3.onclick = function() {
			if (document.getElementById("competition").style.display == "block") {
				document.getElementById("competition").style.display = "none";
				if (check_segment != "segment") {
					document.cookie ='service_competition=N; path=/';
				}
				else {
					document.cookie ='service_competition_seg=N; path=/';
				}
				
			}
			else {
				document.getElementById("competition").style.display = "block";
				if (check_segment != "segment") {
					document.cookie ='service_competition=Y; path=/';
				}
				else {
					document.cookie ='service_competition_seg=Y; path=/';
				}
			}
			var actief = "N";
			if (this.className == "active") {
				this.className = "activeclosed";
				actief = "Y";
			}
			if (this.className == "activeclosed") {
				this.className = "active";
				actief = "Y";
			}
			if (actief == "N") {
				if (this.parentNode.className == "open" ) {
					this.parentNode.className = "";
				}
				else {
					this.parentNode.className = "open";
				}
			}	
			return false;
		}
	}
	var lnk4 = document.getElementById("linkfairs");
	if(lnk4) {
		lnk4.onclick = function() {
			if (document.getElementById("fairs").style.display == "block") {
				document.getElementById("fairs").style.display = "none";
				if (check_segment != "segment") {
					document.cookie ='service_fairs=N; path=/';
				}
				else {
					document.cookie ='service_fairs_seg=N; path=/';
				}
				
			}
			else {
				document.getElementById("fairs").style.display = "block";
				if (check_segment != "segment") {
					document.cookie ='service_fairs=Y; path=/';
				}
				else {
					document.cookie ='service_fairs_seg=Y; path=/';
				}
			}
			var actief = "N";
			if (this.className == "active") {
				this.className = "activeclosed";
				actief = "Y";
			}
			if (this.className == "activeclosed") {
				this.className = "active";
				actief = "Y";
			}
			if (actief == "N") {
				if (this.parentNode.className == "open" ) {
					this.parentNode.className = "";
				}
				else {
					this.parentNode.className = "open";
				}
			}	
			return false;
		}
	}
	var lnk5 = document.getElementById("linkdownloads");
	if(lnk5) {
		lnk5.onclick = function() {
			if (document.getElementById("downloadsnav").style.display == "block") {
				document.getElementById("downloadsnav").style.display = "none";
				if (check_segment != "segment") {
					document.cookie ='service_downloads=N; path=/';
				}
				else {
					document.cookie ='service_downloads_seg=N; path=/';
				}
				
			}
			else {
				document.getElementById("downloadsnav").style.display = "block";
				if (check_segment != "segment") {
					document.cookie ='service_downloads=Y; path=/';
				}
				else {
					document.cookie ='service_downloads_seg=Y; path=/';
				}
			}
			var actief = "N";
			if (this.className == "active") {
				this.className = "activeclosed";
				actief = "Y";
			}
			if (this.className == "activeclosed") {
				this.className = "active";
				actief = "Y";
			}
			if (actief == "N") {
				if (this.parentNode.className == "open" ) {
					this.parentNode.className = "";
				}
				else {
					this.parentNode.className = "open";
				}
			}	
			return false;
		}
	}
	var lnk6 = document.getElementById("linktechniques");
	if(lnk6) {
		lnk6.onclick = function() {
			if (document.getElementById("techniquesnav").style.display == "block") {
				document.getElementById("techniquesnav").style.display = "none";
				if (check_segment != "segment") {
					document.cookie ='service_techniques=N; path=/';
				}
				else {
					document.cookie ='service_techniques_seg=N; path=/';
				}				
			}
			else {
				document.getElementById("techniquesnav").style.display = "block";
				if (check_segment != "segment") {
					document.cookie ='service_techniques=Y; path=/';
				}
				else {
					document.cookie ='service_techniques_seg=Y; path=/';
				}
			}
			var actief = "N";
			if (this.className == "active") {
				this.className = "activeclosed";
				actief = "Y";
			}
			if (this.className == "activeclosed") {
				this.className = "active";
				actief = "Y";
			}
			if (actief == "N") {
				if (this.parentNode.className == "open" ) {
					this.parentNode.className = "";
				}
				else {
					this.parentNode.className = "open";
				}
			}	
			return false;
		}
	}
	var lnk7 = document.getElementById("linkdemos");
	if(lnk7) {
		lnk7.onclick = function() {
			if (document.getElementById("demosnav").style.display == "block") {
				document.getElementById("demosnav").style.display = "none";
				if (check_segment != "segment") {
					document.cookie ='service_demos=N; path=/';
				}
				else {
					document.cookie ='service_demos_seg=N; path=/';
				}
				
			}
			else {
				document.getElementById("demosnav").style.display = "block";
				if (check_segment != "segment") {
					document.cookie ='service_demos=Y; path=/';
				}
				else {
					document.cookie ='service_demos_seg=Y; path=/';
				}
			}
			var actief = "N";
			if (this.className == "active") {
				this.className = "activeclosed";
				actief = "Y";
			}
			if (this.className == "activeclosed") {
				this.className = "active";
				actief = "Y";
			}
			if (actief == "N") {
				if (this.parentNode.className == "open" ) {
					this.parentNode.className = "";
				}
				else {
					this.parentNode.className = "open";
				}
			}	
			return false;
		}
	}
	var lnk8 = document.getElementById("linkpress");
	if(lnk8) {
		lnk8.onclick = function() {
			if (document.getElementById("press").style.display == "block") {
				document.getElementById("press").style.display = "none";
				if (check_segment != "segment") {
					document.cookie ='service_press=N; path=/';
				}
				else {
					document.cookie ='service_press_seg=N; path=/';
				}
				
			}
			else {
				document.getElementById("press").style.display = "block";
				if (check_segment != "segment") {
					document.cookie ='service_press=Y; path=/';
				}
				else {
					document.cookie ='service_press_seg=Y; path=/';
				}
			}
			var actief = "N";
			if (this.className == "active") {
				this.className = "activeclosed";
				actief = "Y";
			}
			if (this.className == "activeclosed") {
				this.className = "active";
				actief = "Y";
			}
			if (actief == "N") {
				if (this.parentNode.className == "open" ) {
					this.parentNode.className = "";
				}
				else {
					this.parentNode.className = "open";
				}
			}	
			return false;
		}
	}
	var lnk9 = document.getElementById("linkchocophilia");
	if(lnk9) {
		lnk9.onclick = function() {
			if (document.getElementById("chocophilia").style.display == "block") {
				document.getElementById("chocophilia").style.display = "none";
				if (check_segment != "segment") {
					document.cookie ='service_chocophilia=N; path=/';
				}
				else {
					document.cookie ='service_chocophilia_seg=N; path=/';
				}
				
			}
			else {
				document.getElementById("chocophilia").style.display = "block";
				if (check_segment != "segment") {
					document.cookie ='service_chocophilia=Y; path=/';
				}
				else {
					document.cookie ='service_chocophilia_seg=Y; path=/';
				}
			}
			var actief = "N";
			if (this.className == "active") {
				this.className = "activeclosed";
				actief = "Y";
			}
			if (this.className == "activeclosed") {
				this.className = "active";
				actief = "Y";
			}
			if (actief == "N") {
				if (this.parentNode.className == "open" ) {
					this.parentNode.className = "";
				}
				else {
					this.parentNode.className = "open";
				}
			}	
			return false;
		}
	}
	var lnk10 = document.getElementById("linktools");
	if(lnk10) {
		lnk10.onclick = function() {
			if (document.getElementById("toolsnav").style.display == "block") {
				document.getElementById("toolsnav").style.display = "none";
				if (check_segment != "segment") {
					document.cookie ='service_instore_tools=N; path=/';
				}
				else {
					document.cookie ='service_instore_tools_seg=N; path=/';
				}
				
			}
			else {
				document.getElementById("toolsnav").style.display = "block";
				if (check_segment != "segment") {
					document.cookie ='service_instore_tools=Y; path=/';
				}
				else {
					document.cookie ='service_instore_tools_seg=Y; path=/';
				}
			}
			var actief = "N";
			if (this.className == "active") {
				this.className = "activeclosed";
				actief = "Y";
			}
			if (this.className == "activeclosed") {
				this.className = "active";
				actief = "Y";
			}
			if (actief == "N") {
				if (this.parentNode.className == "open" ) {
					this.parentNode.className = "";
				}
				else {
					this.parentNode.className = "open";
				}
			}	
			return false;
		}
	}
	var lnk11 = document.getElementById("linktv");
	if(lnk11) {
		lnk11.onclick = function() {
			if (document.getElementById("tvnav").style.display == "block") {
				document.getElementById("tvnav").style.display = "none";
				if (check_segment != "segment") {
					document.cookie ='service_tv=N; path=/';
				}
				else {
					document.cookie ='service_tv_seg=N; path=/';
				}
				
			}
			else {
				document.getElementById("tvnav").style.display = "block";
				if (check_segment != "segment") {
					document.cookie ='service_tv=Y; path=/';
				}
				else {
					document.cookie ='service_tv_seg=Y; path=/';
				}
			}
			var actief = "N";
			if (this.className == "active") {
				this.className = "activeclosed";
				actief = "Y";
			}
			if (this.className == "activeclosed") {
				this.className = "active";
				actief = "Y";
			}
			if (actief == "N") {
				if (this.parentNode.className == "open" ) {
					this.parentNode.className = "";
				}
				else {
					this.parentNode.className = "open";
				}
			}	
			return false;
		}
	}
}
var spiderCount = 0;

function doSpiderMap(id) {
	var spider = document.getElementById(id);
	var img = document.getElementById(id + "Arrow");
	var cl = spider.className;
	var inactive = cl.indexOf("inactive");
	if(inactive > -1) {
		cl = cl.replace(/inactive/, "active");
		img.src = "/images/bt_productarrow_active.gif";
		spiderCount++;
	}else {
		cl = cl.replace(/active/, "inactive");
		img.src = "/images/bt_productarrow.gif";
		spiderCount--;
	}
	spider.className = cl;
	checkSpiderCount();
}

function checkSpiderCount() {
	if(spiderCount < spiders.length) {
		var link = document.getElementById("doSpiderLinks");
		link.onclick = function() {showAllSpiders()};
		link.innerHTML = lbl_products_showAllExtra;
	}else {
		var link = document.getElementById("doSpiderLinks");
		link.onclick = function(){ hideAllSpiders() };
		link.innerHTML = lbl_products_hideAllExtra;
	}
}

function showAllSpiders() {
	var i = 0;
	for(i = 0; i < spiders.length; i++) {
		var id = spiders[i];
		var spider = document.getElementById(id);
		var cl = spider.className;
		var inactive = cl.indexOf("inactive");
		if(inactive > -1) {
			var img = document.getElementById(id + "Arrow");
			cl = cl.replace(/inactive/, "active");
			img.src = "/images/bt_productarrow_active.gif";
			spider.className = cl;
		}
	}
	spiderCount = spiders.length;
	var link = document.getElementById("doSpiderLinks");
	link.onclick = function(){ hideAllSpiders() };
	link.innerHTML = lbl_products_hideAllExtra;
}

function hideAllSpiders() {
	var i = 0;
	for(i = 0; i < spiders.length; i++) {
		var id = spiders[i];
		var spider = document.getElementById(id);
		var cl = spider.className;
		var inactive = cl.indexOf("inactive");
		if(inactive <= -1) {
			var img = document.getElementById(id + "Arrow");
			cl = cl.replace(/active/, "inactive");
			img.src = "/images/bt_productarrow.gif";
			spider.className = cl;
		}
	}
	spiderCount = 0;
	var link = document.getElementById("doSpiderLinks");
	link.onclick = function() {showAllSpiders()};
	link.innerHTML = lbl_products_showAllExtra;
}



var slideShowSpeed = 6000;
var t;
var j = 0;
function runSlideShow(){
	document.getElementById("banner").style.background = "url(" + preLoad[j].src + ")"
	document.getElementById("leftbannerlink").href = ImageLink[j];
	if (ImageLink[j] == "") {
		document.getElementById("banner").onclick = function() {
			//return false;
		}
		document.getElementById("banner").style.cursor = "";
	}
	else {
		document.getElementById("banner").onclick = function() {
			var lnk = document.getElementById("leftbannerlink").href;
			if (lnk != "") {
				window.location.href= lnk;
			}
		}	
		document.getElementById("banner").style.cursor = "pointer";
	}	
	document.getElementById("bannertitel").innerHTML = Titles[j];
	document.getElementById("bannerotitel").innerHTML = TitlesO[j];
	document.getElementById("bannersubtitel").innerHTML = Subtitles[j];
	j = j + 1;
	if (j > (p-1)) j=0
		t = setTimeout('runSlideShow()', slideShowSpeed)
}


function doslider() {
	if (document.getElementById("bannertitel")) {
		clearTimeout(t);
		runSlideShow();
	}	
}


function stages() {
	var form = document.registerform;
	if (form) {
		form.onsubmit = function() {
			return (checkregister(this)) ;
		}	
		form.activity.onchange = function() {
			do_showSpecify(this.value);
		}
	}
	var lnk = document.getElementById("registerlink");
	if(lnk) {
		lnk.onclick = function() {
			if (checkregister(document.registerform)){
				document.registerform.submit();
			}//if
			return false;
		}
	}
}

function checkregister (form){
		var msg = "";
		var error = 0;
		var str = form.email.value;
		if (form.firstname.value.length == 0){
			error++;
			msg += "\n- " + lbl_stage_prenom;
		}//if
		if (form.lastname.value.length == 0){
			error++;
			msg += "\n- " + lbl_stage_nom_famille;
		}//if
		if (form.gender.value.length == 0){
			error++;
			msg += "\n- " + lbl_stage_sexe;
		}//if
		if (form.company.value.length == 0){
			error++;
			msg += "\n- " + lbl_stage_societe;
		}//if
		if (form.activity.value.length == 0){
			error++;
			msg += "\n- " + lbl_stage_activity;
		}//if
		if (form.activity.value.length > 0 && form.activity.value == "others"){
			if (form.activity2.value.length == 0) {
				error++;
				msg += "\n- " + lbl_stage_activity;
			}	
		}//if
		if (form.country.value.length == 0){
			error++;
			msg += "\n- " + lbl_stage_pays;
		}//if
		if (form.languages.value.length == 0){
			error++;
			msg += "\n- " + lbl_stage_language;
		}//if
		if(!checkemail3(str)){
			error++;
			msg += "\n- " + lbl_stage_email;
		}//if
		if (form.tel.value.length == 0){
			error++;
			msg += "\n- " + lbl_stage_tel;
		}//if
		
		if (form.nationality.value.length == 0){
			error++;
			msg += "\n- " + lbl_stage_nationalite;
		}//if
		if (form.vat.value.length == 0){
			error++;
			msg += "\n- " + lbl_stage_tva;
		}//if
		
		if(error) {
			alert(lbl_stage_form_fillout + ": " + msg);
			return false;
		}//if
		return true ;
	}

function checkemail3(str){
	var filter=/^([\w-]+(?:\.[\w-]+)*)@((?:[\w-]+\.)*\w[\w-]{0,66})\.([a-z]{2,6}(?:\.[a-z]{2})?)$/i
	if (filter.test(str)) return true; else return false;
}//checkemail

function validate_rating(theForm) {
	var msg = ""
	if(theForm.my_email.value == "") {
		msg += "-" + lbl_recipe_email + " \n";	
	}
	if (msg != "") {
		msg = lbl_recipe_mandatory + " : \n" + msg;
		alert(msg);
		return false;
	}
	theForm.x.value = "abc123";
	return true;
}

function doRating() {
	if (validate_rating(document.rateform)) {
		document.rateform.submit();
		return false;
	}	
}

function rating() {
	var frm = document.rateform;
	if (frm) {
		frm.onsubmit = function() {
			return validate_rating(this);
		}
	}
}

addLoadEvent(rating);
addLoadEvent(stages);
addLoadEvent(academies);
addLoadEvent(doslider);
addLoadEvent(fairs);
addLoadEvent(press);
addLoadEvent(navigationLeftAbove);
addLoadEvent(dorightnav);
addLoadEvent(contact);
addLoadEvent(contact_country);
addLoadEvent(imagepopups);
addLoadEvent(subscribecheck);
addLoadEvent(moviescheck);
addLoadEvent(toolscheck);
addLoadEvent(ambassadors);
addLoadEvent(send2friend);
addLoadEvent(applicationtable_popups);
addLoadEvent(search);
addLoadEvent(menu);