/*
 * {{{
 *	赞相关JS
 * }}}
 */
var praise_urlTpl = new Template("handle/praiseAjax.php?tid=#{tid}&type=#{type}");

function onPraiseClick(tid, type, uid, thisId){
	if(uid==0){
		window.location.href='../home/login.php';
		return false;
	}
	var thisObj = $(thisId);
	var _url = praise_urlTpl.evaluate({tid: tid, type: type});
	new Ajax.Request(_url, {
				method: "get",
				onComplete: function(transport){
					var response = transport.responseText;
					if(trim(response)=='succ'){
						var _strNum = thisObj.down('span').innerHTML;
						_strNum = _strNum.replace("(", '');
						_strNum = _strNum.replace(")", '');
						_strNum ++;
						thisObj.down('span').update("("+_strNum+")");
					}else{
						if(type==1){
							alert('对不起，您每天只能对同一推荐赞一次');
							return false;
						}
						if(type==2){
							alert('对不起，您每天只能对同一专辑赞一次');
							return false;
						}
					}
				}.bind(this)
			});
	
}
