/**
 *	Constructor proxy layer for the buffalo framework
 *
 *  @author Ben  (zhuaming@gmail.com)
 *  
 */

var CallProxy = Class.create();

CallProxy.prototype = {

	initialize:function(){
		var pathName = window.location.pathname;

		if(pathName.indexOf("bh-")>-1){
			pathName = pathName.substring()
			this.END_POINT = (typeof(END_PONIT) == "undefined" || END_PONIT=="")?"/bh-CpServer/bfapp":END_POINT;
		}else
			this.END_POINT = (typeof(END_PONIT) == "undefined" || END_PONIT=="")?"/bfapp":END_POINT;
		this.async = true;	
		this.buffalo = new Buffalo(this.END_POINT, this.async);
		this.buffalo.setEvents["onLoading"]= function(){};
    }
}

var CategoryCallProxy = Class.create();

Object.extend(Object.extend(CategoryCallProxy.prototype, CallProxy.prototype), { 

    getCategorys : function(_getCategoriesCallback){
       this.buffalo.remoteCall("CategoryService.getCategories", [], _getCategoriesCallback);
    }

});


 
 
 var AboutCallProxy = Class.create();
Object.extend(Object.extend(AboutCallProxy.prototype, CallProxy.prototype), { 
    getAboutTitle : function(title,type,_getAboutTitleCallback){
       this.buffalo.remoteCall("AboutService.getAboutTitle", [title,type], _getAboutTitleCallback);
    }

});

//end add by qhb

var PageCallProxy = Class.create();

Object.extend(Object.extend(PageCallProxy.prototype, CallProxy.prototype), { 
	loadPage : function(div,link){
		//data=data.replace(/&/g,",")
		this.buffalo.switchPart(div,link,false);
	}
});


var CollectCallProxy = Class.create();

Object.extend(Object.extend(CollectCallProxy.prototype, CallProxy.prototype), { 
	collectBook : function(bookId,username,_collectBookCallback){
		 this.buffalo.remoteCall("CollectService.collectBook", [bookId,username], _collectBookCallback);

	},
	collectMovie : function(id,username,_collectBookCallback){
		 this.buffalo.remoteCall("CollectService.collectMovie", [id,username], _collectBookCallback);

	},
	collectMusic : function(id,username,_collectBookCallback){
		 this.buffalo.remoteCall("CollectService.collectMusic", [id,username], _collectBookCallback);

	},
		collectArticle : function(id,username,_collectBookCallback){
			 this.buffalo.remoteCall("CollectService.collectArticle", [id,username], _collectArticleCallback);

	}
});




var DiggCallProxy = Class.create();

Object.extend(Object.extend(DiggCallProxy.prototype, CallProxy.prototype), { 
	diggArticle : function(articleid,username,_collectBookCallback){
		 this.buffalo.remoteCall("DiggService.diggArticle", [articleid,username], _collectBookCallback);

	},
	diggBook : function(id,username,_diggCallback){
		 this.buffalo.remoteCall("DiggService.diggBook", [id,username], _diggCallback);

	},
	diggMovie : function(id,username,_diggCallback){
		 this.buffalo.remoteCall("DiggService.diggMovie", [id,username], _diggCallback);

	},
	diggMusic : function(id,username,_diggCallback){
		 this.buffalo.remoteCall("DiggService.diggMusic", [id,username], _diggCallback);

	},
	diggBlog : function(id,username,_diggCallback){
		 this.buffalo.remoteCall("DiggService.diggBlog", [id,username], _diggCallback);

	}
});

var BuryCallProxy = Class.create();

Object.extend(Object.extend(BuryCallProxy.prototype, CallProxy.prototype), { 
	buryArticle : function(articleid,username,_buryArticleCallback){
		 this.buffalo.remoteCall("BuryService.buryArticle", [articleid,username], _buryArticleCallback);

	},
	cancelBuryArticle: function(articleid,username,_buryArticleCallback){
		 this.buffalo.remoteCall("BuryService.cancelBuryArticle", [articleid,username], _buryArticleCallback);

	}
});


var SelectBlogTempCallProxy = Class.create();

Object.extend(Object.extend(SelectBlogTempCallProxy.prototype, CallProxy.prototype), { 
	selectBolgTemp : function(blogtempid,username,_selectBolgTempCallback){
		 this.buffalo.remoteCall("SelectBlogTempService.selectBolgTemp", [blogtempid,username], _selectBolgTempCallback);

	}
});



var AddFriendCallProxy = Class.create();

Object.extend(Object.extend(AddFriendCallProxy.prototype, CallProxy.prototype), { 
	addFriend : function(userid,username,_buryArticleCallback){
		 this.buffalo.remoteCall("AddFriends.addFriend", [userid,username], _buryArticleCallback);

	}
});

var CheckUserCallProxy = Class.create();

Object.extend(Object.extend(CheckUserCallProxy.prototype, CallProxy.prototype), { 
	addCheck : function(userid,username,_buryArticleCallback){
		 this.buffalo.remoteCall("CheckService.addCheck", [userid,username], _buryArticleCallback);

	}
});

var ShortMsgCallProxy = Class.create();
Object.extend(Object.extend(ShortMsgCallProxy.prototype, CallProxy.prototype), { 
	sendMessage : function(content,toUserId,username,_buryArticleCallback){
		 content = content
		 this.buffalo.remoteCall("ShortMsgService.sendMessage", [content,toUserId,username], _buryArticleCallback);

	}
});


var RightCallProxy = Class.create();

Object.extend(Object.extend(RightCallProxy.prototype, CallProxy.prototype), { 
	putRight : function(values,_putRightCallBack){
		 this.buffalo.remoteCall("PutRightService.putRight", [values], _putRightCallBack);

	},
	cancelRight : function(values,_cancelRightCallBack){
		 this.buffalo.remoteCall("PutRightService.cancelRight", [values], _cancelRightCallBack);

	}
});

var FolderCallProxy = Class.create();
Object.extend(Object.extend(FolderCallProxy.prototype, CallProxy.prototype), { 
	addFolder : function(name,username,_addFolderCallback){
		 this.buffalo.remoteCall("FolderService.addFolder", [name,username], _addFolderCallback);
	}
});


var TestDocCallProxy = Class.create();
Object.extend(Object.extend(TestDocCallProxy.prototype, CallProxy.prototype), { 
	setTestDocSecret : function(testDocId,secret,_setTestDocSecretCallback){
		 this.buffalo.remoteCall("TestDocService.setTestDocSecret", [testDocId,secret], _setTestDocSecretCallback);
	}
});


var SendEmailCallProxy = Class.create();
Object.extend(Object.extend(SendEmailCallProxy.prototype, CallProxy.prototype), { 
	sendInvitationEmail : function(testquestionId,userName,emails,_sendInvitationEmailCallback){
		 this.buffalo.remoteCall("SendEmailService.sendInvitationEmail", [testquestionId,userName,emails], _sendInvitationEmailCallback);
	},
	sendPersonnelGmEmail : function(emailContent,userName,_sendPersonnelGmEmailCallBack){
		 this.buffalo.remoteCall("SendEmailService.sendPersonnelGmEmail", [emailContent,userName], _sendPersonnelGmEmailCallBack);
	},
	sendBdWebSiteInfo:function(identify,pardSeria,email,_sendBdWebSiteInfoCallback){
		 this.buffalo.remoteCall("SendEmailService.sendBdWebSiteInfo",[identify,pardSeria,email],_sendBdWebSiteInfoCallback);
	},
	subscribeRss : function(email,_subscribeRss){
		this.buffalo.remoteCall("SendEmailService.subscribeRss",[email],_subscribeRss);
	}
});

var HandleQuestionCallProxy = Class.create();
Object.extend(Object.extend(HandleQuestionCallProxy.prototype, CallProxy.prototype), { 
	createTestDoc : function(username,questionId,itemAnswer,secret,_createTestDocCallBack){
		this.buffalo.remoteCall("HandleQuestionService.createTestDoc", [username,questionId,itemAnswer,secret], _createTestDocCallBack);
	}
});

var TaoCanCallProxy = Class.create();
Object.extend(Object.extend(TaoCanCallProxy.prototype, CallProxy.prototype), { 
	buyTaoCan : function(taoCanId,username,_buyTaoCanCallBack){
		this.buffalo.remoteCall("TaoCanService.buyTaoCan", [taoCanId,username], _buyTaoCanCallBack);
	}
});

