$(document).ready(function(){
	set_position();
	
	// DropDown Menu
	/* $('.sub-top-menu').each(function () {
		$(this).parent().eq(0).hover(function () {
			$('.sub-top-menu:eq(0)', this).show();
			}, function () {
				$('.sub-top-menu:eq(0)', this).hide();
		});
	}); */
	
	$('.super-sub-menu-content').each(function () {
		$(this).parent().eq(0).hover(function () {
			$('.super-sub-menu-content:eq(0)', this).show();
			}, function () {
				$('.super-sub-menu-content:eq(0)', this).hide();
		});
	});
	
	if($('.facebook-recommend-seachbox')){
		$.post("/src/social-plugin/test.php", { url: window.location.href}, 
			function(data){
				$(".facebook-recommend-seachbox").html(data);
				$(".facebook-recommend").html('');
			}
		);
	}else if($('.facebook-recommend')){
		$.post("/src/social-plugin/test.php", { url: window.location.href}, 
			function(data){
				$(".facebook-recommend").html(data);
			}
		);
	}
	
});

$(window).resize(function(){
	set_position();
});

function get_doc_size(){
	docHeight = $(window).height();
	docWidth = $(window).width();
}
function set_position(){
	get_doc_size();
	$("#menu-cargo").css({"left": (docWidth/2) - 496 +"px"});
	if(docWidth > 1200){
		$("#home-banner-navigator").css({"left": (docWidth/2) - 599 +"px"});
		$(".home-banner-cargo-url").css({"left": (docWidth/2) - 489 +"px"});
	} else {
		$("#home-banner-navigator").css({"left":"0px"});
		$(".home-banner-cargo-url").css({"left":(docWidth/2) - 490 +"px"});
	}
	//$("#footer-content-cargo").css({"left": (docWidth/2) - 496 +"px"});
	$("#flyerbonus-btn").css({"left": (docWidth/2) -490 +"px"});
	$("#booking-cargo").css({"left": (docWidth/2) + 224 +"px"});
	$("#booking-theme").css({"left": (docWidth/2) - 39 +"px"});
	$("#booking-theme-to").css({"left": (docWidth/2) - 39 +"px"});
	$("#booking-adult-select").css({"left": (docWidth/2) + 245 +"px"});
	$("#booking-searchby-select").css({"left": (docWidth/2) + 245 +"px"});
	$("#booking-flight-select").css({"left": (docWidth/2) + 245 +"px"});
	$("#booking-child-select").css({"left": (docWidth/2) + 245 +"px"});
	$("#booking-lap-select").css({"left": (docWidth/2) + 375 +"px"});
	$("#flight-schedule-theme").css({"left": (docWidth/2) - 39 +"px"});
	$("#flight-schedule-theme-to").css({"left": (docWidth/2) - 39 +"px"});
	$("#flight-info-depart-date-select").css({"left": (docWidth/2) + 245 +"px"});
	$("#flight-info-depart-month-select").css({"left": (docWidth/2) + 375 +"px"});
	
	// iPad Screen
	var isiPad = navigator.userAgent.match(/iPad/i) != null;
	if(isiPad) {
		$(".home-banner-cargo-url").css({"left":"50px"});
	}
}

