function submitForm(Form){
  document.getElementById(Form).submit();
}
//affiche/cache les un element avec son id
function ShowHideElement(element){
	//alert(document.getElementById(CampaignName).style.display);
	if(document.getElementById(element).style.display == ""){
		document.getElementById(element).style.display = 'none';
	}else{
		document.getElementById(element).style.display = '';
	}
}

function sub_book(value){
	if(value=="yes"){
		document.getElementById('sub_book_hotel').disabled = false;
		document.getElementById('sub_book_hotel').style.visibility="visible";
	}else{
		document.getElementById('sub_book_hotel').disabled = true;
		document.getElementById('sub_book_hotel').style.visibility="hidden";
	}
}

function sub_dietary(value){
	if(value=="yes"){
	
    	document.getElementById('sub_dietary').disabled = false; 
			document.getElementById('sub_dietary').style.visibility="visible";
	}else{
			document.getElementById('sub_dietary').disabled = true; 
			document.getElementById('sub_dietary').style.visibility="hidden";
	}
}

var bgColor = "#59BEE8";
var bgColor2 = "#FFFFFF";
var myElementActive=null;
function Sub_Menu(value,myElement){

	if(myElementActive!=null){
		myElementActive.style.backgroundColor = "#FFFFFF";
		myElementActive.style.color = '#707c6f';
	}
	//alert(value);
	if(value=='niv2_6'){
		for (i = 1; i < 8; i++){
			document.getElementById('niv1_'+i).style.backgroundColor = "#FFFFFF";
			document.getElementById('niv1_'+i).style.color = '#707c6f';
		}
	}
	
	for (i = 0; i < 8; i++){
			if(i!=5){
			document.getElementById('niv2_'+i).visibility='hidden';
			document.getElementById('niv2_'+i).style.display='none';
			}
	}
	
	document.getElementById(value).style.visibility='visible';
	document.getElementById(value).style.display='block';
	
	myElement.style.backgroundColor = bgColor;
	myElement.style.color = bgColor2;
	myElementActive=myElement;

}
function AlertMessage(value){
	alert(value);
	
}

function MM_openBrWindow(theURL,winName,features) { //v2.0
  window.open(theURL,winName,features);
}

function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function setParticipationFeeOld(){
	if(document.forms["registrationForm"].elements["frm_present_abs"][0].checked){
			document.forms["registrationForm"].elements["frm_part_fee"].value = "no invoice";
	}else{
		if(document.forms["registrationForm"].elements["frm_ismember"][0].checked){
			document.forms["registrationForm"].elements["frm_part_fee"].value = "Member : 195 euros";
		}else{
			document.forms["registrationForm"].elements["frm_part_fee"].value = "Non-member : 245 euros";
		}
	}
	//alert(document.forms["registrationForm"].elements["frm_part_fee"].value);	
		
}
function setParticipationFee(){
	if(document.forms["registrationForm"].elements["frm_present_abs"][0].checked){
			document.forms["registrationForm"].elements["frm_part_fee"].value = "no invoice";
	}else{
		
	  if(document.forms["registrationForm"].elements["specialCode"].value!=1505){//check if code ok
		//si pas ok
		if(document.forms["registrationForm"].elements["frm_ismember"][0].checked){
			document.forms["registrationForm"].elements["frm_part_fee"].value = "Member : 195 euros";
		}else{
			document.forms["registrationForm"].elements["frm_part_fee"].value = "Non-member : 245 euros";
		}
	  }else{//donc code ok
		//select student  teacherOrWKO  memberOfaPartner
		tmpIwillAttend=testerRadio(document.forms["registrationForm"].iWillAttend);
		switch (testerRadio(document.forms["registrationForm"].iam)) 
			{ 
			case 'student': 
				//check if a ou b
				if((tmpIwillAttend)==50){
						tmpValue=50;
					}else if((tmpIwillAttend)==25){
						tmpValue=25;
					}else{
						tmpValue="";
					}
				break;
			case 'teacherOrWKO': 
				//check if a ou b; 
				if((tmpIwillAttend)==70){
						tmpValue=70;
					}else if((tmpIwillAttend)==140){
						tmpValue=140;
					}else{
						tmpValue="";
					}
				break;
			case 'memberOfaPartner': 
				//check if a ou b
				if((tmpIwillAttend)==130){
						tmpValue=130;
					}else if((tmpIwillAttend)==200){
						tmpValue=200;
					}else{
						tmpValue="";
					}
				break;
			//default: alert('autre ' + document.forms["registrationForm"].iam.option[document.forms["registrationForm"].iam.selectedIndex].value);
			break;
			}//de switch
if(tmpValue!=""){
document.forms["registrationForm"].elements["frm_part_fee"].value = "Non-member : "+tmpValue+" euros";}
else{
	document.forms["registrationForm"].elements["frm_part_fee"].value = "";
	}
	 }//de code ok ?
	}
	//alert(document.forms["registrationForm"].elements["frm_part_fee"].value);	
		
}
function validateRegistrationForm(){
	if(document.forms["registrationForm"].elements["frm_part_fee"].value!="") {
		return true;
	}else{
		alert("Please complete your Registration category");	
		return false;
	}
}

function testerRadio(radio) {
      for (var i=0; i<radio.length;i++) {
         if (radio[i].checked) {
            return radio[i].value;
         }
      }
   }


function checkSpecialCode(myCode){
	if(myCode==1505){
		document.getElementById('tr_special_code').style.display='';
		}else{
		document.getElementById('tr_special_code').style.display='none';
		}
	
	}