/*
======================================================================
 Liquid Nails: DIY/Pro User Segmentation.
 Reference this file immediately after each page's body tag.
======================================================================
*/

var SegmentUser = Class.create();
SegmentUser.prototype = {

	// Reference to the HTML body element.
	// Note: Using document.body for this does not work in IE.
	BODY : $$( 'body' )[ 0 ],

	currentUserType : 'none',

	// Initializer.
	//
	initialize : function( userType ) {

		this.currentUserType = userType;

		// Only apply a page style if the HTML body has a user type CSS class. 
		if ( ( this.BODY.hasClassName( 'diy' ) || this.BODY.hasClassName( 'pro' ) ) ) {

			// Apply the user type's page style.
			this.applyPageStyle( userType );

		} // End if.

	}, // End initialize().

	// Applies a CSS style to the page based on the specified user type.
	// Defaults to the PRO style if there is no type specified.
	//
	applyPageStyle : function( userType ) {

		switch( userType ) {
			case 'diy':
				this.BODY.removeClassName( 'pro' );
				this.BODY.addClassName( 'diy' );
				break;
			default:
				this.BODY.removeClassName( 'diy' );
				this.BODY.addClassName( 'pro' );
		} // End switch.

	}, // End applyPageStyle().

	getUserType : function() {

		return this.currentUserType;

	} // End getUserType().

}; // End class SegmentUser.

