var totalOfOtherElementsHeight = 76; var footerHeight = 26; $(document).ready(function(){ b_adjustPositionAndSize(); $(window).resize(function(){ b_adjustPositionAndSize(); }); b_adjustPositionAndSize(); }); function b_adjustPositionAndSize() { //--------------- Adjust content_container height ------------------ windowHeight = $(window).innerHeight(); $("#content_container").css("height", (windowHeight-totalOfOtherElementsHeight)+"px"); //--------------- Adjust bottom_footer position -------------------- $("#bottom_footer").css("top", (windowHeight-footerHeight)+"px"); //--------------- Adjust background_image size --------------------- container = $("#background_image_container"); backgroundImage = $("#background_image"); imageWidth = backgroundImage.innerWidth(); imageHeight = backgroundImage.innerHeight(); containerWidth = container.innerWidth(); containerHeight = container.innerHeight(); containerRatio = containerWidth / containerHeight; imageRatio = imageWidth / imageHeight; if (containerRatio > imageRatio) { newImageWidth = containerWidth; newImageHeight = containerWidth/imageRatio; } else { newImageWidth = containerHeight*imageRatio; newImageHeight = containerHeight; } backgroundImage.css("width", newImageWidth+"px"); backgroundImage.css("height", newImageHeight+"px"); posLeft = (containerWidth-newImageWidth)/2; backgroundImage.css("left", posLeft+"px"); if (backgroundImage.hasClass("align_middle")) { posTop = (containerHeight-newImageHeight-60)/2; backgroundImage.css("top", posTop+"px"); } //--------------- Adjust tagline container margin ------------------ taglineContainer1 = $("#tagline_container1"); taglineContainer2 = $("#tagline_container2"); if (taglineContainer1 != null && taglineContainer2 != null) { taglineContainer1Height = taglineContainer1.innerHeight(); taglineContainer2Height = taglineContainer2.innerHeight(); marginTop = (taglineContainer1Height-taglineContainer2Height)/2; taglineContainer2.css("margin-top", marginTop+"px"); } //--------------- Adjust black transparent background height ------- blackTransparentBackground1 = $("#black_transparent_background1"); if (blackTransparentBackground1 != null) { blackTransparentBackground1.css("height", (containerHeight-40)+"px"); } blackTransparentBackground2 = $("#black_transparent_background2"); if (blackTransparentBackground2 != null) { blackTransparentBackground2.css("height", (containerHeight-40)+"px"); } //--------------- Adjust article container height ------------------ articleContainer1 = $("#article_container1"); if (articleContainer1 != null) { articleContainer1.css("width", containerWidth+"px"); articleContainer1.css("height", (containerHeight-140)+"px"); } articleContainer1a = $("#article_container1a"); if (articleContainer1a != null) { articleContainer1a.css("width", containerWidth+"px"); articleContainer1a.css("height", (containerHeight-90)+"px"); } articleContainer2 = $("#article_container2"); if (articleContainer2 != null) { articleContainer2.css("width", containerWidth+"px"); articleContainer2.css("height", (containerHeight-70)+"px"); } articleContainerNavi = $("#article_container_navi"); if (articleContainerNavi != null) { articleContainerNavi.css("width", containerWidth+"px"); articleContainerNavi.css("height", (containerHeight-40)+"px"); } //--------------- Adjust concierge bell background position ------- conciergeBellContainer = $("#concierge_bell_container"); conciergeBellBackground = $("#concierge_bell_background"); if (conciergeBellContainer != null && conciergeBellBackground != null) { conciergeBellContainerWidth = conciergeBellContainer.innerWidth(); conciergeBellBackgroundWidth = conciergeBellBackground.innerWidth(); leftPos = (conciergeBellContainerWidth-conciergeBellBackgroundWidth)/2; conciergeBellBackground.css("left", leftPos+"px"); } } function b_toggleFaq(num) { faq_item = $("#faq_item_" + num); if (faq_item.hasClass("folded")) { faq_item.removeClass("folded"); switch(num) { case 1: faq_item.animate({ height: "1175px" }, 1000, function(){ b_setMiniArrowUp(num); }); break; case 2: faq_item.animate({ height: "865px" }, 1000, function(){ b_setMiniArrowUp(num); }); break; case 3: faq_item.animate({ height: "1010px" }, 1000, function(){ b_setMiniArrowUp(num); }); break; case 4: faq_item.animate({ height: "930px" }, 1000, function(){ b_setMiniArrowUp(num); }); break; } } else { faq_item.addClass("folded"); faq_item.animate({ height: "0" }, 400, function(){ b_setMiniArrowDown(num); }); } } function b_toggleAcad(num) { faq_item = $("#faq_item_" + num); if (faq_item.hasClass("folded")) { faq_item.removeClass("folded"); faq_item.animate({ height: "320px" }, 500, function(){ b_setMiniArrowUp(num); }); } else { faq_item.addClass("folded"); faq_item.animate({ height: "0" }, 300, function(){ b_setMiniArrowDown(num); }); } } function b_setMiniArrowUp(num) { arrow = $("#faq_mini_arrow_" + num); arrow.removeClass("faq_mini_arrow_down"); arrow.addClass("faq_mini_arrow_up"); footer = $("#faq_item_footer_" + num); footer.css("visibility", "visible"); footer.css("height", "27px"); } function b_setMiniArrowDown(num) { arrow = $("#faq_mini_arrow_" + num); arrow.removeClass("faq_mini_arrow_up"); arrow.addClass("faq_mini_arrow_down"); footer = $("#faq_item_footer_" + num); footer.css("visibility", "hidden"); footer.css("height", "0"); } function b_resetContact() { result = confirm("Reset/clear form?"); return result; } function b_validateEmail(email) { var re = /^(([^<>()[\]\\.,;:\s@"]+(\.[^<>()[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/; return re.test(email); } function b_submitContact() { result = confirm("Submit form now?"); if (result == false) { return false; } else { name = $("#input_form_name").val(); email = $("#input_form_email").val(); mobilephone = $("#input_form_mobilephone").val(); if (name == "") { alert("Please enter your name"); return false; } result = b_validateEmail(email); if (result == false) { alert("Please enter a valid email address"); return false; } if (mobilephone == "") { alert("Please enter your mobile phone number"); return false; } } } function b_toggleHiddenCaption(parent_id, caption_id) { caption = $("#" + caption_id); if (caption != null) { if (caption.hasClass("is_hidden")) { caption.css("visibility", "visible"); caption.animate({ width: "145px", margin: "auto 0 0 -158px" }, 300); caption.removeClass("is_hidden"); } else { caption.animate({ width: "0", margin: "auto 0 0 -13px" }, 100, function(){ caption.css("visibility", "hidden"); }); caption.addClass("is_hidden"); } } }