
/*
 **************
 * IMPORTANT :: All runtime instance declarations MUST be bound to document 'js-class-setup' event
 **************
 */

	$(document).bind("js-class-setup", function ()
	{
		// Setup runtime namespace if doesn't exist
		if (!manheim.global.isNamespaceDefined("manheim.portfolio.runtime.search.searchResults")) manheim.global.createNamespace("manheim.portfolio.runtime.search.searchResults", "1.0");
		
		// create photo flow feature bind, only needed for list mode flow
		if (($('div.vehicle-list-mode-flow').length > 0) && window.PHOTOFLOW_VEHICLE_DATA)
		{
		    //alert("Init stock list flow feature");
		    manheim.portfolio.runtime.search.searchResults.flowListFeature = new manheim.portfolio.common.display.views.FlowListFeature(manheim.portfolio.runtime.search.searchResults.flowListFeature, "manheim.portfolio.runtime.search.searchResults.flowListFeature", "flash-replace-target-search-results-flow-parent", "flash-replace-target-search-results-flow", "flowListFeature", PHOTOFLOW_VEHICLE_DATA);
		    
		    // TODO need to change ajaxConditionalLinkManager to be have a utility class and resolve to that instead.
			manheim.portfolio.runtime.search.searchResults.flowListFeature.callbackUtilities = manheim.portfolio.common.display.ajaxConditionalLinkManager;
	    }
	});


/*
**************
* IMPORTANT :: All runtime instance declarations MUST be bound to document 'js-class-setup' event
**************
*/

$(document).bind("js-class-setup", function() {
    // Setup runtime namespace if doesn't exist
    if (!manheim.global.isNamespaceDefined("manheim.portfolio.runtime.search.searchResults")) manheim.global.createNamespace("manheim.portfolio.runtime.search.searchResults", "1.0");

    // create stock list feature bind, only needed for list mode list
    if ($('div.vehicle-list-mode-list').length > 0)
    {
        //alert("Init stock list feature");
        manheim.portfolio.runtime.search.searchResults.stockListFeature = new manheim.portfolio.common.display.views.StockListFeature();
        //manheim.portfolio.runtime.search.searchResults.stockListFeature.DEBUG = true;
        
        // TODO need to change ajaxConditionalLinkManager to be have a utility class and resolve to that instead.
        manheim.portfolio.runtime.search.searchResults.stockListFeature.callbackUtilities = manheim.portfolio.common.display.ajaxConditionalLinkManager;
    }
    
    // create stock list image list control, always needed
    //manheim.portfolio.runtime.search.searchResults.stockListImageListControls = new manheim.portfolio.common.controls.ImageListControls();
    
    // bind up image list controls
    //manheim.portfolio.runtime.search.searchResults.stockListImageListControls.bind($("#divVehicleListContainer form.mp-tools-form fieldset.displaymode"));
    
});



//
//
//
//
//
// LEGACY DEVELOPMENT APPROACH
//
// - NEEDS TO BE INTEGRATED INTO CLASSED BASED JS
//
//
//
//
//


















//wire up the functions needed to power the timeout page
$(document).ready(function() 
{
	var selector_NoResultsContent	= "div.no-results";
	var selector_LightBox			= ".ui-lightbox-container";
	var selector_NoResultsDialog	= "#divNoResults";
	var selector_LightBoxContent	= ".ui-lightbox-content-body";
	
	// only continue if we have no results context
	if ($(selector_NoResultsContent).length == 0)
	{
		return;
	}	
	
	// get dialog content
	var dialogContent = $(selector_NoResultsDialog);
	
	// format content of no results light box
	var content_NoResults = $(selector_NoResultsContent).clone(true); // get and clone content
	dialogContent.find(selector_LightBoxContent).prepend(content_NoResults); // add cloned content to dialog
	
	//get the params needed to hack this into the lightbox
	var rawParams = '#?go=go&width=600&height=420&target=divUvlContainer&source=divNoResults&displayPosition=viewableCentre';
	var parameters = uiBox_GetQueryString(rawParams);
	
	//show the lightbox
	uiBox_Show(parameters, rawParams);
	
	// get dialogContainer
	var dialogContainer = $(selector_LightBox).find(selector_NoResultsDialog);
	
	//now bind the cancel and continue buttons	
	var continueButton	= dialogContainer.find("div.button-continue");
	
	// Attach standard click functionality to link
	continueButton.click( function (e) { uiBox_Hide(); } );
	
	continueButton.hover(
		function () { $(this).addClass("button-style-1-hover"); },
		function () { $(this).removeClass("button-style-1-hover"); }
	);
	
//
//	[ sIFR button ] activation / styling
//	
//	// If ie then add href attribute to each buttons internal <a> tag
//	if ($.browser.msie)
//	{
//		var continueLink = continueButton.find("a");
//		continueLink.attr("href", "javascript:void uiBox_Hide();");
//	}
//	// Style buttons
//	sIFR.runDelayedButtonStyling(selector_NoResultsDialog + " " + "div.button-style-1" + " " + sIFR.styles.DEFAULT_BUTTON_STYLE_TARGET_STRING_INTERNAL_PATH);
});
	


