﻿		
	/*
	 ***********************************
	 * CORE CONFIGURATION
	 ***********************************
	 */
		
		sIFR.useDomLoaded	= true;	
			
			
			
	/*
	 ***********************************
	 * UTILITIES
	 ***********************************
	 */
		/*
		 ----------
		 CONSTANTS
		 ----------
		 */
		 if (sIFR.styles)
		 {
			sIFR.styles.STYLE_COMPARE					= "STYLE-COMPARE";
			sIFR.styles.STYLE_ADVANCED_SEARCH			= "STYLE-ADVANCED-SEARCH";
			sIFR.styles.STYLE_BUTTONS_STANDARD			= "STYLE_BUTTONS_STANDARD";
			
			
			sIFR.styles.DEFAULT_BUTTON_STYLE_TARGET_STRING					= "div.button-style-1 > div.but-body > p, div.button-style-2 > div.but-body > p, div.button-style-3 > div.but-body > p";
			sIFR.styles.DEFAULT_BUTTON_STYLE_TARGET_STRING_INTERNAL_PATH	= "div.but-body > p"
		}
		
		
		
		/*
		 ----------
		 STYLING UTILITY METHODS
		 ----------
		 */
			 /*
			 ----------
			 ELEMENT STYLING METHODS
			 ----------
			 */
				sIFR.runDelayedStyling = function (type)
				{
					switch (type)
					{
						case sIFR.styles.STYLE_COMPARE :
							sIFR.styleCompareElements();
							break;
							
						case sIFR.styles.STYLE_ADVANCED_SEARCH :
							sIFR.styleAdvancedSettingsPanel();
							break;
							
						default :
							break;
					}
				}
				
				
				
				sIFR.styleCompareElements = function() 
				{
					// Escape if style not defined
					if (!sIFR.styles || !sIFR.styles.OFFSET_FONT_1_STYLE_1) return;
					
//					sIFR.replace(sIFR.styles.OFFSET_FONT_1_STYLE_1, 
//					{
//						selector: "div.compare-display-container div.compare-container-content table h5"
//					});
				}
				
				
				
				sIFR.styleAdvancedSettingsPanel = function ()
				{
					// Escape if style not defined
					if (!sIFR.styles || !sIFR.styles.PANEL_STYLE_2_HEADER) return;
					
					sIFR.replace(sIFR.styles.PANEL_STYLE_2_HEADER, 
					{
						selector: "div.uvl-container > div.search-criteria-container > form > div.search-criteria-panels > div.panel-advanced-settings > div.panel-body-container > div.panel-body > div.panel-body-header > h2"
					});
				}
				
				
				
				sIFR.styleResultsListResultsCount = function ()
				{
					// Escape if style not defined
					if (!sIFR.styles || !sIFR.styles.FONT_1_STYLE_4) return;
					
					sIFR.replace(sIFR.styles.FONT_1_STYLE_4, 
					{
						selector : "div.main-container div.uvl-container div.vehicle-list-container h3:not(div.user-container div.vehicle-list-container h3)"
					});
				}
				
		
				
				sIFR.runDelayedLightBoxHeaderStyling = function (jQueryTargetString)
				{
					// Escape if style not defined
					if (!sIFR.styles) return;
					
					if (jQueryTargetString)
					{
						// Replace h2
						if (sIFR.styles.FONT_3_STYLE_4)
						{
							sIFR.replace(sIFR.styles.FONT_3_STYLE_4, 
							{
								selector: (jQueryTargetString + " h2")
							});
						}
						
						// Replace h3
						if (sIFR.styles.FONT_1_STYLE_8)
						{
							sIFR.replace(sIFR.styles.FONT_1_STYLE_8,
							{
								selector: (jQueryTargetString + " h3")
							});
						}
						
						
						// Replace 'in-content' h4 section headers
						if (sIFR.styles.FONT_1_STYLE_5)
						{
							sIFR.replace(sIFR.styles.FONT_1_STYLE_5,
							{
								selector: (jQueryTargetString + " h4.section-header")
							});
						}
						
						
					}
				}
			
			
			
			
			
			
			/*
			 -------------------------------------------------------------------------------------------------------------
			 * GENERIC SIFR REPLACED ELEMENT TEXT UPDATE 
			 *
			 * @argument : uniqueJQSelector :: unique jquery formatted selector;
			 * @argument : text :: Update text (html formatted e.g: "update <span class='span'>text</span>" )
			 * @argument : isUpperCase :: Boolean indicating when text should be reformatted to uppercase of left untouched
			 *
			 * IMPORTANT :: this technique assumes that there is ONLY 1 object tag within the replaced element and that it is the FIRST CHILD
			 *
			 * EXAMPLE :: << sIFR_Utilities.replaceSifrText($("div.column2 > div.panel-compare > div.header > h2"), "i've been updated <span class='span'>mofo</span>", true); >>
			 -------------------------------------------------------------------------------------------------------------
			 */
				sIFR.replaceSifrText = function (uniqueJQueryTargetString, text, isUpperCase)
				{
					var targetContainer = $(uniqueJQueryTargetString + ":first");
					var target			= sIFR.getReplacementByFlashElement(targetContainer.children()[0]);
					target.replaceText((isUpperCase) ? text.toUpperCase() : text);
				}
