//wangkt todo start
var mp_w=1000;
var mp_h = 660;
//wangkt todo end
var toneutil_w = 430;
var exp_cookie = 2; 
var cookie_lim = 2.5;
var share_lim = 10;
//*********************
var ALL_CHECKBOX = 0;
var ANTICHECK_BOX = 0;
var ALL_PLAY = 0;
var CHECKBOXLEN = 0;
//*******************
if(typeof(sessionId)=="undefined") sessionId = ""+new Date().getTime();

//scenetype  0：普通铃音   1：情景彩铃   2：已订购的普通铃音   3：已订购的情景彩铃  4:打折铃音 10: 营销歌友会
//试听铃音
var listenWindow;
//wangkt todo start
function listentonenew(toneFile,toneID,toneCode,toneName,singerName,desc,price,toneValidDay,spName,updateTime,downTimes,modid,scenetype,isdiscount)
{
	if(typeof(scenetype)=="undefined") scenetype= "0";
	if(typeof(isdiscount)=="undefined") isdiscount= "0";
	if(typeof(sessionId)=="undefined") sessionId= "123";
	
    var info = sub_url(toneFile)+"|"+toneID+"|"+toneCode+"|"+toneName+"|"+singerName+"|"+desc+"|"+price+"|"+toneValidDay+"|"+spName+"|"+updateTime+"|"+downTimes+"|"+modid+"|"+scenetype+"|"+isdiscount;

	mp_putMCookie(info);

    if( listenWindow==null || typeof(listenWindow)== 'undefined' || listenWindow.closed)
	{
		var lisurl = "/user/mplayer_beta.screen?option=1";
		var left = Math.floor((screen.width - mp_w) / 2);
		var top = Math.floor((screen.height - mp_h) / 2);
		listenWindow = window.open(lisurl,"pn_"+sessionId,"resizable=yes,width="+mp_w+",height="+mp_h+",top="+top+",left="+left+",scrollbars=1");
		listenWindow.focus();
	}
	else
	{
		listenWindow.MPlayer.play_list();
		listenWindow.MPlayer.splay();
		listenWindow.Operator.init(1);
		listenWindow.focus();
	}

	try{ if($("body[desc=indexPage_on]").length > 0){ PLBOX.doPause(); }}catch(e){}

}
//wangkt todo end
function sub_url(str_old)
{
	if(str_old.indexOf("/al/") != -1)
	return str_old.substring((str_old.indexOf("/al/")+4));
	else return str_old;
}
function chSceneFlag(s)
{
	if(s.split("|").length == 13) return  (s+"|0");
	else if(s.split("|").length == 12) return  (s+"|0|0");
	else return s;
}
//wangkt todo start
function mp_all_play(n)
{
	var temp_str = "";
	var t_box2 = document.getElementsByName(n);

	if(typeof(t_box2.checked) != "boolean"){
		//more
	   var length = t_box2.length;
	   for(i=0;i<length;i++)
		{
			if(t_box2[i].checked)
			{ 
		        temp_str += "#" + sub_url(chSceneFlag(t_box2[i].getAttribute("info")));
			}
		}
	}else{
       //singer
	    if(t_box2.checked)
		{ 
			temp_str += "#" + sub_url(chSceneFlag(t_box2.getAttribute("info")));
		}
	}
	
    if(temp_str.trim()=="")
	{
		alert("请先选择要播放的铃音");
		return false;
	}
	else
	{
	  temp_str = temp_str.substring(1,temp_str.length);
	  mp_putMCookie(temp_str);
	}
    //记录counts
	ALL_CHECKBOX =$i(n+"_1").getAttribute("count"); 
	ANTICHECK_BOX = $i(n+"_2").getAttribute("count"); 
	ALL_PLAY = 1;
 
	if( listenWindow==null || typeof(listenWindow)== 'undefined' || listenWindow.closed)
	{
			var lisurl = "/user/mplayer_beta.screen?option=1";
			var left = Math.floor((screen.width - mp_w) / 2);
			var top = Math.floor((screen.height - mp_h) / 2);
			listenWindow = window.open(lisurl,"pn_"+sessionId,"resizable=yes,width="+mp_w+",height="+mp_h+",top="+top+",left="+left+",scrollbars=1");
	}
	else
	{
		listenWindow.MPlayer.play_list();
		listenWindow.MPlayer.splay();
		listenWindow.Operator.init(1);
		listenWindow.focus();
		listenWindow.addCountsToS(ALL_CHECKBOX,ANTICHECK_BOX,ALL_PLAY,CHECKBOXLEN);
	}
	listenWindow.focus();
	
	$i(n+"_1").count = 0;
	$i(n+"_2").count = 0;

	try{ if($("body[desc=indexPage_on]").length > 0){ PLBOX.doPause(); }}catch(e){}
}

////wangkt todo end
function mp_putMCookie(info)
{
	var mcookie = LocalData.get("plist");
	if(null!=mcookie&&""!=mcookie)
	{
		var arr_list = mcookie.split("#");
		var arr_listadd = info.split("#");
		var obj_plist = mp_conf_plist(arr_list,arr_listadd);
		LocalData.set("plist",obj_plist.str);
		LocalData.set("curid",obj_plist.num);
	}
	else
	{
		LocalData.set("plist",info);	
		LocalData.set("curid",0);
	}
}
//比较 铃音 wangkt todo start
function mp_conf_plist(arr1,arr2) 
{
	var arr3 = new Array();
	var temp_arr = new Array();
	var flag = true;
	if(null!=arr1&&null!=arr2)
	{
		for(var i=0;i<arr1.length;i++)
		{	
			flag = true;
			for(var j=0;j<arr2.length;j++)
			{
		if((arr1[i].split("|"))[1]==(arr2[j].split("|"))[1])
		{
		    flag = false;
			break;
		}
			}
			if(flag)
			{
		arr3[arr3.length] = arr1[i];
			}			
		}
	}
	var position = arr3.length;
	arr3=arr3.concat(arr2);
	
	var temp_str = escape(arr3.join("#"));
	var len = temp_str.length;
	var tem = "";
	var lim = LocalData.flag ? (share_lim*1024) : (cookie_lim*1024);
	if(len>(lim))
	{
		tem = temp_str.substring(0,temp_str.indexOf("%23",len-lim));
		temp_str = temp_str.substring(temp_str.indexOf("%23",len-lim)+3,len);	
		position = position - (tem.split("%23")).length;	
	}
	if(position<0){
	   position=0;
	}
	
	return {"str":unescape(temp_str),"num":position};
}

function listentonenew2(toneFile,toneID,toneCode,toneName,singerName,desc,price,toneValidDay,spName,updateTime,downTimes,modid,scenetype,isdiscount)
{
 
	if(typeof(scenetype)=="undefined") scenetype= "0";
	if(typeof(isdiscount)=="undefined") isdiscount= "0";

	var param = "tonePath="+toneFile+"&toneID=" + toneID + "&toneCode=" + toneCode + "&toneName=" + toneName 
	          + "&singerName=" + singerName + "&desc=" + desc + "&price=" + price  
			  + "&toneValidDay=" + toneValidDay + "&spName=" + spName + "&updateTime=" + updateTime 
			  + "&downTimes=" + downTimes+"&modid="+modid;
	if(listenWindow != null)
	{
		 listenWindow.close();
	}
	var left = Math.floor( (screen.width - toneutil_w) / 2);
	var top = 60;
		var lisurl = "/user/usertoneoperation.screen?option=1&"+encodeURI(param);
	//var lisurl = "/user/downtoneredirect.screen?option=1&"+param;

	listenWindow = window.open(lisurl,"","width="+toneutil_w+",height=500,top="+top+",left="+left);

	try{ if($("body[desc=indexPage_on]").length > 0){ PLBOX.doPause(); }}catch(e){}
}
//试听财铃
var zcl_listenWindow;
function listentonenewfortune(toneFile,toneID,toneCode,toneName,singerName,desc,price,toneValidDay,spName,updateTime,downTimes,modid)
{
	var param = "tonePath="+toneFile+"&toneID=" + toneID + "&toneCode=" + toneCode + "&toneName=" + toneName 
	          + "&singerName=" + singerName + "&desc=" + desc + "&price=" + price  
			  + "&toneValidDay=" + toneValidDay + "&spName=" + spName + "&updateTime=" + updateTime 
			  + "&downTimes=" + downTimes+"&modid="+modid;
	if(zcl_listenWindow != null)
	{
		 zcl_listenWindow.close();
	}
	var left = Math.floor( (screen.width - toneutil_w) / 2);
	var top = 60;
	var lisurl = "/user/usertoneoperation.screen?option=1&"+encodeURI(param);
	zcl_listenWindow = window.open(lisurl,"","width="+toneutil_w+",height=500,top="+top+",left="+left);
}
//购买财铃
function downtonenewfortune(tonePath,toneID,toneCode,toneName,singerName,desc,price,toneValidDay,spName,updateTime,downTimes,modid)
{
    var param = "tonePath="+tonePath+"&toneID=" + toneID + "&toneCode=" + toneCode + "&toneName=" + toneName 
	          + "&singerName=" + singerName + "&desc=" + desc + "&price=" + price  
			  + "&toneValidDay=" + toneValidDay + "&spName=" + spName + "&updateTime=" + updateTime 
			  + "&downTimes=" + downTimes+"&modid="+modid;
    if(zcl_listenWindow != null)
	{
		 zcl_listenWindow.close();
	}
	var left = Math.floor( (screen.width - toneutil_w) / 2);
	var top = 60;
	zcl_listenWindow=window.open("/user/usertoneoperation.screen?option=2&"+encodeURI(param),"","width="+toneutil_w+",height=500,top="+top+",left="+left);
}
//购买铃音
var downWindow;
function downtonenew2(tonePath,toneID,toneCode,toneName,singerName,desc,price,toneValidDay,spName,updateTime,downTimes,modid,scenetype,isdiscount)
{
	if(typeof(scenetype)=="undefined") scenetype= "0";
	if(typeof(isdiscount)=="undefined") isdiscount= "0";

    var param = "tonePath="+tonePath+"&toneID=" + toneID + "&toneCode=" + toneCode + "&toneName=" + toneName 
	          + "&singerName=" + singerName + "&desc=" + desc + "&price=" + price  
			  + "&toneValidDay=" + toneValidDay + "&spName=" + spName + "&updateTime=" + updateTime 
			  + "&downTimes=" + downTimes+"&modid="+modid;
    if(downWindow != null)
	{
		 downWindow.close();
	}
	var left = Math.floor( (screen.width - toneutil_w) / 2);
	var top = 60;
		downWindow=window.open("/user/usertoneoperation.screen?option=2&"+encodeURI(param),"","width="+toneutil_w+",height=500,top="+top+",left="+left);
	//downWindow=window.open("downtoneredirect.screen?option=2&"+param,"","width="+toneutil_w+",height=440,top="+top+",left="+left);
	try{ if($("body[desc=indexPage_on]").length > 0){ PLBOX.doPause(); }}catch(e){}
}
// 连续播放 购买铃音  wangkt todo start
function downtonenew(tonePath,toneID,toneCode,toneName,singerName,desc,price,toneValidDay,spName,updateTime,downTimes,modid,scenetype,isdiscount)
{
    if(typeof(scenetype)=="undefined") scenetype= "0";
	if(typeof(isdiscount)=="undefined") isdiscount= "0";

    var info = sub_url(tonePath)+"|"+toneID+"|"+toneCode+"|"+toneName+"|"+singerName+"|"+desc+"|"+price+"|"+toneValidDay+"|"+spName+"|"+updateTime+"|"+downTimes+"|"+modid+"|"+scenetype+"|"+isdiscount;
	mp_putMCookie(info);

	if( listenWindow==null || typeof(listenWindow)== 'undefined' || listenWindow.closed)
	{
		var lisurl = "/user/mplayer_beta.screen?option=2";
		var left = Math.floor((screen.width - mp_w) / 2);
		var top = Math.floor((screen.height - mp_h) / 2);
		//,"width="+mp_w+",height="+mp_h+",top="+top+",left="+left
		listenWindow = window.open(lisurl,"pn_"+sessionId,"resizable=yes,width="+mp_w+",height="+mp_h+",top="+top+",left="+left+",scrollbars=1");
	}
	else
	{
		listenWindow.MPlayer.play_list();
		listenWindow.MPlayer.splay();
		listenWindow.Operator.init(2);
		listenWindow.focus();
	}
	try{ if($("body[desc=indexPage_on]").length > 0){ PLBOX.doPause(); }}catch(e){}
}
//wangkt todo end
//赠送铃音
var deliverWindow;
function delivertonenew2(tonePath,toneID,toneCode,toneName,singerName,desc,price,toneValidDay,spName,updateTime,downTimes,modid,scenetype,isdiscount)
{
     if(typeof(scenetype)=="undefined") scenetype= "0";
	if(typeof(isdiscount)=="undefined") isdiscount= "0";

    var param = "tonePath="+tonePath+"&toneID=" + toneID + "&toneCode=" + toneCode + "&toneName=" + toneName 
	          + "&singerName=" + singerName + "&desc=" + desc + "&price=" + price  
			  + "&toneValidDay=" + toneValidDay + "&spName=" + spName + "&updateTime=" + updateTime 
			  + "&downTimes=" + downTimes+"&modid="+modid;
    if(deliverWindow != null)
	{
		 deliverWindow.close();
	}
	var left = Math.floor( (screen.width - toneutil_w) / 2);
	var top = 60;
	deliverWindow=window.open("/user/usertoneoperation.screen?option=3&"+encodeURI(param),"","width="+toneutil_w+",height=440,top="+top+",left="+left);

	try{ if($("body[desc=indexPage_on]").length > 0){ PLBOX.doPause(); }}catch(e){}
}
// 连续试听 赠送铃音 wangkt todo start
function delivertonenew(tonePath,toneID,toneCode,toneName,singerName,desc,price,toneValidDay,spName,updateTime,downTimes,modid,scenetype,isdiscount)
{

     if(typeof(scenetype)=="undefined") scenetype= "0";
	if(typeof(isdiscount)=="undefined") isdiscount= "0";

    var info = sub_url(tonePath)+"|"+toneID+"|"+toneCode+"|"+toneName+"|"+singerName+"|"+desc+"|"+price+"|"+toneValidDay+"|"+spName+"|"+updateTime+"|"+downTimes+"|"+modid+"|"+scenetype+"|"+isdiscount;
	mp_putMCookie(info);

	if( listenWindow==null || typeof(listenWindow)== 'undefined' || listenWindow.closed)
	{
		var lisurl = "/user/mplayer_beta.screen?option=3";
		var left = Math.floor((screen.width - mp_w) / 2);
		var top = Math.floor((screen.height - mp_h) / 2);
		//,"width="+mp_w+",height="+mp_h+",top="+top+",left="+left
		listenWindow = window.open(lisurl,"pn_"+sessionId,"resizable=yes,width="+mp_w+",height="+mp_h+",top="+top+",left="+left+",scrollbars=1");
	}
	else
	{
		listenWindow.MPlayer.play_list();
		listenWindow.MPlayer.splay();
		listenWindow.Operator.init(3);
		listenWindow.focus();
	}

	try{ if($("body[desc=indexPage_on]").length > 0){ PLBOX.doPause(); }}catch(e){}
}
//wangkt todo end
//试听音乐盒
var listenBoxWindow;
function listenBoxnew(toneBoxID,toneBoxCode,toneBoxName,feetype,price,spname,desc,modid,inlib)
{
    if(listenBoxWindow != null)
	{
		 listenBoxWindow.close();
	}
	var left = Math.floor( (screen.width - toneutil_w) / 2);
	var top = Math.floor( (screen.height - 300) / 2 )  - 100;
	var param = "toneBoxID="+toneBoxID+"&toneBoxCode="+toneBoxCode+"&toneBoxName="+toneBoxName+"&feetype="+feetype
		+"&pri="+price+"&spname="+spname+"&desc="+desc+"&modid="+modid;
	if(typeof(inlib)!="undefined") param += "&inb="+inlib;
	listenBoxWindow = window.open("/user/querytoneboxdetailinfo.do?option=1&"+encodeURI(param),"",
		"width="+toneutil_w+",height=500,top="+top+",left="+left+",resizable=yes");

	try{ if($("body[desc=indexPage_on]").length > 0){ PLBOX.doPause(); }}catch(e){}
}
//购买音乐盒
function showDetailnew(toneBoxID,toneBoxCode,toneBoxName,feetype,price,spname,desc,modid)
{
	if(listenBoxWindow != null)
	{
		 listenBoxWindow.close();
	}
	var left = Math.floor( (screen.width - toneutil_w) / 2);
	var top = Math.floor( (screen.height - 300) / 2)-100;
	var param = "toneBoxID="+toneBoxID+"&toneBoxCode="+toneBoxCode+"&toneBoxName="+toneBoxName+"&feetype="+feetype
		+"&pri="+price+"&spname="+spname+"&desc="+desc+"&modid="+modid;
   listenBoxWindow = window.open("/user/querytoneboxdetailinfo.do?option=2&"+encodeURI(param),"","width="+toneutil_w+",height=500,top="+top+",left="+left);

   try{ if($("body[desc=indexPage_on]").length > 0){ PLBOX.doPause(); }}catch(e){}
}

//赠送音乐盒
function deliverToneBox(toneBoxID,toneBoxCode,toneBoxName,feetype,price,spname,desc,modid)
{
	var param = "toneBoxID="+toneBoxID+"&toneBoxCode="+toneBoxCode+"&toneBoxName="+toneBoxName+"&feetype="+feetype
		+"&pri="+price+"&spname="+spname+"&desc="+desc+"&modid="+modid;
  
    if(listenBoxWindow != null)
	{
		 listenBoxWindow.close();
	}
	var left = Math.floor( (screen.width - toneutil_w) / 2);
	var top = Math.floor( (screen.height - 300) / 2)-100;
	listenBoxWindow = window.open("/user/usertoneboxoperation.screen?option=3&"+encodeURI(param),"","width="+toneutil_w+",height=460,top="+top+",left="+left);
}
//赠送音乐盒
//flag  1：已登陆用户，屏蔽购买  0：未登录
var deliverBoxWindow2;
function deliverToneBox2(num,toneboxid,toneboxcode,toneboxname,price,spname,feetype,downloadTimes,desc,flag,modid)
{
	var param = "number=" + num + "&toneboxid=" + toneboxid + "&toneboxcode="+toneboxcode + "&toneboxname=" 
		+ toneboxname + "&pri="+ price + "&spname=" + spname + "&feetype=" + feetype + "&downloadTimes=" 
		     + downloadTimes + "&desc="+desc+"&downflag="+flag+"&modid="+modid;
  
    if(deliverBoxWindow2 != null)
	{
		deliverBoxWindow2.close();
	}
	var left = Math.floor( (screen.width - toneutil_w) / 2);
	var top = Math.floor( (screen.height - 300) / 2)-100;
	deliverBoxWindow2 = window.open("/user/usertoneboxoperation.screen?option=3&"+encodeURI(param),"","width="+toneutil_w+",height=460,top="+top+",left="+left);
}
//登录小窗口
var loginFrameWindow;
function openLoginFrame()
{
	if(loginFrameWindow != null)
	{
		 loginFrameWindow.close();
	}
	var left = Math.floor( (screen.width - toneutil_w) / 2);
	var top = Math.floor( (screen.height - 300) / 2);
    loginFrameWindow = window.open("/user/loginframe.screen","","width="+toneutil_w+",height=300,top="+top+",left="+left);
}

function toLoginFrame()
{
	self.location.href = "loginframe.screen";
	window.resizeTo(410,310);
}

function openLoginWrongFrame()
{
	 if(loginFrameWindow != null)
	{
		 loginFrameWindow.close();
	}
	var left = Math.floor( (screen.width - toneutil_w) / 2);
	var top = Math.floor( (screen.height - 300) / 2);
    loginFrameWindow = window.open("/user/loginwrongframe.screen","","width="+toneutil_w+",height=310,top="+top+",left="+left);
}
//历史记录小窗口
var historyDetailWindow;
function openHistoryDetail(url)
{
	if(historyDetailWindow!=null)
	{
		historyDetailWindow.close();
	}
	var left = Math.floor( (screen.width - toneutil_w) / 2);
	var top = Math.floor( (screen.height - 300) / 2);
	historyDetailWindow = window.open(url,"detail","width="+toneutil_w+",height=340,top="+top+",left="+left); 
}

//无线音乐专区
var wirelessWindow;
function wirelessShow(toneFile,toneID,toneCode,toneName,singerName,desc,price,toneValidDay,spName,updateTime,downTimes)
{
	var param = "tonePath="+toneFile+"&toneID=" + toneID + "&toneCode=" + toneCode + "&toneName=" + toneName 
	          + "&singerName=" + singerName + "&desc=" + desc + "&price=" + price  
			  + "&toneValidDay=" + toneValidDay + "&spName=" + spName + "&updateTime=" + updateTime 
			  + "&downTimes=" + downTimes;
	if(wirelessWindow != null)
	{
		 wirelessWindow.close();
	}
	var left = Math.floor( (screen.width - toneutil_w) / 2);
	var top = Math.floor( (screen.height - 300) / 2) - 100;
	var lisurl= "/user/usertoneoperation.screen?option=55&"+encodeURI(param);
	//alert(lisurl);
	wirelessWindow = window.open(lisurl,"","width="+toneutil_w+",height=380,top="+top+",left="+left);
}
//无线音乐专区
var wireless1Window;
function wireless1Show(toneFile,toneID,toneCode,toneName,singerName,desc,price,toneValidDay,spName,updateTime,downTimes)
{
	var param = "tonePath="+toneFile+"&toneID=" + toneID + "&toneCode=" + toneCode + "&toneName=" + toneName 
	          + "&singerName=" + singerName + "&desc=" + desc + "&price=" + price  
			  + "&toneValidDay=" + toneValidDay + "&spName=" + spName + "&updateTime=" + updateTime 
			  + "&downTimes=" + downTimes;
	if(wireless1Window != null)
	{
		 wireless1Window.close();
	}
	var left = Math.floor( (screen.width - toneutil_w) / 2);
	var top = Math.floor( (screen.height - 300) / 2) - 100;
	var lisurl= "/user/usertoneoperation.screen?option=56&"+param;
	//alert(lisurl);
	wireless1Window = window.open(lisurl,"","width="+toneutil_w+",height=380,top="+top+",left="+left);
}


///打折专区
//试听铃音
function listendistonenew(toneFile,toneID,toneCode,toneName,singerName,desc,price,toneValidDay,spName,updateTime,downTimes,modid,disprice)
{
	var param = "tonePath="+toneFile+"&toneID=" + toneID + "&toneCode=" + toneCode + "&toneName=" + toneName 
	          + "&singerName=" + singerName + "&desc=" + desc + "&price=" + price  
			  + "&toneValidDay=" + toneValidDay + "&spName=" + spName + "&updateTime=" + updateTime 
			  + "&downTimes=" + downTimes+"&modid="+modid+"&disprice="+disprice;
	if(listenWindow != null)
	{
		 listenWindow.close();
	}
	var left = Math.floor( (screen.width - toneutil_w) / 2);
	var top = 60;
	var lisurl= "/user/usertoneoperation.screen?option=1&"+encodeURI(param);
	//alert(lisurl);
	listenWindow = window.open(lisurl,"pn_"+sessionId,"width="+toneutil_w+",height=350,top="+top+",left="+left);
}
//购买铃音
function downdistonenew(tonePath,toneID,toneCode,toneName,singerName,desc,price,toneValidDay,spName,updateTime,downTimes,modid,disprice)
{
    var param = "tonePath="+tonePath+"&toneID=" + toneID + "&toneCode=" + toneCode + "&toneName=" + toneName 
	          + "&singerName=" + singerName + "&desc=" + desc + "&price=" + price  
			  + "&toneValidDay=" + toneValidDay + "&spName=" + spName + "&updateTime=" + updateTime 
			  + "&downTimes=" + downTimes+"&modid="+modid+"&disprice="+disprice;
    if(downWindow != null)
	{
		 downWindow.close();
	}
	var left = Math.floor( (screen.width - toneutil_w) / 2);
	var top = 60;
	downWindow=window.open("/user/usertoneoperation.screen?option=2&"+encodeURI(param),"pn_"+sessionId,"width="+toneutil_w+",height=440,top="+top+",left="+left);
}

//情景彩铃
//试听铃音
function listenscenetone(toneFile,toneID,toneCode,toneName,singerName,desc,price,toneValidDay,spName,updateTime,downTimes,modid,scenetype)
{
	var param = "tonePath="+toneFile+"&toneID=" + toneID + "&toneCode=" + toneCode + "&toneName=" + toneName 
	          + "&singerName=" + singerName + "&desc=" + desc + "&price=" + price  
			  + "&toneValidDay=" + toneValidDay + "&spName=" + spName + "&updateTime=" + updateTime 
			  + "&downTimes=" + downTimes+"&modid="+modid+"&scenetype="+scenetype;
	if(listenWindow != null)
	{
		 listenWindow.close();
	}
	var left = Math.floor( (screen.width - toneutil_w) / 2);
	var top = 60;
	var lisurl= "/user/usertoneoperation.screen?option=1&"+encodeURI(param);
	//alert(lisurl);
	listenWindow = window.open(lisurl,"pn_"+sessionId,"width="+toneutil_w+",height=350,top="+top+",left="+left);
}

//购买铃音
function downscenetone(tonePath,toneID,toneCode,toneName,singerName,desc,price,toneValidDay,spName,updateTime,downTimes,modid,scenetype)
{
    var param = "tonePath="+tonePath+"&toneID=" + toneID + "&toneCode=" + toneCode + "&toneName=" + toneName 
	          + "&singerName=" + singerName + "&desc=" + desc + "&price=" + price  
			  + "&toneValidDay=" + toneValidDay + "&spName=" + spName + "&updateTime=" + updateTime 
			  + "&downTimes=" + downTimes+"&modid="+modid+"&scenetype="+scenetype;
    if(downWindow != null)
	{
		 downWindow.close();
	}
	var left = Math.floor( (screen.width - toneutil_w) / 2);
	var top = 60;
	downWindow=window.open("/user/usertoneoperation.screen?option=2&"+encodeURI(param),"pn_"+sessionId,"width="+toneutil_w+",height=440,top="+top+",left="+left);
}

//全选
function check_all(box,boxs){
	t_box = document.getElementsByName(box);//.all[box];
		var length = t_box.length;
		for(var i=0;i<length;i++){
			t_box[i].checked=true;
		}
		if(undefined != document.getElementsByName(boxs)[0]) 
		{
			check_status2(boxs,box);
		}
		$i(box+"_1").count = parseInt($i(box+"_1").getAttribute("count"))+1;
	}
//反选
function check_anti(box,boxs){
	var t_box = document.getElementsByName(box);//.all[box];
	var t_allbox = document.getElementsByName(boxs);
	var length = t_box.length;	
	var num = 0;
	for(i=0;i<length;i++){
		if(true==t_box[i].checked)
		{
			t_box[i].checked=false;
		}
		else
		{
			t_box[i].checked=true;
		}
		}
		if((undefined != t_allbox[0]) && (t_allbox != null)) 
		{
			check_status2(boxs,box);
		}
		$i(box+"_2").count = parseInt($i(box+"_2").getAttribute("count"))+1;
	}
function check_status2(aa,cc)
{
		var a = document.getElementsByName(aa);
		var c = document.getElementsByName(cc);
		var tmp1 = true, tmp2 = false
		for(var i=0;i<c.length;i++)
		tmp1 &= c[i].checked, tmp2 |= c[i].checked;
		a[0].checked = tmp1;
		a[0].indeterminate = !tmp1 && tmp2;
}

//爱音乐营销 购买铃音
function loveMusicDown(tonePath,toneID,toneCode,toneName,singerName,desc,price,toneValidDay,spName,updateTime,downTimes,modid,scenetype)
{
    if(scenetype==null) scenetype= "0";
    var param = "tonePath="+tonePath+"&toneID=" + toneID + "&toneCode=" + toneCode + "&toneName=" + toneName 
	          + "&singerName=" + singerName + "&desc=" + desc + "&price=" + price  
			  + "&toneValidDay=" + toneValidDay + "&spName=" + spName + "&updateTime=" + updateTime 
			  + "&downTimes=" + downTimes+"&modid="+modid;
    if(downWindow != null)
	{
		 downWindow.close();
	}
	var left = Math.floor( (screen.width - toneutil_w) / 2);
	var top = 60;
		downWindow=window.open("/user/usertoneoperation.screen?lm=1&option=2&"+encodeURI(param),"","width="+toneutil_w+",height=440,top="+top+",left="+left);
}

////爱音乐营销 shi听 音乐盒
function loveMusicBoxDown(toneBoxID,toneBoxCode,toneBoxName,feetype,price,spname,desc,modid)
{
    if(listenBoxWindow != null)
	{
		 listenBoxWindow.close();
	}
	var left = Math.floor( (screen.width - toneutil_w) / 2);
	var top = Math.floor( (screen.height - 300) / 2 )  - 100;
	var param = "toneBoxID="+toneBoxID+"&toneBoxCode="+toneBoxCode+"&toneBoxName="+toneBoxName+"&feetype="+feetype
		+"&price="+price+"&spname="+spname+"&desc="+desc+"&modid="+modid;
	listenBoxWindow = window.open("/user/querytoneboxdetailinfo.do?lm=1&option=1&"+encodeURI(param),"",
		"width="+toneutil_w+",height=470,top="+top+",left="+left+",resizable=yes");
}

function super_query(mun,singerName)
{
	window.location="/user/super_index.screen?mun=1&values="+encodeURI(singerName).replace(/(\+)/g,"%2B");
}
function super_query_singer(singerName)
{
	window.location="/user/super_index.screen?mun=1&values="+encodeURI(singerName).replace(/(\+)/g,"%2B");
}

///试听页面试听（批量）
function mp_all_play_self(n,callBack)
{
	var temp_str = "";
	var t_box2 = document.getElementsByName(n);

	if(typeof(t_box2.checked) != "boolean"){
		//more
	   var length = t_box2.length;
	   for(i=0;i<length;i++)
		{
			if(t_box2[i].checked)
			{ 
		temp_str += "#" + sub_url(chSceneFlag(t_box2[i].getAttribute("info")));
			}
		}
	}else{
       //singer
	    if(t_box2.checked)
		{ 
			temp_str += "#" + sub_url(chSceneFlag(t_box2.getAttribute("info")));
		}
	}
	
    if(temp_str.trim()=="")
	{
		alert("请先选择要播放的铃音");
		return false;
	}
	else
	{
	  temp_str = temp_str.substring(1,temp_str.length);
	  mp_putMCookie(temp_str);
	}
    //记录counts
	ALL_CHECKBOX =$i(n+"_1").getAttribute("count"); 
	ANTICHECK_BOX = $i(n+"_2").getAttribute("count"); 
	ALL_PLAY = 1;
 
    TopList.show(0);
	MPlayer.play_list();
    MPlayer.splay();
    Operator.init(1);
	addCountsToS(ALL_CHECKBOX,ANTICHECK_BOX,ALL_PLAY,CHECKBOXLEN);

	$i(n+"_1").count = 0;
	$i(n+"_2").count = 0;

	if(typeof(callBack) != "undefined") callBack();
}
///试听页面试听(单个)
function mp_add_listentone(toneFile,toneID,toneCode,toneName,singerName,desc,price,toneValidDay,spName,updateTime,downTimes,modid,scenetype,isdiscount)
{	
	if(typeof(scenetype)=="undefined") scenetype= "0";
	if(typeof(isdiscount)=="undefined") isdiscount= "0";
    var info = sub_url(toneFile)+"|"+toneID+"|"+toneCode+"|"+toneName+"|"+singerName+"|"+desc+"|"+price+"|"+toneValidDay+"|"+spName+"|"+updateTime+"|"+downTimes+"|"+modid+"|"+scenetype+"|"+isdiscount;

	mp_putMCookie(info);

	TopList.show(0);
	MPlayer.play_list();
	MPlayer.splay();
	Operator.init(1);
}