/*
*	modello框架
**
*	author 贺博
*	version 2007-8-28
**
*	收费库
*/
CWebFav = Class.create(WebFav);
CWebFav.register("com.duxiu.js.CWebFav");

CWebFav.construct = function($self, $class){
	this.reprintFav = function(){
		if(_webfav.checkConsume()){
			$self.super0.reprintFav();
			return ;
		}
		if(formatNumber(this.getUserId() ,0) != 0){
			var url = "/backgroundjsp/editvalue.jsp?uid="+this.getUserId()
				+"&repid="+this.getRepId()
				+"&v="+this.getRepType()
				+"&repuid="+this.getRepUserId()+"&t="+new Date().getTime();
			var request = new XMLRequst(url).createXMLRequst();			
			request.onreadystatechange =function(){
				if(request.readyState == 4){//over
					if (request.status == 200){
						var re = formatNumber(request.responseText , -1);						
						if(re == 0){
							$self.super0.reprintFav();
						}
						else{
							g('fav').innerHTML ='<div class="c_right"><div class="cc_content">账户余额不足一个星币，无法浏览正文内容！</div></div>';
						}
					}
					else{
						throw new Error("您所请求的"+url+"异常。 异常代号="+request.status);
					}
				}
			};			
			request.send(null);	
		}
		else{
			g('fav').innerHTML ='<div class="c_right"><div class="cc_content">本库需要消费星币才可浏览，请登录后访问。</div></div>';
		}
	}
	
	this.checkConsume = function(){
		if(this.getRepType()==0||this.getCatalog().c== "0"){			
			return true;
		}
		return false;	
	}
}