function RandomMembers( strControllerURL ){
	this.ControllerURL = strControllerURL;
	this.Init();
};

RandomMembers.prototype.objPostProperties = function( objPostProperties ){
	this.PostProperties = objPostProperties;
};

RandomMembers.prototype = new PageControllerClass;
RandomMembers.prototype.Init = function(){
	var objSelf = this;
	this.SetBusy( true );
	$('img#refresh-btn').click(
		function( objEvent ){
			var $this = $('form#random-members-options');
			objSelf.GetRandomMembers( $this );
			return( false );
		}
	);
	$('img#options-img').click(
		function( objEvent ){
			var $this = $(this);
			$this.css('display','none');
			$('form#random-members-options').css('display','block');
			return( false );
		}
	);
	this.SetBusy( false );
};

RandomMembers.prototype.GetRandomMembers = function( jForm ){
	var objSelf = this;
	if (objSelf.GetBusy()){ objSelf.AlertBusy(); } else { objSelf.SetBusy( true ); };
	var objPostProperties = {
		"do": "api.members.getRandomMembers",
		returnLen: jForm.find("select[name='returnLen']").val(),
		sex: jForm.find("select[name='sex']").val(),
		hasAvatar: jForm.find("select[name='hasAvatar']").val()
	};
	$.post(this.ControllerURL,objPostProperties,function(objResponse){objSelf.GetRandomMembersHandler(objResponse,jForm);},"json");
};

RandomMembers.prototype.GetRandomMembersHandler = function( objResponse , jForm ){
	if(objResponse.SUCCESS){
		$('#themembers').html(objResponse.DATA);
	} else {
		this.ShowAPIErrors( objResponse.ERRORS );
	};
	this.SetBusy( false );
};

