(function($) {
	var site = window.site = function() {
		return {
			data : {
				// js data
				divLoadingHTML : function() {
					return	'<div id="LoadingDivContent">' +
								'<img id="AjaxLoading" src="/assets/images/img/img-AjaxLoader.gif" alt="Loading" />' +
								'<a class="js-PopupDivClose" href="#Close"><img src="/assets/images/btn/btn-Cancel.gif" alt="Cancel" /></a>' +
								'</div>';
				},
				pageOverlayHTML : "<div id='PageOverlayLayer'><!-- --></div>",
				imageOffPostfix : "_off",
				imageOnPostfix : "_on",
				searchByVehicleURL : "",
				searchByVehicleReady : false,
				searchByVehicleVOFilter : null,
				searchBySizeURL : "",
				searchBySizeTraditionalReady : false,
				searchBySizeHighFlotationReady : false
			},
			func : {
				// commonly used site specfic functions
				toggleOrderTotals : function() {
					$(".js-ShowOrderTotalCollapsible a.js-ToggleOrderTotalCollapsible").click(function(evt) {
						evt.preventDefault();
						$("#myBasket", window.parent.document).height($("body").height() + 117);
						$(".js-ShowOrderTotalCollapsible").hide();
						$(".js-HideOrderTotalCollapsible").show();
						$(".js-OrderTotalCollapsible").slideDown(350);
					});
					
					$(".js-HideOrderTotalCollapsible a.js-ToggleOrderTotalCollapsible").click(function(evt) {
						evt.preventDefault();
						$("#myBasket", window.parent.document).height($("body").height() - 117);
						$(".js-ShowOrderTotalCollapsible").show();
						$(".js-HideOrderTotalCollapsible").hide();
						$(".js-OrderTotalCollapsible").slideUp(350);
					});
				},
            toggleRecommendedServicesTotals : function() {
					$(".js-ShowRecommendedServicesCollapsible a.js-ToggleRecommendedServicesCollapsible").click(function(evt) {
						evt.preventDefault();
						$(".js-ShowRecommendedServicesCollapsible").hide();
						$(".js-HideRecommendedServicesCollapsible").show();
						$(".js-RecommendedServicesCollapsible").slideDown(350);
					});

					$(".js-HideRecommendedServicesCollapsible a.js-ToggleRecommendedServicesCollapsible").click(function(evt) {
						evt.preventDefault();
						$(".js-ShowRecommendedServicesCollapsible").show();
						$(".js-HideRecommendedServicesCollapsible").hide();
						$(".js-RecommendedServicesCollapsible").slideUp(350);
					});
				},
            loadVehicleDefaultsFromUrl : function(url) {
					// Grab the params to load teh vehicle in dropdowns
					var params = url.split("?")[1].split("&");
					var finalizedParams = [];
					for( var x = 0; x < params.length; x++)
					{
						finalizedParams[x] = params[x].split("=")[1];
						if( finalizedParams[x] == "" )
						{ finalizedParams[x] = "N/A"; }
					}
					
					// load the previous vehicle
					site.func.searchByVehicleDefault({
						make : finalizedParams[0],
						model : finalizedParams[1],
						year : finalizedParams[2],
						version : finalizedParams[3],
						option : finalizedParams[4]
					});
				},
				doEmptyTheCartLayer : function(url) {
					var html =	'<div id="EmptyTheCartLayerContent" class="PopupTemplate1">' +
									'<h1>Empty the Cart?</h1>' +
									'<div class="Stripe TopStripe"><!--  --></div>' +
									'<div class="PopupContent">' +
									'You have items in your cart and you are attempting to shop for a different vehicle. (Only one vehicle may be shopped for at a time.) The tires currently in the cart may not be safe for this vehicle.' +
									'<br /><br /><span class="bold">Would you like to empty the cart?</span>' +
									'<div id="EmptyTheCartButtons">' +
									'<a href="' + url + '&emptyCart=Y"><img src="/assets/images/btn/btn-Yes.gif" alt="Yes" /></a>' +
									'&nbsp;&nbsp;&nbsp;<a href="' + url + '&emptyCart=N"><img src="/assets/images/btn/btn-No.gif" alt="No" /></a>' +
									'</div>' +
									'</div>' +
									'<div class="Stripe PopupCloseButtonArea"><a href="#CloseLayer" class="js-PopupDivClose"><img src="/assets/images/btn/btn-Cancel.gif" alt="Cancel" /></a></div>' +
									'</div>';
				
					lib.layer.add("#EmptyTheCartLayer", html, "#_none");
					$("#EmptyTheCartLayer").fadeIn(500);
					$("#EmptyTheCartLayer .js-PopupDivClose").click(function(evt) {
						evt.preventDefault();
						$("#EmptyTheCartLayer").fadeOut(500, function() {
							lib.layer.remove("#EmptyTheCartLayer");
							site.func.doPageOverlay(null);
							window.onscroll = null;
						});
					});
				},
				doCheckoutMap : function(storeAddress) {
					var geocoder = new GClientGeocoder();
					geocoder.getLatLng( storeAddress, function(geocode) {
						if( geocode )
						{ 
							site.data.gmap = new GMap2(document.getElementById("Map"));
							site.data.gmap.addControl(new GLargeMapControl());
							site.data.gmap.setCenter(new GLatLng(geocode.lat(), geocode.lng()), 11, G_NORMAL_MAP);
							
							// setup the base icon
							site.data.mapBaseIcon = new GIcon();
							site.data.mapBaseIcon.shadow = "http://www.google.com/intl/en_us/mapfiles/arrowshadow.png";
						   site.data.mapBaseIcon.iconSize = new GSize(20, 34);
						   site.data.mapBaseIcon.shadowSize = new GSize(37, 34);
						   site.data.mapBaseIcon.iconAnchor = new GPoint(9, 34);
						   site.data.mapBaseIcon.infoWindowAnchor = new GPoint(9, 2);
						   site.data.mapBaseIcon.infoShadowAnchor = new GPoint(18, 25);
						   
						   // setup the markers
						   site.data.mapMarkerType1 = new GIcon(site.data.mapBaseIcon);
						   site.data.mapMarkerType1.image = "http://maps.google.com/mapfiles/marker.png"
							
							var newmarker = new GMarker( new GLatLng(geocode.lat(), geocode.lng()), site.data.mapMarkerType1);
							site.data.gmap.addOverlay( newmarker );
						}
					});	
				},
				doCalendarLayer : function(href) {
					// reset the array
					site.data.dayTimeAvaliability = null
					site.data.dayTimeAvaliability = [];
					
					// do the layers
					lib.layer.add("#CalendarLayer", site.data.divLoadingHTML(), ".js-PopupDivClose");
				   var location = lib.utils.getPosition("#DatePicker")[0]
				   location[0] = location[0] + 35; 
				   $("#CalendarLayer").css("left", location[0] +"px").css("top", location[1]+"px");
				  	lib.layer.ie6Fix("#CalendarLayer", "u");
				   lib.layer.loadHTML("#CalendarLayer", href, ".js-PopupDivClose", function() {
				   	location[1] = location[1] - ( $("#CalendarLayer").height() / 2 );
				   	$("#CalendarLayer").css("left", location[0] +"px").css("top", location[1]+"px");
				  		lib.layer.ie6Fix("#CalendarLayer", "u");
				   });
				},
				doPageOverlay : function(action) {
					clearInterval(site.data.overlayScrollInterval);
					$("html").css("overflow", "auto");
					$("#PageOverlayLayer").remove();
					lib.layer.ie6Fix("#PageOverlayLayer","r");
					
					if( action == "add" )
					{  
						site.data.overlayScrollInterval = setInterval( function() {
							window.scroll(0,0);
						}, 10);
						
						$("html").css("overflow","hidden");
						$("body").append(site.data.pageOverlayHTML);
						
						var size = lib.screen.size();
						var position = lib.screen.position();
						
						$("#PageOverlayLayer").css("left", position[0]+"px").css("top", position[1]+"px").css("width", size[0]+"px").css("height", size[1]+"px");
						lib.layer.ie6Fix("#PageOverlayLayer","a");
					}
				},
				
				doCompareLayerOverlay : function(action) {
				
					$("html").css("overflow", "auto");
					$("#PageOverlayLayer").remove();
					lib.layer.ie6Fix("#PageOverlayLayer","r");
					
					if( action == "add" )
					{  
						$("body").append(site.data.pageOverlayHTML);	
						$("#PageOverlayLayer").css("left", "0px").css("top", "0px").css("width", document.body.scrollWidth).css("height", document.body.scrollHeight);
						lib.layer.ie6Fix("#PageOverlayLayer","a");
					}
				},
				
				
				
				
				doTireSizeMismatch : function(html) {
					lib.layer.add("#TireSizeMismatchLayer", html, "#_none");
					$("#TireSizeMismatchLayer").fadeIn(500);
					$("#TireSizeMismatchLayer .js-PopupDivClose").click(function(evt) {
						evt.preventDefault();
						$("#TireSizeMismatchLayer").fadeOut(500, function() {
							lib.layer.remove("#TireSizeMismatchLayer");
							site.func.doPageOverlay(null);
							window.onscroll = null;
						});
					});
				},
				doTireSizeLayer :function(html) { 
					lib.layer.add("#TireSizeLayer", html, "#_none");
					$("#TireSizeLayer").fadeIn(500);
					$("#TireSizeLayer .js-PopupDivClose").click(function(evt) {
						evt.preventDefault();
						var location = lib.utils.getPosition(".js-HeaderMyTireSize")[0];
						$("#TireSizeLayer, #TireSizeLayer-iframe").animate({
							left: location[0],
							top: location[1],
							height: 0,
							width: 0
							},1000, function() {
								$(".js-HeaderMyTireSize").addClass("HeaderVehicleInformationHighlight");
								setTimeout(function() { $(".js-HeaderMyTireSize").removeClass("HeaderVehicleInformationHighlight"); }, 1000);
								lib.layer.remove("#TireSizeLayer");
								site.func.doPageOverlay(null);	
								window.onscroll = null;
							}
						);
					});
				},
				doStoreSearch : function( formSelector ) {
					var searchVal = $(formSelector + " " + "input[name=cityStateZip]").val();
					var geocoder = new GClientGeocoder();
					geocoder.getLatLng( searchVal, function(geocode) {
						if( !geocode )
						{ alert( "Please enter a valid city, state or zip code to find a store near you."); }
						else
						{ 
							$(formSelector + " " + "input[name=latitude]").val( geocode.lat() );
							$(formSelector + " " + "input[name=longitude]").val( geocode.lng() );
							$(formSelector).unbind("submit");
							$(formSelector).submit();
						}
					});
				},
				setupStoreLocatorLayer : function() {
					var storeLocatorLayerTimer;
					$("#js-StoreLocatorLayer").hover(
						function() {
							clearTimeout(storeLocatorLayerTimer);
							if( $("#StoreLocatorLayer").size() == 0 )
							{
								// Add HTML
								var html =	'<div id="StoreLocatorLayer" styleClass="widget-ie6png">' +
												'<div class="Inner">' +
												'<h3>Find Stores within:</h3>' +
												'<form method="post" id="locateStoreFormHeader" name="locateStoreFormHeader" action="/custserv/locate_store.cmd">' +
												'<input type="hidden" name="latitude" />' +
												'<input type="hidden" name="longitude" />' +
												'<input type="radio" class="RadioButton" name="radius" id="radius10" value="10" checked="checked" /><label for="radius10">10 Miles</label>' +
												'<input type="radio" class="RadioButton" name="radius" id="radius20" value="20" /><label for="radius20">20 Miles</label>' +
												'<input type="radio" class="RadioButton" name="radius" id="radius50" value="50" /><label for="radius50">50 Miles</label>' +
												'<div class="clr"><!-- --></div>' +
												'<input type="text" name="cityStateZip" id="" size="28" />' +
                                                '<input type="image" class="Button" src="/assets/images/btn/btn-Go.gif" alt="Go" />' +
												'<div class="clr"><!-- --></div>' +
												'</form>' +
												'</div>' +
												'</div>';
								$("body").append(html);
								
								// Position Layer and Display
								var posLeft = lib.utils.getPosition("#PageContentBody")[0][0] + $("#PageContentBody").width() - $("#StoreLocatorLayer").width();
								$("#StoreLocatorLayer").css("left", posLeft+"px").show();
								lib.layer.ie6Fix("#StoreLocatorLayer", "a");
								
								
								// search field default text
								lib.input.defaultText("form[name=locateStoreFormHeader] input[name=cityStateZip]", { defaultText : "City & State, or ZIP Code" });
								
								// Attach the Events
								$("#StoreLocatorLayer").hover(
									function() {
										clearTimeout(storeLocatorLayerTimer);
									},
									function() {
										storeLocatorLayerTimer = setTimeout(function() { $("#StoreLocatorLayer").remove(); lib.layer.ie6Fix("#StoreLocatorLayer", "r"); }, 500);
									}
								);
								$("#locateStoreFormHeader").submit(function(evt) {
									evt.preventDefault();
									site.func.doStoreSearch("#locateStoreFormHeader")
								});
							}
							
						},
						function() {
							storeLocatorLayerTimer = setTimeout(function() { $("#StoreLocatorLayer").remove(); lib.layer.ie6Fix("#StoreLocatorLayer", "r");  }, 500);
						}
					);
					
					$("#js-StoreLocatorLayerUnknown").hover(
						function() {
							clearTimeout(storeLocatorLayerTimer);
							if( $("#StoreLocatorLayer").size() == 0 )
							{
								// Add HTML
								var html =	'<div id="StoreLocatorLayer" styleClass="widget-ie6png">' +
												'<div class="Inner">' +
												'<h3>Find Stores within:</h3>' +
												'<form method="post" id="locateStoreFormHeader" name="locateStoreFormHeader" action="/custserv/locate_store.cmd">' +
												'<input type="hidden" name="latitude" />' +
												'<input type="hidden" name="longitude" />' +
												'<input type="radio" class="RadioButton" name="radius" id="radius10" value="10" checked="checked" /><label for="radius10">10 Miles</label>' +
												'<input type="radio" class="RadioButton" name="radius" id="radius20" value="20" /><label for="radius20">20 Miles</label>' +
												'<input type="radio" class="RadioButton" name="radius" id="radius50" value="50" /><label for="radius50">50 Miles</label>' +
												'<div class="clr"><!-- --></div>' +
												'<input type="text" name="cityStateZip" id="" size="28" />' +
												'<input type="image" class="Button" src="/assets/images/btn/btn-Go.gif" alt="Go" />' +
												'<div class="clr"><!-- --></div>' +
												'</form>' +
												'</div>' +
												'</div>';
								$("body").append(html);
								
								// Position Layer and Display
								var posLeft = $("#PageContent").width() - $("#StoreLocatorLayer").width();
								$("#StoreLocatorLayer").css("left", posLeft+"px").show();
								// search field default text
								lib.input.defaultText("form[name=locateStoreFormHeader] input[name=cityStateZip]", { defaultText : "City & State, or ZIP Code" });
								
								// Attach the Events
								$("#StoreLocatorLayer").hover(
									function() {
										clearTimeout(storeLocatorLayerTimer);
									},
									function() {
										storeLocatorLayerTimer = setTimeout(function() { $("#StoreLocatorLayer").remove(); lib.layer.ie6Fix("#StoreLocatorLayer", "r"); }, 500);
									}
								);
								$("#locateStoreFormHeader").submit(function(evt) {
									evt.preventDefault();
									site.func.doStoreSearch("#locateStoreFormHeader")
								});
							}
							
						},
						function() {
							storeLocatorLayerTimer = setTimeout(function() { $("#StoreLocatorLayer").remove(); lib.layer.ie6Fix("#StoreLocatorLayer", "r");  }, 500);
						}
					);
				},
				searchByVehicleDefault : function(settings) {
					var settings = $.extend({
						make : null,
						model : null,
						year : null,
						option : null,
						version : null,
						tpms : null
					}, settings);
					
					if( settings.make != null )
					{
						var makeInterval = setInterval(function() {
							if( $("#vehMake option").size() > 1 )
							{
								$("#vehMake").val(settings.make);
								$("#vehMake").change();
								clearInterval(makeInterval);
								if ( settings.model != null )
								{
									var modelInterval = setInterval(function() {
										if( $("#vehModel option").size() > 1 )
										{
											$("#vehModel").val(settings.model);
											$("#vehModel").change();
											clearInterval(modelInterval);
											if( settings.year != null )
											{
												var yearInterval = setInterval(function() {
													if( $("#vehYear option").size() > 1 )
													{
														$("#vehYear").val(settings.year);
														$("#vehYear").change();
														clearInterval(yearInterval);
														
														if( settings.tpms != null )
														{ $("#vehTPMS").val( settings.tpms ); }
														
														if ( settings.version != null )
														{
															var versionInterval = setInterval(function() {
																
																if ($("#vehVersion").is(":hidden")){
																	$("#vehVersion").val(settings.version);
																	$("#vehVersion").change();
																	clearInterval(versionInterval);
																}else if( $("#vehVersion option").size() > 1 )
																{
																	$("#vehVersion").val(settings.version);
																	$("#vehVersion").change();
																	clearInterval(versionInterval);
																}
															}, 200);
														} // end settings.version != null
														
														
														if( settings.option != null )
														{
															var optionInterval = setInterval(function() {
																
																if ($("#vehOption").is(":hidden")){
																	$("#vehOption").val(settings.option);
																	$("#vehOption").change();
																	clearInterval(optionInterval);
																}else if( $("#vehOption option").size() > 1 )
																{
																	$("#vehOption").val(settings.option);
																	$("#vehOption").change();
																	clearInterval(optionInterval);
																}
															}, 200);
														} // end settings.option != null

														
														
													}
												}, 200);
											} // end settings.year != null
										}
									}, 200);
								} // end settings.model != null
							}
						}, 200);
					} // end settings.make != null
				},
				searchByVehicleResets : function( resets ) {
					var resets = $.extend({
						model : false,
						year : false,
						veropt : false
					}, resets);
					
					// do the resets
					site.data.searchByVehicleReady = false;
					if( resets.model )
					{
						$("#vehModel").val("");
						$("#vehModel").attr("disabled", "true");
					}
					if( resets.year )
					{
						$("#vehYear").val("");
						$("#vehYear, #yearNotSure").attr("disabled", "true");
					}
					if( resets.veropt )
					{ 
						if ( $("#TireConsultationContent").size() > 0 ) // in checkout
						{ $("#vehVersion, #vehOption").parent().remove(); }
						else // not in checkout
						{ 
							$("#vehOption, #vehVersion, #js-VehOptionVehVersionEntry").remove(); 
						}
						
					}
				},
				setupSearchByVehicle : function() {
					site.data.searchByVehicleURL = $("#FormSearchByVehicle").attr("action");
				
					//Initially Load the vehicle Makes
					$.getJSON(site.data.searchByVehicleURL, { getMakes : true }, function(data) {
						$("#vehMake option").remove();
						var html = '<option value="">Select Make</option>';
						for(var i = 0; i < data.length; i++)
						{ html += '<option value="' + data[i] + '">' + data[i] + '</option>'; }
						$("#vehMake").append(html);
						$("#vehMake").removeAttr("disabled");
					});
					
					//Add the events to each dropdown
					$("#vehMake").unbind("change.selector").bind("change.selector", function() {
						site.func.searchByVehicleResets({ model : true, year : true, veropt : true });
						if( $(this).val() != "" )
						{
							$.getJSON(site.data.searchByVehicleURL, { vehMake : $("#vehMake").val() }, function(data) {
								$("#vehModel option").remove();
								var html = '<option value="">Select Model</option>';
								for(var i = 0; i < data.length; i++)
								{ html += '<option value="' + data[i] + '">' + data[i] + '</option>'; }
								$("#vehModel").append(html);
								$("#vehModel").removeAttr("disabled");
							});
						}
					});
					$("#vehModel").unbind("change.selector").bind("change.selector", function() {
						site.func.searchByVehicleResets({ year : true, veropt : true });
						if( $(this).val() != "" )
						{
							$.getJSON(site.data.searchByVehicleURL, { vehMake : $("#vehMake").val(), vehModel : $("#vehModel").val() }, function(data) {
								$("#vehYear option").remove();
								var html = '<option value="">Select Year</option>';
								for(var i = 0; i < data.length; i++)
								{ html += '<option value="' + data[i] + '">' + data[i] + '</option>'; }
								$("#vehYear").append(html);
								$("#vehYear").removeAttr("disabled");
								$("#yearNotSure").removeAttr("disabled");
							});	
						}
					});
					$("#yearNotSure").unbind("click.selector").bind("click.selector", function() {	$(this).change(); });
					$("#vehYear, #yearNotSure").unbind("change.selector").bind("change.selector", function(evt) {
						site.func.searchByVehicleResets({ veropt : true });
						if( ($(evt.target).is("#vehYear") && ($(this).val() != "")) || ($(evt.target).is("#yearNotSure") && ($("#vehYear").val() != "")) )
						{
							//Get the options / versions ready
							site.data.searchByVehicleVOFilter = new lib.obj.dynamicDropdown({ dropdownSelector : ".widget-VehicleOptions", customDefaults : true, customDefaultLabels : ["Select Version (Optional)","Select Option (Optional)"], customDefaultValues : ["null","null"] });
							 
							$.ajax({
								url:site.data.searchByVehicleURL,
								dataType: 'json',
								data: { vehMake : $("#vehMake").val(), vehModel : $("#vehModel").val(), vehYear : $("#vehYear").val(), yearNotSure : $("#yearNotSure").attr("checked") }, 
								success:function(data) {
								if ($("#TireConsultationContent").size() > 0){
									$("#vehVersion, #vehOption").parent().remove(); 
								}else{
									$("#vehOption, #vehVersion, #js-VehOptionVehVersionEntry, #js-VehVersionEntry, #js-VehOptionEntry").remove();
								}
								var htmlVersion = '<select class="widget-VehicleOptions" name="vehVersion" id="vehVersion"></select>';
								var htmlOption = '<select class="widget-VehicleOptions" name="vehOption" id="vehOption"></select>';
								var showVersion = false;
								var showOption = false;
                        var versionCount = 0;
                        var optionCount = 0;
                        var versionValueHidden = "null";
                        var optionValueHidden = "null";
                        
                        
                        var availableVersions = new Array();
                        var availableOptions= new Array();
                        
                        for(var i = 0; i < data.length; i++){
                        	if ($.inArray(data[i].VEH_VERSION, availableVersions) == -1){
                        		availableVersions.push(data[i].VEH_VERSION);
                        		versionValueHidden = data[i].VEH_VERSION;
                        	}
                        	
                        	if ($.inArray(data[i].VEH_OPTION, availableOptions) == -1){
                        		availableOptions.push(data[i].VEH_OPTION);
                        		optionValueHidden = data[i].VEH_OPTION;
                        	}
                        	var versionVal = (data[i].VEH_VERSION == "-")?"NA":data[i].VEH_VERSION;
                        	var optionVal=(data[i].VEH_OPTION == "-")?"NA":data[i].VEH_OPTION;
                        	
                        	site.data.searchByVehicleVOFilter.addEntry({ id : (i + 1), values : [ versionVal, optionVal ], labels : [ data[i].VEH_VERSION, data[i].VEH_OPTION ] });
                        	
                        	
                        }
                        
                        versionCount =  availableVersions.length;
                        optionCount = availableOptions.length;
                        var index = data.length + 1;	
                        
                        // set the flags for what to display
                        if (versionCount <= 1 && optionCount <=1) {
                           showVersion = false;
                           showOption = false;
                           versionVal = versionValueHidden == "-"?"NA":versionValueHidden;
                           optionVal = optionValueHidden == "-"?"NA":optionValueHidden;
                           
                        }else{
                        	showVersion = true;
                        	showOption = true;
                        	
                        	if (versionCount ==1 ){
                        		
                        		versionVal = versionValueHidden == "-"?"NA":versionValueHidden;
                        		site.data.searchByVehicleVOFilter.addEntry({ id : index++, values : [ versionVal, "not-sure" ], labels : [ versionValueHidden, "Not Sure"] });
                        		
                        	}else if (optionCount ==1){
                        		
                        		optionVal = optionValueHidden == "-"?"NA":optionValueHidden;
                        		site.data.searchByVehicleVOFilter.addEntry({ id : index++, values : [ "not-sure", optionVal ], labels : ["Not Sure", optionValueHidden] });
                        		
                        	}else{
                        		site.data.searchByVehicleVOFilter.addEntry({ id : index++, values : [ "not-sure", "not-sure" ], labels : [ "Not Sure", "Not Sure"] });
                        		
                        		for (var x =0; x < availableVersions.length; x++){
                        			
                        			versionVal = availableVersions[x] == "-"?"NA":availableVersions[x];
                        			site.data.searchByVehicleVOFilter.addEntry({id : index++, values : [ versionVal, "not-sure" ], labels : [ availableVersions[x], "Not Sure"]});
                        			
                        		}
                        		
                        		
                        		for (var y =0; y < availableOptions.length; y++){
                        			optionVal = availableOptions[y]=="-"?"NA":availableOptions[y];
                        			site.data.searchByVehicleVOFilter.addEntry({ id : index++, values : [ "not-sure", optionVal ], labels : ["Not Sure", availableOptions[y]] });
                        		}
                        		
                        	
                        	}
                        	                        	
                        	
                        }

                        	
                        
                        // append / prepend the dropdowns
								if ( $("#TireConsultationContent").size() > 0 ) // in checkout
								{
									if (!showVersion) {
                              htmlVersion = '<input id="vehVersion" type="hidden" name="vehVersion" value="' + versionVal + '"/>';
                              htmlVersion = '<div id="js-VehVersionEntry" class="FormEntry">' +
                                            htmlVersion +
                                            '</div>';
                           } else {
                              htmlVersion = 	'<div class="FormEntry">' +
                                             '<label for="vehVersion">Version (Optional)</label>' +
                                             htmlVersion +
                                             '</div>';
                           }

                           if (!showOption) {
                              htmlOption = '<input id="vehOption" type="hidden" name="vehOption" value="' + optionVal + '"/>';
                              htmlOption = '<div id="js-VehOptionEntry" class="FormEntry">' +
                                            htmlOption +
                                            '</div>';
                           } else {
                              htmlOption =	'<div class="FormEntry">' +
                                             '<label for="vehOption">Option (Optional)</label>' +
                                             htmlOption +
                                             '</div>';
                           }
          												
									$("#FormSearchByVehicle").append(htmlVersion).append(htmlOption);
								}
								else // not in checkout
								{
                           if (!showVersion) {
                              htmlVersion = '<input id="vehVersion" type="hidden" name="vehVersion" value="' + versionVal + '"/>';
                           }

                           if (!showOption) {
                              htmlOption = '<input id="vehOption" type="hidden" name="vehOption" value="' + optionVal + '"/>';
                           }

                           htmlVersionOption =	'<div id="js-VehOptionVehVersionEntry" class="FormEntry">' +
																'<div class="w100">' +
																htmlVersion +
																htmlOption +			
																'<div class="clr"><!--  --></div>' +
																'</div>' +
																'</div>';
									
									$("#FormSearchByVehicle div.optional").append(htmlVersionOption);
								}
								
								// hide the select box if no values
								if( !showVersion )
								{ 
									if ( $("#TireConsultationContent").size() > 0 ) // in checkout
									{ $("#vehVersion").parent().hide(); }
									else // not in checkout
									{ $("#vehVersion").hide(); }
								}
								if( !showOption )
								{ 
									if ( $("#TireConsultationContent").size() > 0 ) // in checkout
									{ $("#vehOption").parent().hide(); }
									else // not in checkout
									{ $("#vehOption").hide(); }
								}
								
								// start the dropdowns
								if (showVersion || showOption){
									site.data.searchByVehicleVOFilter.start();
									
								}
								
								site.data.searchByVehicleReady = true;
							}
							});
						}
					});
					
					// check the form submit
					$("#FormReserveAppointment").submit(function(evt) {
						if( !site.data.searchByVehicleReady )
						{
							evt.preventDefault();
							$(".js-SearchVehicleError").html('<span class="ErrorText">You must complete all required fields.</span>');
						}
					});
					
					$("#FormSearchByVehicle").submit(function(evt) {
						if( !site.data.searchByVehicleReady )
						{
							evt.preventDefault();
							
							var errorString = "You must select a ";
							var endErrorString = "to find tires.";
							var makeError =false;
							var modelError=false;
							var yearError=false;
							var typeError = "";
							var numErrors = 0;
							
							if( $("#vehMake").val() == ""){
							    typeError += "Make, "; numErrors++;
							    makeError=true;
							}
							if( $("#vehModel").val() == ""){
							    modelError=true;
								if (numErrors > 0) {
									typeError += "Model, "; 
								} else {
									typeError += "Model "; 
								}
								numErrors++;
							}
							if( $("#vehYear").val() == "") {
							    yearError=true;
								if (numErrors > 0) {
									typeError += "and Year ";
								} else {
									typeError = "Year ";
								} 
							}
							errorString = errorString + typeError + endErrorString;
							if (makeError) {
                                $(".js-SearchMakeError").html('<span class="ErrorText">' + errorString + '</span>');
                                $(".js-SearchModelError").html('');
                                $(".js-SearchYearError").html('');
                            } else if (modelError) {
                                $(".js-SearchMakeError").html('');
                                $(".js-SearchModelError").html('<span class="ErrorText">' + errorString + '</span>');
                                $(".js-SearchYearError").html('');
                            } else if (yearError) {
                                $(".js-SearchMakeError").html('');
                                $(".js-SearchModelError").html('');
                                $(".js-SearchYearError").html('<span class="ErrorText">' + errorString + '</span>');
                            } else {
                                $(".js-SearchMakeError").html('');
                                $(".js-SearchModelError").html('');
                                $(".js-SearchYearError").html('');
                            }

							$(".js-SearchVehicleError").html('<span class="ErrorText">' + errorString + '</span>');
						}
					});
				},
				searchBySizeDefault : function (settings) {
				   var settings = $.extend({
					    prefix :null,
						width : null,
						aspect : null,
						rim : null,
					    overallDia : null,
						traditional : true
					}, settings);

					if(settings.traditional){
						if(settings.prefix !=null){

							var prefixInterval= setInterval(function(){
						  	if($("#prefix option").size() > 1 ){
								$("#prefix").val(settings.prefix);
								$("#prefix").change();
								clearInterval(prefixInterval);
								if (settings.width !=null){
								   var widthInterval= setInterval(function(){
									   if( $("#sectionWidth option").size() > 1 ){
										  $("#sectionWidth").val(settings.width);
										  $("#sectionWidth").change();
										  clearInterval(widthInterval);
										  
										  if(settings.aspect!=null){
											 var aspectInterval=setInterval(function(){
												if( $("#aspectRatio option").size() > 1 ){

													$("#aspectRatio").val(settings.aspect);
													$("#aspectRatio").change();
													 clearInterval(aspectInterval);

													if(settings.rim !=null){

														var rimInterval= setInterval(function(){
																if( $("#rimDiameter option").size() > 1 ){

																	$("#rimDiameter").val(settings.rim);
																	$("#rimDiameter").change();
																	clearInterval(rimInterval);

																}


															},200);

													} // end setting.rim dia

											   	  }

												},200) ;

										   }   //end settings.aspect !=null


									   }

								   },200);
								} // end settings.width!=null
							}
						},200);

						}  // end settings.prefix != null
					}
					else{
						if(settings.overallDia!=null){

							var overallDiaInterval= setInterval(function(){
								if($("#overallDiameter option").size()>1){
									$("#overallDiameter").val(settings.overallDia);
									$("#overallDiameter").change();
									clearInterval(overallDiaInterval);

									if(settings.width!=null){
										var widthInterval= setInterval(function(){
										 if( $("#sectionWidth option").size() > 1 ){
										  	$("#sectionWidth").val(settings.width);
										  	$("#sectionWidth").change();
										  	clearInterval(widthInterval);

											if(settings.rim !=null){

												var rimInterval= setInterval(function(){
														if( $("#rimDiameter option").size() > 1 ){

															$("#rimDiameter").val(settings.rim);
															$("#rimDiameter").change();
															clearInterval(rimInterval);
														}

													},200);

											} // end setting.rim dia
											 
										 }

										},200);


									} // end of settings.width

								}

							},200);
							
						} // end settings.traditional !=null
					}

				},
				searchBySizeResets : function( resets ) {
					var resets = $.extend({
						width : false,
						aspect : false,
						rim : false,
						traditional : true
					}, resets);
					
					// do the resets
					if( resets.traditional )
					{ 
						site.data.searchBySizeTraditionalReady = false;
						if( resets.width )
						{
							$("#FormSearchBySizeTraditional #sectionWidth").val("");
							$("#FormSearchBySizeTraditional #sectionWidth").attr("disabled", "true");
						}
						if( resets.aspect )
						{
							$("#FormSearchBySizeTraditional #aspectRatio").val("");
							$("#FormSearchBySizeTraditional #aspectRatio").attr("disabled", "true");
						}
						if( resets.rim )
						{
							$("#FormSearchBySizeTraditional #rimDiameter").val("");
							$("#FormSearchBySizeTraditional #rimDiameter").attr("disabled", "true");
						}
					}
					else
					{ 
						site.data.searchBySizeHighFlotationReady = false;
						if( resets.width )
						{
							$("#FormSearchBySizeHighFlotation #sectionWidth").val("");
							$("#FormSearchBySizeHighFlotation #sectionWidth").attr("disabled", "true");
						}
						if( resets.rim )
						{
							$("#FormSearchBySizeHighFlotation #rimDiameter").val("");
							$("#FormSearchBySizeHighFlotation #rimDiameter").attr("disabled", "true");
						}
					}
				},
				setupSearchBySize : function() {
					if( $("#FormSearchBySizeTraditional").size() > 0 )
					{
						site.data.searchBySizeURL = $("#FormSearchBySizeTraditional").attr("action");
						//Add the events to each dropdown (non floatation)
						$("#FormSearchBySizeTraditional #prefix").val("");
						$("#FormSearchBySizeTraditional #prefix").unbind("change.selector").bind("change.selector", function() {
							site.func.searchBySizeResets({ traditional: true, width : true, aspect : true, rim : true });
							if( $(this).val() != "" )
							{
								$.getJSON(site.data.searchBySizeURL, { prefix : $("#FormSearchBySizeTraditional #prefix").val() }, function(data) {
									$("#FormSearchBySizeTraditional #sectionWidth option").remove();
									var html = '<option value="">Select Width</option>';
									for(var i = 0; i < data.length; i++)
									{ html += '<option value="' + data[i] + '">' + data[i] + '</option>'; }
									$("#FormSearchBySizeTraditional #sectionWidth").append(html);
									$("#FormSearchBySizeTraditional #sectionWidth").removeAttr("disabled");
								});
							}
						});
						$("#FormSearchBySizeTraditional #sectionWidth").unbind("change.selector").bind("change.selector", function() {
							site.func.searchBySizeResets({ traditional: true, aspect : true, rim : true });
							if( $(this).val() != "" )
							{
								$.getJSON(site.data.searchBySizeURL, { prefix : $("#FormSearchBySizeTraditional #prefix").val(), sectionWidth : $("#FormSearchBySizeTraditional #sectionWidth").val() }, function(data) {
									$("#FormSearchBySizeTraditional #aspectRatio option").remove();
									var html = '<option value="">Aspect Ratio</option>';
									for(var i = 0; i < data.length; i++)
									{ html += '<option value="' + data[i] + '">' + data[i] + '</option>'; }
									$("#FormSearchBySizeTraditional #aspectRatio").append(html);
									$("#FormSearchBySizeTraditional #aspectRatio").removeAttr("disabled");
								});	
							}
						});
						$("#FormSearchBySizeTraditional #aspectRatio").unbind("change.selector").bind("change.selector", function() {
							site.func.searchBySizeResets({ traditional : true, rim : true });
							if( $(this).val() != "" )
							{
								$.getJSON(site.data.searchBySizeURL, { prefix : $("#FormSearchBySizeTraditional #prefix").val(), sectionWidth : $("#FormSearchBySizeTraditional #sectionWidth").val(), aspectRatio : $("#FormSearchBySizeTraditional #aspectRatio").val() }, function(data) {
									$("#FormSearchBySizeTraditional #rimDiameter option").remove();
									var html = '<option value="">Rim Diameter</option>';
									for(var i = 0; i < data.length; i++)
									{ html += '<option value="' + data[i].TIRE_SIZE_ID + '">' + data[i].RIMDIAMETER + '</option>'; }
									$("#FormSearchBySizeTraditional #rimDiameter").append(html);
									$("#FormSearchBySizeTraditional #rimDiameter").removeAttr("disabled");
								});	
							}
						});
						$("#FormSearchBySizeTraditional #rimDiameter").unbind("change.selector").bind("change.selector", function() {
							site.func.searchBySizeResets({ traditional: true });
							if( $(this).val() != "" )
							{	site.data.searchBySizeTraditionalReady = true; }
						});
					}
					// -------------------------
					
					//Add the events to each dropdown (floatation)
					if( $("#FormSearchBySizeHighFlotation").size() > 0 )
					{
						site.data.searchBySizeURLHighFloatation = $("#FormSearchBySizeHighFlotation").attr("action");
						$.getJSON(site.data.searchBySizeURLHighFloatation, { sizeType : "high flotation" }, function(data) {
							$("#FormSearchBySizeHighFlotation #overallDiameter option").remove();
							var html = '<option value="">Overall Diameter</option>';
							for(var i = 0; i < data.length; i++)
							{ html += '<option value="' + data[i] + '">' + data[i] + '</option>'; }
							$("#FormSearchBySizeHighFlotation #overallDiameter").append(html);
							$("#FormSearchBySizeHighFlotation #overallDiameter").removeAttr("disabled");
						});
						
						$("#FormSearchBySizeHighFlotation #overallDiameter").unbind("change.selector").bind("change.selector", function() {
							site.func.searchBySizeResets({ traditional: false, width: true, rim : true });
							if( $(this).val() != "" )
							{
								$.getJSON(site.data.searchBySizeURLHighFloatation, { sizeType : "high flotation" , overallDiameter : $("#FormSearchBySizeHighFlotation #overallDiameter").val() }, function(data) {
									$("#FormSearchBySizeHighFlotation #sectionWidth option").remove();
									var html = '<option value="">Section Width</option>';
									for(var i = 0; i < data.length; i++)
									{ html += '<option value="' + data[i] + '">' + data[i] + '</option>'; }
									$("#FormSearchBySizeHighFlotation #sectionWidth").append(html);
									$("#FormSearchBySizeHighFlotation #sectionWidth").removeAttr("disabled");
								});	
							}
						});
						
						$("#FormSearchBySizeHighFlotation #sectionWidth").unbind("change.selector").bind("change.selector", function() {
							site.func.searchBySizeResets({ traditional: false, rim : true });
							if( $(this).val() != "" )
							{
								$.getJSON(site.data.searchBySizeURLHighFloatation, { sizeType : "high flotation" , overallDiameter : $("#FormSearchBySizeHighFlotation #overallDiameter").val(), sectionWidth : $("#FormSearchBySizeHighFlotation #sectionWidth").val() }, function(data) {
									$("#FormSearchBySizeHighFlotation #rimDiameter option").remove();
									var html = '<option value="">Rim Diameter</option>';
									for(var i = 0; i < data.length; i++)
									{ html += '<option value="' + data[i].TIRE_SIZE_ID + '">' + data[i].RIMDIAMETER + '</option>'; }
									$("#FormSearchBySizeHighFlotation #rimDiameter").append(html);
									$("#FormSearchBySizeHighFlotation #rimDiameter").removeAttr("disabled");
								});	
							}
						});
						
						$("#FormSearchBySizeHighFlotation #rimDiameter").unbind("change.selector").bind("change.selector", function() {
							site.func.searchBySizeResets({ traditional: false });
							if( $(this).val() != "" )
							{	site.data.searchBySizeHighFlotationReady = true; }
						});
					}
					// --------------------------
										
					// check the form submit
					$("#FormSearchBySizeTraditional").submit(function(evt) {
						if( !site.data.searchBySizeTraditionalReady )
						{ 
							evt.preventDefault();
							var errorString = "You must select a ";
							var endErrorString = "to find tires.";
                            var metricError =false;
                            var widthError=false;
                            var aspectRatioError=false;
                            var rimDiameterError =false;
							
							var typeError = "";
							var numErrors = 0;
							
							if( $("#prefix").val() == ""){
							    typeError += "Metric, "; numErrors++;
							    metricError=true;
							}
							if( $("#sectionWidth").val() == ""){
							    typeError += "Section Width, "; numErrors++;
							    widthError=true;
							}
							if( $("#aspectRatio").val() == ""){
							    typeError += "Aspect Ratio, "; numErrors++;
							    aspectRatioError=true;
							}
							if( $("#rimDiameter").val() == "" && numErrors == 0){
							    typeError += "Rim Diameter ";
							    rimDiameterError=true;
							}
							if( $("#rimDiameter").val() == "" && numErrors != 0){
							    typeError += "and Rim Diameter ";
							    rimDiameterError=true;
							}
							
							errorString = errorString + typeError + endErrorString;

                            if (metricError) {
                                $(".js-SearchMetricError").html('<span class="ErrorText">' + errorString + '</span>');
                                $(".js-SearchWidthError").html('');
                                $(".js-SearchAspectRatioError").html('');
                                $(".js-SearchRimDiameterError").html('');
                            } else if (widthError) {
                                $(".js-SearchMetricError").html('');
                                $(".js-SearchWidthError").html('<span class="ErrorText">' + errorString + '</span>');
                                $(".js-SearchAspectRatioError").html('');
                                $(".js-SearchRimDiameterError").html('');
                            } else if (aspectRatioError) {
                                $(".js-SearchMetricError").html('');
                                $(".js-SearchWidthError").html('');
                                $(".js-SearchAspectRatioError").html('<span class="ErrorText">' + errorString + '</span>');
                                $(".js-SearchRimDiameterError").html('');
                            } else if (rimDiameterError) {
                                $(".js-SearchMetricError").html('');
                                $(".js-SearchWidthError").html('');
                                $(".js-SearchAspectRatioError").html('');
                                $(".js-SearchRimDiameterError").html('<span class="ErrorText">' + errorString + '</span>');
                            } else {
                                $(".js-SearchMetricError").html('');
                                $(".js-SearchWidthError").html('');
                                $(".js-SearchAspectRatioError").html('');
                                $(".js-SearchRimDiameterError").html('');
                            }

							$(".js-SearchSizeError").html('<span class="ErrorText">' + errorString + '</span>');
						}
					});
					$("#FormSearchBySizeHighFlotation").submit(function(evt) {
						if( !site.data.searchBySizeHighFlotationReady )
						{ 
							evt.preventDefault();
							var errorString = "You must select a ";
							var endErrorString = "to find tires.";
							var typeError = "";
							var numErrors = 0;
                            var overallDiameterError =false;
                            var widthError=false;
                            var rimDiameterError =false;

							if( $("#overallDiameter").val() == ""){
							    typeError += "Overall Diameter, "; numErrors++;
							    overallDiameterError=true;
							}
							if( $("#sectionWidth").val() == ""){
							    typeError += "Section Width, "; numErrors++;
							    widthError=true;
							}
							if( $("#rimDiameter").val() == "" && numErrors == 0){
							    typeError += "Rim Diameter ";
							    rimDiameterError=true;
							}
							if( $("#rimDiameter").val() == "" && numErrors != 0){
							    typeError += "and Rim Diameter ";
							    rimDiameterError=true;
							}
							
							errorString = errorString + typeError + endErrorString;

                            if (overallDiameterError) {
                                $(".js-OverallDiameterError").html('<span class="ErrorText">' + errorString + '</span>');
                                $(".js-SearchWidthError").html('');
                                $(".js-SearchRimDiameterError").html('');
                            } else if (widthError) {
                                $(".js-OverallDiameterError").html('');
                                $(".js-SearchWidthError").html('<span class="ErrorText">' + errorString + '</span>');
                                $(".js-SearchRimDiameterError").html('');
                            } else if (rimDiameterError) {
                                $(".js-OverallDiameterError").html('');
                                $(".js-SearchWidthError").html('');
                                $(".js-SearchRimDiameterError").html('<span class="ErrorText">' + errorString + '</span>');
                            } else {
                                $(".js-OverallDiameterError").html('');
                                $(".js-SearchWidthError").html('');
                                $(".js-SearchRimDiameterError").html('');
                            }

							$(".js-SearchSizeError").html('<span class="ErrorText">' + errorString + '</span>');
						}
					});
				},
				setupTooltips : function() {
					$(".js-Tooltip").hover(
						function(evt) {
							lib.layer.add("#TooltipLayer", $(".Tooltip", this).html(), "#_none");
							var position = lib.utils.getPosition(this)[0];
							$("#TooltipLayer").css("left", (position[0]) + "px").css("top", (position[1] - 28) + "px").fadeIn(150);	
							lib.layer.ie6Fix("#TooltipLayer", "u");
						},
						function() { lib.layer.remove("#TooltipLayer"); }
					);
				}
			},
			openStoreLocatorPopup : function(params) {
				lib.layer.add("#StoreLocatorPopup", site.data.divLoadingHTML(), ".js-PopupDivClose");
				var href = '/custserv/locate_local_store.cmd?'+ params;
				lib.layer.loadHTML("#StoreLocatorPopup", href, "#_none", function() {
					$("#PageContainer").addClass("NoPrint");
					$(".js-PopupDivClose").click(function(evt) {
						evt.preventDefault();
						$("#PageContainer").removeClass("NoPrint");
						lib.layer.remove("#StoreLocatorPopup");
					});
				});
			},
			init : {
				sliders : function(){
					$(".promoSlider").each(function(i){
						var slider = new lib.obj.itemSlider({
							viewport: ".promoSlider:eq(" + i + ") .sliderViewport",
					      content: ".promoSlider:eq(" + i + ") .sliderContent",
					      next: ".promoSlider:eq(" + i + ") .sliderNext a",
					      prev: ".promoSlider:eq(" + i + ") .sliderPrev a",
					      statusbar : ".promoSlider:eq(" + i + ") ul.sliderStatus",
					      item: ".promoSlider:eq(" + i + ") .sliderItem",
					      direction: "horizontal",
					      showAmount: 3
				   	});
				   });
				},
				recentlyViewed : function(){
					if($("#RecentlyViewed").size() > 0){
						var slider = new lib.obj.itemSlider({
							viewport: "#RecentlyViewed .sliderViewport",
					      content: "#RecentlyViewed ul.sliderContent",
					      next: "#RecentlyViewed .sliderNext",
					      prev: "#RecentlyViewed .sliderPrev",
					      item: "#RecentlyViewed li.item",
					      direction: "vertical",
					      showAmount: 3
				   	});
				   }
				}
			},
			obj : {
				
			}
		};
	}($)
})($);

// on body load
$(function() {

	site.init.sliders();
	site.init.recentlyViewed();
	
	// preload a the ajax loading images.
	lib.image.preload("/assets/images/img/img-AjaxLoader.gif,/assets/images/btn/btn-Cancel.gif");

	//Run the Form Setup
	lib.func.formSetup();
	
	// Add Header Tooltips
	site.func.setupTooltips();
	
	// Store Locator Layer Setup
	site.func.setupStoreLocatorLayer();
	
	// Active Leftnav if needed
	if( $("#LeftNavigation").size() > 0 )
	{
		// Setup the buttons for image
		$("#LeftNavigation li a").each(function(i) {
			var imageOff = $("img",this).attr("src");
			var imageOn = $("img",this).attr("src").split(".png")[0] + site.data.imageOnPostfix + ".png";
			// Fix IE 6 roll mouse over 
			if(lib.utils.isIE6()) {
				var style = $("img",this).attr("style");
				if (style != null && style.indexOf("DXImageTransform.Microsoft.AlphaImageLoader") != -1) {
					var txtImg = $("img",this).attr("filters")['DXImageTransform.Microsoft.AlphaImageLoader'].src;
					if (txtImg != null && txtImg.indexOf('_on.png') != -1) {
						imageOn = txtImg;
						imageOff = txtImg.split('_on.png')[0] + ".png";
					} else {
						imageOff = txtImg;
						imageOn = txtImg.split(".png")[0] + site.data.imageOnPostfix + ".png";
					}
				}
			}
			
			$(this).hover(function(){
				$("img",this).attr('src',imageOn);
			},
			function(){
				$("img",this).attr('src',imageOff);
			});
	   });
	}

	// Awards Info Popup Windows
	lib.link.popupWindow(".ProductAwards a", {
		width: 600,
  		height: 400,
  		scrollbars: 1
	});
	// -------------------------
	
	// Product Icons Popups
	$(".js-ProductIcons img").each(function(i) {
		$(this).hover(
			function() {
				var iconHTML = $(".js-ProductIconsContent:eq(" + i + ")").html();
				var location = lib.utils.getPosition(this)[0];
				location[0] = location[0] + $(this).width() + 0;
				
				lib.layer.add("#IconsLayer", iconHTML, "#_none");	
				$("#IconsLayer").css("left", location[0] + "px").css("top", location[1] + "px").fadeIn(200);
				lib.layer.ie6Fix("#IconsLayer","u");
			},
			function() {
				lib.layer.remove("#IconsLayer");
			}
		);
	});
	// --------------------------

	// OrderTotals collapsable
	site.func.toggleOrderTotals();

   // Recommended Services collapsable
   site.func.toggleRecommendedServicesTotals();

   // Button for print action
	$(".js-PrintButton").click(function(evt) {
		evt.preventDefault();
		window.print();
	});

	// Close Button for the popup windows
	$(".js-PopupWindowClose").click(function(){ window.close(); });

	$(".js-ChooseMoreService").click(function(evt){
		evt.preventDefault();
		pageTracker._trackPageview("/virtual/ServiceSchedulerWidget");
		if ($(this).attr("name")!=""){
			pageTracker._trackPageview($(this).attr("name"));
		}
		$("input[name=source]", "#ServiceSchedulerForm").val("MoreServices");
		$("#ServiceSchedulerForm").submit();
	});
});
