function clrActive(){
    var indexTabs = getId("index_tabs").getElementsByTagName("li");
    for (var i = 0; i < indexTabs.length; i ++) {
        indexTabs[i].className = "";
    }
}

function focusTab(which,i) {
    if(which.className == "active"){return};
    clrActive();
    which.className = "active";

    var pop = getId("pop_box");
    var classical = getId("class_box");
    var yuan = getId("yuan_box");
    var artist = getId("artist_box");
    if(i == "pop"){
        classical.style.display = "none";
        yuan.style.display = "none";
        artist.style.display = "none";
        pop.style.display = "block";
    }
    else if(i == "class"){
        yuan.style.display = "none";
        artist.style.display = "none";
        pop.style.display = "none";
        classical.style.display = "block";
    }
    else if(i == "yuan"){
        artist.style.display = "none";
        pop.style.display = "none";
        classical.style.display = "none";
        yuan.style.display = "block";
    }
    else if(i == "artist"){
        pop.style.display = "none";
        classical.style.display = "none";
        yuan.style.display = "none";
        artist.style.display = "block";
    } else {
        return;
    }
}

function sltAll(id){
    var slts = getId(id).getElementsByTagName("input");
    for (var i = 0; i < slts.length; i ++) {
        if(slts[i].type == "checkbox") {
//            slts[i].setAttribute("checked","checked");
            slts[i].checked = true;
        }
    }
}
function unSlt(id){
    var slts = getId(id).getElementsByTagName("input");
    for (var i = 0; i < slts.length; i ++) {
        if(slts[i].type == "checkbox") {
//            slts[i].removeAttribute("checked","checked");
            slts[i].checked = false;
        }
    }
}

plist = "templates/default/images/flash/playlist.xml";
function valueCheck(id){

}
function trans (id,url) {
	plist = url;
    $(id).effect('transfer', {to: 'list_target', className:'transfer' }, 600);
    setTimeout("rebuildPlayer(plist)",650);
}

function rebuildPlayer(plist)
    {
      var s2 = new SWFObject("templates/default/images/flash/mediaplayer.swf", "playlist", "180", "248", "7");
          s2.addVariable("file", plist);
          s2.addVariable("backcolor", "0x5d8121");
          s2.addVariable("frontcolor", "0xffffff");
          s2.addVariable("lightcolor", "0xcee521");
          s2.addVariable("displayheight", "0");
          s2.addVariable("overstretch", "fit");
          s2.addVariable("autostart", "true");
          s2.addVariable("showicons", "false");
          s2.addVariable("shuffle", "false");
          s2.addVariable("width", "180");
          s2.addVariable("height", "248");
          s2.addVariable("bufferlength", "3");
          s2.addVariable("repeat", "true");
          s2.addParam("wmode", "transparent");
          s2.write("player");
    }