var tochange = '';
var defaultValue = '';
var language = 'English';

var yearQL, makeQL, modelQL, optionsQL, tireSizeQL;
var size, width, aspectratio, diameter;
var name, category;		

$(document).ready(function() {
  $("#tireSizeDiv").hide();
  $("#find_vehicle_submit").hide();
  $("#find_size_submit").hide();
  $("#find_name_submit").hide();
  $("#find_category_submit").hide();
	//logic to hide and show tabs
	setCookieData();

 });
function setCookieData()
{
if($.cookie('type') != null || $.cookie('type') != '')
	{
		if($.cookie('type') =='vehicle')
		{
			$('ul.tabs li.vehicle a').addClass("active");
			$('ul.tabs li.tire_size a').removeClass("active");
			$('ul.tabs li.tire_name a').removeClass("active");
			$('ul.tabs li.tire_category a').removeClass("active");
			
			$("#vehicle_tab").show();
			$("#tire_size_tab").hide();
			$("#tire_name_tab").hide();
			$("#tire_category_tab").hide();
			yearQL = $.cookie('year');
			makeQL = $.cookie('make');
			modelQL = $.cookie('model');
			optionsQL = $.cookie('options');
			tireSizeQL = $.cookie('tireSize');
			toChange = 'yearQL';
			fnSetDDLQL(toChange,yearQL);
		}
		else if($.cookie('type') =='size')
		{
			$('ul.tabs li.vehicle a').removeClass("active");
			$('ul.tabs li.tire_size a').addClass("active");
			$('ul.tabs li.tire_name a').removeClass("active");
			$('ul.tabs li.tire_category a').removeClass("active");
			
			$("#vehicle_tab").hide();
			$("#tire_size_tab").show();
			$("#tire_name_tab").hide();
			$("#tire_category_tab").hide();
			
			size = $.cookie('size');
			width = $.cookie('width');
			aspectratio = $.cookie('aspectratio');
			diameter = $.cookie('diameter');
			toChange = 'size';
			fnSetDDLQL(toChange,size);
			
		}
		else if($.cookie('type') =='name')
		{
			$('ul.tabs li.vehicle a').removeClass("active");
			$('ul.tabs li.tire_size a').removeClass("active");
			$('ul.tabs li.tire_name a').addClass("active");
			$('ul.tabs li.tire_category a').removeClass("active");
			
			$("#vehicle_tab").hide();
			$("#tire_size_tab").hide();
			$("#tire_name_tab").show();
			$("#tire_category_tab").hide();
			
			name = $.cookie('name');
			toChange = 'name';
			fnSetDDLQL(toChange,name);
			
		}
		else if($.cookie('type') =='category')
		{
			$('ul.tabs li.vehicle a').removeClass("active");
			$('ul.tabs li.tire_size a').removeClass("active");
			$('ul.tabs li.tire_name a').removeClass("active");
			$('ul.tabs li.tire_category a').addClass("active");
			
			$("#vehicle_tab").hide();
			$("#tire_size_tab").hide();
			$("#tire_name_tab").hide();
			$("#tire_category_tab").show();
			
			category = $.cookie('category');
			toChange = 'category';
			fnSetDDLQL(toChange,category);
		}
		
		
	}
}
function fnSetDDLQL(toChange, value)
{
var onChange = toChange;
if(document.getElementById(onChange) != null)
	for(var i=0;i < document.getElementById(onChange).length;i=i+1)
	{
		var ddlText=document.getElementById(onChange).options[i].value;
		txtText=value;
		if(ddlText==txtText)
		{
		document.getElementById(onChange).selectedIndex=i;
		break;
		}
	}
	
	$("#"+onChange).change();
	
}
function sizeTypeFilter(v) {
		if (v) v=v.toLowerCase().replace(/^[\r\n]+|[\r\n]+$/g, "").substring(0,(v.indexOf("(")-1));
		return v;
	}	
function populateDropDownsQL(temp)
{	
	if (temp == "year")
	{
	    
		var yearValue = document.getElementById('yearQL').value;
		if(yearValue != yearQL){
			makeQL = "";
		}
		if(yearValue != '-1'){
			$("#makeQL, #modelQL, #optionsQL, #tireSizeQL").html('');
			$("#tireSizeDiv").hide();
			$("#width, #aspectratio, #diameter").html('');
			fnSetDDLQL("size","-1");
			fnSetDDLQL("category","-1");
			fnSetDDLQL("name","-1");
			$("#find_vehicle_submit").hide();
			$("#find_vehicle_submit_disable").show();
			tochange = 'makeQL';
			defaultValue = 'choose_a_make';
			temp="year"+"&yearValue="+yearValue;
                ajaxCallQL(temp);
		} else if(yearValue == '-1'){
			
			$("#makeQL, #modelQL, #optionsQL, #tireSizeQL").html('');
			$("#tireSizeDiv").hide();
			$("#width, #aspectratio, #diameter").html('');
			$("#find_vehicle_submit").hide();
			$("#find_vehicle_submit_disable").show();
		
		}
	}
	if(temp == "make")
	{
	     
		var yearValue = document.getElementById('yearQL').value;
		var makeValue = document.getElementById('makeQL').value;	
		if(makeValue != makeQL){
			modelQL = "";
		}		
		if(makeValue != '-1'){
			$("#modelQL, #optionsQL, #tireSizeQL").html('');
			$("#tireSizeDiv").hide();
			$("#find_vehicle_submit").hide();
			$("#find_vehicle_submit_disable").show();
			tochange = 'modelQL';
			defaultValue = 'choose_a_model';
			temp="make"+"&yearValue="+yearValue+"&makeValue="+escape(makeValue);
			ajaxCallQL(temp);
		} else if(makeValue == '-1'){
			
			$("#modelQL, #optionsQL, #tireSizeQL").html('');
			$("#tireSizeDiv").hide();
			$("#find_vehicle_submit").hide();
			$("#find_vehicle_submit_disable").show();
		
		}
	}
	if(temp == "model")
	{
	     
		var yearValue = document.getElementById('yearQL').value;
		var makeValue = document.getElementById('makeQL').value;
		var modelValue = document.getElementById('modelQL').value;
		if(modelValue != modelQL){
			optionsQL = "";
		}
		if(modelValue != '-1'){
			$("#optionsQL, #tireSizeQL").html('');
			$("#tireSizeDiv").hide();
			$("#find_vehicle_submit").hide();
			$("#find_vehicle_submit_disable").show();
			tochange = 'optionsQL';
			defaultValue = 'choose_an_option';
			temp="model"+"&yearValue="+yearValue+"&makeValue="+escape(makeValue)+"&modelValue="+escape(modelValue);
			ajaxCallQL(temp);
		}else if(modelValue == '-1'){
			
			$("#optionsQL, #tireSizeQL").html('');
			$("#tireSizeDiv").hide();
			$("#find_vehicle_submit").hide();
			$("#find_vehicle_submit_disable").show();
		
		}
	}
	if(temp == "options")
	{
	     
		var yearValue = document.getElementById('yearQL').value;
		var makeValue = document.getElementById('makeQL').value;
		var modelValue = document.getElementById('modelQL').value;
		var optionValue = document.getElementById('optionsQL').value;
		if(optionValue != optionsQL){
			tireSizeQL = "";
		}
		
		if(optionValue != '-1'){
			$("#tireSizeQL").html('');
			$("#tireSizeDiv").hide();
			$("#find_vehicle_submit").hide();
			$("#find_vehicle_submit_disable").show();					
			tochange = 'tireSizeQL';
			defaultValue = 'choose_a_tire_size';
			temp="options"+"&yearValue="+yearValue+"&makeValue="+escape(makeValue)+"&modelValue="+escape(modelValue)+"&optionValue="+escape(optionValue);
			
			ajaxCallQL(temp);
		}else if(optionValue == '-1'){
			
			$("#tireSizeQL").html('');
			$("#tireSizeDiv").hide();
			$("#find_vehicle_submit").hide();
			$("#find_vehicle_submit_disable").show();	
		
		}
	}
	if(temp == "size")
	{
		var sizeTypeValue= document.getElementById('size').value;		
		if(sizeTypeValue != '-1'){
			$("#width, #aspectratio, #diameter").html('');
			$("#makeQL, #modelQL, #optionsQL, #tireSizeQL").html('');
			$("#tireSizeDiv").hide();
			fnSetDDLQL("yearQL","-1");
			fnSetDDLQL("category","-1");
			fnSetDDLQL("name","-1");
			$("#find_size_submit_disable").show();
			$("#find_size_submit").hide();
			tochange = 'width';
			defaultValue = 'choose_a_width';
			temp=temp+"&sizeTypeValue="+sizeTypeValue;
			ajaxCallQL(temp);
		}else if(sizeTypeValue == '-1'){
			
			$("#width, #aspectratio, #diameter").html('');
			$("#makeQL, #modelQL, #optionsQL, #tireSizeQL").html('');
			$("#tireSizeDiv").hide();
			$("#find_size_submit_disable").show();
			$("#find_size_submit").hide();
		
		}
	}
	if(temp == "width")
	{
		var sizeTypeValue= document.getElementById('size').value;
		var widthValue= document.getElementById('width').value;		
		if(widthValue != '-1'){
			$("#aspectratio, #diameter").html('');
			$("#find_size_submit_disable").show();
			$("#find_size_submit").hide();
			tochange = 'aspectratio';
			defaultValue = 'choose_an_aspect_ratio';
			temp=temp+"&sizeTypeValue="+sizeTypeValue+"&widthValue="+widthValue;
			ajaxCallQL(temp);
		}else if(widthValue == '-1'){
			
			$("#aspectratio, #diameter").html('');
			$("#find_size_submit_disable").show();
			$("#find_size_submit").hide();
		
		}
	}
	if(temp == "aspectratio")
	{
		var sizeTypeValue= document.getElementById('size').value;
		var widthValue= document.getElementById('width').value;
		var aspectValue = document.getElementById('aspectratio').value;		
		if(aspectValue != '-1'){
			$("#diameter").html('');
			$("#find_size_submit_disable").show();
			$("#find_size_submit").hide();
			tochange = 'diameter';
			defaultValue = 'choose_a_size';
			temp=temp+"&sizeTypeValue="+sizeTypeValue+"&widthValue="+widthValue+"&aspectValue="+aspectValue;
			ajaxCallQL(temp);
		}else if(aspectValue == '-1'){
			
			$("#diameter").html('');
			$("#find_size_submit_disable").show();
			$("#find_size_submit").hide();
		
		}
	}
}

function ajaxCallQL(temp)
{ 		
		$.ajax({
		 type: "GET",
                 url: uri+"?type="+temp,
		 dataType: "xml",
		 success: function(xml){                   
                  
                 parsexmlQL(xml);    
			  
		}                 	  
		
		});
	}
 
 function parsexmlQL(result){
		if(tochange == "winterNonWinterCount")
		{
			var differentWinterTires = result.getElementsByTagName("winterCount");
			if(differentWinterTires.length > 0){
				var winterCount = differentWinterTires[0].getAttribute("winter_count");                                  
				var nonWinterCount = differentWinterTires[0].getAttribute("Non_winter_count");
				if(nonWinterCount < 1){
					submitPage($("#searchType").val(),'no');
				} else {
					if(winterCount <= 1){
					$("#winterCount").text(" ["+winterCount+" tire]");
					}
					else {
						$("#winterCount").text(" ["+winterCount+" tires]");
					}
					if(nonWinterCount <= 1){
						$("#nonWinterCount").text(" ["+nonWinterCount+" tire]");
					}
					else {
						$("#nonWinterCount").text(" ["+nonWinterCount+" tires]");
					}
					$("#tire_search_widget_overlay").show();
					$("#vehicle_tab").hide();
					$("#tire_size_tab").hide();
					if($("#searchType").val() == 'vehicle') {
						$("#findTireSnow").parent().bind("click", function(){
							submitPage('vehicle','yes');
						});
					} else {
						$("#findTireSnow").parent().bind("click", function(){
							submitPage('size','yes');
						});
					}
				}
				
				
			}
			else
			{	//onclick="submitPage('vehicle','yes');"
				if($("#searchType").val() == 'vehicle') {
					submitPage('vehicle','no');
				} else {
					submitPage('size','no');
				}
					
			}
		}
		
		if(tochange == "tireSizeQL")
		{
			var toShowOrNotLst = result.getElementsByTagName("tstireSize");
			if(toShowOrNotLst.length > 0){
				$("#tireSizeDiv").show();
				$("#find_vehicle_submit").hide();
				$("#find_vehicle_submit_disable").show();
			} else{
				$("#find_vehicle_submit_disable").hide();
				$("#find_vehicle_submit").show();
			}
		}
		var newValue;
				
				if(tochange == 'yearQL')
					newValue = 'year';
				else if(tochange == 'makeQL')
					newValue = 'make';
				else if(tochange =='modelQL')
					newValue = 'model';
				else if(tochange == 'optionsQL')
					newValue = 'options';
				else if(tochange == 'tireSizeQL')
					newValue = 'tireSize';
				else newValue = tochange;
		if( null != document.getElementById(tochange) && typeof document.getElementById(tochange) != 'undefined'){
			document.getElementById(tochange).options.length = 0;	
		}
		
		
													   
		var oSelField = document.getElementById(tochange);
							  
		var dnl = result.getElementsByTagName(newValue);
		
		
		if(dnl.length == 1){
			var val = dnl[0].getAttribute(newValue+"_value");                                  
			var name= dnl[0].getAttribute(newValue+"_name");                         
			var oOption = document.createElement("OPTION");
			oSelField.options.add(oOption);
			oOption.text = name ;
			oOption.value = val ;
			oOption.selected = true;
			if(tochange == "diameter")
				{
					$("#find_size_submit_disable").hide();
					$("#find_size_submit").show();
				}
			if(tochange == "optionsQL")
				{
					$("#find_vehicle_submit").show();
					$("#find_vehicle_submit_disable").hide();
				}
			populateDropDownsQL(newValue);
			
		} else if(dnl.length > 1){
			
			for (var i=0; i < dnl.length; i++) 
			{    
				
				var val = dnl[i].getAttribute(newValue+"_value");                                  
				var name= dnl[i].getAttribute(newValue+"_name");                         
				var oOption = document.createElement("OPTION");
				oSelField.options.add(oOption);
				oOption.text = name ;
				oOption.value = val ;
			}
			if(tochange=="makeQL"){
				fnSetDDLQL(tochange,makeQL);
			}
			else if(tochange=="modelQL"){
				fnSetDDLQL(tochange,modelQL);
			}
			else if(tochange=="optionsQL"){
				fnSetDDLQL(tochange,optionsQL);
			}
			else if(tochange=="tireSizeQL"){
				fnSetDDLQL(tochange,tireSizeQL);
			}
			if(tochange=="width"){
				fnSetDDLQL(tochange,width);
			}
			else if(tochange=="aspectratio"){
				fnSetDDLQL(tochange,aspectratio);
			}
			else if(tochange=="diameter"){
				fnSetDDLQL(tochange,diameter);
			}
		}
}
var xmlhttp=GetXmlHttpObject();
function GetXmlHttpObject()
{
		var xmlHttp=null;
		try
		 {
			 // Firefox, Opera 8.0+, Safari
			 xmlHttp=new XMLHttpRequest();
		 }
		catch (e)
		 {
			 //Internet Explorer
			 try
			  {
			  xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
			  }
			 catch (e)
			  {
			  xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
			  }
		 }
		return xmlHttp;
}
function checkForWinter(methodName){
		document.getElementById('searchType').value = methodName;
		if(methodName == 'vehicle'){
		 
			var yearValue = document.getElementById('yearQL').value;
			var makeValue = document.getElementById('makeQL').value;
			var modelValue = document.getElementById('modelQL').value;
			var optionValue = document.getElementById('optionsQL').value;
			var tireSize = document.getElementById('tireSizeQL').value;		
			
			makeValue = escape(makeValue);
			modelValue = escape(modelValue);
			optionValue = escape(optionValue);			
						
			tochange = 'winterNonWinterCount';
			var winterCount="winterCount&yearValue="+yearValue+"&makeValue="+makeValue+"&modelValue="+modelValue+"&optionValue="+optionValue+"&tireSize="+tireSize;
			ajaxCallQL(winterCount);
		} else if(methodName == 'size'){
			var sizeValue = document.getElementById('size').value;
			var widthValue = document.getElementById('width').value;
			var aspectratioValue = document.getElementById('aspectratio').value;
			var diameterValue = document.getElementById('diameter').value;		
			
			sizeValue = escape(sizeValue);
			widthValue = escape(widthValue);
			aspectratioValue = escape(aspectratioValue);
			diameterValue = escape(diameterValue);
			
			tochange = 'winterNonWinterCount';
			var winterCount="winterCountSize&sizeTypeValue="+sizeValue+"&widthValue="+widthValue+"&aspectValue="+aspectratioValue+"&rimValue="+diameterValue;
			ajaxCallQL(winterCount);
		}
		
}

String.prototype.ReplaceAll = function(stringToFind,stringToReplace){

    var temp = this;

    var index = temp.indexOf(stringToFind);

        while(index != -1){

            temp = temp.replace(stringToFind,stringToReplace);

            index = temp.indexOf(stringToFind);

        }

        return temp;

    }


function submitPage(methodName,winterOrNot){

var ajaxLoderimgName = 'sizeajaxloader'+methodName;
$('#'+ajaxLoderimgName).attr('src', '/assets/mi/system/images/ajax-loader.gif');
document.getElementById('searchType').value = methodName;
if(winterOrNot == 'yes'){
    document.getElementById('winterNonWinter').value = $('input:radio[name=winterRadio]:checked').val();
}
else
{
$('#winterRadio').attr('checked','false');
}
var redirectUrl = '/tire-selector';
// creating cookies which expires in 180 days.
if(methodName == 'vehicle')
{	
	yearQL	= $("#yearQL option:selected").val();
	makeQL	= $("#makeQL option:selected").val();
	modelQL	= $("#modelQL option:selected").val();
	optionsQL	= $("#optionsQL option:selected").val();
	tireSizeQL = $("#tireSizeQL option:selected").val();
	
	$.cookie('type', 'vehicle', { expires: 180 , path: '/' });
	redirectUrl = redirectUrl+'/vehicle';
	$.cookie('year', yearQL ,{ expires: 180, path: '/' });
	redirectUrl = redirectUrl+'/'+yearQL;
	$.cookie('make', makeQL ,{ expires: 180 , path: '/'});
	redirectUrl = redirectUrl+'/'+makeQL;
	$.cookie('model', modelQL ,{ expires: 180 , path: '/'});
	redirectUrl = redirectUrl+'/'+modelQL.ReplaceAll(" ","+").ReplaceAll("/","|");
	$.cookie('options', optionsQL ,{ expires: 180 , path: '/'});
	redirectUrl = redirectUrl+'/'+optionsQL.ReplaceAll(" ","+").ReplaceAll("/","|");
	if(tireSizeQL != "" && tireSizeQL != undefined && tireSizeQL != null){
		$.cookie('tireSize', tireSizeQL ,{ expires: 180 , path: '/'});
		redirectUrl = redirectUrl+'/'+tireSizeQL.ReplaceAll(" ","+").ReplaceAll("/","|");
	}
	if(winterOrNot == 'yes' && $('input:radio[name=winterRadio]:checked').val() == 'true')
	{
		redirectUrl = redirectUrl+'/winter-tires'
	}
	else {
		redirectUrl = redirectUrl+'/tires'
	}
	
	
	
	$.cookie('size', null,{path: '/' });
	$.cookie('width', null,{path: '/' });
	$.cookie('aspectratio', null),{path: '/' };
	$.cookie('diameter', null,{path: '/' });
	$.cookie('name', null,{path: '/' });
	$.cookie('category', null,{path: '/' });
	
}
if(methodName == 'size')
{
	size		= $("#size option:selected").val();
	width	= $("#width option:selected").val();
	aspectratio		= $("#aspectratio option:selected").val();
	diameter		= $("#diameter option:selected").val();

	$.cookie('type', 'size', { expires: 180, path: '/' });
	redirectUrl = redirectUrl+'/size';
	$.cookie('size', size ,{ expires: 180 , path: '/'});
	redirectUrl = redirectUrl+'/'+size;
	$.cookie('width', width ,{ expires: 180, path: '/' });
	redirectUrl = redirectUrl+'/'+width;
	$.cookie('aspectratio', aspectratio ,{ expires: 180 , path: '/'});
	redirectUrl = redirectUrl+'/'+aspectratio;
	$.cookie('diameter', diameter ,{ expires: 180 , path: '/'});
	redirectUrl = redirectUrl+'/'+diameter;
	
	if(winterOrNot == 'yes' && $('input:radio[name=winterRadio]:checked').val() == 'true')
	{
		redirectUrl = redirectUrl+'/winter-tires'
	}
	else {
		redirectUrl = redirectUrl+'/tires'
	}
	
	$.cookie('year', null,{path: '/' });
	$.cookie('make', null,{path: '/' });
	$.cookie('model', null,{path: '/' });
	$.cookie('options', null,{path: '/' });
	$.cookie('tireSize', null ,{path: '/'});
	$.cookie('name', null,{path: '/' });
	$.cookie('category', null,{path: '/' });
	
}
if(methodName == 'name')
{
	name			= $('#name option:selected').val();
	$.cookie('type', 'name', { expires: 180 , path: '/'});
	redirectUrl = redirectUrl+'/name';
	$.cookie('name', name ,{ expires: 180, path: '/' });
	redirectUrl = redirectUrl+'/'+name+'-tires';
	$.cookie('year', null,{path: '/' });
	$.cookie('make', null,{path: '/' });
	$.cookie('model', null,{path: '/' });
	$.cookie('options', null,{path: '/' });
	$.cookie('tireSize', null ,{path: '/'});
	$.cookie('size', null,{path: '/' });
	$.cookie('width', null,{path: '/' });
	$.cookie('aspectratio', null,{path: '/' });
	$.cookie('diameter', null,{path: '/' });
	$.cookie('category', null,{path: '/' });
}
if(methodName == 'category')
{
	category		= $('#category option:selected').val();

	$.cookie('type', 'category', { expires: 180, path: '/' });
	redirectUrl = redirectUrl+'/category';
	$.cookie('category', category ,{ expires: 180 , path: '/'});
	redirectUrl = redirectUrl+'/'+category+'-tires';
	$.cookie('year', null,{path: '/' });
	$.cookie('make', null,{path: '/' });
	$.cookie('model', null,{path: '/' });
	$.cookie('options', null,{path: '/' });
	$.cookie('tireSize', null ,{path: '/'});
	$.cookie('size', null,{path: '/' });
	$.cookie('width', null,{path: '/' });
	$.cookie('aspectratio', null,{path: '/' });
	$.cookie('diameter', null,{path: '/' });
	$.cookie('name', null,{path: '/' });
}
document.forms["widgetForm"].action = redirectUrl;
document.forms["widgetForm"].submit();
}

function activateSearchQL(selectType){
	
	if(selectType == "optionsQL"){
		if(document.getElementById('optionsQL').value == "-1")
		{
			$("#find_vehicle_submit_disable").show();
			$("#find_vehicle_submit").hide();
		}
	}
	if(selectType == "tireSize"){
			if(document.getElementById('tireSizeQL').value != "-1")
			{
				$("#find_vehicle_submit_disable").hide();
				$("#find_vehicle_submit").show();
			}else if(document.getElementById('tireSizeQL').value == "-1")
			{
				$("#find_vehicle_submit_disable").show();
				$("#find_vehicle_submit").hide();
			}
		
	}
	if(selectType == "diameter"){
		if(document.getElementById('diameter').value != "-1")
		{
			$("#find_size_submit_disable").hide();
			$("#find_size_submit").show();
		} else if(document.getElementById('diameter').value == "-1")
		{
			$("#find_size_submit_disable").show();
			$("#find_size_submit").hide();
		}
	}
	if(selectType == "name"){
		if(document.getElementById('name').value != "-1")
		{
			$("#makeQL, #modelQL, #optionsQL, #tireSizeQL").html('');
			$("#tireSizeDiv").hide();
			$("#width, #aspectratio, #diameter").html('');
			fnSetDDLQL("size","-1");
			fnSetDDLQL("category","-1");
			fnSetDDLQL("yearQL","-1");
			$("#find_name_submit_disable").hide();
			$("#find_name_submit").show();
		}else if(document.getElementById('name').value == "-1")
		{
			$("#find_name_submit_disable").show();
			$("#find_name_submit").hide();
		}
	}
	if(selectType == "category"){
		if(document.getElementById('category').value != "-1")
		{
			$("#makeQL, #modelQL, #optionsQL, #tireSizeQL").html('');
			$("#tireSizeDiv").hide();
			$("#width, #aspectratio, #diameter").html('');
			fnSetDDLQL("size","-1");
			fnSetDDLQL("yearQL","-1");
			fnSetDDLQL("name","-1");
			$("#find_category_submit_disable").hide();
			$("#find_category_submit").show();
		}else if(document.getElementById('name').value == "-1")
		{
			$("#find_category_submit_disable").show();
			$("#find_category_submit").hide();
		}
	}
}
function clearWinter(){
	$("#tire_search_widget_overlay").hide();
	setCookieData();
}

