﻿
// cached javascript
var PlayAJAX = {
GetTrackList:function(productID,type,userID,callback,context){return new ajax_request(this.url + '?_method=GetTrackList&_session=rw','productID=' + enc(productID)+ '\r\ntype=' + enc(type)+ '\r\nuserID=' + enc(userID),callback, context);},
GetTrackListPartner:function(productID,type,parUserID,callback,context){return new ajax_request(this.url + '?_method=GetTrackListPartner&_session=rw','productID=' + enc(productID)+ '\r\ntype=' + enc(type)+ '\r\nparUserID=' + enc(parUserID),callback, context);},
GetSingerOtherSongs:function(singerID,callback,context){return new ajax_request(this.url + '?_method=GetSingerOtherSongs&_session=rw','singerID=' + enc(singerID),callback, context);},
HotSingerSong:function(singerID,count,callback,context){return new ajax_request(this.url + '?_method=HotSingerSong&_session=rw','singerID=' + enc(singerID)+ '\r\ncount=' + enc(count),callback, context);},
RecordAudition:function(productID,auditionURL,userID,actionType,curTime,callback,context){return new ajax_request(this.url + '?_method=RecordAudition&_session=rw','productID=' + enc(productID)+ '\r\nauditionURL=' + enc(auditionURL)+ '\r\nuserID=' + enc(userID)+ '\r\nactionType=' + enc(actionType)+ '\r\ncurTime=' + enc(curTime),callback, context);},
IsLogin:function(callback,context){return new ajax_request(this.url + '?_method=IsLogin&_session=rw','',callback, context);},
IsLoginTop100:function(callback,context){return new ajax_request(this.url + '?_method=IsLoginTop100&_session=rw','',callback, context);},
GetLastSpecialByLang:function(lang,callback,context){return new ajax_request(this.url + '?_method=GetLastSpecialByLang&_session=rw','lang=' + enc(lang),callback, context);},
GetSpecialSongs:function(productID,userID,callback,context){return new ajax_request(this.url + '?_method=GetSpecialSongs&_session=rw','productID=' + enc(productID)+'\r\nuserID=' + enc(userID),callback, context);},
GetHotSong:function(callback,context){return new ajax_request(this.url + '?_method=GetHotSong&_session=rw','',callback, context);},
GetHotSpecial:function(callback,context){return new ajax_request(this.url + '?_method=GetHotSpecial&_session=rw','',callback, context);},
GetHotSinger:function(callback,context){return new ajax_request(this.url + '?_method=GetHotSinger&_session=rw','',callback, context);},
GetLyric:function(productID,callback,context){return new ajax_request(this.url + '?_method=GetLyric&_session=rw','productID=' + enc(productID),callback, context);},
GetSingerStation:function(singerID,callback,context){return new ajax_request(this.url + '?_method=GetSingerStation&_session=rw','singerID=' + enc(singerID),callback, context);},
GetRoamMusic:function(userID,callback,context){return new ajax_request(this.url + '?_method=GetRoamMusic&_session=rw','userID=' + enc(userID),callback, context);},
GetTagListOfOwner:function(userID,callback,context){return new ajax_request(this.url + '?_method=GetTagListOfOwner&_session=rw','userID=' + enc(userID),callback, context);},
GetProductByTagID:function(tagID,callback,context){return new ajax_request(this.url + '?_method=GetProductByTagID&_session=rw','tagID=' + enc(tagID),callback, context);},
GetProductByTagIDList:function(idList,callback,context){return new ajax_request(this.url + '?_method=GetProductByTagIDList&_session=rw','idList=' + enc(idList)+'\r\nuserID=',callback, context);},
HotSingerSongByCount:function(singerID,count,callback,context){return new ajax_request(this.url + '?_method=HotSingerSongByCount&_session=rw','singerID=' + enc(singerID)+ '\r\ncount=' + enc(count),callback, context);},
GetSingerPhoto:function(singerIDList,callback,context){return new ajax_request(this.url + '?_method=GetSingerPhoto&_session=rw','singerIDList=' + enc(singerIDList),callback, context);},
GetSongBPS:function(url,callback,context){return new ajax_request(this.url + '?_method=GetSongBPS&_session=rw','url=' + enc(url),callback, context);},
IsBaoYue:function(callback,context){return new ajax_request(this.url + '?_method=IsBaoYue&_session=rw','',callback, context);},
BaoYueExpriseDate:function(callback,context){return new ajax_request(this.url + '?_method=BaoYueExpriseDate&_session=rw','',callback, context);},
FeedBack:function(userID,comments,title,object_Id,callback,context){return new ajax_request(this.url + '?_method=FeedBack&_session=rw','userID=' + enc(userID)+ '\r\ncomments=' + enc(comments)+ '\r\ntitle=' + enc(title)+ '\r\nobject_Id=' + enc(object_Id),callback, context);},
GetProductByMusicID:function(s,callback,context){return new ajax_request(this.url + '?_method=GetProductByMusicID&_session=rw','s=' + enc(s),callback, context);},
GetSearchResult:function(keyWord,callback,context){return new ajax_request(this.url + '?_method=GetSearchResult&_session=rw','keyWord=' + enc(keyWord),callback, context);},
HasSynLrc:function(fileName,callback,context){return new ajax_request(this.url + '?_method=HasSynLrc&_session=rw','fileName=' + enc(fileName),callback, context);},
GetSynedLrc:function(fileName,callback,context){return new ajax_request(this.url + '?_method=GetSynedLrc&_session=rw','fileName=' + enc(fileName),callback, context);},
url:'/ajax/Top100Web.Audition.PlayAJAX,Top100Web.ashx'
}
function HtmlControl(id) {
	var ele = null;
	if(typeof(id) == 'object') ele = id; else ele = document.getElementById(id);
	if(ele == null) return null;
	var _o = ele.cloneNode(true);
	var _op = document.createElement('SPAN');
	_op.appendChild(_o);	
	this._source = _op.innerHTML;
}
HtmlControl.prototype.toString = function(){ return this._source; }

function HtmlControlUpdate(func, parentId) {
var f,i,ff,fa='';
var ele = document.getElementById(parentId);
if(ele == null) return;
var args = [];
for(i=0; i<HtmlControlUpdate.arguments.length; i++)
	args[args.length] = HtmlControlUpdate.arguments[i];
if(args.length > 2)
	for(i=2; i<args.length; i++){fa += 'args[' + i + ']';if(i < args.length -1){ fa += ','; }}
f = '{"invoke":function(args){return ' + func + '(' + fa + ');}}';
ff = null;eval('ff=' + f + ';');
if(ff != null && typeof(ff.invoke) == 'function')
{
	var res = ff.invoke(args);
	if(res.error != null){alert(res.error);return;}
	ele.innerHTML = res.value;
}
}
function AjaxImage(url){var img=new Image();img.src=url;return img;}
function TimeSpan(){this.Days=0;this.Hours=0;this.Minutes=0;this.Seconds=0;this.Milliseconds=0;}
TimeSpan.prototype.toString = function(){return this.Days+'.'+this.Hours+':'+this.Minutes+':'+this.Seconds+'.'+this.Milliseconds;}
function digi(v, c){v = v + "";var n = "0000";if(v.length < c) return n.substr(0, c-v.length) + v;return v;}
function DateTime(year,month,day,hours,minutes,seconds){if(year>9999||year<1970||month<1||month>12||day<0||day>31||hours<0||hours>23||minutes<0||minutes>59||seconds<0||seconds>59)throw("ArgumentException");this.Year = year;this.Month = month;this.Day = day;this.Hours = hours;this.Minutes = minutes;this.Seconds = seconds;}
DateTime.prototype.toString = function(){return digi(this.Year,4) + digi(this.Month,2) + digi(this.Day,2) + digi(this.Hours,2) + digi(this.Minutes,2) + digi(this.Seconds,2);}
function _getTable(n,e){for(var i=0; i<e.Tables.length; i++){if(e.Tables[i].Name == n)return e.Tables[i];}return null;}
