var url = "include/ajax_p.php?"; 
var url_atoll = "include/ajax_atoll.php?"; 
/*var Weeks_label="Weeks";
var Select_Accommodation="Select an accommodation";
var Select_Course="Courses"
var Select_Room="Select a room type";
var Select_Arrival="Select an arrival date";
var Select_Week="Select a duration";
var Select_Departure="Select a departure date";*/

function LTrim( value ) {
	
	var re = /\s*((\S+\s*)*)/;
	return value.replace(re, "$1");
	
}

// Removes ending whitespaces
function RTrim( value ) {
	
	var re = /((\s*\S+)*)\s*/;
	return value.replace(re, "$1");
	
}

// Removes leading and ending whitespaces
function trim( value ) {
	
	return LTrim(RTrim(value));
	
}

function printpage() {
window.print();  
}
function check_course()
{
	var  course_msg=document.getElementById("course_hint").innerHTML;
	//alert (course_msg);
	if (trim(course_msg)=="true")	
	{
	document.getElementById("course_hint").style.display ="none";
	return true;
	}	
	else
	{
	document.getElementById("course_hint").style.display ="block";				
	return false;
	}
}

function requestCustomInfo(div_id,func) 
{    
	var cb=0;
	var obj;
	var s_lang= document.getElementById("lang").value
	var index_course = document.register.course.selectedIndex; // get the select course
	var s_course 	 = document.register.course[index_course].value; // get the select course				
	var index_level  = document.register.level.selectedIndex; // get the select level
	var s_level 	 = document.register.level[index_level].value ; // get the select level		
	var index_accomm_level = document.register.accomm_level.selectedIndex ; // get the selected accommodtion
	var s_accomm_level     = document.register.accomm_level[index_accomm_level].value; // get the selected accommodtion
//alert (s_course+" "+s_level+" "+func) ;
if ((s_course==0) || (s_level==0))
{
		document.getElementById("room_div").innerHTML ='<label> <select name="accomm_reg" id="accomm_reg" disabled="disabled" class="widthselect" ><option value="29">'+Select_Room+'</option></select> <input type="hidden" value="29" name="accomm_reg1" ></label>';	
	
	document.getElementById("arrival_div").innerHTML ='<label><select name="Arrival_Date" id="Arrival_Date" disabled="disabled" class="widthselect" ><option>'+Select_Arrival+'</option></select></label>';			
			
	document.getElementById("departure_div").innerHTML ='<label><select name="Departure_Date" id="Departure_Date" disabled="disabled" class="widthselect" ><option>'+Select_Departure+'</option></select></label>';
		
	document.getElementById("week_div").innerHTML ='<label><select name="weeks" id="weeks" disabled="disabled"  class="widthselect" ><option>'+Select_Week+'</option></select></label>';
	}

	if ((s_course!=0) && (s_level!=0) && (func=="hint1")  )
	{	
	document.getElementById("accomm_level").disabled=true; 
	document.register.accomm_level.selectedIndex=0; 
	var variables_str="course="+s_course ;
	variables_str+="&func=check_course"; 
	variables_str+="&level="+s_level; 
	variables_str+="&lang="+s_lang;
	document.getElementById("room_div").innerHTML ='<label> <select name="accomm_reg" id="accomm_reg" disabled="disabled" class="widthselect" ><option value="29">'+Select_Room+'</option></select> <input type="hidden" value="29" name="accomm_reg1" ></label>';	
	
	document.getElementById("arrival_div").innerHTML ='<label><select name="Arrival_Date" id="Arrival_Date" disabled="disabled" class="widthselect" ><option>'+Select_Arrival+'</option></select></label>';			
			
	document.getElementById("departure_div").innerHTML ='<label><select name="Departure_Date" id="Departure_Date" disabled="disabled" class="widthselect" ><option>'+Select_Departure+'</option></select></label>';
		
	document.getElementById("week_div").innerHTML ='<label><select name="weeks" id="weeks" disabled="disabled"  class="widthselect" ><option>'+Select_Week+'</option></select></label>';
//alert(func);
executeajax (url,variables_str,"course_hint");
	// added by mahmoud  // this code to fix problem with firefox
	/*if(navigator.userAgent.indexOf('Firefox') != -1)
	{
		alert('There are a lot of options to select from');
		}*/
		
}

// added by mahmoud // this condition is to fix a problem in firefox
if(navigator.userAgent.indexOf('Firefox') != -1)
	{
		setTimeout ("fixx('"+div_id+"','"+func+"')",1000);
	}
	else
	{
		if ((s_course!=0) &&  (s_level!=0) && (check_course()) )
		{
		var d = new Date(); // TO AVOID PAGE CASHING
		dtime=d.getTime();	
		var s_accomm=0;
		var s_Arrival_Date =0;	
		var s_Departure_Date =0;
		var s_week =0;
			if ( ((s_accomm_level == 6)||(s_accomm_level == 9) ) && (func=="room"))
			{ 
			func="arrival";
			div_id="arrival_div";
			document.getElementById("room_div").innerHTML ='<label> <select name="accomm_reg" id="accomm_reg" disabled="disabled" class="widthselect" ><option value="29">'+Select_Room+'</option></select> <input type="hidden" value="29" name="accomm_reg1" ></label>';
			}
		
			///add accommodation id as static id for no accommodation
	
			switch (func)
			{	
			case "hint1":
		/*document.getElementById("accomm_level").disabled=true 
		document.register.accomm_level.selectedIndex=0; 
		var variables_str="course="+s_course ;*/
	document.getElementById("room_div").innerHTML ='<label><select name="accomm_reg" id="accomm_reg" disabled="disabled" class="widthselect" ><option value="29">'+Select_Room+'</option></select> <input type="hidden" value="29" name="accomm_reg1" ></label>';	
	
	document.getElementById("arrival_div").innerHTML ='<label><select name="Arrival_Date" id="Arrival_Date" disabled="disabled" class="widthselect" ><option>'+Select_Arrival+'</option></select></label>';			
			
	document.getElementById("departure_div").innerHTML ='<label><select name="Departure_Date" id="Departure_Date" disabled="disabled" class="widthselect" ><option>'+Select_Departure+'</option></select></label>';
		
	document.getElementById("week_div").innerHTML ='<label><select name="weeks" id="weeks" disabled="disabled"  class="widthselect" ><option>'+Select_Week+'</option></select></label>';
	
	/*alert (func+" "+div_id+" "+s_accomm_level);	*/
	//s_accomm_level=0;
			break;
			case "room":
			 var index_Arrival_Date = document.register.Arrival_Date.selectedIndex ;// get the selected Arrival_Date
			s_Arrival_Date  	 = document.register.Arrival_Date[index_Arrival_Date].value;// get the selected Arrival_Date
			document.getElementById("arrival_div").innerHTML ='<label><select name="Arrival_Date" id="Arrival_Date" disabled="disabled" class="widthselect" ><option>'+Select_Arrival+'</option></select></label>';
			
			
			document.getElementById("departure_div").innerHTML ='<label><select name="Departure_Date" id="Departure_Date" disabled="disabled" class="widthselect" ><option>'+Select_Departure+'</option></select></label>';
		
			 document.getElementById("week_div").innerHTML ='<label><select name="weeks" id="weeks" disabled="disabled"  class="widthselect" ><option>'+Select_Week+'</option></select></label>';
			 break;
			
			case "arrival":
			var index_reg = document.register.accomm_reg.selectedIndex ; // get the selected accommodtion
			s_accomm   	  = document.register.accomm_reg[index_reg].value; // get the selected accommodtion
			//alert (s_accomm);
			//document.getElementById("arrival_div").innerHTML ='<label><select name="Arrival_Date" id="Arrival_Date" disabled="disabled" class="widthselect" ><option>Date d&rsquo;arriv&eacute;e ?</option></select></label>';
			
			document.getElementById("week_div").innerHTML ='<label><select name="weeks" id="weeks" disabled="disabled"  class="widthselect" ><option>'+Select_Week+'</option></select></label>';
			document.getElementById("departure_div").innerHTML ='<label><select name="Departure_Date" id="Departure_Date" disabled="disabled" class="widthselect" ><option>'+Select_Departure+'</option></select></label>';		
			break;	
			
			case "week":
			var index_reg = document.register.accomm_reg.selectedIndex ; // get the selected accommodtion
			s_accomm   	  = document.register.accomm_reg[index_reg].value;
		  var index_Arrival_Date = document.register.Arrival_Date.selectedIndex ;// get the selected Arrival_Date
		  s_Arrival_Date  	 = document.register.Arrival_Date[index_Arrival_Date].value;// get the selected Arrival_Date
		  document.getElementById("departure_div").innerHTML ='<label><select name="Departure_Date" id="Departure_Date" disabled="disabled" class="widthselect" ><option>'+Select_Departure+'</option></select></label>';
		  break;
			  
			case "departure":
			var index_reg = document.register.accomm_reg.selectedIndex ; // get the selected accommodtion
			s_accomm   	  = document.register.accomm_reg[index_reg].value;
			 var index_Arrival_Date = document.register.Arrival_Date.selectedIndex ;// get the selected Arrival_Date
				 s_Arrival_Date  	= document.register.Arrival_Date[index_Arrival_Date].value;// get the selected Arrival_Date
				
				  var index_Departure_Date 	= document.register.Departure_Date.selectedIndex ;// get the selected Departure_Date
				s_Departure_Date  	= document.register.Departure_Date[index_Departure_Date].value;// get the selected Departure_Date
		
		//alert (document.getElementById("weeks").type)
				if (document.getElementById("weeks").type=="select-one")
				{var index_week 	= document.register.weeks.selectedIndex ;// get the selected Departure_Date
				s_week  	= document.register.weeks[index_week].value;// get the selected Departure_Date	
				}
				else if (document.getElementById("weeks").type=="hidden")
				{
				s_week=document.getElementById("weeks").value;
				}
			  break;
		
			default:
			 
		document.getElementById("arrival_div").innerHTML ='<label><select name="Arrival_Date" id="Arrival_Date" disabled="disabled" class="widthselect" ><option>'+Select_Arrival+'</option></select></label>';
		
		document.getElementById("room_div").innerHTML ='<label><select name="accomm_reg" id="accomm_reg" disabled="disabled" class="widthselect" ><option>'+Select_Room+'</option></select></label>';
						
		document.getElementById("week_div").innerHTML ='<label><select name="weeks" id="weeks" disabled="disabled"  class="widthselect" ><option>'+Select_Week+'</option></select></label>';
			
		document.getElementById("departure_div").innerHTML ='<label><select name="Departure_Date" id="Departure_Date" disabled="disabled" class="widthselect" ><option>'+Select_Departure+'</option></select></label>';
			
			}
		
			/*if (func=="week")
			{
			
				if  (s_Arrival_Date !=0)
				{
				}
				else
				{
				  //disabled weeks selected 
				return;
				}	
			}
			else
			{document.getElementById("weeks").disabled=true;}  */
	
				
			variables_str="course="+s_course ;
			variables_str+="&lang="+s_lang;	
			variables_str+="&level="+s_level;
			variables_str+="&accomm_level="+s_accomm_level+"&accomm="+s_accomm;
			variables_str+="&arrival="+s_Arrival_Date+"&week="+s_week+"&departure="+s_Departure_Date;
				variables_str+="&func="+func+"&"+dtime;
			//alert(variables_str);
				/// execute ajax code 
				executeajax (url,variables_str,div_id);
			// to submit when departure is friday
		if ( (s_accomm_level == 6) && (func=="departure"))
			{ 
			//alert ("test");
			t=setTimeout("document.getElementById('register').submit()"  ,1000);  

			}
			
		}
		}
	
	return;
	
} 

// added by mahmoud // this function used only in firefox is to fix a problem in firefox
function fixx(div_id,func)
{
	var cb=0;
	var obj;
	var s_lang= document.getElementById("lang").value
	var index_course = document.register.course.selectedIndex; // get the select course
	var s_course 	 = document.register.course[index_course].value; // get the select course				
	var index_level  = document.register.level.selectedIndex; // get the select level
	var s_level 	 = document.register.level[index_level].value ; // get the select level		
	var index_accomm_level = document.register.accomm_level.selectedIndex ; // get the selected accommodtion
	var s_accomm_level     = document.register.accomm_level[index_accomm_level].value; // get the selected accommodtion	
	
	if ((s_course!=0) &&  (s_level!=0) && (check_course()) )
		{
		var d = new Date(); // TO AVOID PAGE CASHING
		dtime=d.getTime();	
		var s_accomm=0;
		var s_Arrival_Date =0;	
		var s_Departure_Date =0;
		var s_week =0;
			if ( ((s_accomm_level == 6)||(s_accomm_level == 9) ) && (func=="room"))
			{ 
			func="arrival";
			div_id="arrival_div";
			document.getElementById("room_div").innerHTML ='<label> <select name="accomm_reg" id="accomm_reg" disabled="disabled" class="widthselect" ><option value="29">'+Select_Room+'</option></select> <input type="hidden" value="29" name="accomm_reg1" ></label>';
			}
		
			///add accommodation id as static id for no accommodation
	
			switch (func)
			{	
			case "hint1":
		/*document.getElementById("accomm_level").disabled=true 
		document.register.accomm_level.selectedIndex=0; 
		var variables_str="course="+s_course ;*/
	document.getElementById("room_div").innerHTML ='<label><select name="accomm_reg" id="accomm_reg" disabled="disabled" class="widthselect" ><option value="29">'+Select_Room+'</option></select> <input type="hidden" value="29" name="accomm_reg1" ></label>';	
	
	document.getElementById("arrival_div").innerHTML ='<label><select name="Arrival_Date" id="Arrival_Date" disabled="disabled" class="widthselect" ><option>'+Select_Arrival+'</option></select></label>';			
			
	document.getElementById("departure_div").innerHTML ='<label><select name="Departure_Date" id="Departure_Date" disabled="disabled" class="widthselect" ><option>'+Select_Departure+'</option></select></label>';
		
	document.getElementById("week_div").innerHTML ='<label><select name="weeks" id="weeks" disabled="disabled"  class="widthselect" ><option>'+Select_Week+'</option></select></label>';
	
	/*alert (func+" "+div_id+" "+s_accomm_level);	*/
	//s_accomm_level=0;
			break;
			case "room":
			 var index_Arrival_Date = document.register.Arrival_Date.selectedIndex ;// get the selected Arrival_Date
			s_Arrival_Date  	 = document.register.Arrival_Date[index_Arrival_Date].value;// get the selected Arrival_Date
			document.getElementById("arrival_div").innerHTML ='<label><select name="Arrival_Date" id="Arrival_Date" disabled="disabled" class="widthselect" ><option>'+Select_Arrival+'</option></select></label>';
			
			
			document.getElementById("departure_div").innerHTML ='<label><select name="Departure_Date" id="Departure_Date" disabled="disabled" class="widthselect" ><option>'+Select_Departure+'</option></select></label>';
		
			 document.getElementById("week_div").innerHTML ='<label><select name="weeks" id="weeks" disabled="disabled"  class="widthselect" ><option>'+Select_Week+'</option></select></label>';
			 break;
			
			case "arrival":
			var index_reg = document.register.accomm_reg.selectedIndex ; // get the selected accommodtion
			s_accomm   	  = document.register.accomm_reg[index_reg].value; // get the selected accommodtion
			//alert (s_accomm);
			//document.getElementById("arrival_div").innerHTML ='<label><select name="Arrival_Date" id="Arrival_Date" disabled="disabled" class="widthselect" ><option>Date d&rsquo;arriv&eacute;e ?</option></select></label>';
			
			document.getElementById("week_div").innerHTML ='<label><select name="weeks" id="weeks" disabled="disabled"  class="widthselect" ><option>'+Select_Week+'</option></select></label>';
			document.getElementById("departure_div").innerHTML ='<label><select name="Departure_Date" id="Departure_Date" disabled="disabled" class="widthselect" ><option>'+Select_Departure+'</option></select></label>';		
			break;	
			
			case "week":
			var index_reg = document.register.accomm_reg.selectedIndex ; // get the selected accommodtion
			s_accomm   	  = document.register.accomm_reg[index_reg].value;
		  var index_Arrival_Date = document.register.Arrival_Date.selectedIndex ;// get the selected Arrival_Date
		  s_Arrival_Date  	 = document.register.Arrival_Date[index_Arrival_Date].value;// get the selected Arrival_Date
		  document.getElementById("departure_div").innerHTML ='<label><select name="Departure_Date" id="Departure_Date" disabled="disabled" class="widthselect" ><option>'+Select_Departure+'</option></select></label>';
		  break;
			  
			case "departure":
			var index_reg = document.register.accomm_reg.selectedIndex ; // get the selected accommodtion
			s_accomm   	  = document.register.accomm_reg[index_reg].value;
			 var index_Arrival_Date = document.register.Arrival_Date.selectedIndex ;// get the selected Arrival_Date
				 s_Arrival_Date  	= document.register.Arrival_Date[index_Arrival_Date].value;// get the selected Arrival_Date
				
				  var index_Departure_Date 	= document.register.Departure_Date.selectedIndex ;// get the selected Departure_Date
				s_Departure_Date  	= document.register.Departure_Date[index_Departure_Date].value;// get the selected Departure_Date
		
		//alert (document.getElementById("weeks").type)
				if (document.getElementById("weeks").type=="select-one")
				{var index_week 	= document.register.weeks.selectedIndex ;// get the selected Departure_Date
				s_week  	= document.register.weeks[index_week].value;// get the selected Departure_Date	
				}
				else if (document.getElementById("weeks").type=="hidden")
				{
				s_week=document.getElementById("weeks").value;
				}
			  break;
		
			default:
			 
		document.getElementById("arrival_div").innerHTML ='<label><select name="Arrival_Date" id="Arrival_Date" disabled="disabled" class="widthselect" ><option>'+Select_Arrival+'</option></select></label>';
		
		document.getElementById("room_div").innerHTML ='<label><select name="accomm_reg" id="accomm_reg" disabled="disabled" class="widthselect" ><option>'+Select_Room+'</option></select></label>';
						
		document.getElementById("week_div").innerHTML ='<label><select name="weeks" id="weeks" disabled="disabled"  class="widthselect" ><option>'+Select_Week+'</option></select></label>';
			
		document.getElementById("departure_div").innerHTML ='<label><select name="Departure_Date" id="Departure_Date" disabled="disabled" class="widthselect" ><option>'+Select_Departure+'</option></select></label>';
			
			}
		
			/*if (func=="week")
			{
			
				if  (s_Arrival_Date !=0)
				{
				}
				else
				{
				  //disabled weeks selected 
				return;
				}	
			}
			else
			{document.getElementById("weeks").disabled=true;}  */
	
				
			variables_str="course="+s_course ;
			variables_str+="&lang="+s_lang;	
			variables_str+="&level="+s_level;
			variables_str+="&accomm_level="+s_accomm_level+"&accomm="+s_accomm;
			variables_str+="&arrival="+s_Arrival_Date+"&week="+s_week+"&departure="+s_Departure_Date;
				variables_str+="&func="+func+"&"+dtime;
			//alert(variables_str);
				/// execute ajax code 
				executeajax (url,variables_str,div_id);
			// to submit when departure is friday
		if ( (s_accomm_level == 6) && (func=="departure"))
			{ 
			//alert ("test");
			t=setTimeout("document.getElementById('register').submit()"  ,1000);  

			}
			
		}
	
}
///////////////////
function get_SelectedIndex(sx)
{
//alert (sx);
var index_sx=0 ;
var s_sx=0;	
	  if (sx.selectedIndex==undefined)
	  {   s_sx=sx.value;
	  }
	  else
	  {
	  index_sx = sx.selectedIndex; // get the selected index 	 
      s_sx	  = sx[index_sx].value; // get the selected value
	  }
return s_sx;	
}

function disabled_select(div_name,select_name,select_title)
{
document.getElementById(div_name).innerHTML ='<label> <select name="'+select_name+'" id="'+select_name+'" disabled="disabled" class="widthselect" ><option value="0">'+select_title+'</option></select> </label>';	
//alert (document.getElementById(div_name).innerHTML ='<label> <select name="'+select_name+'" id="'+select_name+'" disabled="disabled" class="widthselect" ><option value="0">'+select_title+'</option></select> </label>');
return ;
}

function display_text(div_name,select_name,select_value,text)
{
document.getElementById(div_name).innerHTML =' <p class="decription_age">'+text+'<input type="hidden" value="'+select_value+'" name="'+select_name+'" id="'+select_name+'"></p>';	

return ;
}
/*function requestAtollInfo(div_id,func) 
{    
	var cb=0;
	var obj;				
	var variables_str;
	
	var index_age = document.register.age.selectedIndex; // get the selected index 
	var s_age	 = document.register.age[index_age].value; // get the selected value
	if (s_age==0 || s_age=="" ) 
	{
		disabled_select("city_div","destination","Age of the student"); 
		disabled_select("accommodation_div","accommodation",Select_Accommodation); 
			disabled_select("course_div","course",Select_Course); 
			disabled_select("arrival_div","arrival",Select_Arrival); 
			disabled_select("departure_div","departure",Select_Departure);
			document.getElementById("price_div").style.display ="none";
	return;		
	}
			
	if (s_age!=0 && s_age!="" ) 
	{	var d = new Date(); // TO AVOID PAGE CASHING
		dtime=d.getTime();			
		variables_str="age="+s_age;		
		//if 	( func=="city" || func=="accommodation" ||func=="course"  ||  func=="arrival")
		//{
			
		//	if (s_age < 14 )
			//{		
				//func="arrival";
				//div_id="arrival_div";				
					//if (s_age < 12)
					//{
					  //display_text("accommodation_div","accommodation","7","Campus (open space room)" ); }
					//else
					{ display_text("accommodation_div","accommodation","6","Campus (2,3,4/room)" );  }
			
			 display_text("city_div","destination","4","Hyeres");
			 display_text("course_div","course","2","Standard (20 lessons / week)");
			}
		}
* /		
		//|| func=="accommodation" ||func=="course"  ||  func=="arrival"
		if 	( func=="city" )
		{
			//s_destination	  =  get_SelectedIndex(formname.destination); 
			if (s_age < 12 )
			{		
				func="accommodation";
				div_id="accommodation_div";				
					/*if (s_age < 12)
					{
					  display_text("accommodation_div","accommodation","7","Campus (open space room)" ); }
					else
					{ display_text("accommodation_div","accommodation","6","Campus (2,3,4/room)" );  }*  /
			
			 display_text("city_div","destination","4","Hyeres");
			// display_text("course_div","course","2","Standard (20 lessons / week)");
			}
		}
	
			
	//alert (variables_str+" "+div_id+" "+s_age);
		var s_departure	=0;
		var s_arrival=0;
		var s_course=0;
		var s_accommodation=0;
		var s_destination=0;
		var s_supplement=0;
		var formname=document.register;
		if (func=="accommodation" &&  (s_age < 14 ) )
		{
		s_destination	  =  get_SelectedIndex(formname.destination); 
			if (  s_destination ==9 )
			{		
			func="course";
			div_id="course_div";				
			 display_text("accommodation_div","accommodation","6","No Accommodation" );  
			//	display_text("course_div","course","2","Standard (20 lessons / week)");
			 }
		}
		
		if (func=="course" &&  (s_age < 14 ))
		{
		s_destination	  =  get_SelectedIndex(formname.destination); 
			if (  s_destination ==4 )
			{		
			func="arrival";
			div_id="arrival_div";				
			// display_text("accommodation_div","accommodation","6","Campus (2,3,4/room)" );  
				 display_text("course_div","course","2","Standard (20 lessons / week)");
			 }
		}
		switch (func)
		{		
			
		case "city":
			disabled_select("accommodation_div","accommodation",Select_Accommodation); 
			disabled_select("course_div","course",Select_Course); 
			disabled_select("arrival_div","arrival",Select_Arrival); 
			disabled_select("departure_div","departure",Select_Departure);
			document.getElementById("price_div").style.display ="none";
		document.getElementById("supplement").disabled=true;
		document.getElementById("supplement_div").style.display ="none";
	
		break;
		case "accommodation":
			s_destination	  =  get_SelectedIndex(formname.destination); // get the selected value
			
			disabled_select("accommodation_div","accommodation",Select_Accommodation); 
			disabled_select("course_div","course",Select_Course); 
			disabled_select("arrival_div","arrival",Select_Arrival); 
			disabled_select("departure_div","departure",Select_Departure); 
			document.getElementById("price_div").style.display ="none";
			document.getElementById("supplement").disabled=true;
		document.getElementById("supplement_div").style.display ="none";
			if (s_destination==0 || s_destination=="")
			{   
				disabled_select("accommodation_div","accommodation",Select_Accommodation); 
				return;   }
		break;
		case "course":		
			s_accommodation	  =  get_SelectedIndex(formname.accommodation); // get the selected value
			s_destination	  =  get_SelectedIndex(formname.destination);

			disabled_select("arrival_div","arrival",Select_Arrival); 
			disabled_select("departure_div","departure",Select_Departure); 
			document.getElementById("price_div").style.display ="none";
			document.getElementById("supplement").disabled=true;
		document.getElementById("supplement_div").style.display ="none";
			if (s_accommodation==0 || s_accommodation=="")				
			{   disabled_select("course_div","course",Select_Course); 
			return;   }
		break;
		case "arrival":
			s_course	 =  get_SelectedIndex(formname.course); // get the selected value			
			s_accommodation	  =  get_SelectedIndex(formname.accommodation);
			s_destination	  =  get_SelectedIndex(formname.destination);
			disabled_select("departure_div","departure",Select_Departure); 
			document.getElementById("price_div").style.display ="none";
		document.getElementById("supplement").disabled=true;
		document.getElementById("supplement_div").style.display ="none";
			//alert (s_course+s_accommodation+s_destination)
		if (s_course==0 || s_course=="")
			{
			disabled_select("arrival_div","arrival",Select_Arrival); 
			return;   }
		break;
		case "departure":
		document.getElementById("price_div").style.display ="none";
		
		//var suppx = document.getElementById("supplement").options;
//		 for (var i = suppx.length - 1; i > 0; i--)
//		 {
//          suppx[i].selected = false;
//        }
//		suppx[0].selected=true;
	//	document.getElementById("supplement").selectedIndex=document.getElementById("supplement").options[0];		
		document.getElementById("supplement").disabled=true;
		document.getElementById("supplement").selectedIndex=0;		
	//	document.getElementById("supplement").options[0].selected;//selectedIndex=0;
		document.getElementById("supplement_div").style.display ="none";
		s_arrival	  = get_SelectedIndex(formname.arrival); 	
		s_course	 =  get_SelectedIndex(formname.course);
		s_accommodation	  =  get_SelectedIndex(formname.accommodation);
		s_destination	  =  get_SelectedIndex(formname.destination);
			if (s_arrival==0 || s_arrival=="")
			{  
			disabled_select("departure_div","departure",Select_Departure); 
			return;   }
		break;
		case "supplement": ///spical case for hyares 
			document.getElementById("price_div").style.display ="none";			
			document.getElementById("supplement").disabled=false;
			document.getElementById("supplement_div").style.display ="none";
		    s_departure	  = get_SelectedIndex(formname.departure); 			
			s_arrival	  = get_SelectedIndex(formname.arrival); 
			s_course	 =  get_SelectedIndex(formname.course);
			s_accommodation	=  get_SelectedIndex(formname.accommodation);
			s_destination	=  get_SelectedIndex(formname.destination);
		if (s_departure==0 || s_departure=="")
		{   
		document.getElementById("supplement_div").style.display ="none";
		return;   }
		else 
		{
			document.getElementById("supplement_div").style.display ="block";
			return;
		}
		break;	
		case "price":
		
		    s_departure	  = get_SelectedIndex(formname.departure); 			
			s_arrival	  = get_SelectedIndex(formname.arrival); 
			s_course	 =  get_SelectedIndex(formname.course);
			s_accommodation	=  get_SelectedIndex(formname.accommodation);
			s_destination	=  get_SelectedIndex(formname.destination);
			s_supplement	=  get_SelectedIndex(formname.supplement);
		if (s_departure==0 || s_departure=="")
		{   
		document.getElementById("price_div").style.display ="none";
		return;   }
		else 
		{
			document.getElementById("price_div").style.display ="block";
		}
		break;	
		default:					
		}
		/*if (s_accommodation==0 || s_accommodation=="")
		{
		
		}* /
			
		variables_str+="&destination="+s_destination;
		variables_str+="&accommodation="+s_accommodation;
		variables_str+="&course="+s_course;		
		variables_str+="&arrival="+s_arrival;
		variables_str+="&departure="+s_departure;	
		variables_str+="&supplement="+s_supplement;		
		variables_str+="&func="+func+"&"+dtime;	
	executeajax (url_atoll,variables_str,div_id);
}


/* 	
			document.getElementById("room_div").innerHTML ='<label> <select name="accomm_reg" id="accomm_reg" disabled="disabled" class="widthselect" ><option value="29">'+Select_Room+'</option></select> <input type="hidden" value="29" name="accomm_reg1" ></label>';
			 
		document.getElementById("arrival_div").innerHTML ='<label><select name="Arrival_Date" id="Arrival_Date" disabled="disabled" class="widthselect" ><option>'+Select_Arrival+'</option></select></label>';
		
		document.getElementById("room_div").innerHTML ='<label><select name="accomm_reg" id="accomm_reg" disabled="disabled" class="widthselect" ><option>'+Select_Room+'</option></select></label>';
						
		document.getElementById("week_div").innerHTML ='<label><select name="weeks" id="weeks" disabled="disabled"  class="widthselect" ><option>'+Select_Week+'</option></select></label>';
			
		document.getElementById("departure_div").innerHTML ='<label><select name="Departure_Date" id="Departure_Date" disabled="disabled" class="widthselect" ><option>'+Select_Departure+'</option></select></label>';	* /
	return;
	
} */




function getHTTPObject() 
{ 
  var xmlhttp; 
  if(window.XMLHttpRequest){ 
    xmlhttp = new XMLHttpRequest(); 
  } 
  else if (window.ActiveXObject){ 
    xmlhttp=new ActiveXObject("Microsoft.XMLHTTP"); 
    if (!xmlhttp){ 
        xmlhttp=new ActiveXObject("Msxml2.XMLHTTP"); 
    }    
  } 
  return xmlhttp;   
} 
var http = getHTTPObject();
////////////////////////executeajax
function executeajax (url,variables_str,div_id)
	{	
	//alert (url+'----------'+variables_str+'------'+div_id); 
	//alert (document.getElementById('course_hint').innerHTML); 
		document.getElementById(div_id).innerHTML ="<img src='images-cia/loading_cropedh.gif'>";
		
		// added by mahmoud // this code to fix problem with firefox
	if(navigator.userAgent.indexOf('Firefox') != -1)
	{
		http.open("GET", url+variables_str , true); // false
		}
		else
		{
			http.open("GET", url+variables_str , false); // true
			}
		//http.open("GET", url+variables_str , false); // true
		//obj = document.getElementById(div_id); 		
		//alert (url+variables_str);
		http.onreadystatechange  = function()
		{
			//alert (http.responseText);
			if (http.readyState == 4 &&	http.status == 200) 
			{
			var results=http.responseText; 
			//results.charset="ISO-8859-1";	alert (results); 	//results=escape(results);										
			
			document.getElementById(div_id).innerHTML = results;	

				/*if (div_id=="course_hint")	
				{
				check_course();	
				}*/
				
				if (url=="include/ajax_p.php?")
				{
					if ((document.getElementById("weeks").type=="hidden") && (div_id=="departure_div"))
					{
			document.getElementById("week_div").innerHTML="<center> "+document.getElementById("weeks").value+Weeks_label+" </center>"; 
					}
				}
			}
							
		}          
		http.send(null); 	
		return;
	}

////////////////
function registersubmit()
{
var index_Arrival_Date 	= document.register.Arrival_Date.selectedIndex ; // get the selected accommodtion
s_Arrival_Date  	= document.register.Arrival_Date[index_Arrival_Date].value; 
	
	if  (s_Arrival_Date !=0)
	{
	document.register.submit();
	}
	else
	{
	var t="______________________________\n";
		t=t+"\t\t\n";
		t=t+"\tPlease select correct Data !\n";
		t=t+"______________________________";
	alert (t);
	}
	
}

function registersubmit_atoll()
{
/*var index_Arrival_Date 	= document.register.Arrival_Date.selectedIndex ; // get the selected accommodtion
s_Arrival_Date  	= document.register.Arrival_Date[index_Arrival_Date].value; 
	
	if  (s_Arrival_Date !=0)
	{
	document.register.submit();
	}
	else
	{
	var t="______________________________\n";
		t=t+"\t\t\n";
		t=t+"\tPlease select correct Data !\n";
		t=t+"______________________________";
	alert (t);
	}*/
	document.register.submit();	
}	




function formSubmit(xform)
{
//alert (xform);

document.supplementform.accomm_reg.value=xform;
document.getElementById("supplementform").submit();

}

/////////////////////////////////////////////supplement functions //////////////////////////
function radiovalue (Formname,radioName) 
{var halawa = document.forms[Formname].elements[radioName];
		for (j=0;j<halawa.length;j++) 
		{
			if (halawa[j].checked) 
			{				
			slected_item=halawa[j].value;
			}
		}
return 	slected_item;	
}

function turboresa_link(previous_v,slected_item,weeks)
{
	
var turboresa_var="https://www.turboresa.com/WD100AWP/WD100Awp.exe/CONNECT/turboresa?PARAM1=";
var turboresa_array=new Array();

////////////
turboresa_href=document.getElementById('turboresa').href;		
turboresa_href=turboresa_href.replace(turboresa_var, "");
turboresa_array=turboresa_href.split("&");
var param1= turboresa_array[0];
var param2= turboresa_array[1];
	param2= param2.replace(/param2=/i, "");
var param3= turboresa_array[2];
///////////

	if (previous_v!=0)
	{
	param2= param2.replace(previous_v, "");
	param1=parseInt(param1)-1;
		if (previous_v=="RAFS00RAFW00")
		{param1=param1-1 ;}
	}
	if (slected_item!=0)
	{
	param1=parseInt(param1)+1;	
		if(slected_item=="RAFS00RAFW00")
		{ param1=param1+1 ;}
	var pos=param2.indexOf("/");
	pos=pos-2;
	var firstpart =param2.substr(pos);
	param2= param2.replace(firstpart, "");
	param2=param2+slected_item+firstpart;
	}	
 turboresa_var=turboresa_var+param1+"&param2="+param2+"&"+param3;
return turboresa_var;
}


function turboresa_link_date(new_selected,old_selected)
{
var turboresa_href=document.getElementById('turboresa').href;
var new_selected_array=new Array();
var old_selected_array=new Array();
new_selected_array=new_selected.split("-");
old_selected_array=old_selected.split("-");

new_selected=new_selected_array[2]+"/"+new_selected_array[1]+"/"+new_selected_array[0];
old_selected=old_selected_array[2]+"/"+old_selected_array[1]+"/"+old_selected_array[0];
////////////alert (new_selected+" "+old_selected);
turboresa_href=turboresa_href.replace(old_selected, new_selected);
document.getElementById('turboresa').href=turboresa_href;
return ;
}


function extra_day(Formname,radioName,s_var) 
{ //alert("mahmoud");
	var d = new Date(); // TO AVOID PAGE CASHING
		dtime=d.getTime();	
var selected=document.getElementById(radioName+"_selected").value;
//alert (s_var.value+selected);
//alert (selected+" "+Formname+" "+radioName+" "+s_var.name+" "+s_var.value);

//turboresa_link_date(new_selected,old_selected));
turboresa_link_date(s_var.value,selected);

	
if (s_var.value!=selected)	
{

var val=document.getElementById(radioName+"_val").value;
var val_1=document.getElementById(radioName+"_val_1").value;
var val_2=document.getElementById(radioName+"_val_2").value;
var action=document.getElementById(radioName+"_action").value;
document.getElementById(radioName+"_selected").value=s_var.value;
var total=document.getElementById("total_price").innerHTML;
var total_1=document.getElementById("total_price1").innerHTML;
var total_2=document.getElementById("total_price2").innerHTML;
//var selected=document.getElementById(radioName+"_selected").value;

	if (action=="remove")
	{
	total=parseInt(total)-parseInt(val);
	var total_cost_1=parseInt(total_1)-parseInt(val_1);
	var total_cost_2=parseInt(total_2)-parseInt(val_2);
	document.getElementById("total_price").innerHTML=total;
	document.getElementById("price_cost").value=total;
	
	// added by mahmoud
		document.getElementById("total_price_total").innerHTML=total-40;
		document.getElementById("price_cost_total").value=total-40;
	// added by mahmoud
	
	document.getElementById("total_price1").innerHTML=total_cost_1;
	document.getElementById("total_price2").innerHTML=total_cost_2;
	document.getElementById("price_cost1").value=total_cost_1;
	document.getElementById("price_cost2").value=total_cost_2;
	document.getElementById(radioName+"_action").value="add";
		///////////////////// hide extra day alert
	document.getElementById(radioName+"_span").style.display ="none";
	document.getElementById(radioName+"_red1").style.display ="none";
	document.getElementById(radioName+"_red2").style.display ="none";
	}
	
	if (action=="add")
	{		
	total=parseInt(total)+parseInt(val);
	var total_cost_1=parseInt(total_1)+parseInt(val_1);
	var total_cost_2=parseInt(total_2)+parseInt(val_2);
	
	document.getElementById("total_price").innerHTML=total;
	document.getElementById("price_cost").value=total;
	
	// added by mahmoud
	document.getElementById("total_price_total").innerHTML=total-40;
	document.getElementById("price_cost_total").value=total-40;
	// added by mahmoud
	
	document.getElementById("total_price1").innerHTML=total_cost_1;
	document.getElementById("total_price2").innerHTML=total_cost_2;
	document.getElementById("price_cost1").value=total_cost_1;
	document.getElementById("price_cost2").value=total_cost_2;

	document.getElementById(radioName+"_action").value="remove";
			///////////////////// show extra day alert
	document.getElementById(radioName+"_red1").style.display ="";
	document.getElementById(radioName+"_red2").style.display ="";
	document.getElementById(radioName+"_span").style.display ="block";
	
	}
document.getElementById("price_convert").href="popup/convert.php?total="+total+"&d"+dtime
document.getElementById("price_convert_1").href="popup/convert.php?total="+total_cost_1+"&d"+dtime
document.getElementById("price_convert_2").href="popup/convert.php?total="+total_cost_2+"&d"+dtime

}
}

function supplement_atoll(Formname,radioName) 
{

var slected_item=radiovalue (Formname,radioName);
var total=document.getElementById("total_price").innerHTML;
var weeks=document.getElementById("weeks").value;
	weeks=parseInt(weeks);

var mysupplement = new Array();
var year_id=document.getElementById("year_id").value;
if (year_id==1 )   //2008 price list 
{
mysupplement["0"] = 0;
mysupplement["DLFSTN"] = 0;	
mysupplement["DLFINT"] = 65;	
}
else  			//2009 price list 
{
mysupplement["0"] = 0;
mysupplement["DLFSTN"] = 0;	
mysupplement["DLFINT"] = 65;
}

var supplement_text = new Array();
supplement_text["0"] = 0;
supplement_text["DLFSTN"] = "";	
supplement_text["DLFINT"] = "";


 
////////////
	switch (radioName)
	{
	case "Delf_Atoll":
	var Delf_Atoll=document.getElementById("Delf_Atoll_value").value;	
	weeks=weeks-2;
//	alert (slected_item+" "+Delf_Atoll)
	total=parseInt(total)- ( parseInt(mysupplement[Delf_Atoll]) * weeks)+(parseInt(mysupplement[slected_item])* weeks );
	
	document.getElementById("total_price").innerHTML=total;
	document.getElementById("price_cost").value=total;
	
	// added by Mahmoud
	document.getElementById("total_price_total").innerHTML=total-40;
	document.getElementById("price_cost_total").value=total-40;
	// added by Mahmoud
	
	//document.getElementById("total_price_pdf").value=total;
	document.getElementById("Delf_Atoll_value").value=slected_item;
	break;
	}
	document.getElementById("price_convert").href="popup/convert.php?total="+total

}


function supplement(Formname,radioName) 
{

var slected_item=radiovalue (Formname,radioName); // selected radio button of supplement choices
var total=document.getElementById("total_price").innerHTML; // main total price before add supplement
var total_1=document.getElementById("total_price1").innerHTML; // first extra total price before add supplement
var total_2=document.getElementById("total_price2").innerHTML; // second extra price before add supplement
var weeks=document.getElementById("weeks").value;
	weeks=parseInt(weeks);
///////////alert(Formname+"  "+slected_item+"  "+radioName)
var mysupplement = new Array();
var year_id=document.getElementById("year_id").value;

if (year_id==1 )   //2008 price list 
{
mysupplement["0"] = 0;
mysupplement["TAAA00"] = 50;		///Nice airport -- > Residence
mysupplement["TAAD00"] = 50;		///Residence -- > Nice airport
mysupplement["TAGA00"] = 15;		///Antibes train station -- > Residence
mysupplement["TAGD00"] = 15;		///Residence -- > Antibes train station
mysupplement["RAFS00"] = 37;		///Half board
mysupplement["RAFS00RAFW00"] = 52;	/// Half board and weekend lunches
mysupplement["HARG00"] = 0;
mysupplement["HAR000"] = 0;	///Guest

mysupplement["TAAA0P"] = 180;		///paris airport -- > Arrival transfer 
mysupplement["TAGA0P"] = 180;		///paris airport -- > depurture 

mysupplement["TAAD0P"] = 100;		///paris train -- > Arrival transfer
mysupplement["TAGD0P"] = 100;		///paris train -- >depurture 


mysupplement["TAGAAD"] = 240;		///paris airport arrival + depurture 
mysupplement["TAGDAD"] = 145;		///paris train station arrival + depurture 

////////////NICE suppliment
mysupplement["TAAANA"] =50; ///Nice airport -- > Residence
mysupplement["TAADNA"] =50; ///Residence -- > Nice airport

mysupplement["TAGANT"] =15; ///Nice train station -- > Residence
mysupplement["TAGDNT"] =15; ///Residence -- >  Nice train station 

}
else  			//2009 price list 
{
mysupplement["0"] = 0;
mysupplement["TAAA00"] = 50;		///Nice airport -- > Residence
mysupplement["TAAD00"] = 50;		///Residence -- > Nice airport
mysupplement["TAGA00"] = 15;		///Antibes train station -- > Residence
mysupplement["TAGD00"] = 15;		///Residence -- > Antibes train station
mysupplement["RAFS00"] = 41;		///Half board
mysupplement["RAFS00RAFW00"] = 57;	/// Half board and weekend lunches
mysupplement["HARG00"] = 0;
mysupplement["HAR000"] = 0;			///Guest

mysupplement["TAAA0P"] = 180;		///paris airport -- > Arrival transfer 
mysupplement["TAGA0P"] = 180;		///paris airport -- > depurture 

mysupplement["TAAD0P"] = 100;		///paris train -- > Arrival transfer
mysupplement["TAGD0P"] = 100;		///paris train -- >depurture 


mysupplement["TAGAAD"] = 240;		///paris airport arrival + depurture 
mysupplement["TAGDAD"] = 145;		///paris train station arrival + depurture 
////////////NICE suppliment
mysupplement["TAAANA"] =50; // Transport Arrival Nice Airport
mysupplement["TAADNA"] =50; // Transport Departure Nice Airport

mysupplement["TAGANT"] =15; // Transport Arrival Nice Train
mysupplement["TAGDNT"] =15; // Transport Departure Nice Train
}




var supplement_text = new Array();
supplement_text["0"] = 0;
supplement_text["TAAA00"] ="<b>"+Transfer_Arrival_Label+"</b> "+transport_Arrival_Airport;
supplement_text["TAAD00"] ="<b>"+Transfer_Departure_Label+"</b> "+transport_Departure_Airport;
supplement_text["TAGA00"] ="<b>"+Transfer_Arrival_Label+"</b> "+transport_Arrival_Train_Station;
supplement_text["TAGD00"] ="<b>"+Transfer_Departure_Label+"</b> "+transport_Departure_Train_Station;
supplement_text["RAFS00"] ="<b>"+Host_family+"</b> "+Half_Board;
supplement_text["RAFS00RAFW00"]="<b>"+Host_family+"</b> "+Half_Board_Weekend;
supplement_text["HARG00"] = 0;
//supplement_text["HAR000"] = "<b>"+Guest_Label+":</b> You wish to have a guest during all or part of your stay. Our booking officer will contact you to confirm the price of this supplement.";
supplement_text["HAR000"] = "<b>"+Guest_Label+":</b> "+wish_guest;
//////////paris suppliment
supplement_text["TAAA0P"] ="<b>"+Paris_airport+" :</b> "+Transportation_Paris_airport_Arrival;
supplement_text["TAGA0P"] ="<b>"+Paris_airport+" :</b> "+Transportation_Paris_airport_Departure;

supplement_text["TAAD0P"] ="<b>"+Paris_train_station+": </b>"+Transportation_Paris_train_Arrival;
supplement_text["TAGD0P"] ="<b>"+Paris_train_station+": </b>"+Transportation_Paris_airport_Departure;

supplement_text["TAGAAD"] ="<b>"+Paris_airport+":</b> "+Arrival_Departure_transfer_airport;
supplement_text["TAGDAD"] ="<b>"+Paris_train_station+": </b> "+Arrival_Departure_transfer_train; 
////////////NICE suppliment
supplement_text["TAAANA"] ="<b>"+Transfer_Arrival_Label+"</b> "+transport_Arrival_Nice_Airport;
supplement_text["TAADNA"] ="<b>"+Transfer_Departure_Label+"</b> "+transport_Departure_Nice_Airport;

supplement_text["TAGANT"] ="<b>"+Transfer_Arrival_Label+"</b> "+transport_Arrival_Nice_Train;
supplement_text["TAGDNT"] ="<b>"+Transfer_Departure_Label+"</b> "+transport_Departure_Nice_Train;


	var other_accommodation1=document.getElementById("other_accommodation1").value; // hidden field has extra total price 1
	var other_accommodation2=document.getElementById("other_accommodation2").value; // hidden field has extra total price 2
	
	var accommodation_with_transport=new Array('1','2','3','4','13','26'); // this array have (IDs) of accommodation that have transportations supplements 
	
/////////////////////	
	switch (radioName)
	{
	case "transport_arrival":	
	var arrival_v=document.getElementById("arrival_value").value;	
		total=parseInt(total) - parseInt(mysupplement[arrival_v]) + parseInt(mysupplement[slected_item]);
	document.getElementById("total_price").innerHTML=total;	
	document.getElementById("price_cost").value=total;
	
	// added by mahmoud
		document.getElementById("total_price_total").innerHTML=total-40;	
		document.getElementById("price_cost_total").value=total-40;
	// added by mahmoud

	for( var i = 0; i< accommodation_with_transport.length; i++ ) 
	{
		   	if (other_accommodation1== accommodation_with_transport[i])
		   {
			   document.getElementById("total_price1").innerHTML=parseInt(total_1) - parseInt(mysupplement[arrival_v]) + parseInt(mysupplement[slected_item]);
			   document.getElementById("price_cost1").value=parseInt(total_1)- parseInt(mysupplement[departure_value]) +parseInt(mysupplement[slected_item]);
			  }
		   	if (other_accommodation2== accommodation_with_transport[i])
		   {
			  document.getElementById("total_price2").innerHTML=parseInt(total_2) - parseInt(mysupplement[arrival_v]) + parseInt(mysupplement[slected_item]);
			  document.getElementById("price_cost2").value=parseInt(total_2)- parseInt(mysupplement[departure_value]) +parseInt(mysupplement[slected_item]);
			  }
  	}
	

	//
	//
	document.getElementById("arrival_value").value =slected_item;
	if (slected_item==0)
	{
	document.getElementById("transport_arrival_text").innerHTML ="";
	}
	else 
	{
		// modified by mahmoud
		document.getElementById("transport_arrival_text").innerHTML =" <span  class=\"supplement-price-td\" >"+mysupplement[slected_item]+"</span><span class=\"supplement-number-td\" >1</span><span class=\"supplement-text-td\"> "+supplement_text[slected_item]+":</span>";
// modified by mahmoud
	//document.getElementById("transport_arrival_text").innerHTML =supplement_text[slected_item];
	}
	////////**************************////////////
	turboresa_var=turboresa_link(arrival_v,slected_item,weeks); 	
	document.getElementById('turboresa').href=turboresa_var;
	break;
	////////////////////////////////////
	case "transport_departure":	
	var departure_value=document.getElementById("departure_value").value;///hidden input temp has default value (0) and we add any new  value 	//
	total=parseInt(total)- parseInt(mysupplement[departure_value]) +parseInt(mysupplement[slected_item]); // here we subtract the value in the temp hidden field and add the new cost of chosen supplement
	document.getElementById("total_price").innerHTML=total; // main total price to show to the user
	document.getElementById("price_cost").value=total; // hidden field has main total price 
	
	// added by mahmoud
	document.getElementById("total_price_total").innerHTML=total-40; // main total price to show to the user
	document.getElementById("price_cost_total").value=total-40; // hidden field has main total price 
	// added by mahmoud
	
	for( var i = 0; i< accommodation_with_transport.length; i++ ) 
	{
	 	if (other_accommodation1== accommodation_with_transport[i]) // check if it in array or not
		   {
			document.getElementById("total_price1").innerHTML=parseInt(total_1)- parseInt(mysupplement[departure_value]) +parseInt(mysupplement[slected_item]);
			document.getElementById("price_cost1").value=parseInt(total_1)- parseInt(mysupplement[departure_value]) +parseInt(mysupplement[slected_item]);
		   }
		   
		   if (other_accommodation2== accommodation_with_transport[i])// check if it in array or not
		   {
		   document.getElementById("total_price2").innerHTML=parseInt(total_2)- parseInt(mysupplement[departure_value]) +parseInt(mysupplement[slected_item]);
		   document.getElementById("price_cost2").value=parseInt(total_2)- parseInt(mysupplement[departure_value]) +parseInt(mysupplement[slected_item]);
		   }
	}
	//
	//
	document.getElementById("departure_value").value=slected_item;
	
	turboresa_var=turboresa_link(departure_value,slected_item,weeks); 
	document.getElementById('turboresa').href=turboresa_var;	
	if (slected_item==0)
	{
	document.getElementById("transport_departure_text").innerHTML ="";
	}
	else 
	{
		// modified by mahmoud
		document.getElementById("transport_departure_text").innerHTML =" <span  class=\"supplement-price-td\" >"+mysupplement[slected_item]+"</span><span class=\"supplement-number-td\" >1</span><span class=\"supplement-text-td\"> "+supplement_text[slected_item]+":</span>";
		// modified by mahmoud
	//document.getElementById("transport_departure_text").innerHTML =supplement_text[slected_item];
	}
	break;
	////////////////PARIS///////////////////
		case "transport_paris_arrival":	
	var arrival_v=document.getElementById("arrival_paris_value").value;	
		total=parseInt(total) - parseInt(mysupplement[arrival_v]) + parseInt(mysupplement[slected_item]);
	document.getElementById("total_price").innerHTML=total;	
	document.getElementById("price_cost").value=total;
	
	// added by mahmoud
		document.getElementById("total_price_total").innerHTML=total-40;	
		document.getElementById("price_cost_total").value=total-40;
	// added by mahmoud

	for( var i = 0; i< accommodation_with_transport.length; i++ ) 
	{
		   	if (other_accommodation1== accommodation_with_transport[i])
		   {
			   document.getElementById("total_price1").innerHTML=parseInt(total_1) - parseInt(mysupplement[arrival_v]) + parseInt(mysupplement[slected_item]);
			   document.getElementById("price_cost1").value=parseInt(total_1)- parseInt(mysupplement[departure_value]) +parseInt(mysupplement[slected_item]);
			  }
		   	if (other_accommodation2== accommodation_with_transport[i])
		   {
			  document.getElementById("total_price2").innerHTML=parseInt(total_2) - parseInt(mysupplement[arrival_v]) + parseInt(mysupplement[slected_item]);
			  document.getElementById("price_cost2").value=parseInt(total_2)- parseInt(mysupplement[departure_value]) +parseInt(mysupplement[slected_item]);
			  }
  	}
	

	//
	//
	document.getElementById("arrival_paris_value").value =slected_item;
	if (slected_item==0)
	{
	document.getElementById("transport_paris_arrival_text").innerHTML ="";
	}
	else 
	{
		// modified by mahmoud
		document.getElementById("transport_paris_arrival_text").innerHTML =" <span  class=\"supplement-price-td\" >"+mysupplement[slected_item]+"</span><span class=\"supplement-number-td\" >1</span><span class=\"supplement-text-td\"> "+supplement_text[slected_item]+":</span>";
		// modified by mahmoud
	//document.getElementById("transport_paris_arrival_text").innerHTML =supplement_text[slected_item];
	}
	////////**************************////////////
	turboresa_var=turboresa_link(arrival_v,slected_item,weeks); 	
	document.getElementById('turboresa').href=turboresa_var;
	break;
	case "transport_paris_departure":	
	var departure_value=document.getElementById("departure_paris_value").value;
	total=parseInt(total)- parseInt(mysupplement[departure_value]) +parseInt(mysupplement[slected_item]);
	document.getElementById("total_price").innerHTML=total;
	document.getElementById("price_cost").value=total;
	
	// added by mahmoud
		document.getElementById("total_price_total").innerHTML=total-40;
		document.getElementById("price_cost_total").value=total-40;
	// added by mahmoud
	
	for( var i = 0; i< accommodation_with_transport.length; i++ ) 
	{
	 	if (other_accommodation1== accommodation_with_transport[i])
		   {
			document.getElementById("total_price1").innerHTML=parseInt(total_1)- parseInt(mysupplement[departure_value]) +parseInt(mysupplement[slected_item]);
			document.getElementById("price_cost1").value=parseInt(total_1)- parseInt(mysupplement[departure_value]) +parseInt(mysupplement[slected_item]);
		   }
		   if (other_accommodation2== accommodation_with_transport[i])
		   {
		   document.getElementById("total_price2").innerHTML=parseInt(total_2)- parseInt(mysupplement[departure_value]) +parseInt(mysupplement[slected_item]);
		   document.getElementById("price_cost2").value=parseInt(total_2)- parseInt(mysupplement[departure_value]) +parseInt(mysupplement[slected_item]);
		   }
	}
	//
	//
	document.getElementById("departure_paris_value").value=slected_item;
	
	turboresa_var=turboresa_link(departure_value,slected_item,weeks); 
	document.getElementById('turboresa').href=turboresa_var;	
	if (slected_item==0)
	{
	document.getElementById("transport_paris_departure_text").innerHTML ="";
	}
	else 
	{
		// modified by mahmoud
		document.getElementById("transport_paris_departure_text").innerHTML =" <span  class=\"supplement-price-td\" >"+mysupplement[slected_item]+"</span><span class=\"supplement-number-td\" >1</span><span class=\"supplement-text-td\"> "+supplement_text[slected_item]+":</span>";
		// modified by mahmoud
	//document.getElementById("transport_paris_departure_text").innerHTML =supplement_text[slected_item];
	}
	break;
	//////////////////////////////////
	case "Famille":
	// mahmoud
	var Famille_value=document.getElementById("Famille_value").value;	
	total=parseInt(total)- ( parseInt(mysupplement[Famille_value]) * weeks )+(parseInt(mysupplement[slected_item])* weeks );
	document.getElementById("total_price").innerHTML=total;
	document.getElementById("price_cost").value=total;
	
	// added by mahmoud
		document.getElementById("total_price_total").innerHTML=total-40;
		document.getElementById("price_cost_total").value=total-40;
	// added by mahmoud
	
	//document.getElementById("total_price1").innerHTML=parseInt(total_1)-( parseInt(mysupplement[Famille_value]) * weeks )+(parseInt(mysupplement[slected_item])* weeks );
	//document.getElementById("total_price2").innerHTML=parseInt(total_2)-( parseInt(mysupplement[Famille_value]) * weeks )+(parseInt(mysupplement[slected_item])* weeks );
	
	document.getElementById("Famille_value").value=slected_item;	
	turboresa_var=turboresa_link(Famille_value,slected_item,weeks); 
	document.getElementById('turboresa').href=turboresa_var;	
	if (slected_item==0)
	{
		// modified by mahmoud
		document.getElementById("Famille_text").innerHTML = " <span  class=\"supplement-price-td\" >"+mysupplement[slected_item]+"</span><span class=\"supplement-number-td\" >"+weeks+"</span><span class=\"supplement-text-td\"> <b>"+Host_family+" </b>: "+Half_Board_Breaksfasts+":</span>";
		// modified by mahmoud
	//document.getElementById("Famille_text").innerHTML ="<B>"+Host_family+" </b>: "+Half_Board_Breaksfasts;
	}
	else 
	{
		// modified by mahmoud
		document.getElementById("Famille_text").innerHTML = " <span  class=\"supplement-price-td\" >"+(parseInt(mysupplement[slected_item])* weeks )+"</span><span class=\"supplement-number-td\" >"+weeks+"</span><span class=\"supplement-text-td\"> "+supplement_text[slected_item]+":</span>";
		// modified by mahmoud
		//document.getElementById("Famille_text").innerHTML =supplement_text[slected_item];
		}
		break;
		
	case "Private":
	 if (slected_item=="yes" )
	 {
	 document.getElementById("private_course").disabled=false ;
	 }
	 
	 if (slected_item=="no" )
	 {
var previous_v= document.getElementById("Private_param").value
 
  turboresa_var=turboresa_link(previous_v,0,weeks); 
  document.getElementById('turboresa').href=turboresa_var;
  document.getElementById("Private_param").value=0;  

 var cost= document.getElementById("Private_value").value;
 var total= document.getElementById("total_price").innerHTML;
 //var total_1=document.getElementById("total_price1").innerHTML;
//var total_2=document.getElementById("total_price2").innerHTML;
	total = parseInt(total) - (parseInt(cost));
  document.getElementById("total_price").innerHTML=total;
  document.getElementById("price_cost").value=total;
  
  // added by mahmoud
	  document.getElementById("total_price_total").innerHTML=total-40;
	  document.getElementById("price_cost_total").value=total-40;
  // added by mahmoud
  
  //document.getElementById("total_price1").innerHTML=parseInt(total_1) - (parseInt(cost));
	//document.getElementById("total_price2").innerHTML=parseInt(total_2) - (parseInt(cost));
  document.getElementById("Private_value").value=0;
   document.getElementById("private_course").selectedIndex =0;
 document.getElementById("private_course").disabled=true ;
 document.getElementById("Private_text").innerHTML ="";
	 }
	 break;
		case "Private2":
	 if (slected_item=="yes" )
	 {
	 document.getElementById("private_course2").disabled=false ;
	 }
	 
	 if (slected_item=="no" )
	 {
		var previous_v= document.getElementById("Private_param2").value
 
 		 turboresa_var=turboresa_link(previous_v,0,weeks); 
 		 document.getElementById('turboresa').href=turboresa_var;
		  document.getElementById("Private_param2").value=0;  

		 var cost= document.getElementById("Private_value2").value;
 		var total= document.getElementById("total_price").innerHTML;
		var total_1=document.getElementById("total_price1").innerHTML;
		var total_2=document.getElementById("total_price2").innerHTML;
			total = parseInt(total) - (parseInt(cost));
 			document.getElementById("total_price").innerHTML=total;
			document.getElementById("price_cost").value=total;
			
			// added by mahmoud
				document.getElementById("total_price_total").innerHTML=total-40;
				document.getElementById("price_cost_total").value=total-40;
			// added by mahmoud
			
			document.getElementById("total_price1").innerHTML=parseInt(total_1) - (parseInt(cost));
			document.getElementById("total_price2").innerHTML=parseInt(total_2) - (parseInt(cost));
	 	 document.getElementById("Private_value2").value=0;
  		 document.getElementById("private_course2").selectedIndex =0;
		 document.getElementById("private_course2").disabled=true ;
	 	document.getElementById("Private_text2").innerHTML ="";
	 }
	 break;	
	case "Guest":
	if (slected_item==0)
	{
	document.getElementById("Guest_text").innerHTML ="";
	}
	else 
	{
		// modified by mahmoud
		document.getElementById("Guest_text").innerHTML =" <span  class=\"supplement-price-td\" ></span><span></span><span> "+supplement_text[slected_item]+":</span>";
		// modified by mahmoud
		//document.getElementById("Guest_text").innerHTML =supplement_text[slected_item];
	}
	break;


	default:	
	
	//
	}
document.getElementById("price_convert").href="popup/convert.php?total="+total

}
function add_Private(x)
{
var Private_price=48; ///  Private course price 
var total=document.getElementById("total_price").innerHTML;
var total_1=document.getElementById("total_price1").innerHTML;
var total_2=document.getElementById("total_price2").innerHTML;
var weeks=document.getElementById("weeks").value;
weeks=parseInt(weeks);
var xint=parseInt(x.value);
/*var cours_price=0;
if (year_id==1 )   //2008 price list 
{
	cours_price=0;
}
else
{
cours_price=0;
}*/

///var total_private= xint * weeks;	to coalculate no of week * no of lessons 
var total_private= xint ;	

var	cost=(total_private*Private_price);	
var last_cost=document.getElementById("Private_value").value;
total_cost=(parseInt(total)-parseInt(last_cost))+cost;
//alert (total_cost+"=("+total+"-"+last_cost+")+"+cost);

// modified by mahmoud
document.getElementById("Private_text").innerHTML =" <span  class=\"supplement-price-td\" >"+cost+"</span><span class=\"supplement-number-td\" >"+total_private+"</span><span class=\"supplement-text-td\"> "+Private_Lessons+":</span>";
// modified by mahmoud

if (total_private <= 9)
	{
	total_private="0"+total_private;
	}
var	slected_item="CAPA"+total_private;
//alert (slected_item); 	

var previous_v=document.getElementById("Private_param").value; 

	turboresa_var=turboresa_link(previous_v,slected_item,weeks); 
  document.getElementById('turboresa').href=turboresa_var;
 
 document.getElementById("Private_param").value=slected_item;
 document.getElementById("Private_value").value=cost;
 document.getElementById("total_price").innerHTML=total_cost;
 document.getElementById("price_cost").value=total_cost;
 
 // added by mahmoud
 document.getElementById("total_price_total").innerHTML=total_cost-40;
 document.getElementById("price_cost_total").value=total_cost-40;
 // added by mahmoud
 
 var total_cost_1=(parseInt(total_1)-parseInt(last_cost))+cost;
 var total_cost_2=(parseInt(total_2)-parseInt(last_cost))+cost;
 document.getElementById("total_price1").innerHTML=total_cost_1;
 document.getElementById("total_price2").innerHTML=total_cost_2;
 document.getElementById("price_cost1").value=total_cost_1;
 document.getElementById("price_cost2").value=total_cost_2;


document.getElementById("price_convert").href="popup/convert.php?total="+total_cost
document.getElementById("price_convert_1").href="popup/convert.php?total="+total_cost_1
document.getElementById("price_convert_2").href="popup/convert.php?total="+total_cost_2
}

function add_Private2(x)
{
var Private2_price=35;  ///  Private course price 
var total=document.getElementById("total_price").innerHTML;
var total_1=document.getElementById("total_price1").innerHTML;
var total_2=document.getElementById("total_price2").innerHTML;
var weeks=document.getElementById("weeks").value;
weeks=parseInt(weeks);
var xint=parseInt(x.value);
/*var cours_price=0;
if (year_id==1 )   //2008 price list 
{
	cours_price=0;
}
else
{
cours_price=0;
}*/
///var total_private= xint * weeks;	to coalculate no of week * no of lessons 
var total_private= xint ;	

var	cost=(total_private*Private2_price);	
var last_cost=document.getElementById("Private_value2").value;
total_cost=(parseInt(total)-parseInt(last_cost))+cost;
//alert (total_cost+"=("+total+"-"+last_cost+")+"+cost);


// modified by mahmoud
document.getElementById("Private_text2").innerHTML = "<span  class=\"supplement-price-td\" >"+cost+"</span><span class=\"supplement-number-td\" >"+total_private+"</span><span class=\"supplement-text-td\"> "+to_1_Lesson+":</span> "+total_private;
// modified by mahmoud

if (total_private <= 9)
	{
	total_private="0"+total_private;
	}
var	slected_item="C2T1"+total_private;
//alert (slected_item); 	

var previous_v=document.getElementById("Private_param2").value; 

	turboresa_var=turboresa_link(previous_v,slected_item,weeks); 
  document.getElementById('turboresa').href=turboresa_var;
 
 document.getElementById("Private_param2").value=slected_item;
 document.getElementById("Private_value2").value=cost;
document.getElementById("total_price").innerHTML=total_cost;
document.getElementById("price_cost").value=total_cost;

// added by mahmoud 
document.getElementById("total_price_total").innerHTML=total_cost-40;
document.getElementById("price_cost_total").value=total_cost-40;
// added by mahmoud 

 var total_cost_1=(parseInt(total_1)-parseInt(last_cost))+cost;
 var total_cost_2=(parseInt(total_2)-parseInt(last_cost))+cost;
 document.getElementById("total_price1").innerHTML=total_cost_1;
 document.getElementById("total_price2").innerHTML=total_cost_2;
 document.getElementById("price_cost1").value=total_cost_1;
 document.getElementById("price_cost2").value=total_cost_2;


document.getElementById("price_convert").href="popup/convert.php?total="+total_cost
document.getElementById("price_convert_1").href="popup/convert.php?total="+total_cost_1
document.getElementById("price_convert_2").href="popup/convert.php?total="+total_cost_2

}