
/* Start Closure */
;( function( $ ) {

	var OPTIONS_AJAX_URL = contextRoot + '/options.do';

	//----- Shows content based on the current retailer site mode (homedepot, walmart, idd)
	$.fn.retailerTypeSwitch = function( homeDepotEvent, walmartEvent, iddEvent ) {

		var thisObj = this;

		// Load the current site options.
		$.getJSON( OPTIONS_AJAX_URL, { action : 'getOptions' }, function( data ) {

			// If the site is in Home Depot mode...
			if ( data.retailer == 'homedepot' ) {
				thisObj.queue( homeDepotEvent );

			// If the site is in Walmart mode...
			} else if ( data.retailer == 'walmart' ) {
				thisObj.queue( walmartEvent );

			// If the site is in IDD mode...
			} else if ( data.retailer == 'idd' ) {
				thisObj.queue( iddEvent );

			// If the site is not in a retailer mode...
			} else {
				
				// Random feature removed prior to walmart integration launch
				//
				// Pick a random retailer to display.
				// var i = Math.floor( Math.random() * 3 );
				// if ( i == 2 ) thisObj.queue( homeDepotEvent );
				// if ( i == 1 ) thisObj.queue( walmartEvent );
				// if ( i == 0 ) thisObj.queue( iddEvent );
			}

		});

		return this;
	};

} )( jQuery ); /* End Closure */

