﻿//ICMS - HUYNQ(chungkhoan_vnn@yahoo.com)
function ScrollTop() { jQuery('body,html').animate({ scrollTop: 300 }, 820); return false; }
function BackToTop() { jQuery('body,html').animate({ scrollTop: 0 }, 820); return false; }
//$(function () {$('#gallery a').lightBox();});
$(function () {$(window).scroll(function () {if ($(this).scrollTop() != 0) {$('#toTop').fadeIn();} else {$('#toTop').fadeOut();}});$('#toTop').click(function () {$('body,html').animate({ scrollTop: 0 }, 800);});});
function active(){
    var path = location.pathname;
    var home = "/";
    if (path == home) { $("#home-menu").addClass("active"); }
    else if (path.indexOf('/vietnam-tours') != '-1' || path.indexOf('/vietnam-tour/') != '-1' || path.indexOf('/tours/') != '-1') { $("#mn2").addClass('actived'); }
    else if (path.indexOf('/customized-tours.asp') != '-1' || path.indexOf('/Customize-tour.aspx') != '-1') { $("#mn6").addClass('active'); }
    else if (path.indexOf('/cambodia-tours') != '-1' || path.indexOf('/indochina-tours') != '-1' || path.indexOf('/indochina-tour') != '-1' || path.indexOf('/cambodia-tour') != '-1' || path.indexOf('/laos-tours') != '-1' || path.indexOf('/laos-tour') != '-1') { $("#mn3").addClass('actived'); }
    else if (path.indexOf('/services') != '-1' || path.indexOf('-/services/') != '-1' || path.indexOf('/apply-vietnam-visa-online') != '-1') { $("#mm5").addClass('actived'); }
    else if (path.indexOf('/hotels/') != '-1' || path.indexOf('-hotel/') != '-1' || path.indexOf('Book-Hotel.aspx') != '-1' || path.indexOf('/vietnam-hotels') != '-1' || path.indexOf('/cambodia-hotels') != '-1' || path.indexOf('/laos-hotels') != '-1' || path.indexOf('-hotels') != '-1') { $("#mm4").addClass('actived'); }
}
//Menu
$(document).ready(function () { mainmenu(); active(); aboutmenu(); });
function aboutmenu() { $("#ab-menu ul ").css({ display: "none" }); $("#ab-menu").hover(function () { $(this).find('ul:first').css({ visibility: "visible", display: "none" }).show(200); }, function () { $(this).find('ul:first').css({ visibility: "hidden" }); }); $("#ab-menu .sub-menu").hover(function () { $("#ab-menu").show(200); }); }
function mainmenu() { $("#nav ul ").css({ display: "none" }); $("#nav li").hover(function () { $(this).find('ul:first').css({ visibility: "visible", display: "none" }).show(200); }, function () { $(this).find('ul:first').css({ visibility: "hidden" }); }); $("#nav li ul.sub-menu").hover(function () { $("#nav li a").addClass('eparent'); }); }
//Search tabs
$(document).ready(function () { $(".tab-search").hide(); $("ul.nav-tabs li:first").addClass("active").show(); $(".tab-search:first").show(); $("ul.nav-tabs li").click(function () { $("ul.nav-tabs li").removeClass("active"); $(this).addClass("active"); $(".tab-search").hide(); var activeTab = $(this).find("a").attr("href"); $(activeTab).fadeIn(); return false; }); });
$(document).ready(function () { $(".sub-tabs").hide(); $("ul.content-tabs li:first").addClass("active").show(); $(".sub-tabs:first").show(); $("ul.content-tabs li").click(function () { $("ul.content-tabs li").removeClass("active"); $(this).addClass("active"); $(".sub-tabs").hide(); var activeTab = $(this).find("a").attr("href"); $(activeTab).fadeIn(); return false; }); });
$(document).ready(function () { $(".sub-content").hide(); $("ul.nav-tab li:first").addClass("active").show(); $(".sub-content:first").show(); $("ul.nav-tab li").click(function () { $("ul.nav-tab li").removeClass("active"); $(this).addClass("active"); $(".sub-content").hide(); var activeTab = $(this).find("a").attr("href"); $(activeTab).fadeIn(); return false; }); });
//Product Paging
$(document).ready(function () {$('.pagination a.next').click(function (e) {e.preventDefault();var country = $(this).text();var pageNum = parseInt($('#' + country).val());var pageMax = parseInt($('#' + country + '_max').val());if (pageNum < pageMax) {var curPage = pageNum + 1;$('#' + country).val(curPage);var target = $('#paginator_' + country + '_' + curPage + '').attr('class');$('#paginator_' + country + '_' + pageNum + '').removeClass('current');$('#paginator_' + country + '_' + curPage + '').addClass('current');$('.tour_' + country).hide();$('#' + target).fadeIn();}});$('.pagination a.pre').click(function (e) {e.preventDefault();var country = $(this).text();var pageNum = parseInt($('#' + country).val());var pageMax = parseInt($('#' + country + '_max').val());if (pageNum > 1) {var curPage = pageNum - 1;var target = $('#paginator_' + country + '_' + curPage + '').attr('class');$('#' + country).val(curPage);$('#paginator_' + country + '_' + pageNum + '').removeClass('current');$('#paginator_' + country + '_' + curPage + '').addClass('current');$('.tour_' + country).hide();$('#' + target).fadeIn();}});$('.pagination a').click(function (e) {e.preventDefault();if ($(this).hasClass("current")) {} else {var target = $(this).attr('class');var id = target.split("_");var country = id[0];var curPage = id[1];$('#' + country).val(curPage);$('.tour_' + country).hide();$('#' + target).fadeIn();$(this).siblings().removeClass('current');$(this).addClass('current');}});});
function CityAjax() { $("#cbCity").attr('disabled', true).html(''); $("#cbCity").append("<option value=''>[ Loading... ]</option>"); $.ajax({ type: "POST", url: "/Ajax/AjaxHelper.aspx/GetCity", data: "{countryID:" + $("#cbCountry :selected").val() + "}", contentType: "application/json; charset=utf-8", dataType: "json", success: function (msg) { CityUpdating(msg.d); } }); }; function CityUpdating(items) { $('#cbCity > option').remove(); if (items.length > 0) { var options = "<option value=''>All Cities</option>"; ; for (o in items) { var city = items[o]; options += "<option value='" + city.DestinationName + "'>" + city.DestinationName + "</option>"; } $("#cbCity").removeAttr('disabled').html(options); } else { CityNotChanged(); } } function CityNotChanged() { $("#cbCity").attr('disabled', true).html(''); $("#cbCity").append("<option value=''>[ All Cities ]</option>"); }
function TourCategory() { $("#cbCategory").attr('disabled', true).html(''); $("#cbCategory").append("<option value=''>[ Tour Style ]</option>"); $.ajax({ type: "POST", url: "Ajax/AjaxHelper.aspx/GetTourCategory", data: "{countryID:" + $("#cbCountries :selected").val() + "}", contentType: "application/json; charset=utf-8", dataType: "json", success: function (msg) { CatagoryUpdating(msg.d); } }); }; function CatagoryUpdating(items) { $('#cbCategory > option').remove(); if (items.length > 0) { var options = "<option value=''>All Style</option>"; for (o in items) { var city = items[o]; options += "<option value='" + city.CatName + "'>" + city.CatName + "</option>"; } $("#cbCategory").removeAttr('disabled').html(options); } else { CityNotChanged(); } } function CityNotChanged() { $("#cbCategory").attr('disabled', true).html(''); $("#cbCategory").append("<option value=''>[Tour Style]</option>"); }
function HotelFilter(star, price) {
    $('#list-hotels').html('<div class="loading-results"><h3>Please wait</h3><p class="throbber" /><span>We are locating the right hotels for you…</span>');
    var location = star;
    defaultParameters = "{star:" + star + ",price:" + price + "}";
    $.ajax({
        url: "/Ajax/AjaxHelper.aspx/HotelFilter",
        type: "POST",
        data: defaultParameters,
        contentType: "application/json; charset=utf-8",
        dataType: "json",
        success: function (msg) {
            $('#list-hotels').html(msg.d);
        }
    });
}
