﻿/// <reference path="jquery-1.3.2-vsdoc.js" />
// Show site Link
function showSite() {
    jQuery("#siteTip").show(300);
    setTimeout("hideSite()", 5000);
}
function hideSite() {
    jQuery("#siteTip").hide(300);
}

//Seo Input Text && showCitys
jQuery(document).ready(function() {
    jQuery("#minSeoText").blur(function() { if (jQuery(this).val() == "") { jQuery(this).val("请输入演出，艺人，场馆名称…"); }; })
    .focus(function() { if (jQuery(this).val() == "请输入演出，艺人，场馆名称…") { jQuery(this).val(""); }; });
    jQuery("#minSeoText").keydown(function(event) {
        var keyCode = event.keyCode ? event.keyCode : event.which ? event.which : event.charCode;
        if (keyCode == 13) {
            jQuery(".seoBtn").click();
        }
    });
    jQuery(".seoBtn").click(function() {
        if (jQuery.trim(jQuery("#minSeoText").val()) != "请输入演出，艺人，场馆名称…" && jQuery.trim(jQuery("#minSeoText").val()) != "") {
            location.href = "/search.aspx?host=" + jQuery(".seoBtn").attr("host") + "&word=" + encodeURI(jQuery.trim(jQuery("#minSeoText").val()));
        }
        else {
            alert("请输入关键字!");
            jQuery("#minSeoText").focus();
        }
    });
    jQuery("#allResults").keydown(function(event) {
        var keyCode = event.keyCode ? event.keyCode : event.which ? event.which : event.charCode;
        if (keyCode == 13) {
            jQuery(".seoBtnY").click();
        }
    });
    jQuery(".seoBtnY").click(function() {
        if (jQuery.trim(jQuery("#allResults").val()) != "")
            location.href = "/search.aspx?host=" + jQuery(".seoBtnY").attr("host") + "&siteid=" + jQuery("#siteinfo").val() + "&word=" + encodeURI(jQuery.trim(jQuery("#allResults").val()));
        else {
            alert("请输入关键字!");
            jQuery("#allResults").focus();
        }
    });

    jQuery("#Etake").click(function() {
        if (jQuery("#Etakecon").css("display") == "none")
            jQuery("#Etakecon").slideDown("slow");
        else {
            jQuery("#Etakecon").slideUp("slow");
        }
    });
    jQuery(".citSha").height(jQuery("#changeCity").height() + 23);

    $(".citys li a").click(function() { window.location.href = $(this).attr("href") });
    jQuery(".citySelect").toggle(function() { jQuery("#changeCity").show(400); }, function() { jQuery("#changeCity").hide(400); });

    $(document).click(function() {if (jQuery("#changeCity:visible").size() > 0) { jQuery(".citySelect").click(); } });

    jQuery("#Jun_hot .inner:first").show();
    jQuery("#Jun_hot  .hd li").each(function(i) {
        jQuery(this).click(function() {
            jQuery("#Jun_hot .hd li").removeClass("on").eq(i).addClass("on");
            if (jQuery(this).attr("id") != "yh") { jQuery("#Jun_hot .hd li:last").removeClass("ps2"); }
            jQuery("#Jun_hot .inner").hide().eq(i).show();
        })
    })
    jQuery("#yh").click(function() {
        jQuery("#yh").removeClass("on");
        jQuery("#yh").addClass("ps2");
    })
    jQuery("#Jun_hot  .inner li").each(function(i) {
        jQuery(this).hover(function() {
            jQuery("#Jun_hot  .inner li").css("background", "none").eq(i).css("background", "#e1e6ef")
        }, function() { jQuery(this).css("background", "none") })
    })

    jQuery(".seoResult li").each(function(i) {
        jQuery(this).hover(function() {
            jQuery(".seoResult li").css("background", "none").eq(i).css("background", "#e1e6ef")
        }, function() { jQuery(this).css("background", "none") })
    })
    //jQuery(".tab li:first").addClass("on");
    jQuery(".brandList:first").show();
    //jQuery(".tabList:first").show();
    //jQuery(".tab li a").attr("href","javascript:void(0)" );
    //if (jQuery(".tabList:first").size() > 0) { go(1) }
    //    jQuery(".tab li").each(function(i) {
    //        jQuery(this).click(function() {
    //            jQuery(".tab li").removeClass("on").eq(i).addClass("on");
    //            jQuery(".brandList").hide().eq(i).show();
    //            jQuery(".tabList").hide().eq(i).show();
    //            go(1);
    //        })
    //    })
    jQuery(".seoTextResult tr").live("mouseover", function() {
        jQuery(this).css("background", "#fef8e5").find(".name").css("font-weight", "bold");
    });
    jQuery(".seoTextResult tr").live("mouseout", function() {
        jQuery(this).css("background", "none").find(".name").css("font-weight", "normal");
    });
    //加载品牌的问题

    //获取页面的加载时间
    function getTranTime() {
        var time = getCookie('page_tran_time');
        return formatFloat(parseFloat(time) / 1000, 4);
    }
    function getCookieVal(offset) {
        var endstr = document.cookie.indexOf(";", offset);
        if (endstr == -1) {
            endstr = document.cookie.length;
        }
        return unescape(document.cookie.substring(offset, endstr));
    }
    function getCookie(name) {
        var arg = name + "=";
        var alen = arg.length;
        var clen = document.cookie.length;
        var i = 0;
        while (i < clen) {
            var j = i + alen;
            if (document.cookie.substring(i, j) == arg) {
                return getCookieVal(j);
            }
            i = document.cookie.indexOf(" ", i) + 1;
            if (i == 0) break;
        }
        return "";
    }
    jQuery("#ShowTime").html("运行时间：" + getTranTime() + "秒");
});
function formatFloat(src, pos)
{
    return Math.round(src*Math.pow(10, pos))/Math.pow(10, pos);
}

function CreatePager(TotalPageCount, CurPage) {
    if (TotalPageCount <= 1) { return ""; }
    var fromstart = CurPage - 2;
    var fromend = CurPage + 2;
    if (CurPage > TotalPageCount) {
        CurPage = TotalPageCount;
    }
    var sb = new StringBuilder();
    sb.Append("<div class=\"pagination\">");
        //首页
        if (TotalPageCount > 1 && CurPage != 1) {
            sb.Append("<a href=\"javascript:void(0)\""); sb.Append(" Page=\"1\""); sb.Append(">"); sb.Append("首页"); sb.Append("</a>");
        }
        else {
            sb.Append("<span class=\"disabled\">首页</span>");
        }
        //执行上一页
        if (CurPage == 1) {
            sb.Append("<span class=\"disabled\">上一页</span>");
        }
        else if (CurPage > 1) {
            sb.Append("<a href=\"javascript:void(0)\""); sb.Append(" Page=\"" + (CurPage - 1) + "\""); sb.Append(">"); sb.Append("上一页"); sb.Append("</a>");
        }
        else {
            sb.Append("<span class=\"disabled\">上一页</span>");
        }
    if (CurPage < 6 && TotalPageCount <= 12) {
        for (var i = 1; i <= TotalPageCount; i++) {
            if (i == CurPage) {
                sb.Append("<span class=\"current\">"); sb.Append(i); sb.Append("</span>");
            }
            else {
                sb.Append("<a href=\"javascript:void(0)\""); sb.Append(" Page=\"" + i + "\""); sb.Append(">"); sb.Append(i); sb.Append("</a>");
            }
        }
        //执行下一页
        if (CurPage == TotalPageCount)//最后一页
        {
            sb.Append("<span class=\"disabled\">下一页</span>");
        }
        else if (TotalPageCount > 1)//如果有下一页
        {
            sb.Append("<a href=\"javascript:void(0)\""); sb.Append(" Page=\"" + (CurPage + 1) + "\""); sb.Append(">"); sb.Append("下一页"); sb.Append("</a>");
        }
        else {
            sb.Append("<span class=\"disabled\">下一页</span>");
        }
        //执行尾页
        if (CurPage == TotalPageCount)//最后一页
        {
            sb.Append("<span class=\"disabled\">尾页</span>");
        }
        else if (TotalPageCount > 1) {
            sb.Append("<a href=\"javascript:void(0)\""); sb.Append(" Page=\"" + TotalPageCount + "\""); sb.Append(">"); sb.Append("尾页"); sb.Append("</a>");
        }
        else {
            sb.Append("<span class=\"disabled\">尾页</span>");
        }
        sb.Append("</div>");
        return sb.ToString();
    }

    if (fromstart > 2) {
        sb.Append("<a href=\"javascript:void(0)\""); sb.Append(" Page=\"1\""); sb.Append(">"); sb.Append(1); sb.Append("</a>");
        sb.Append("…");
        for (var i = CurPage - 2; i < CurPage; i++) {
            sb.Append("<a href=\"javascript:void(0)\""); sb.Append(" Page=\"" + i + "\""); sb.Append(">"); sb.Append(i); sb.Append("</a>");
        }

        if (fromend < TotalPageCount) {
            for (var i = CurPage; i <= CurPage + 2; i++) {
                if (i == CurPage) {
                    sb.Append("<span class=\"current\">"); sb.Append(i); sb.Append("</span>");
                }
                else {
                    sb.Append("<a href=\"javascript:void(0)\""); sb.Append(" Page=\"" + i + "\""); sb.Append(">"); sb.Append(i); sb.Append("</a>");
                }
            }
            sb.Append(" … ");
            for (var i = TotalPageCount - 1; i <= TotalPageCount; i++) {
                sb.Append("<a href=\"javascript:void(0)\""); sb.Append(" Page=\"" + i + "\""); sb.Append(">"); sb.Append(i); sb.Append("</a>");
            }
        }
        else {
            for (var i = CurPage; i <= TotalPageCount; i++) {
                if (i == CurPage) {
                    sb.Append("<span class=\"current\">"); sb.Append(i); sb.Append("</span>");
                }
                else {
                    sb.Append("<a href=\"javascript:void(0)\""); sb.Append(" Page=\"" + i + "\""); sb.Append(">"); sb.Append(i); sb.Append("</a>");
                }
            }
        }
    }
    else {
        for (var i = 1; i <= 5; i++) {
            if (i == CurPage) {
                sb.Append("<span class=\"current\">"); sb.Append(i); sb.Append("</span>");
            }
            else {
                sb.Append("<a href=\"javascript:void(0)\""); sb.Append(" Page=\"" + i + "\""); sb.Append(">"); sb.Append(i); sb.Append("</a>");
            }
        }

        sb.Append("…");
        for (var i = TotalPageCount - 1; i <= TotalPageCount; i++) {
            sb.Append("<a href=\"javascript:void(0)\""); sb.Append(" Page=\"" + i + "\""); sb.Append(">"); sb.Append(i); sb.Append("</a>");
        }
    }
    //执行下一页
    if (CurPage == TotalPageCount)//最后一页
    {
        sb.Append("<span class=\"disabled\">下一页</span>");
    }
    else if (TotalPageCount > 1)//如果有下一页
    {
        sb.Append("<a href=\"javascript:void(0)\""); sb.Append(" Page=\"" + (CurPage + 1) + "\""); sb.Append(">"); sb.Append("下一页"); sb.Append("</a>");
    }
    else {
        sb.Append("<span class=\"disabled\">下一页</span>");
    }
    //执行尾页
    if (CurPage == TotalPageCount)//最后一页
    {
        sb.Append("<span class=\"disabled\">尾页</span>");
    }
    else if (TotalPageCount > 1) {
        sb.Append("<a href=\"javascript:void(0)\""); sb.Append(" Page=\"" + TotalPageCount + "\""); sb.Append(">"); sb.Append("尾页"); sb.Append("</a>");
    }
    else {
        sb.Append("<span class=\"disabled\">尾页</span>");
    }
    sb.Append("</div>");
    return sb.ToString();
}
function StringBuilder() { this._strings_ = new Array(); }
StringBuilder.prototype.Append = function(str) { this._strings_.push(str); }
StringBuilder.prototype.ToString = function() { return this._strings_.join(""); }

//校验票面信息真伪
//Writer;杨含斌
//2009-6-2 11:25:32
function CheckCode() {
    var txtVcode = jQuery.trim(jQuery("#txtVcode").val());
    var txtVcode2 = jQuery.trim(jQuery("#txtVcode2").val());
    var txtVcode3 = jQuery.trim(jQuery("#txtVcode3").val());
    if (txtVcode == "" || txtVcode2 == "" || txtVcode3 == "") {
        alert("请按照正确的验证码格式填写！");
        return false;
    }    
    return true;
}
//滚动插件
(function($) {
    jQuery.fn.extend({
        Scroll: function(opt, callback) {
            //参数初始化
            if (!opt) var opt = {};
            var _this = this.eq(0).find("ul:first");
            var lineH = _this.find("li:first").height(), //获取行高
                        line = opt.line ? parseInt(opt.line, 10) : parseInt(this.height() / lineH, 10), //每次滚动的行数，默认为一屏，即父容器高度
                        speed = opt.speed ? parseInt(opt.speed, 10) : 5000, //卷动速度，数值越大，速度越慢（毫秒）
                        timer = opt.timer ? parseInt(opt.timer, 10) : 3000; //滚动的时间间隔（毫秒）
            if (line == 0) line = 1;
            var upHeight = 0 - line * lineH;
            //滚动函数
            scrollUp = function() {
                _this.animate({
                    marginTop: upHeight
                }, speed, function() {
                    for (i = 1; i <= line; i++) {
                        _this.find("li:first").appendTo(_this);
                    }
                    _this.css({ marginTop: 0 });
                });
            }
            //鼠标事件绑定
            _this.hover(function() {
                clearInterval(timerID);
            }, function() {
                timerID = setInterval("scrollUp()", timer);
            }).mouseout();
        }
    })
})(jQuery);
//收藏开始
var IsCheckUrl = false; //是否已经校验过该URL
(function($) {
    jQuery.fn.CheckNull = function(classname) {
        var _this = this;
        _this.each(function() {
            var v = jQuery.trim(jQuery(this).val());
            if ((v == "" || v == null) && v != undefined) {
                if (!jQuery(this).hasClass(classname)) { jQuery(this).addClass(classname).blur(function() { jQuery(this).CheckNull(classname); }); }
            }
            else {
                jQuery(this).removeClass(classname);
            }
        });
        return _this;
    };
})(jQuery);
//重写弹出层的插件
//Writer:杨含斌2009-7-22 10:51:56
(function($) {
    $.fn.jQueryDialog = function(options) {
        var o = $.extend({
            closeObj: "", //需要添加隐藏事件的jquery对象
            showMask: true, //是否显示遮罩层
            maskAlphaColor: "#000", //遮罩透明色
            maskAlpha: 40 	//遮罩透明度
        }, options);
        var _self = this;
        _self.hide();
        $.fn.jQueryDialog.ShowLayer(o);
        _self.css({ "position": "absolute", "z-index": "10002", left: ($(document).width() - _self.width()) / 2, top: ($(document).scrollTop() + 100) }).show(5)
        $(o.closeObj).die("click");
        $(o.closeObj).live("click", function() {
            $.fn.jQueryDialog.CloseLayer(_self);
        });
    }
    $.fn.jQueryDialog.ShowLayer = function(o) {
        var wsize = $(document).width();
        var hsize = $(document).height();
        var maskStyle = "";
        //创建遮罩层
        if (o.showMask) {
            maskStyle = "position:absolute;top:0;left:0;background:" + o.maskAlphaColor + ";filter:alpha(opacity=" + o.maskAlpha + ");-moz-opacity:" + o.maskAlpha / 100 + ";opacity:" + o.maskAlpha / 100 + "";
        }
        else {
            maskStyle = "position:absolute;top:0;left:0;";
        }
        //增加一个可以遮罩select下拉框的iframe
        if ($("#maskiframe").size() <= 0) { $("body").append("<iframe id=\"maskiframe\" style=\"position:absolute;top:0;left:0;z-index:9999;filter:alpha(opacity=0);-moz-opacity:0;opacity:0;display:none;\"></iframe>"); }
        if ($("#maskLevel").size() <= 0) { $("body").append("<div id=\"maskLevel\" style=\"" + maskStyle + ";z-index:10000;display:none;\"></div>"); }
        $("#maskiframe,#maskLevel").css({ width: wsize, height: hsize });
        if ($("#maskiframe:hidden").size() > 0 && $("#maskLevel:hidden").size() > 0) { $("#maskiframe,#maskLevel").fadeIn("slow"); }
    }
    $.fn.jQueryDialog.CloseLayer = function(obj) {
        $(obj).hide();
        if ($("#maskiframe:visible").size() > 0 && $("#maskLevel:visible").size() > 0) { $("#maskiframe,#maskLevel").fadeOut("slow"); }
    };
})(jQuery);
function indexLogin() {
    return LoginFrom(function() {
        window.location.reload();
    });
}

function ReloadCode() {
    var rnd = new Date();
    document.getElementById('myid').src = '/ValidateCode.aspx?id=' + rnd;
}

function redirect(url) {
    setTimeout(function() { window.location.href = url}, 0);
}



/*finally*/
/// <reference path="jquery-1.3.2-vsdoc.js" />
jQuery(document).ready(function() {
    jQuery(".selcetSeat .inner h5 a:first").addClass("on");
    jQuery(".selcetSeat ul:first").show();
    jQuery(".selcetSeat .inner h5 a").each(function(i) {
        jQuery(this).hover(function() {
            jQuery(".selcetSeat .inner h5 a").removeClass("on").eq(i).addClass("on");
            jQuery(".selcetSeat ul").hide().eq(i).show();
        })
    })

    jQuery(".book .inner:first").show();
    jQuery(".book h1 li").each(function(i) {
        jQuery(this).click(function() {
            jQuery(".book h1 li").removeClass("on").eq(i).addClass("on");
            jQuery(".book  .inner").hide().eq(i).show();
        })
    })

    jQuery(".inner .table").each(function(i) {
        jQuery(this).hover(function() { jQuery(".inner .table").eq(i).find("tr").css("background", "#cfdbee") }, function() { jQuery(".inner .table").eq(i).find("tr").css("background", "#fff") })
    })
    /*weather*/
    jQuery(".overWea .weaCon:first").show();
    jQuery(".overWea ul li").each(function(i) {
        jQuery(this).hover(function() {
            jQuery(".overWea ul li").removeClass("on").eq(i).addClass("on");
            jQuery(".overWea  .weaCon").hide().eq(i).show();
        })
    })

    jQuery(".siteTab .inner:first").show();
    //    jQuery(".siteTab h1 li").each(function(i) {
    //        jQuery(this).click(function() {
    //            jQuery(".siteTab h1 li").removeClass("on").eq(i).addClass("on");
    //            jQuery(".siteTab .inner").hide().eq(i).show();
    //        })
    //    })
    //    jQuery(".siteTab tr").hover(function() {
    //        jQuery(this).css("background", "#e5eaf1")
    //    }, function() { jQuery(this).css("background", "#fff") })
    //针对场馆的logo和图片，如果没有的情况的控制
    var allowExt = ["jpg", "png", "bmp", "gif"]; //定义允许的图片参数
    if (!new RegExp(allowExt.join("\|"), "ig").test($.trim($("#siteFlash>img").attr("src")))) { $("#siteFlash>img").attr("src", "/Images/NoPic.gif"); }
    if (!new RegExp(allowExt.join("\|"), "ig").test($.trim($(".siteHead .hd img").attr("src")))) { $(".siteHead .hd img").hide(); }
    //通过截取字符串来控制显示
    var descript = jQuery("#desc").html();
    jQuery("#desc").data("des", descript);
    showText(0);
});
function getQueryString(key) { var value = ""; var sURL = window.document.URL; if (sURL.indexOf("?") > 0) { var arrayParams = sURL.split("?"); var arrayURLParams = arrayParams[1].split("&"); for (var i = 0; i < arrayURLParams.length; i++) { var sParam = arrayURLParams[i].split("="); if ((sParam[0] == key) && (sParam[1] != "")) { value = sParam[1]; break; } } } return value; }
//加载天气
function LoadWeahter() {
    if (WeatherJson == "" || WeatherJson == undefined) { $("#tianqipic").remove(); return; }
    var data = WeatherJson;
    for (var i = 0; i < 3; i++) {
        var sdata = "";
        switch (i) {
            case 0:
                sdata = data[0].First.split("--");
                break;
            case 1:
                sdata = data[0].Second.split("--");
                break;
            case 2:
                sdata = data[0].Third.split("--");
                break;
        }
        if (sdata.length < 3) continue;
        var strimg = "";
        if (sdata[0].split("转").length > 1) {
            strimg = "<img src=\"http://static.damai.cn/travel/images/weather/" + sdata[0].split("转")[0] + ".gif\" alt=\"" + sdata[0] + "\" /><img  src=\"http://static.damai.cn/travel/images/weather/" + sdata[0].split("转")[1] + "2.gif\" alt=\"" + sdata[0] + "\" />"
        } else {
            strimg = "<img src=\"http://static.damai.cn/travel/images/weather/" + sdata[0].split("转")[0] + ".gif\" alt=\"" + sdata[0] + "\" />";
        }
        $("#tianqi p[name='Weather']:eq(" + i + ")").html(strimg + "<span>" + sdata[0] + "</span><span>" + sdata[1] + "</span><span>" + sdata[2] + "</span>");
    }
}
function showText(flow) {
    if (GetLength(jQuery("#desc").data("des")) > 370) {
        if (flow > 0) {
            jQuery("#desc").html(jQuery("#desc").data("des") + "<a href=\"javascript:void(0)\" onclick=\"showText(0);\" title=\"点击查看全部，再次点击收缩\">(点击收起)</a>");
        }
        else {
            jQuery("#desc").html(SubStr(jQuery("#desc").html(), 370) + "<a href=\"javascript:void(0)\" onclick=\"showText(1);\" title=\"点击查看全部，再次点击收缩\">(点击查看全部)</a>");
        }
    }
}
function SubStr(str, len) {
    if (str == null) { return; }
    var newLength = 0;
    var newStr = "";
    var chineseRegex = /[^\x00-\xff]/g;
    var singleChar = "";
    var strLength = str.replace(chineseRegex, "**").length;
    for (var i = 0; i < strLength; i++) {
        singleChar = str.charAt(i).toString();
        if (singleChar.match(chineseRegex) != null) {
            newLength += 2;
        }
        else {
            newLength++;
        }
        if (newLength > len) {
            break;
        }
        newStr += singleChar;
    }

    if (strLength > len) {
        newStr += "...";
    }
    return newStr;
}
//获取字符串长度
function GetLength(str) {
    if (str == null) { return; }
    var chineseRegex = /[^\x00-\xff]/g;
    var strLength = str.replace(chineseRegex, "**").length;
    return strLength;
}



function getQueryString(key) { var value = ""; var sURL = window.document.URL; if (sURL.indexOf("?") > 0) { var arrayParams = sURL.split("?"); var arrayURLParams = arrayParams[1].split("&"); for (var i = 0; i < arrayURLParams.length; i++) { var sParam = arrayURLParams[i].split("="); if ((sParam[0] == key) && (sParam[1] != "")) { value = sParam[1]; break; } } } return value; }

