//***
var inputid;
var val;
var uid;
var uidt=GetQueryString('u');
var defauluid=1725;

function GetQueryString(name)
{
	var reg = new RegExp("(^|&)"+ name +"=([^&]*)(&|$)");
	var r = window.location.search.substr(1).match(reg);
	if (r!=null)
	return unescape(r[2]);
	return   null;
}
function SendCOMBD(id,uidx,uuid){
	if(uidx.length>0)
	uid=uidx;
	else
	uid=defauluid;
	uid=retuid(uid);
window.open('http://my.12530.com/newchannel/orderTone/'+id+'/1/'+uid+'/'+uuid+'/-/-/order.htm','','width=502,height=331,scrollbars=yes,status=yes');	
	return false;
}
function SendCOMBD2(id,uidx,uuid){
	if(uidx.length>0)
	uid=uidx;
	else
	uid=defauluid;
	uid=retuid(uid);
window.open('http://my.12530.com/newchannel/orderTone/'+id+'/1/'+uid+'/'+uuid+'/-/-/order.htm','','width=502,height=331,scrollbars=yes,status=yes');
	return false;
}
function SendCOMBD3(id,uidx,uuid){
	if(uidx.length>0)
	uid=uidx;
	else
	uid=defauluid;
	uid=retuid(uid);
window.open('http://my.12530.com/newchannel/orderTone/'+id+'/1/'+uid+'/'+uuid+'/-/-/order.htm','','width=502,height=331,scrollbars=yes,status=yes');
	return false;
}
function SendCOMBDZL(id,uidx,uuid){
	if(uidx.length>0)
	uid=uidx;
	else
	uid=defauluid;
	uid=retuid(uid);
window.open('http://my.12530.com/newchannel/orderTone/'+id+'/1/'+uid+'/'+uuid+'/-/-/order.htm','','width=502,height=331,scrollbars=yes,status=yes');
	return false;
}
function SendCOMBDczl(id,uidx,uuid){
	if(uidx.length>0)
	uid=uidx;
	else
	uid=defauluid;
	uid=retuid(uid);
window.open('http://my.12530.com/newchannel/orderTone/'+id+'/1/'+uid+'/'+uuid+'/-/-/order.htm','','width=502,height=331,scrollbars=yes,status=yes');
	return false;
}
function gserch(){
    uid=retuid(uid);
	var key=document.getElementById("keyword").value;
	window.open('http://my.12530.com/new12530/interface/go/in.php?from='+uid+'&songname='+key);
	return false;
}
function fileto(fileurl,uid,divname){
	uid=retuid(uid);
	if(divname)
	var path=fileurl+'?u='+uid+'#'+divname;
	else
	path=fileurl+'?u='+uid;
	window.open(path);
}
function clfltomini(nodeid,nuid){
nuid=retuid(nuid);
path='http://movement.12530.com/more/'+nodeid+'/1/more.htm?u='+nuid+'&uu='+nuid+'_mini'+'?u='+nuid;
window.open(path);
}

function songertomini(songername,nuid,nuuid){
nuid=retuid(nuid);
songername=encodeURI(songername);
path='http://movement.12530.com/search/'+songername+'/1/search.htm?u='+nuid+'&uu='+nuuid;
window.open(path);
}

function emp(inputid){
	val=document.getElementById(inputid).value;
	document.getElementById(inputid).value='';
	return false;
}
function openpage(pagename){
	window.open(pagename);
}
function nowdatetime(){
	Date.prototype.format = function(format)
	{
		var o = {
		"M+" : this.getMonth()+1, //month
		"d+" : this.getDate(),    //day
		"h+" : this.getHours(),   //hour
		"m+" : this.getMinutes(), //minute
		"s+" : this.getSeconds(), //second
		"q+" : Math.floor((this.getMonth()+3)/3),  //quarter
		"S" : this.getMilliseconds() //millisecond
		}
		if(/(y+)/.test(format)) format=format.replace(RegExp.$1,
		(this.getFullYear()+"").substr(4 - RegExp.$1.length));
		for(var k in o)if(new RegExp("("+ k +")").test(format))
		format = format.replace(RegExp.$1,
		RegExp.$1.length==1 ? o[k] :
		("00"+ o[k]).substr((""+ o[k]).length));
		return format;
	}
	//上面的函数必须在上面(先定义后使用),不然无法识别format()
	var ddd = new Date();
	return ddd.format('yyyyMMddhhmmssS');

}
function songersearch_zl(name){
searchurl='http://mp3.baidu.com/m?f=ms&tn=baidump3ring&ct=285212672&lf=&rn=&word='+name+'&lm=-1';
window.open(searchurl);
}
function songersearch_cl(name){
	'http://calling.baidu.com/m?tn=baidump3cal&ct=134217728&lf=&rn=&word=%CD%F5%C1%A6%BA%EA&lm=-1 '
searchurl='http://calling.baidu.com/m?tn=baidump3cal&ct=134217728&lf=&rn=&word='+name+'&lm=-1 ';
window.open(searchurl);
}

//***
var uidpublic;
var uidtpublic=GetQueryString('u');
var uidtpublicf=GetQueryString('from');
if(uidtpublic){
uidpublic=uidtpublic;
}else if(uidtpublicf){
uidpublic=uidtpublicf;
}else{
uidpublic=1534;
}
var uupublic=GetQueryString('uu');
uidpublic=retuid(uidpublic);


function SendCOMBDpublic(id,uidx,uuid){
	datetime=nowdatetime();	
	if(uuid=='fsrl')
		uuid=uupublic+'_'+uuid;
window.open('http://my.12530.com/newchannel/orderTone/'+id+'/1/'+uidpublic+'/'+uuid+'/-/-/order.htm','','width=502,height=331,scrollbars=yes,status=yes');	
	return false;
}
function SendCOMBDZLpublic(id,uidx,uuid){
	datetime=nowdatetime();
//window.open('http://my.12530.com/newchannel/tpl/channel3/index.jsp?msgid='+uidpublic+datetime+'&objname='+id+'&type=1&from='+uidpublic+'&subfrom='+uidpublic+'_'+uuid+'','','width=502,height=331,scrollbars=yes,status=yes');

window.open('http://my.12530.com/newchannel/orderTone/'+id+'/1/'+uidpublic+'/'+uuid+'/-/-/order.htm','','width=502,height=331,scrollbars=yes,status=yes');	
	return false;
}
function gserchpublic(){
	var key=document.getElementById("keyword").value;
	window.open('http://my.12530.com/new12530/interface/go/in.php?from='+uidpublic+'&songname='+key);
	return false;
}
function filetopublic(fileurl,divname){
	if(divname)
	var path=fileurl+'?u='+uidpublic+'#'+divname;
	else
	path=fileurl+'?u='+uidpublic;
	window.open(path);
}


//***
var getuid=uidpublic;
getuid=retuid(getuid);
var pagefromurl=document.referrer;
  pagefromurl=pagefromurl.split("?")[0];   
var datetime=nowdatetime();
var localurl = location.href;
  localurl=localurl.split("?")[0];   

function mouseDown(ev){
	 ev = ev || window.event;
  pa1= ev.clientX; 
  pa2= ev.clientY; 

  var scripts = document.getElementsByTagName("script"); 
	var sobj = document.createElement('script'); 
	sobj.src='http://my.12530.com/newchannel/tpl/c/doRecord.jsp?from='+encodeURIComponent(pagefromurl)+'&url='+encodeURIComponent(localurl)+'&u='+getpageuid+'&pa1='+pa1+'&pa2='+pa2+'&pa10=1';
	var headobj = document.getElementsByTagName('head')[0]; 
	headobj.appendChild(sobj); 

}
function include_js(pageuid) 
{ 
	if(pageuid!='null' && pageuid!='' && pageuid!='public' )	
		getpageuid=pageuid;
	else
		getpageuid=getuid;

	
	var scripts = document.getElementsByTagName("script"); 
	var sobj = document.createElement('script'); 
	sobj.src = 'http://my.12530.com/newchannel/tpl/c/doRecord.jsp?from='+encodeURIComponent(pagefromurl)+'&url='+encodeURIComponent(localurl)+'&u='+getpageuid; 
	var headobj = document.getElementsByTagName('head')[0]; 
	headobj.appendChild(sobj); 
}


function retuid(uidstr){
uidstr=''+uidstr+'';
var s=uidstr.indexOf('_');
if(s==-1)
return uidstr;
else
return uidstr.split("_")[0];
}
