 $(document).ready(function(){ 
		    var guidephotos = $('.guidenav li');
		    var current = 0;
		    var itemsNumber = guidephotos.length;
    		
		    guidephotos.each(function(index, el){
			    if (index !== current ){
				    $(el).hide();
			    }
		    });
    		
		    var interval = window.setInterval(function(){
			    var oldElement = guidephotos.eq(current);
    			
			    if (current + 1 === itemsNumber) {
				    current = 0;
			    } 
			    else {
				    current++;
			    }
    			
			    var newElement = guidephotos.eq(current);
			    oldElement.fadeOut(500,function(){
			        newElement.fadeIn(500);
			    });
		    }, 5000);
		;
           $('.myDropDownList').css('cursor', 'pointer');
           $('.myDropDownList').each(function() {
               $(this).click(function() {
                   if ($(this).css('z-index') == '999')
                       $(this).css('z-index', '0 ').find('.datalist').hide().parent().find('.arrow').attr('src', '/img/ddl_down.gif');
                   else {
                       $('.myDropDownList').not($(this)).css('z-index', '0 ').find('.datalist').hide().parent().find('.arrow').attr('src', '/img/ddl_down.gif');
                       $(this).css('z-index', '999').find('.arrow').attr('src', '/img/ddl_up.gif').parent().find('.datalist').width($(this).width()).css('top', $(this).height() + 3).show();
                   }
               }).find('li').click(function() {
                   var thisddl = $(this).parents('.myDropDownList');
                   thisddl.find('li.selected').removeClass('selected').removeClass('bgGrey').addClass('bgWhite');
                   thisddl.find('.selectedtext').attr('title', $(this).text()).val($(this).text()).siblings('.selectedvalue').val($(this).attr('val'));
                   $(this).addClass('selected').addClass('bgGrey');
                   if (thisddl.find('.valuefor').val().length > 0)
                       $("#" + thisddl.find('.valuefor').val()).val($(this).attr('val'));
               }).hover(
                  function() {
                      if (!$(this).hasClass('selected')) $(this).removeClass('bgWhite').addClass('bgGrey');
                  },
                  function() {
                      if (!$(this).hasClass('selected')) $(this).removeClass('bgGrey').addClass('bgWhite');
                  }
                ).attr('title', 'Click to select this item').css('padding', '0 2px');
           });
           $("#btnSearchClient").click(function(){
               var t = escape($("#hd_drpTheme").val());
               var d = escape($("#hd_drpDuration").val());
               var p = escape($("#hd_drpPrice").val());
               var m = escape($("#hd_drpMonth").val());
               if ("" == t && "" == d && "" == p && "" == m)
                   window.location = $(this).parent().find("#hd_alltoururl").val();
               else {
                   $(this).parent().find(".divSearchOptions").hide().siblings(".divSearchWait").show();
                   var src = "/Map.aspx?theme=" + t + "&duration=" + d + "&price=" + p + "&month=" + m;
                   $(this).parent().find("#searchFrame").attr("src", src);
               }
           });
	    $('div.highlinklist li>a').unbind('click').click(function(){
            GB_showCenter($(this).attr('title'), $(this).attr('href'), 600, 720);
            $(this).blur();
            return false;
       });
            $('.ListTitle').click(function() {
                $(this).toggleClass('ShowList').next('ul').toggle();
            }).next('ul').hide();
            $("img[@largeurl != '']").unbind('click').attr('onclick', 'void(0)').each(function() {
                $(this).click(function() {
                $('#divOneLineImage img').attr('src', $(this).attr('largeurl'));
                tb_show('', '?TB_inline&height=520&width=650&inlineId=divOneLineImage', '');
                });
            });});
    function QInquiry(url) {
        var ttl = "Quick Inquiry";
        GB_showCenter(ttl, url, 450, 420);
    }
;
var gaJsHost = (("https:" == document.location.protocol) ? "https://ssl." : "http://www.");
document.write(unescape("%3Cscript src='" + gaJsHost + "google-analytics.com/ga.js' type='text/javascript'%3E%3C/script%3E"));
;
try {
var pageTracker = _gat._getTracker("UA-15619948-1");
pageTracker._setDomainName(".cnadventure.com");
pageTracker._trackPageview();
} catch(err) {};
function pageClose()
{
    if (event.clientX>document.body.clientWidth && event.clientY<0||event.altKey)
    {
        window.location = "/Default.aspx?act=clearsession";
    }
}

function showForgot(forgot_url, win_height, win_width)
{
    GB_hide();
    return GB_showCenter('Forgot Password', forgot_url, win_height, win_width);
}

function refreshSession()
{
    try
    {
        $.ajax({
            url: "/Noop.aspx",
            cache: false,
            success: function(msg){
            },
            error: function(msg) {
            }
        });        
    }
    catch(e){alert(e);}    
}

function siteSearch()
{
    var url_search = "/PageTwoColumnMainRight.aspx?tabid=22";
    var objKeywords = document.getElementById("ctl00_ctl00_txt_KeyWords");
    var keywords = objKeywords.value;
    if("" != keywords && "Search Site by Google" != keywords)
    {
        url_search += "&start=0&q=" + encodeURI(keywords);
        window.location = url_search;
    }
    else
    {
        alert("Please input keyword(s)!");
        objKeywords.focus();
    }
}

function switchLanguage(lang)
{
    var loc =  window.location.href;
    var idx = loc.indexOf("?");
    if(-1 == idx)
        loc += "?language=" + lang;
    else
    {
        var new_s = "";
        var languageExisted = false;
        
        var s = window.location.search;
        var a = s.split("?");
        var b = a[1].split("&"); 
        for(var i=0; i<b.length; i++) 
        { 
            if("" != new_s)
                new_s += "&";
                
            var c = b[i].split("=");
            if(c[0] == "language")
            {
                new_s += "language="+lang;
                languageExisted = true;
            }
            else
                new_s += b[i];
        }
        
        loc = loc.substring(0, idx+1) + new_s;
        if(!languageExisted)
            loc += "&language=" + lang;
    }   
        
    window.location = loc;
}
;