function swapSearchForms(what)
{
	var fST = document.getElementById("searchFormTires");
	var fSW = document.getElementById("searchFormWheels");
	var nST = document.getElementById("searchNavTires");
	var nSW = document.getElementById("searchNavWheels");
	
	if(what == "tires")
	{
		fST.style.display = 'block';
		fSW.style.display = 'none';
		
		nST.style.display = 'block';
		nSW.style.display = 'none';
	}
	else
	{
		fST.style.display = 'none';
		fSW.style.display = 'block';
		
		nST.style.display = 'none';
		nSW.style.display = 'block';
	}
}

function checkLoginFrm()
{
	if(pressed == false)
	{
		return false;
	}
	
	unFld = document.getElementById("gumiShopUser");
	pwdFld = document.getElementById("gumiShopPass");
	
	if(unFld.value == "" || pwdFld.value == "")
	{
		return false;
	}
}

function handleLoginKeyPress()
{
	if(pressed == false)
	{
		unFld = document.getElementById("gumiShopUser");
		unFld.value = "";
		
		pwdFld = document.getElementById("gumiShopPass");
		pwdFld.value = "";
	}
	
	pressed = true;
}

function handleLoginOnClick()
{
	if(pressed == false)
	{
		unFld = document.getElementById("gumiShopUser");
		unFld.select();
	}
}

function initInvoiceData()
{
	invoice = document.getElementById("showInvoice");
	invoiceFields = document.getElementById("invoiceDataFields");
	
	if(invoice.checked == true)
	{
		invoiceFields.style.display = 'block';
	}
	else
	{
		invoiceFields.style.display = 'none';
		
		document.getElementById("invoice_company").value = '';
		document.getElementById("invoice_town").value = '';
		document.getElementById("invoice_address").value = '';
		document.getElementById("invoice_bulstat").value = '';
		document.getElementById("invoice_vat_no").value = '';
		document.getElementById("invoice_mol").value = '';
	}
}

/* SEARCH SCRIPT */

/* AJAX functions BEGIN */

function fillTHeights()
{
	$("#dTHeightId").load( baseUrl + "ajax/tires_get_heights");
}
function fillTWidths()
{
	$("#dTWidthId").load( baseUrl + "ajax/tires_get_widths");
}
function fillTDiameters()
{
	$("#dTDiameterId").load( baseUrl + "ajax/tires_get_diameters");
}
function fillTSeasons()
{
	$("#dTSeasonId").load( baseUrl + "ajax/tires_get_seasons");
}
function fillTWeights()
{
	$("#dTWeightId").load( baseUrl + "ajax/tires_get_weight_indices");
}
function fillTSpeeds()
{
	$("#dTSpeedId").load( baseUrl + "ajax/tires_get_speed_indices");
}
function fillTManufacturers()
{
	$("#dTManufacturerId").load( baseUrl + "ajax/tires_get_manufacturers");
}
function fillTModels(manufacturerId)
{
	$("#dTModelId").load( baseUrl + "ajax/tires_get_models/" + manufacturerId);
}

function onChangeTireManufacturers()
{
	var manufacturerId = $("#tManufacturerId").attr("value");
	
	fillTModels(manufacturerId);
}

function fillWBrands()
{
	$("#dWBrandId").load( baseUrl + "ajax/wheels_get_car_brands");
}

function fillWModels(brandId)
{
	$("#dWModelId").load( baseUrl + "ajax/wheels_get_car_models/" + brandId);
}

function fillWEngines(modelId)
{
	$("#dWEngineId").load( baseUrl + "ajax/wheels_get_car_engines/" + modelId);
}

function fillWYears(engineId)
{
	$("#dWYearKw").load( baseUrl + "ajax/wheels_get_car_engine_years/" + engineId);
}

function onChangeWheelBrands()
{
	var brandId = $("#wBrandId").attr("value");
	
	fillWModels(brandId);
	fillWEngines(0);
	fillWYears(0);
}

function onChangeWheelModels()
{
	var modelId = $("#wModelId").attr("value");
	
	fillWEngines(modelId);
	fillWYears(0);
}

function onChangeWheelEngines()
{
	var engineId = $("#wEngineId").attr("value");
	
	fillWYears(engineId);
}

/* AJAX functions END */