﻿document.domain="99mc.com";
function getObject(idname) {if (document.getElementById){return document.getElementById(idname);}else if (document.all){return document.all[idname];}else if (document.layers){return document.layers[idname];}else{return null;}}
function getTags(parentobj, tag){if (parentobj == null){return new Array();}else if (typeof parentobj.getElementsByTagName != 'undefined'){return parentobj.getElementsByTagName(tag);}else if (parentobj.all && parentobj.all.tags){return parentobj.all.tags(tag);}else{return new Array();}}
function GetCookie(name){var arr=document.cookie.match(new RegExp("(^| )"+name+"=([^;]*)(;|$)"));if(arr!=null){return unescape(arr[2]);}return null;}

function clk(type,id)
{
    var url = "";
    var urli=0;
    var object2;
    var object = getTags(getObject(id),"input");
    if(object.length > 133)
    {
        objectlength=133;
    }
    else
    {
        objectlength=object.length;
    }
    for(var i=0;i<object.length;i++)
    {
        object2 = object[i];
        if(object[i].value.replace("@","")>0 && object[i].checked)
        {
            url += object[i].value.replace("@","") + "/";
            urli= urli+1;
        }
    }
    url = url.substring(0,url.length-1);
    if(type=="playadd")
    {
	    if(url.length> 0){Addplay(url);}
	    else{alert("请选择要添加的歌曲!");}
    }
}

function Addplay(url)
{
    var ifplay= GetCookie("jk_ifplay");
    if(ifplay=="1")
    {
        var now = new Date();
        var ss = now.getTime();
        now.setTime(ss + 12*60*60*1000);//12 hours
        document.cookie = "jk_addplay="+(url)+";domain=99mc.com;path=/;expires="+ now.toGMTString();
        alert("恭喜，已经添加到连续播放列表！");
    }
    else
    {
        if(url.indexOf("/")!=-1)
        {   
            url = url.replace(new RegExp("\/","g"),",") ;       
            window.open("http://www.99mc.com/play.php?id="+url,"jk_play") ;
            //window.open("http://www.99mc.com/pp/"+url+"/pp.htm","jk_play");
        }
        else
        {
            //window.open("/zg/play/"+url+".html","jk_play");
            //location = "/zg/play/"+url+".html" ;
            window.open("http://www.99mc.com/zg/play/"+url+".html","jk_play") ;
        }
    }
}

