
	/********************************************************************/
	/*                                                                  */
	/*      Copyright (C) 2004 Arash Dejkam, All Rights Reserved.       */
	/*      http://www.tracewatch.com                                   */
	/*                                                                  */
	/*      Please read the licence file distributed with this          */
	/*      file or the one available at tracewatch.com for             */
	/*      the terms under which you can use or modify this file.      */
	/*                                                                  */
	/********************************************************************/
    
function UserManager( viewReports, viewAdmin, admin, viewIps, viewCookieIds ) {

	this.ArdeComponent( 'div' );
	this.cls( 'block' );
	
	var t = new ArdeTable().cls( 'std' ).appendTo( ardeE( 'div' ).appendTo( this ) );
	var tr = ardeE( 'tr' ).appendTo( ardeE( 'thead' ).appendTo( t ) );
	tr.append( ardeE( 'td' ).append( ardeT( 'User' ) ) ).append( ardeE( 'td' ).append( ardeT( 'View Reports' ) ) );
	tr.append( ardeE( 'td' ).append( ardeT( 'View Admin' ) ) ).append( ardeE( 'td' ).append( ardeT( 'Administrate' ) ) );
	tr.append( ardeE( 'td' ).append( ardeT( 'View Ips' ) ) ).append( ardeE( 'td' ).append( ardeT( 'View Cookie Ids' ) ) );
	this.viewReportsCheck = new ArdeCheckBox( viewReports );
	this.viewAdminCheck = new ArdeCheckBox( viewAdmin );
	this.administrateCheck = new ArdeCheckBox( admin );
	this.viewIpsCheck = new ArdeCheckBox( viewIps );
	this.viewCookieIdsCheck = new ArdeCheckBox( viewCookieIds );
	
	var tr = ardeE( 'tr' ).appendTo( ardeE( 'tbody' ).appendTo( t ) );
	
	tr.append( ardeE( 'td' ).append( ardeT( 'Guest' ) ) ).append( ardeE( 'td' ).append( this.viewReportsCheck ) );
	tr.append( ardeE( 'td' ).append( this.viewAdminCheck ) ).append( ardeE( 'td' ).append( this.administrateCheck ) );
	tr.append( ardeE( 'td' ).append( this.viewIpsCheck ) ).append( ardeE( 'td' ).append( this.viewCookieIdsCheck ) );
	this.applyButton = new ArdeRequestButton( 'Apply Changes' );
	this.applyButton.setStandardCallbacks( this, 'apply' );
	this.append( ardeE( 'p' ).append( this.applyButton ) );
}

UserManager.prototype.applyClicked = function () {
	var url = new ArdeUrlWriter( 'rec/rec_users.php' ).setParam( 'profile', twatchProfile, 'default' );
	this.applyButton.request( url.getUrl(), 'a=change&vr='+(this.viewReportsCheck.element.checked?'t':'f')+'&va='+(this.viewAdminCheck.element.checked?'t':'f')+'&ad='+(this.administrateCheck.element.checked?'t':'f')+'&vi='+(this.viewIpsCheck.element.checked?'t':'f')+'&vc='+(this.viewCookieIdsCheck.element.checked?'t':'f') );
}

ArdeClass.extend( UserManager, ArdeComponent );

