//------------------------------------------------------[  ]
// Public: JS
//------------------------------------------------------[  ]

//------------------------------------------------------[BD]
var Synergy = function( Config ) {
	var This = function() {
		// Public Vars -----------------------------------------[BD]
		This._Config = {};
		//------------------------------------------------------[BD]

		// Constructor -----------------------------------------[BD]
		(function() {
			This._Config = $.extend(This._Config, Config);
		})();
		//------------------------------------------------------[BD]
		
		// Public Functions ------------------------------------[BD]
		This.InitSearch = function() {
			$('form[name=FRM_SRCH]').find('input[name=q]').focus( function() {
				$(this).removeClass('Empty').val( ( $.trim( $(this).val() ) == 'Search Here' ) ? '' : $(this).val() );
			});

			$('form[name=FRM_SRCH]').find('input[name=q]').blur( function() {
				if ( $.trim( $(this).val() ) == '' )
					$(this).addClass('Empty').val( 'Search Here' );
				else
					$(this).removeClass('Empty');
			});
		}
		//------------------------------------------------------[BD]

		// Send Back Reference ---------------------------------[BD]
		return This;
		//------------------------------------------------------[BD]
	};
	return This();
};

var MDS = new Synergy();
MDS.InitSearch();
//------------------------------------------------------[BD]

// Rotating Module Box ---------------------------------[BD]
var RotatingModuleBox = function(RMBType) {
	var This = {
		ModuleRotate: function() {
			var active	= $('.RMBWrapper .' + RMBType  + ':visible');
			var next	= $(active).next().length ? $(active).next() : $('.RMBWrapper .' + RMBType  + ':first');


			next.fadeIn('fast');
			active.toggle();
		},
		ModuleStart: function(className, time) {
			if ($('.RMBWrapper .' + RMBType  + ':visible').length == 0)
				$('.RMBWrapper .' + RMBType  + ':first').toggle();

			if ($('.RMBWrapper .' + RMBType  + '').length > 1) 
				setInterval(className + '.ModuleRotate()', time);
		}
	}
	return This;
}

var RMBProSolutions	= new RotatingModuleBox('PRONews'); 
var RMBPromo		= new RotatingModuleBox('Promotions'); 
var RMBNews			= new RotatingModuleBox('RMBNews'); 
//------------------------------------------------------[BD]