/**
 *	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("JobTestServer")>-1)
			this.END_POINT = (typeof(END_PONIT) == "undefined" || END_PONIT=="")?"/bh-JobTestServer/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), { 
	getImageCode : 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 DeleteCallProxy = Class.create();

Object.extend(Object.extend(DeleteCallProxy.prototype, CallProxy.prototype), { 
	deleteUser : function(values,_deleteCallback){
		 this.buffalo.remoteCall("DeleteService.deleteUser", [values], _deleteCallback);

	},
	deleteMessage : function(values,_deleteCallback){
		 this.buffalo.remoteCall("DeleteService.deleteMessage", [values], _deleteCallback);

	}
});

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 PushCallProxy = Class.create();
Object.extend(Object.extend(PushCallProxy.prototype, CallProxy.prototype), { 
	getPushVoOfTag : function(tags, type, _getPushVoOfTagCallback){
		this.buffalo.remoteCall("PushService.getPushVoOfTag", [tags,type], _getPushVoOfTagCallback);
	}
});

var PositionCallProxy = Class.create();
Object.extend(Object.extend(PositionCallProxy.prototype, CallProxy.prototype), { 
	getPositions : function(tradeId,isQuestion, _getPositionsCallback){
		this.buffalo.remoteCall("PositionService.getPositions", [tradeId,isQuestion], _getPositionsCallback);
	}
});

var TestCallProxy = Class.create();
Object.extend(Object.extend(TestCallProxy.prototype, CallProxy.prototype), { 
	saveTest : function(questionId,answers,username, _saveTestCallback){
		this.buffalo.remoteCall("saveTestService.saveTest", [questionId,answers,username], _saveTestCallback);
	}
});

var CityCallProxy = Class.create();
Object.extend(Object.extend(CityCallProxy.prototype, CallProxy.prototype), { 
    getCitys : function(prov,_getCitysCallback){
       this.buffalo.remoteCall("CityService.getCitys", [prov], _getCitysCallback);
    }

});

var CityCallProxy = Class.create();
Object.extend(Object.extend(CityCallProxy.prototype, CallProxy.prototype), { 
    getCitys : function(prov,_getCitysCallback){
       this.buffalo.remoteCall("CityService.getCitys", [prov], _getCitysCallback);
    }

});

var SendEmailCallProxy = Class.create();
Object.extend(Object.extend(SendEmailCallProxy.prototype, CallProxy.prototype), { 
    sendMessage : function(email,username,type,_getSendEmailCallback){
     this.buffalo.remoteCall("SendEmaiService.sendMessage", [email,username,type], _getSendEmailCallback);
    }

});

var EnabledUserBuffaloService = Class.create();
Object.extend(Object.extend(EnabledUserBuffaloService.prototype, CallProxy.prototype), { 
    enabledUser : function(id,_EnabledUserCallback){
     this.buffalo.remoteCall("EnabledUserBuffaloService.enabledUser", [id], _EnabledUserCallback);
    }

});

var ResetPassBuffaloService = Class.create();
Object.extend(Object.extend(ResetPassBuffaloService.prototype, CallProxy.prototype), { 
    resetPass : function(id,_EnabledUserCallback){
     this.buffalo.remoteCall("ResetPassBuffaloService.resetPass", [id], _EnabledUserCallback);
    }

});



