
var to = null;


function fadeOutMenu(m) {
	$("#"+m).fadeOut('500');
	$("#"+m).prev("a.act").removeClass('act');
	clearTimeout(to);
}

$(document).ready(function(){

	/*  Change Your Location  */
	$('#yLocChange').click(function(e) {
		e.preventDefault();
		if ($(this).hasClass('act')) {
			$(this).removeClass('act');
			$("#yLocFrm").fadeOut('100');
			clearTimeout(to);
		} else {
			$(this).addClass('act');
			$("#yLocFrm").fadeIn('150');
		}
		
	});
	
//		$("#yLocFrm a").click(function(e) {
//			e.preventDefault();
//			$('#yLocChange').removeClass('act');
//			$("#yLocFrm").fadeOut('100');
//			clearTimeout(to);
//		});
		
		$("#yLocFrm, #yLocChange.act").hover(
			function(e) { if (e.relatedTarget) clearTimeout(to); },
			function(e) { if (e.relatedTarget) to = setTimeout(function() { fadeOutMenu('yLocFrm') }, 1000); }
		);
//		$("#yLocFrm select").hover(
//			function() { clearTimeout(to); },
//			function() { to = setTimeout(function() { fadeOutMenu('yLocFrm') }, 1000); }
//		);
		$("#yLocChange").hover(
			function(e) {},
			function(e) { if ($(this).hasClass('act') && e.relatedTarget) to = setTimeout(function() { fadeOutMenu('yLocFrm') }, 1000); }
		);

	/*  The Best Places tabs  */
	$('#bpTabs a').click(function(e) {
		e.preventDefault();
		$('#bpTabs a').removeClass('act');
		$("div[id^='bp_tab']").hide();
		
		$(this).addClass('act');

		tmp = $(this).attr('id')+"_frm";
		$("#"+tmp).fadeIn('200');
	});
	
	$('#bpTabs a span').click(function(e) {
		
        $('#bpTabs a span').removeClass('select');
		$(this).addClass('select');

	});

	/*  The Hot Places tabs  */
	$('#hotnow a').click(function(e) {
		e.preventDefault();
		$('#hotnow li').removeClass('act');
		$("div[id^='hotnow_tab']").hide();
		tmp1=$(this).attr('id')+"_li";
		$("#"+tmp1).addClass('act');
        tmp = $(this).attr('id')+"_txt";
        
         /*$("#" + tmp).height('225px');*/
		$("#"+tmp).fadeIn('200');
	});
	
	/*  Select Your Region  */
	$('#yRegSelect').click(function(e) {
		e.preventDefault();
		if ($(this).hasClass('act')) {
			$(this).removeClass('act');
			//$("#yRegSelect_dd").fadeOut('100');
			//clearTimeout(to);
		} else {
			$(this).addClass('act');
			$("#yRegSelect_dd").fadeIn('150');
		}
	});
	
		$("#yRegSelect_dd a").click(function(e) {
			e.preventDefault();
			$('#yRegSelect').removeClass('act');
			//$("#yRegSelect_dd").fadeOut('100');
			//clearTimeout(to);
		});
		
		$("#yRegSelect_dd, #yRegSelect.act").hover(
			function() { clearTimeout(to); },
			function() { to = setTimeout(function() { fadeOutMenu('yRegSelect_dd') }, 1000); }
		);
		
		$("#yRegSelect").hover(
			function() {},
			function() { if ($(this).hasClass('act')) to = setTimeout(function() { fadeOutMenu('yRegSelect_dd') }, 1000); }
		);
	
	
	/*  Facebook box  */
	$("#fbBox").hover(
		function() { $(this).addClass('hover'); },	
		function() { $(this).removeClass('hover'); }	
	);

	
//	/*  Yadig On Your Mobile  */
//	$("#mobTabs li a").click(function(e) {
//		e.preventDefault();		
//		$('#mobTabs li a').removeClass('act');
//		$("div[id^='mob_tab']").hide();
//		
//		$(this).addClass('act');

//		tmp = $(this).attr('id')+"_txt";
//		$("#"+tmp).fadeIn('200');
//	});
	
	
	/*  List with thumbnails  */
	$(".thmbList li").hover(
		function() { $(this).addClass('hover'); },	
		function() { $(this).removeClass('hover'); }	
	);
	
	/*$('#header #btnSignIn').click(function(e) {
		e.preventDefault();
		if ($(this).hasClass('btnSignIn_act')) {
			$(this).removeClass('btnSignIn_act');
			$("#divSignIn").fadeOut('100');
			clearTimeout(to);
		} else {
			$(this).addClass('act');
			$("#divSignIn").fadeIn('150');
		}
	});
	$("#divSignIn, #divSignIn .chk_box, #divSignIn .chk_label").click(function() {
			clearTimeout(to);
		});*/
		
		
	
});

