﻿$(document).ready(function() {
    $("#songTop10 > ul").mouseover(function() {
        var str = $(this).find("input").val();
        $("#songTop10 dl").remove();
        $("#songTop10 > ul").show();
        $(this).hide().after("<dl><dt><img src=\"http://img.wmusic.cn/images/disc/" + str.split("|")[3] + "h.gif\" /></dt><dd>" + str.split("|")[1] + " <br /> " + str.split("|")[2] + "<br /> <div style=\"cursor:hand\" onclick=\"play('" + str.split("|")[0] + "',this)\"><img src=\"/images/play.gif\"/></div></dd></dl>");
    });
    
    
});

function mplay(id) {
    var play;
    var width = 480
    var height = 460
    var left = parseInt((screen.availWidth / 2) - (width / 2)); //屏幕居中
    var top = parseInt((screen.availHeight / 2) - (height / 2));
    var windowFeatures = "width=" + width + ",height=" + height + ",status,resizable,scrollbars=auto,left=" + left + ",top=" + top + ",screenX=" + left + ",screenY=" + top;
    var play = window.open("/play/?id=" + id, "MusicPlay", windowFeatures);
    play.focus();
}



function SetCookie(name, value) {
    var Days = 1;
    var exp = new Date();
    exp.setTime(exp.getTime() + 60 * 1000);
    document.cookie = name + "=" + escape(value) + ";path=/;domain=max-star.com.cn;expires=" + exp.toGMTString();
}
function GetCookie(name) {
    var arr, reg = new RegExp("(^| )" + name + "=([^;]*)(;|$)");
    if (arr = document.cookie.match(reg)) return unescape(arr[2]);
    else return null;
}
function delCookie(name) {
    var exp = new Date();
    exp.setTime(exp.getTime() - 1);
    var cval = GetCookie(name);
    if (cval != null) document.cookie = name + "=" + cval + ";expires=" + exp.toGMTString();
}

function chkCookie() {
    SetCookie('chkcoo', '1');
    return GetCookie('chkcoo') == null ? false : true;
}

function play(id) {
    delCookie('wmplay');
    var idstr = id; //checkValue(id);
    if (idstr != '') {
        if (chkCookie()) {
            SetCookie('wmplay', idstr);
            if (GetCookie('wmstatus') != 1) { mplay(idstr); }
        } else { mplay(idstr); }
    } else {
        alert("请选择歌曲!");
    }
}


