﻿
//页面脚本处理
var page = {
    various: {
        //域名
        siteDomain: "http://www.top100.cn/",
        ajaxUrl: "http://www.top100.cn/WebHelper/AjaxHandle.ashx",
        pageImagePath: "http://www.top100.cn/images/",
        userCenterPath: "",
        musicUrl: "http://www.top100.cn/",
        widgetUrl: "http://widget.top100.cn/",
        currentUrl: "",
        loaderimg: "http://www.top100.cn/images/loader.gif"

        //        siteDomain: "http://localhost:3359/",
        //        ajaxUrl: "http://localhost:3359/WebHelper/AjaxHandle.ashx",
        //        pageImagePath: "http://localhost:3359/images/",
        //        userCenterPath: "",
        //        musicUrl: "http://localhost:3359/",
        //        widgetUrl: "http://widget.top100.cn/",
        //        currentUrl: "",
        //        loaderimg: "http://localhost:3359/images/loader.gif"


    },
    header: {
        logoutHandler: null,
        //设置用户登录信息
        setUserInfo: function(userId, userName, userHeaderPic) {
            if (userId != "") {
                $("#aUserName").text(userName);
                $("#iUserHeaderPic").parent().attr("href", page.various.siteDomain + "user/info-shtml");
                $("#aUserName").attr("href", page.various.siteDomain + "user/info-shtml");
                $("#iUserHeaderPic").attr("src", userHeaderPic);
                $("#LoginStatus_NotLogin").hide();
                $("#LoginStatus_UserPic").show();
                $("#LoginStatus_IsLogin").show();
            } else {
                $("#LoginStatus_NotLogin").show();
                $("#LoginStatus_UserPic").hide();
                $("#LoginStatus_IsLogin").hide();
                $("#aUserName").removeAttr("href");
                $("#iUserHeaderPic").removeAttr("src");
            }
        },
        login: function() {
            window.location.href = "http://passport.top100.cn/login.aspx?returnurl=" + encodeURI(window.location.href);
        },
        //登出
        logout: function() {
            page.users.logout(function() {
                page.header.setUserInfo("");
                if (page.header.logoutHandler != null && typeof (page.header.logoutHandler) == 'function') {
                    page.header.logoutHandler();
                }
            });
        },
        //检查当前用户状态
        checkUserStatus: function() {
            var user = page.users.getCurrentUserId();
            if (user != null) {
                page.header.setUserInfo(user.id, user.name, user.headpic);
            } else {
                page.header.setUserInfo("");
            }
            $("#UserStatus").removeAttr("style");
        }
    },
    //搜索相关
    search: {
        searchTypePanelStatus: false,
        searchTypeList: [{ "name": "音乐", "link": "index.aspx" }, { "name": "单曲", "link": "allsong.aspx" }, { "name": "专辑", "link": "allalbum.aspx" }, { "name": "MV", "link": "allmv.aspx" }, { "name": "艺术家", "link": "allartist.aspx" }, { "name": "歌词", "link": "alllyric.aspx"}],
        openSearchTypePanel: function() {
            if (page.search.searchTypePanelStatus) {
                page.search.closeSearchTypePanel();
            } else {
                var html = "";
                for (var i = 0; i < page.search.searchTypeList.length; i++) {
                    if (page.search.searchTypeList[i].name != $("#currentSearchType").text()) {
                        html += "<a href=\"javascript:void(0)\" onclick=\"javascript:page.search.changeSearchTypePanel('" + page.search.searchTypeList[i].name + "');\">" + page.search.searchTypeList[i].name + "</a>";
                    }
                }
                $("#searchTypePanel").html(html);
                $("#searchTypePanel").show();
                page.search.searchTypePanelStatus = true;
                $(document).bind("click.closeSearchType", function(event) {
                    var element = null;
                    if ($.browser.msie) {
                        element = document.srcElement;
                    }
                    else if ($.browser.mozilla) {
                        element = event ? event.target : null;
                    }
                    if (element.id != "searchTypePanel" && (element.Parent == null ? true : element.Parent.id != "searchTypePanel") && element.id != "searchTypeHandler") {
                        page.search.closeSearchTypePanel();
                    }
                })
            }
        },
        changeSearchTypePanel: function(text) {
            $("#currentSearchType").text(text);
            page.search.closeSearchTypePanel();
        },
        closeSearchTypePanel: function() {
            $("#searchTypePanel").hide();
            page.search.searchTypePanelStatus = false;
            $(document).unbind("click.closeSearchType");
        },
        //搜索
        search: function() {
            var txtKey = $("#txtSearch").val();
            var link = "";
            for (var i = 0; i < page.search.searchTypeList.length; i++) {
                if (page.search.searchTypeList[i].name == $("#currentSearchType").text()) {
                    link = page.search.searchTypeList[i].link;
                }
            }
            location.href = page.various.siteDomain + "search/" + link + "?keyword=" + encodeURIComponent(txtKey);
        },
        //初始化
        init: function() {

            var siteSear = $("#txtSearch");
            siteSear.autocomplete({ url: page.various.siteDomain + "ashx/ServiceRouter.ashx?reqType=search&q={0}", sureElement: "#sureSearch", parseResultToArray: page.search.google_parseResultToArray, autocompleteSure: page.search.search });

            //page.search.userLinkBind();
            if ($("#areaDD").length > 0)
                artistIndexInit();
        },
        //用户模块连接初始化
        userLinkBind: function() {
            if ($(".uli > li > a").length > 0) {
                $(".uli > li > a").each(function(m) {
                    var menuurl = $(".uli > li > a:eq(" + m + ")").attr("href");
                    var cururl = page.various.currentUrl.substring(page.various.currentUrl.lastIndexOf('/'));
                    menuurl = menuurl.substring(menuurl.lastIndexOf('/'));
                    if ($.trim(cururl) == $.trim(menuurl)) {
                        $(".uli > li:eq(" + m + ")")[0].className = "c";
                        return;
                    }
                });
            }
        },
        //将返回结果，放到一个数组中
        google_parseResultToArray: function(data) {
            eval(data);
            if (!searchList) return null;
            var parsed = [];
            for (var i = 0; i < searchList[1].length; i++) {
                parsed[i] = searchList[1][i][0]; ;
            }
            return parsed;
        }
    },
    //专辑部分
    album: {
        //初始化搜藏专辑 判断用户是否登录了
        initCollectAlbum: function(cookieName, albumId) {
            if (page.common.getCookie(cookieName) != null) {
                page.album.collectAlbum(albumId)
            } else {
                page.ajaxlogin.openLogon(); page.ajaxlogin.cloLogonEvent = function() {
                    var userid = parseInt(puserid); if (page.ajaxlogin.loginLater(userid)) page.album.collectAlbum(albumId);
                }

            };
        },
        //收藏专辑
        collectAlbum: function(id) {
            $.post(page.various.ajaxUrl + "?req=CollectAlbum", { albumId: id }, function(ret) {
                switch (ret) {
                    case "1": alert('收藏成功'); break;
                    case "0": alert('您已经收藏过了'); break;
                    case "-1": alert('收藏失败'); break;
                }
            }
            )
        },
        //初始化通用评论 判断用户是否登录了
        initAlbumComment: function(cookieName, albumId, commentType) {
            if (page.common.getCookie(cookieName) != null) {
                page.album.addAlbumComment(albumId, commentType)
            } else {
                page.ajaxlogin.openLogon(); page.ajaxlogin.cloLogonEvent = function() {
                    var userid = parseInt(puserid); if (page.ajaxlogin.loginLater(userid)) page.album.addAlbumComment(albumId, commentType);
                }

            };
        },
        //增加通用评论
        addAlbumComment: function(id, commentType) {
            var scontent = document.getElementById("txtComment").value;
            if (scontent.length <= 0) {
                alert("请填写评论内容!");
                return;
            }
            if (scontent.length > 100) {
                alert("您的评论内容多于100字!");
                return;
            }

            //防止重复内容连续提交
            if ($("#txtComment").data("old") == scontent) {
                alert('请不要重复提交');
                return;
            }




            $.post(page.various.ajaxUrl + "?req=AddAlbumComment", { albumId: id, content: scontent, type: commentType }, function(ret) {
                switch (ret) {
                    case "1":
                        oldscontent = document.getElementById("comment_area").innerHTML;
                        document.getElementById("comment_area").innerHTML = "<ul class=\"co2\"><li class=\"l2\"><a  class=\"a2\">您的留言</a><p>1秒前</p></li><li class=\"l3\">" + page.common.encodeHTML(scontent) + "</li></ul>" + oldscontent;
                        //记住上次评论内容!防止下次重复发
                        $("#txtComment").data("old", document.getElementById("txtComment").value); break;
                    case "-1": alert('评论失败'); break;
                }


            });


        },
        //获取专辑评论列表
        getAlbumComment: function(albumid, pgIndex, commentType) {
            $.get(page.various.ajaxUrl, { req: "GetAlbumCommentPager", itemid: albumid, page: pgIndex, type: commentType }, function(retData) {
                $("#comment_main").html(retData);
            }
          )

        },
        //播放电台
        playBraadCast: function(songsIdStr) {
            page.common.openPlayer(songsIdStr);
        },
        //获取widget
        getWidget: function(songsIdStr) {
            window.open(page.various.widgetUrl + "?Type=Song&ProductId=" + songsIdStr);
        }
    },
    artist: {
        photo: {
            imgList: null,
            length: 0,
            curimg: 1,
            getImgListHtml: function(imgList, size, callBack) {
                var imghtml = "";
                if (imgList != null && imgList.length != 0) {
                    for (var i = 0; i < imgList.length; i++) {
                        imghtml += "<li><a href=\"" + imgList[i].imageurl + "\"  title=\"支持键盘左右键换图片\"><img src=\"" + imgList[i].breimageurl + "\"  height=\"100px\"  longdesc=\"\"  alt=\"支持键盘左右键换图片\" onerror=\"this.src=page.various.loaderimg;\"   /></a></li>";
                    }

                    if (document.getElementById("ViewPhoto")) {
                        $("#ViewPhoto >ul").html(imghtml);
                        if (typeof callBack == 'function') { //回调
                            callBack();
                        }
                    }
                }
            },

            init: function(singerid, size, callBack) {
                $.ajax({
                    type: "Get",
                    url: page.various.siteDomain + "ashx/ServiceRouter.ashx",
                    data: "reqtype=imagelist&singerid=" + singerid + "&time=" + new Date().getTime().toString(),
                    async: true,
                    success: function(msg) {
                        if (msg.length > 0) {
                            eval("page.artist.photo.imgList=" + msg);
                            page.artist.photo.length = page.artist.photo.imgList.list.length;
                            page.artist.photo.getImgListHtml(page.artist.photo.imgList.list, size, callBack);
                            $("#loadingImg").hide();
                        }
                        else {
                            $("#loadingImg").show();
                            $("#gallery").hide();
                        }
                    }
                });



            }
        }

    },
    //用户部分
    users: {
        headUpload: function(imgUserId) {
            $("#upinfo")[0].innerHTML = "";
            //验证格式与大小
            if (page.users.validUpload()) {
                $("#upinfo").ajaxStart(function() { $(this).html(" 正在上传..."); });
                //ajax  start
                $.ajaxFileUpload({ url: page.various.siteDomain + "upload/upphoto.ashx?imgtype=user&imgitemid=" + imgUserId,
                    secureuri: false, fileElementId: "fileupload",
                    dataType: "json",
                    success: function(ret) {
                        //上传后获得的新图片地址
                        var newImg = ret.imgurl;
                        $.post(page.various.ajaxUrl + "?reg=AddOrUpdateHeadPic", { img: newImg }, function(ret) { if (ret == "1") { $("#upinfo").html(""); $("#imgface").attr("src", newImg); } else { $("#upinfo").html("上传失败!"); } });
                    },
                    error: function(data, status, e) {
                        $("#upinfo").html("失败:服务器忙或图片大小超过限制");
                    }
                }
                                 );
            }
        },
        validUpload: function() {
            var ret = false;
            var s = $("#fileupload").val();
            if ($.trim(s) == "") {
                $("#upinfo").html(" 请输入图片地址! ");
                $("#fileupload").focus();
            } else {
                s = s.substr(s.lastIndexOf(".") + 1, 3);
                if (s != "gif" && s != "jpg" && s != "png") {
                    $("#upinfo").html(" 请选择正确的图片格式! ")
                } else {
                    var img = new Image();
                    // 限制上传的文件大小，单位(k)  ;
                    var FileMaxSize = 100;
                    img.src = $("#fileupload").val();
                    //下面这些代码 并没有作用 只有IE支持 而且fileSize 必须要 img  onload完毕才有意义  这里明显 永远是-1 
                    //真正的 大小判断在 C#里
                    if (img.fileSize > FileMaxSize * 1024) {
                        $("#upinfo").html(" 请上传小于100K的图片 ");
                        $("#fileupload").focus();
                    }
                    else {
                        ret = true;
                    }
                }
            }
            return ret;
        },
        //获取当前登录用户信息
        getCurrentUserId: function() {
            var user = null;
            $.ajax({
                type: "Get",
                url: page.various.siteDomain + "ashx/ServiceRouter.ashx",
                data: "reqtype=user&method=currentuser&time=" + new Date().getTime().toString(),
                async: false,
                success: function(msg) {
                    if (msg.length > 0) {
                        eval(msg);
                        user = login_user;
                    }
                }
            });
            return user;
        },
        //登出
        logout: function(func) {
            $.ajax({
                type: "Get",
                url: page.various.siteDomain + "ashx/ServiceRouter.ashx",
                data: "reqtype=user&method=logout&time=" + new Date().getTime().toString(),
                async: false,
                success: function(msg) {
                    func();
                }
            });
        },
        //登录
        login: function(userName, password, func) {
            $.ajax({
                type: "Get",
                url: page.various.siteDomain + "ashx/ServiceRouter.ashx",
                data: "reqtype=user&method=login&username=" + userName + "&password=" + password + "&time=" + new Date().getTime().toString(),
                async: false,
                success: function(msg) {
                    if (msg == "True") {
                        func();
                    }
                }
            });
        }
    },
    //公用部分
    common: {
        //仿造server.encodeHTML 替换掉关键字符XSS  by jianan.wang
        encodeHTML: function(str) {
            return str.replace(/>/g, '&gt;').replace(/</g, '&lt;').replace(/\''/g, '&#39;').replace(/\""/g, '&quot;').replace(/\r/g, '<br   />');
        },
        //选中所有指定name属性的选择框
        selectAll: function(checkerName, sender) {
            $("input[name='" + checkerName + "'][type='checkbox']").attr("checked", sender.checked);
        },
        //获取选中的checked的argument参数
        getSelected: function(checkerName) {
            var arrayList = $("input[name='" + checkerName + "'][type='checkbox'][checked]");
            var resultStr = "";
            arrayList.each(function(e) {
                resultStr = resultStr.concat(",").concat(arrayList[e].getAttribute("argument"));
            });
            if (resultStr.length > 0) {
                resultStr = resultStr.substring(1, resultStr.length);
            }
            return resultStr;
        },
        //切割掉列表中单元项的首位标志符
        trimArrayItemFirstFlag: function(arrayStr) {
            var arrayList = arrayStr.split(',');
            for (var i = 0; i < arrayList.length; i++) {
                arrayList[i] = arrayList[i].substring(1);
            }
            return arrayList.join(',');
        },
        //播放,/*加密后的产品id,多个用逗号分隔,超过80首则截断*/
        openPlayer: function(productids) {
            var paramKey = "artist";
            if (productids.indexOf('m') == 0) paramKey = "song";
            if (productids.indexOf('s') == 0) paramKey = "album";
            if (productids.indexOf('p') == 0) paramKey = "top100songlist";
            var url = page.various.siteDomain + "audition/flplayer.html?" + paramKey + "=" + page.common.trimArrayItemFirstFlag(productids);
            var playWindow = window.open(url, "playWindow", "width=980px,height=590px,top=100px,left=120px,scrollbars=no,resizable=yes");
            playWindow.focus();
        },
        //下载，/*加密后的产品id,多个用逗号分隔,超过80首则截断*/
        openDownload: function(productids) {
            window.open(page.various.siteDomain + "download/download.aspx?Productid=" + page.common.trimArrayItemFirstFlag(productids));
        },
        //获取cookie值
        getCookie: function(name) {
            try {
                var arr = document.cookie.match(new RegExp("(^| )" + name + "=([^;]*)(;|$)"));
                if (arr != null) return unescape(arr[2]); return null;
            } catch (e) {
                return null;
            }
        },
        //设置cookie值
        setCookie: function(name, value, days) {
            try {
                var exp = new Date();
                exp.setTime(exp.getTime() + days * 24 * 60 * 60 * 1000);
                //document.cookie = name + "=" + escape(value) + ";expires=" + exp.toGMTString() + ";path=/";
                document.cookie = name + "=" + escape(value) + ";expires=" + exp.toGMTString() + ";path=/;domain=top100.cn";
            } catch (e) {
                return null;
            }
        },
        /*根据event取得触发事件的元素*/
        getEventSrc: function(evt) { var me = evt.srcElement ? evt.srcElement : evt.target; return me; },
        /*动态添加脚本文件,不能在void(0)标签A中onclick触发,因涉及到脚本加载完毕后的输出值*/
        createScript: function(_src) {
            var _elem = document.createElement("script");
            _elem.src = _src
            _elem.type = "text/javascript";
            document.getElementsByTagName("head")[0].appendChild(_elem);
            return _elem;
        },
        /*判断元素是否加载完毕*/
        readyHander: function(redyElem, readyFunc, argumentArray) {
            if (document.all) {
                redyElem.onreadystatechange = function() {//IE用    
                    var state = redyElem.readyState;
                    if (state == "loaded" || state == "interactive" || state == "complete") {
                        if (argumentArray) readyFunc.apply(this, argumentArray); //readyFunc(); 
                        else readyFunc();
                    }
                };

            } else {
                redyElem.onload = function() {//FF用    
                    if (argumentArray) readyFunc.apply(this, argumentArray); //readyFunc(); 
                    else readyFunc();
                };
            }
        },
        /*************************
        判断是否是空或者空格
        *************************/
        checkspace: function(checkstr) {
            var str = ''; for (i = 0; i < checkstr.length; i++) { str = str + ' '; }
            return (str == checkstr);
        },
        ScreenConvert: function() {
            var browser = new this.Browser();
            var objScreen = $("#ScreenOver")[0];
            if (!objScreen) {
                var objScreen = document.createElement("div");
            }
            var oS = objScreen.style;
            objScreen.id = "ScreenOver";
            oS.display = "block";
            oS.top = oS.left = oS.margin = oS.padding = "0px";
            var doc = document.documentElement;
            wh = doc.scrollHeight > doc.clientHeight ? doc.scrollHeight : doc.clientHeight;
            oS.width = "100%";
            oS.height = wh + 'px';
            oS.position = "absolute";
            oS.zIndex = "3";
            if ((!browser.isSF) && (!browser.isOP)) {
                oS.background = "#cccccc";
            }
            else {
                oS.background = "#cccccc";
            }
            oS.filter = "alpha(opacity=40)";
            oS.opacity = 40 / 100;
            oS.MozOpacity = 40 / 100;
            document.body.appendChild(objScreen);
        },
        ScreenClean: function() {
            var objScreen = $("#ScreenOver")[0];
            if (objScreen) {
                objScreen.style.display = "none";
            }
        },
        Browser: function() {
            var ua, s, i;
            this.isIE = false;
            this.isNS = false;
            this.isOP = false;
            this.isSF = false;
            ua = navigator.userAgent.toLowerCase();
            s = "opera";
            if ((i = ua.indexOf(s)) >= 0) {
                this.isOP = true;
                return;
            }
            s = "msie";
            if ((i = ua.indexOf(s)) >= 0) {
                this.isIE = true;
                return;
            }
            s = "netscape6/";
            if ((i = ua.indexOf(s)) >= 0) {
                this.isNS = true;
                return;
            }
            s = "gecko";
            if ((i = ua.indexOf(s)) >= 0) {
                this.isNS = true;
                return;
            }
            s = "safari";
            if ((i = ua.indexOf(s)) >= 0) {
                this.isSF = true;
                return;
            }
        }


    },
    ajaxlogin: {

        //异步登陆
        winLongon: function() {
            var name = $.trim($("#winUname").val());
            if (page.common.checkspace(name)) {
                alert("请填写用户名");
                return;
            }
            var pwd = $("#winPwd").val();
            if (page.common.checkspace(pwd)) {
                alert("请填写密码");
                return;
            }
            var postUrl = site_domian + "WebHelper/AjaxHandle.ashx" + "?reqMtd=EncryptUser&u=" + escape(name) + "&p=" + escape(pwd);
            $.getJSON(postUrl, function(ret) {
                if (ret.uname != "") {
                    var url = ajax_loginurl + "?u=" + encodeURIComponent(ret.uname) + "&p=" + encodeURIComponent(ret.pwd);
                    page.common.readyHander(page.common.createScript(url), page.ajaxlogin.cloLogonEvent);
                }
                else {
                    alert("系统异常，请联系管理员!");
                    return;
                }
            })

        },
        //登陆操作后的统一函数调用（不包含具体操作的业务调用）
        loginLater: function(uid) {
            if (uid > 0) {

                page.ajaxlogin.closeLogon();
                //*******临时修正pheadImg
                page.header.setUserInfo(puserid, pusername, pheadImg)//初始化是否登录区域
                return true;
            }
            else {
                alert("登陆失败!请重新输入账号和密码");
                return false;
            }
        },
        cloLogonEvent: {}, /*成功登录后执行的函数*/
        openLogon: function() {
            var logonHtml = '<div id="winLogon" class="win1" style="height:192px;width:626px;"><div class="login"><div class="tit2"><h3 id="winLogonTit">欢迎回家，请登陆</h3><p id="closewinLogon" onclick="page.ajaxlogin.closeLogon();">关闭窗口</p></div><div class="col3">';
            logonHtml += '<table border="0" cellspacing="0" cellpadding="0"><tr><td class="td1">用户名：</td><td><input name="" id="winUname" type="text" class="inp1" value="" /></td></tr>';
            logonHtml += '<tr><td class="td1">密码：</td><td><input name="" id="winPwd" type="password" class="inp1" value="" onkeydown="if(event.keyCode==13) page.ajaxlogin.winLongon();"/> <a href="#">忘记密码？</a></td></tr>';
            logonHtml += '<tr><td class="td1">&nbsp;</td><td><span id="abcdef" class="errortxt"></span></td></tr>';
            logonHtml += '<tr><td class="td1">&nbsp;</td><td><p class="p2"><a href="javascript:page.ajaxlogin.winLongon();">登&nbsp;陆</a><a href="javascript:closeLogon();">取&nbsp;消</a></p></td></tr></table></div>';
            logonHtml += '<div class="col4"><div class="inav"><h4>还不是巨鲸用户？现在赶紧注册！</h4>';
            //logonHtml += '<p>1.download free music to listen to for free.</p>';
            logonHtml += '<p class="p3"><a href="http://passport.top100.cn/reg/first.aspx">免费注册</a></p></div></div><p class="clearit">&nbsp;</p></div></div>';
            $("body").append(logonHtml);
            page.common.ScreenConvert();
            //$("#winLogon").dragwindow({ coverSelect: true }); //,transparence:true
            $("#winLogonTit").dragwindow({ target: "#winLogon", closeElements: "closewinLogon" });
        },
        closeLogon: function() {
            //$("#winLogon").closeDragwindow(false);
            $("#winLogon").parent().hide();
            $("#winLogon").remove();
            if ($("#ScreenOver").length > 0)
                page.common.ScreenClean();
        }
    }

}
//关闭播放列表 整合operate_songs.js的时候用
function closePlaylist() {
    $("#pltSuccessWindow").closeDragwindow(true);
    if ($("#ScreenOver").length > 0)
        page.common.ScreenClean();
}
//弹出添加播放列表窗口
function showplaylistProcess() {
    if (page.common.getCookie("top100ssoid") != null) {
        $("#pltSuccessTitle").dragwindow({ target: "#pltSuccessWindow", closeElements: "#closepltSuccess" });
        //$("#pltSuccessWindow").dragwindow({ coverSelect: true });
        addSongsToPlt(); //初始化用户已有的播放列表
    }
    else {
        page.ajaxlogin.openLogon();
        page.ajaxlogin.cloLogonEvent = function() {
            var userid = parseInt(puserid);
            if (page.ajaxlogin.loginLater(userid)) {//弹出窗口
                $("#pltSuccessTitle").dragwindow({ target: "#pltSuccessWindow", closeElements: "#closepltSuccess" });
                //$("#pltSuccessWindow").dragwindow({ coverSelect: true });
                addSongsToPlt(); //初始化用户已有的播放列表
            }

        };
    }
}
//添加歌曲到widget
function addSongsToWidget(productids) {
    if (page.common.getCookie("top100ssoid") != null) {
        if (page.common.getCookie("wgp_musicContent") != null)
            productids += "," + page.common.getCookie("wgp_musicContent");
        page.common.setCookie("wgp_musicContent", productids, 30);
        window.location.href = "http://widget.top100.cn/step1.aspx";
    }
    else {
        page.ajaxlogin.openLogon();
        page.ajaxlogin.cloLogonEvent = function() {
            var userid = parseInt(puserid);
            if (page.ajaxlogin.loginLater(userid)) {//弹出窗口
                if (page.common.getCookie("wgp_musicContent") != null)
                    productids += "," + page.common.getCookie("wgp_musicContent");
                page.common.setCookie("wgp_musicContent", productids, 30);
                window.location.href = "http://widget.top100.cn/step1.aspx";
            }

        };
    }
}
function artistIndexInit() {
    var curUrl = page.various.currentUrl.replace(page.various.siteDomain, "../");
    if ($("a[href='" + curUrl + "']").length > 0)
        $("a[href='" + curUrl + "']").addClass("sel");
}
//播放电台
function playBraadCast() {
    page.common.openPlayer(hotSongs);
}
//乐库的flash调用的公用函数
function BrowseFlLink(_url) { window.location.href = _url; }
function PlayFlLink(_url) { page.common.openPlayer(_url); }



//兼容变量
var page_image_path = page.various.pageImagePath;
var site_domian = page.various.siteDomain;
var usercenter_path = page.various.userCenterPath;
var music_url = page.various.musicUrl;
var ajax_url = page.various.ajaxUrl;

//兼容变量结束

//艺术家或者用户的全局变量（有些变量作用待看代码）
var itemtype = 2;
var coll_itemtype = 2;
var ajax_loginurl = "http://passport.top100.cn/ajax/logon.ashx";


