var DomainUrl = top.location.hostname;
function get_cookie(_name){
	var Res=eval('/'+_name+'=([^;]+)/').exec(document.cookie); return Res==null?'':unescape(Res[1]);
};
//打开播放后暂停首页播放
//if(window.opener.Ylmv_Player){window.opener.Ylmv_Player.controls.pause();}
function SetCookie(name, value){
	var expdate = new Date();
	var argv = SetCookie.arguments;
	var argc = SetCookie.arguments.length;
	var expires = (argc > 2) ? argv[2] : null;
	var path = (argc > 3) ? argv[3] : null;
	var domain = (argc > 4) ? argv[4] : null;
	var secure = (argc > 5) ? argv[5] : false;
	if(expires!=null) expdate.setTime(expdate.getTime() + ( expires * 1000 ));
	document.cookie = name + "=" + escape (value) +((expires == null) ? "" : ("; expires="+ expdate.toGMTString()))+((path == null) ? "" : ("; path=" + path)) +((domain == null) ? "" : ("; domain=" + domain))+((secure == true) ? "; secure" : "");
};

function set_history(_url, _name, _id){
    var current_str = _id + "#" + _name + "#" + _url + "*ylmv*";
    var cookie_info = get_cookie("ylmvHistory");
    var deal_cookie="";
    if( "" != cookie_info){
		cookie_info = cookie_info.split("*ylmv*");
        var N = (cookie_info.length > 18) ? 18 : cookie_info.length - 1;
		for(var i=0; i<N; i++){
            if(current_str != cookie_info[i] + "*ylmv*" && '' != cookie_info[i]) deal_cookie += (cookie_info[i] + "*ylmv*");
        }
	}
    current_str = ('' == deal_cookie) ? current_str : current_str + deal_cookie;
    SetCookie("ylmvHistory", current_str, 48 * 3600, "/", DomainUrl, false);
};
function get_history(){
	var cookie_info=get_cookie("ylmvHistory").split("*ylmv*");
    var N = cookie_info.length - 1;
    var history_list = "", infos, s;
	for(var i=0; i<N; i++){
                var ii = i+1;
		infos = cookie_info[i].split("#");
        //s = (i == 0) ? 'class="n selected"' : 'class="n" onMouseOver="over_bg(this)" onMouseOut="out_bg(this)"';
        history_list += '<li><a title="'+infos[1]+'" href="'+infos[2]+'" target="_self">'+infos[1]+'</a></li>';
	}
      document.getElementById("dance_list").innerHTML = history_list;
};
function del_history(){
    SetCookie("ylmvHistory", "", null, "/", DomainUrl, false);
    document.getElementById("dance_list").innerHTML = "<li>&nbsp;清除试听记录成功!</li>";
};

function over_bg(t){ t.style.background = '#FFFFFF'; };
function out_bg(t){ t.style.background = '#FFFFFF'; };