
$(document).ready(function(){
	hideAll();
	
	

//set cookies	
	$("#na_hover").click(function() { // set cookie for 1 year
		$.cookie('TN_langauge', 'english', { path: '/', domain: '.sabretravelnetwork.com', expires: 365 });
		$.cookie('TN_region', 'america', { path: '/', domain: '.sabretravelnetwork.com', expires: 365 });
		$.cookie('TN_country', $(this).attr('class'), { path: '/', domain: '.sabretravelnetwork.com', expires: 365 });
		return true;
	});
	
	$("#northamerica").click(function() { // set cookie for 1 year
		$.cookie('TN_langauge', 'english', { path: '/', domain: '.sabretravelnetwork.com', expires: 365 });
		$.cookie('TN_region', 'america', { path: '/', domain: '.sabretravelnetwork.com', expires: 365 });
		$.cookie('TN_country', $(this).attr('class'), { path: '/', domain: '.sabretravelnetwork.com', expires: 365 });
		return true;
	});
	
	
	
	$("#country_select_la_sp a").click(function() { // set cookie for 1 year
		$.cookie('TN_langauge', 'spanish', { path: '/', domain: '.sabretravelnetwork.com', expires: 365 });
		$.cookie('TN_region', 'latin', { path: '/', domain: '.sabretravelnetwork.com', expires: 365 });
		$.cookie('TN_country', $(this).attr('class'), { path: '/', domain: '.sabretravelnetwork.com', expires: 365 });
		return true;
	});
	
	$("#country_select_la_pt a").click(function() { // set cookie for 1 year
		$.cookie('TN_langauge', 'portuguese', { path: '/', domain: '.sabretravelnetwork.com', expires: 365 });
		$.cookie('TN_region', 'latin', { path: '/', domain: '.sabretravelnetwork.com', expires: 365 });
		$.cookie('TN_country', $(this).attr('class'), { path: '/', domain: '.sabretravelnetwork.com', expires: 365 });
		return true;
	});
	
	$("#country_select_la_en a").click(function() { // set cookie for 1 year
		$.cookie('TN_langauge', 'english', { path: '/', domain: '.sabretravelnetwork.com', expires: 365 });
		$.cookie('TN_region', 'latin', { path: '/', domain: '.sabretravelnetwork.com', expires: 365 });
		$.cookie('TN_country', $(this).attr('class'), { path: '/', domain: '.sabretravelnetwork.com', expires: 365 });
		return true;
	});
	
	$("#country_select_eu_en a").click(function() { // set cookie for 1 year
		$.cookie('TN_langauge', 'english', { path: '/', domain: '.sabretravelnetwork.com', expires: 365 });
		$.cookie('TN_region', 'emea', { path: '/', domain: '.sabretravelnetwork.com', expires: 365 });
		$.cookie('TN_country', $(this).attr('class'), { path: '/', domain: '.sabretravelnetwork.com', expires: 365 });
		return true;
	});
	
	$("#country_select_eu_it a").click(function() { // set cookie for 1 year
		$.cookie('TN_langauge', 'italian', { path: '/', domain: '.sabretravelnetwork.com', expires: 365 });
		$.cookie('TN_region', 'emea', { path: '/', domain: '.sabretravelnetwork.com', expires: 365 });
		$.cookie('TN_country', $(this).attr('class'), { path: '/', domain: '.sabretravelnetwork.com', expires: 365 });
		return true;
	});
	
	$("#country_select_eu_fr a").click(function() { // set cookie for 1 year
		$.cookie('TN_langauge', 'french', { path: '/', domain: '.sabretravelnetwork.com', expires: 365 });
		$.cookie('TN_region', 'emea', { path: '/', domain: '.sabretravelnetwork.com', expires: 365 });
		$.cookie('TN_country', $(this).attr('class'), { path: '/', domain: '.sabretravelnetwork.com', expires: 365 });
		return true;
	});
	
	$("#country_select_eu_de a").click(function() { // set cookie for 1 year
		$.cookie('TN_langauge', 'german', { path: '/', domain: '.sabretravelnetwork.com', expires: 365 });
		$.cookie('TN_region', 'emea', { path: '/', domain: '.sabretravelnetwork.com', expires: 365 });
		$.cookie('TN_country', $(this).attr('class'), { path: '/', domain: '.sabretravelnetwork.com', expires: 365 });
		return true;
	});
	
	$("#country_select_eu_ru a").click(function() { // set cookie for 1 year
		$.cookie('TN_langauge', 'russian', { path: '/', domain: '.sabretravelnetwork.com', expires: 365 });
		$.cookie('TN_region', 'emea', { path: '/', domain: '.sabretravelnetwork.com', expires: 365 });
		$.cookie('TN_country', $(this).attr('class'), { path: '/', domain: '.sabretravelnetwork.com', expires: 365 });
		return true;
	});
	
	$("#country_select_me_en a").click(function() { // set cookie for 1 year
		$.cookie('TN_langauge', 'english', { path: '/', domain: '.sabretravelnetwork.com', expires: 365 });
		$.cookie('TN_region', 'me', { path: '/', domain: '.sabretravelnetwork.com',expires: 365 });
		$.cookie('TN_country', $(this).attr('class'), { path: '/', domain: '.sabretravelnetwork.com', expires: 365 });
		return true;
	});
	
	$("#country_select_me_ar a").click(function() { // set cookie for 1 year
		$.cookie('TN_langauge', 'arabic', { path: '/', domain: '.sabretravelnetwork.com', expires: 365 });
		$.cookie('TN_region', 'me', { path: '/', domain: '.sabretravelnetwork.com',expires: 365 });
		$.cookie('TN_country', $(this).attr('class'), { path: '/', domain: '.sabretravelnetwork.com', expires: 365 });
		return true;
	});
	
	
	
	
	
	
	
	
	
	
	$(".langauges_na").click(function () { 
	  $("#country_select_na").show(); 
	});
	$("#langauges_la_sp").click(function () { 
	  $("#country_select_la_sp").show();
	  $("#country_select_la_en").hide();
	  $("#country_select_la_pt").hide();
	});
	$("#langauges_la_en").click(function () { 
	  $("#country_select_la_en").show(); 
	  $("#country_select_la_sp").hide();
	  $("#country_select_la_pt").hide();
	});
	$("#langauges_la_pt").click(function () { 
	  $("#country_select_la_pt").show(); 
	  $("#country_select_la_en").hide();
	  $("#country_select_la_sp").hide();
	});
	$("#langauges_eu_en").click(function () { 
	  $("#country_select_eu_en").show();
	  $("#country_select_eu_de").hide();
	  $("#country_select_eu_fr").hide();
	  $("#country_select_eu_it").hide();
	  $("#country_select_eu_ru").hide();
	});
	$("#langauges_eu_de").click(function () { 
	  $("#country_select_eu_de").show();
	  $("#country_select_eu_en").hide();
	  $("#country_select_eu_fr").hide();
	  $("#country_select_eu_it").hide();
	  $("#country_select_eu_ru").hide();
	});
	$("#langauges_eu_fr").click(function () { 
	  $("#country_select_eu_fr").show();
	  $("#country_select_eu_de").hide();
	  $("#country_select_eu_en").hide();
	  $("#country_select_eu_it").hide();
	  $("#country_select_eu_ru").hide();
	});
	$("#langauges_eu_it").click(function () { 
	  $("#country_select_eu_it").show();
	  $("#country_select_eu_de").hide();
	  $("#country_select_eu_fr").hide();
	  $("#country_select_eu_en").hide();
	  $("#country_select_eu_ru").hide();
	});
	$("#langauges_eu_ru").click(function () { 
	  $("#country_select_eu_ru").show();
	  $("#country_select_eu_de").hide();
	  $("#country_select_eu_fr").hide();
	  $("#country_select_eu_it").hide();
	  $("#country_select_eu_en").hide();
	});
	
	
	$("#langauges_me_en").click(function () { 
	  $("#country_select_me_en").show();
	  $("#country_select_me_ar").hide();
	});
	$("#langauges_me_ar").click(function () { 
	  $("#country_select_me_ar").show();
	  $("#country_select_me_en").hide();
	});
	$("#langauges_ap_sp").click(function () { 
	  $("#country_select_ap_sp").show();
	  $("#country_select_ap_asia").hide();
	});
	$("#langauges_ap_asia").click(function () { 
	  $("#country_select_ap_sp").hide();
	  $("#country_select_ap_asia").show();
	});
	
	$("#northamerica").click(function () { 
	  $("#na_options").show(); 
	  $("#la_options").hide();
	  $("#eu_options").hide();
	  $("#me_options").hide();
	  $("#ap_options").hide();
	});
	$("#latinamerica").click(function () { 
	  $("#la_options").show(); 
  	  $("#na_options").hide();
	  $("#eu_options").hide();
	  $("#me_options").hide();
	  $("#ap_options").hide();
	});
	$("#europe").click(function () { 
	  $("#eu_options").show();
	  $("#na_options").hide();
	  $("#la_options").hide();
	  $("#me_options").hide();
	  $("#ap_options").hide();
	});
	$("#middleeastafrica").click(function () { 
	  $("#me_options").show(); 
	  $("#na_options").hide();
	  $("#eu_options").hide();
	  $("#la_options").hide();
	  $("#ap_options").hide();
	});
	$("#asiapacific").click(function () { 
	  $("#ap_options").show();
	  $("#na_options").hide();
	  $("#eu_options").hide();
	  $("#me_options").hide();
	  $("#la_options").hide(); 
	});
	
	$("#na_hover").mouseover(function () { 
	  $("#na_options").show(); 
	  $("#la_options").hide();
	  $("#eu_options").hide();
	  $("#me_options").hide();
	  $("#ap_options").hide();
	});
	$("#la_hover").mouseover(function () { 
	  $("#la_options").show();
	  $("#na_options").hide();
	  $("#eu_options").hide();
	  $("#me_options").hide();
	  $("#ap_options").hide(); 
	});
	$("#eu_hover").mouseover(function () { 
	  $("#eu_options").show(); 
	  $("#na_options").hide();
	  $("#la_options").hide();
	  $("#me_options").hide();
	  $("#ap_options").hide();
	});
	$("#me_hover").mouseover(function () { 
	  $("#me_options").show();
	  $("#na_options").hide();
	  $("#eu_options").hide();
	  $("#la_options").hide();
	  $("#ap_options").hide();
	});
	$("#ap_hover").mouseover(function () { 
	  $("#ap_options").show();
	  $("#na_options").hide();
	  $("#eu_options").hide();
	  $("#me_options").hide();
	  $("#la_options").hide();
	});
	variable = false;	
	$().mousemove(function(e){
	var p = $("#container");
	var position = p.position();
	
	if((e.pageX > position.left && e.pageX < position.left +820) && (e.pageY > 90 && e.pageY < 375)){
			variable = true;
	}
      if(variable == true){
		  if(e.pageX < position.left || e.pageX > (position.left + 820) || e.pageY < 90 || e.pageY > 375){
			hideAll();
			variable = false;
		  }
	}
   });
  });
  
function hideAll(){
	$("#country_select_na").hide();
	$("#country_select_la_en").hide();
	$("#country_select_la_pt").hide();
	$("#country_select_la_sp").hide();
	$("#country_select_eu_en").hide();
	$("#country_select_eu_fr").hide();
	$("#country_select_eu_de").hide();
	$("#country_select_eu_it").hide();
	$("#country_select_eu_ru").hide();
	$("#country_select_me_en").hide();
	$("#country_select_me_ar").hide();
	$("#country_select_ap_sp").hide();
	$("#country_select_ap_asia").hide();
	
	$("#na_options").hide();
	$("#la_options").hide();
	$("#eu_options").hide();
	$("#me_options").hide();
	$("#ap_options").hide();	
}
	
