		var msg="";
	
	// JavaScript Document
function switch_btn(img){
//alert(img);
var img1;
var img2;
var img3;
var td;
if (img=="hotels"){
img1 = document.getElementById('hotel_img')
img1.src="images/hotel_down.gif";

img2 = document.getElementById('tour_img')
img2.src="images/tour_up.gif";

img2 = document.getElementById('trans_img')
img2.src="images/trans_up.gif";

img3 = document.getElementById('crus_img')
img3.src="images/crus_up.gif";

}
if (img=="tours"){
img1 = document.getElementById('hotel_img')
img1.src="images/hotel_up.gif";

img2 = document.getElementById('tour_img')
img2.src="images/tour_down.gif";

img2 = document.getElementById('trans_img')
img2.src="images/trans_up.gif";

img3 = document.getElementById('crus_img')
img3.src="images/crus_up.gif";

}
if (img=="trans"){
img1 = document.getElementById('hotel_img')
img1.src="images/hotel_up.gif";

img2 = document.getElementById('tour_img')
img2.src="images/tour_up.gif";

img2 = document.getElementById('trans_img')
img2.src="images/trans_down.gif";

img3 = document.getElementById('crus_img')
img3.src="images/crus_up.gif";

}

if (img=="cruises"){
img1 = document.getElementById('hotel_img')
img1.src="images/hotel_up.gif";

img2 = document.getElementById('tour_img')
img2.src="images/tour_up.gif";

img2 = document.getElementById('trans_img')
img2.src="images/trans_up.gif";

img3 = document.getElementById('crus_img')
img3.src="images/crus_down.gif";

}





}

function p_layout_switch(form, page)
{
 var old_page
 var e
 //editied to fix hotel layout problem
 e = document.getElementById('p_layout_pagehotels')
   e.style.display = 'none'


 old_page = form['p_layout_page'].value
 form['p_layout_page'].value=page;
 if((e = document.getElementById('p_layout_tab' + old_page)))
  e.className = 'p_layout_classtab'
 if((e = document.getElementById('p_layout_button' + old_page)))
  e.className = 'p_layout_classtab_button'
 if((e = document.getElementById('p_layout_page' + old_page)))
  e.style.display = 'none'
 if((e = document.getElementById('p_layout_tab' + page)))
  e.className = 'p_layout_classpage'
 if((e = document.getElementById('p_layout_button' + page)))
  e.className = 'p_layout_classpage_button'
 if(page != old_page)
 {
  var a=new ML.Animation.Animate(); a.addAnimation({ name: 'Fade tab', effects: [ { type: 'CancelAnimation', animation: 'Fade tab' }, { type: 'FadeIn', element: 'p_layout_page' + page, duration: 0.25, visibility: 'display' } ] });
 }
 if((e = document.getElementById('p_layout_page' + page)))
  e.style.display = 'block'
}

function p_layout_adjust_size(e)
{
 if(document.getBoxObjectFor)
 {
  var b=document.getBoxObjectFor(e)
  var size={width: parseInt(b.width), height: parseInt(b.height)}
  if(window.getComputedStyle)
  {
   var s=window.getComputedStyle(e,null)
   size.width-=parseInt(s.borderLeftWidth)+parseInt(s.borderRightWidth)+parseInt(s.paddingLeft)+parseInt(s.paddingRight)
   size.height-=parseInt(s.borderTopWidth)+parseInt(s.borderBottomWidth)+parseInt(s.paddingTop)+parseInt(s.paddingRight)
  }
 }
 else
  var size={width: parseInt(e.offsetWidth), height: parseInt(e.offsetHeight)}
 return(size)
 }

function p_layout_adjust()
{
 var width = 0
 var height = 0
 var pages = ['hotels', 'tours', 'trans','cruises'];
 var parent = document.getElementById('p_layout_page_parent')
 var ad = [];
 var l = 0;
 for(var a = parent; a && a.style; a = a.parentNode, ++l)
 {
  if((ad[l] = a.style.display) == 'none')
   a.style.display = 'block'
 }
 for(var p = 0; p < pages.length; ++p)
 {
  var e = document.getElementById('p_layout_page' + pages[p])
  if(!e) continue
  var d = e.style.display
  if(d == 'none')
  {
   e.style.visibility = 'hidden'
   e.style.display = 'block'
  }
  var s = p_layout_adjust_size(e)
  width = Math.max(width, s.width)
  height = Math.max(height, s.height)
  if(d == 'none')
  {
   e.style.display = d
   e.style.visibility = ''
  }
 }
 l = 0
 for(var a = parent; a && a.style; a = a.parentNode, ++l)
 {
  if(ad[l]  == 'none')

   a.style.display = 'none'
 }
 if(parent)
 {
  if(width)
   parent.style.width = width
  if(height)
   parent.style.height = height
 }
}

function change_dir(dir){
	if (dir.name=="dir1"){
		if (dir.value=="To"){
			document.getElementById("dir2").selectedIndex=1;
		}else{
			document.getElementById("dir2").selectedIndex=0;
		}
	}
	
	if (dir.name=="dir2"){
		if (dir.value=="To"){
			document.getElementById("dir1").selectedIndex=0;
		}else{
			document.getElementById("dir1").selectedIndex=1;
		}
	}

//          TRANSFARE PACKAGE PAGE 

	if (dir.name=="dir3"){
		if (dir.value=="To"){
			document.getElementById("dir4").selectedIndex=0;
		}else{
			document.getElementById("dir4").selectedIndex=1;
		}
	}
	if (dir.name=="dir4"){
		if (dir.value=="To"){
			document.getElementById("dir3").selectedIndex=0;
		}else{
			document.getElementById("dir3").selectedIndex=1;
		}
	}
}

function ValidateForm(form){
	if (msg!==""){
	return false;
	}
}

function submit_hotel(){
	msg="";
	if (document.getElementById("country_sel").value==""){
		msg=msg+"- Please choose country\n ";
	}
	if (document.getElementById("city_sel").value==""){
		msg=msg+"- Please choose city or all cities\n ";
	}
	
	if (document.getElementById("hotel_area_sel").value==""){
		msg=msg+"- Please choose hotel area or all hotel areas\n ";
	}
	
	if (document.getElementById("hotel_sel").value==""){
		msg=msg+"- Please choose hote or all hotels\n ";
	}
	
	if (document.getElementById("check_in").value==""){
		msg=msg+"- Please choose check in date\n ";
	}else if (!isDate(document.getElementById("check_in").value,"yyyy/M/d")){
		msg=msg+"- Wrong date format in check in field,Please choose check in date\n ";
	}
	
	if (document.getElementById("check_out").value==""){
		msg=msg+"- Please choose check out date\n ";
	}else if (!isDate(document.getElementById("check_out").value,"yyyy/M/d")){
		msg=msg+"- Wrong date format in check out field,Please choose check out date\n ";
	}
	
	var today = new Date();
	var indate=new Date(document.getElementById("check_in").value);
	var outdate=new Date(document.getElementById("check_out").value);

	if (indate<today)
	{
		msg=msg+"- You can't Check in Before today\n ";
	}
	
	if (outdate<=indate)
	{
		msg=msg+"- Wrong checkout Date\n ";
	}

	if (msg!==""){
	window.alert(msg);
	return false;
	}

	document.getElementById("hotel_out").value=document.getElementById("check_out").value;
	document.getElementById("hotel_in").value=document.getElementById("check_in").value;
	document.cont_form.action="show_hotel_list.php";
	document.cont_form.submit();
	
}

function submit_tour(){
	msg="";
	if (document.getElementById("tour_country_sel").value==""){
		msg=msg+"- Please choose country\n ";
	}
	if (document.getElementById("tour_city_sel").value==""){
		msg=msg+"- Please choose city or all cities\n ";
	}
	
	
	if (msg!==""){
	window.alert(msg);
	return false;
	}

		document.cont_form.action="show_tour_list.php";
		document.cont_form.submit();
	
}
function submit_cruise(){
	
	msg="";
	if (document.getElementById("cruise_country_sel").value==""){
		msg=msg+"- Please choose country\n ";
	}
	
	if (msg!==""){
	window.alert(msg);
	return false;
	}
		document.cont_form.action="show_cruise_list.php";
		document.cont_form.submit();

}

function submit_trans(){
	
	msg="";
	if (document.getElementById("airport_sel").value==""){
		msg=msg+"- Please choose airport first\n ";
	}
	var x=document.getElementById("hotel_trans_sel").value ;

	if (x=="undefined" || x=="" || x==0){
		msg=msg+"- Please choose hotel\n ";
	}
	if (msg!==""){
	window.alert(msg);
	return false;
	}
		document.cont_form.action="show_trans.php";
		document.cont_form.submit();

}

function sort_results(dir,entity)
{
	if (dir=="up"){
		document.getElementById('sort_up').src="images/sort_up_in.gif";
		document.getElementById('sort_down').src="images/sort_down_out.gif";
		document.getElementById('sort_as').value="asc"
	}else if (dir=="down"){
		document.getElementById('sort_up').src="images/sort_up_out.gif";
		document.getElementById('sort_down').src="images/sort_down_in.gif";
		document.getElementById('sort_as').value="desc"
	}
	
	if (entity=="hotel"){
		get_hotel_list(this);
	}else if (entity=="tour"){
		get_tour_list(this);
	}else if (entity=="cruise"){
		get_cruise_list(this);
	}
	
}

function assign_value_sel(sel,value){
	for (i=0; i<sel.options.length; i++){
		if (sel.options[i].value==value){
			sel.selectedIndex=i;
		}
	}	
}
//------------------------------ Configrator Section ------------------------------------------------
function check_hotel_config(){
	msg="";
	if (document.getElementById("room").value=="none"){
		msg=msg+"- Please choose room\n ";
	}
	if (document.getElementById("room_type").value=="none"){
		msg=msg+"- Please choose room type\n ";
	}
	if (document.getElementById("num_room").value=="none"){
		msg=msg+"- Please choose num of rooms\n ";
	}
	if (document.getElementById("num_adult").value=="none"){
		msg=msg+"- Please choose num of adults\n ";
	}
	if (document.getElementById("num_child").value=="none"){
		msg=msg+"- Please choose num of childs\n ";
	}
	if (document.getElementById("room_total").value=="$"){
		msg=msg+"- Please wait till we calcaute room rate\n ";
	}

	if (msg!==""){
	window.alert(msg);
	return false;
	}else{
	document.hotel_form.submit();
	}

		
	
}

function check_cruise_config(){
	msg="";
	if (document.getElementById("trip").value=="none"){
		msg=msg+"- Please choose trip\n ";
	}
	if (document.getElementById("trip_date").value=="none"){
		msg=msg+"- Please choose trip date\n ";
	}
	if (document.getElementById("room_type").value=="none"){
		msg=msg+"- Please choose cabinet type\n ";
	}

	if (document.getElementById("num_room").value=="none"){
		msg=msg+"- Please choose num of cabinets\n ";
	}
	if (document.getElementById("num_adult").value=="none"){
		msg=msg+"- Please choose num of adults\n ";
	}
	if (document.getElementById("num_child").value=="none"){
		msg=msg+"- Please choose num of childs\n ";
	}
	if (document.getElementById("room_total").value=="$"){
		msg=msg+"- Please wait till we calcaute cabinet rate\n ";
	}

	if (msg!==""){
	window.alert(msg);
	return false;
	}else{
	document.cruise_form.submit();
	}
}

function check_tour_config(){
	msg="";
	var today = new Date();
	var indate=new Date(document.getElementById("tour_date").value);

	if (document.getElementById("tour_date").value==""){
		msg=msg+"- Please choose tour date\n ";
	}else if (!isDate(document.getElementById("tour_date").value,"yyyy/M/d")){
		msg=msg+"- Wrong date format in tour date field,Please choose tour date\n ";
	}
			if (indate<today)
	{
		msg=msg+"- You can't reserve tour before today\n ";
	}


	if (document.getElementById("tour_lang").value=="none"){
		msg=msg+"- Please choose tour language\n ";
	}
	if (document.getElementById("num_person").value==""){
		msg=msg+"- Please define the num of adults\n ";
	}

	if (document.getElementById("tour_location").value==""){
		msg=msg+"- Please define the pickup location\n ";
	}
	if (document.getElementById("total").value=="$"){
		msg=msg+"- Please wait till we calcaute cabinet rate\n ";
	}

	if (msg!==""){
	window.alert(msg);
	return false;
	}else{
	document.tour_form.submit();
	}
}

function check_trans_config(){
	msg="";
	var today = new Date();
	var indate=new Date(document.getElementById("flight_date").value);

	if (document.getElementById("airport_form").value==""){
		msg=msg+"- Please choose the airport\n ";
	}
	if (document.getElementById("hotel_trans_form").value==""){
		msg=msg+"- Please choose the hotel\n ";
	}
	if (document.getElementById("num_person").value==""){
		msg=msg+"- Please define the num of adults\n ";
	}
	if (document.getElementById("flight_num").value==""){
		msg=msg+"- Please define the flight number\n ";
	}

	if (document.getElementById("flight_date").value==""){
		msg=msg+"- Please choose flight date\n ";
	}else if (!isDate(document.getElementById("flight_date").value,"yyyy/M/d")){
		msg=msg+"- Wrong date format in flight date field,Please choose flight date\n ";
	}
		if (indate<today)
	{
		msg=msg+"- You can't reserve transfer package before today\n ";
	}
	

	if (document.getElementById("total").value=="$"){
		msg=msg+"- Please wait till we calcaute cabinet rate\n ";
	}

	if (msg!==""){
	window.alert(msg);
	return false;
	}else{
	document.trans_form.submit();
	}
}
