function init()
{
	fillYearSelect(document.locateVehicleForm.year);
	LoadState();
}

function fillYearSelect(year)
{
	Years(year);
	fillBrandSelect();
}

function fillBrandSelect()
{
	year = document.locateVehicleForm.year.options[document.locateVehicleForm.year.selectedIndex].value;
	make = document.locateVehicleForm.make;
	Brands(year, make);
	fillModelSelect();
}

function fillModelSelect()
{
	year = document.locateVehicleForm.year.options[document.locateVehicleForm.year.selectedIndex].value;
	brand = document.locateVehicleForm.make.options[document.locateVehicleForm.make.selectedIndex].value;
	Model = document.locateVehicleForm.modelId;
	Models(year, brand, Model);
	fillStyleSelect();
}

function fillStyleSelect()
{
	year = document.locateVehicleForm.year.options[document.locateVehicleForm.year.selectedIndex].value;
	model = document.locateVehicleForm.modelId.options[document.locateVehicleForm.modelId.selectedIndex].value;
	Style = document.locateVehicleForm.bstyle;
	Styles(year, model, Style);
}

function initState()
{
	fillYearSelectState(document.LVStateForm.year);
	LoadState2();
}

function fillYearSelectState(year)
{
	Years(year);
	fillBrandSelectState();
}

function fillBrandSelectState()
{
	year = document.LVStateForm.year.options[document.LVStateForm.year.selectedIndex].value;
	make = document.LVStateForm.make;
	Brands(year, make);
	fillModelSelectState();
}

function fillModelSelectState()
{
	year = document.LVStateForm.year.options[document.LVStateForm.year.selectedIndex].value;
	brand = document.LVStateForm.make.options[document.LVStateForm.make.selectedIndex].value;
	Model = document.LVStateForm.modelId;
	Models(year, brand, Model);
	fillStyleSelectState();
}

function fillStyleSelectState()
{
	year = document.LVStateForm.year.options[document.LVStateForm.year.selectedIndex].value;
	model = document.LVStateForm.modelId.options[document.LVStateForm.modelId.selectedIndex].value;
	Style = document.LVStateForm.bstyle;
	Styles(year, model, Style);
}

function initVIN()
{
	fillYearSelectVIN(document.LVVinForm.year);
}

function fillYearSelectVIN(year)
{
	Years(year);
	fillBrandSelectVIN();
}

function fillBrandSelectVIN()
{
	year = document.LVVinForm.year.options[document.LVVinForm.year.selectedIndex].value;
	make = document.LVVinForm.make;
	Brands(year, make);
	fillModelSelectVIN();
}

function fillModelSelectVIN()
{
	year = document.LVVinForm.year.options[document.LVVinForm.year.selectedIndex].value;
	brand = document.LVVinForm.make.options[document.LVVinForm.make.selectedIndex].value;
	Model = document.LVVinForm.modelId;
	Models(year, brand, Model);
	fillStyleSelectVIN();
}

function fillStyleSelectVIN()
{
	year = document.LVVinForm.year.options[document.LVVinForm.year.selectedIndex].value;
	model = document.LVVinForm.modelId.options[document.LVVinForm.modelId.selectedIndex].value;
	Style = document.LVVinForm.bstyle;
	Styles(year, model, Style);
}

function initSVector()
{
	fillYearSelectSVector(document.LVSVectorForm.year);
}

function fillYearSelectSVector(year)
{
	Years(year);
	fillBrandSelectSVector();
}

function fillBrandSelectSVector()
{
	year = document.LVSVectorForm.year.options[document.LVSVectorForm.year.selectedIndex].value;
	make = document.LVSVectorForm.make;
	Brands(year, make);
	fillModelSelectSVector();
}

function fillModelSelectSVector()
{
	year = document.LVSVectorForm.year.options[document.LVSVectorForm.year.selectedIndex].value;
	brand = document.LVSVectorForm.make.options[document.LVSVectorForm.make.selectedIndex].value;
	Model = document.LVSVectorForm.modelId;
	Models(year, brand, Model);
	fillStyleSelectSVector();
}

function fillStyleSelectSVector()
{
	year = document.LVSVectorForm.year.options[document.LVSVectorForm.year.selectedIndex].value;
	model = document.LVSVectorForm.modelId.options[document.LVSVectorForm.modelId.selectedIndex].value;
	Style = document.LVSVectorForm.bstyle;
	Styles(year, model, Style);
}

function initMVector()
{
	fillYearSelectMVector(document.LVMVectorForm.year);
}

function fillYearSelectMVector(year)
{
	Years(year);
	fillBrandSelectMVector();
}

function fillBrandSelectMVector()
{
	year = document.LVMVectorForm.year.options[document.LVMVectorForm.year.selectedIndex].value;
	make = document.LVMVectorForm.make;
	Brands(year, make);
	fillModelSelectMVector();
}

function fillModelSelectMVector()
{
	year = document.LVMVectorForm.year.options[document.LVMVectorForm.year.selectedIndex].value;
	brand = document.LVMVectorForm.make.options[document.LVMVectorForm.make.selectedIndex].value;
	Model = document.LVMVectorForm.modelId;
	Models(year, brand, Model);
	fillStyleSelectMVector();
}

function fillStyleSelectMVector()
{
	year = document.LVMVectorForm.year.options[document.LVMVectorForm.year.selectedIndex].value;
	model = document.LVMVectorForm.modelId.options[document.LVMVectorForm.modelId.selectedIndex].value;
	Style = document.LVMVectorForm.bstyle;
	Styles(year, model, Style);
}

function initVendorProx()
{
	fillYearSelectVendorProx(document.LVVendorProxForm.year);
}

function fillYearSelectVendorProx(year)
{
	Years(year);
	fillBrandSelectVendorProx();
}

function fillBrandSelectVendorProx()
{
	year = document.LVVendorProxForm.year.options[document.LVVendorProxForm.year.selectedIndex].value;
	make = document.LVVendorProxForm.make;
	Brands(year, make);
	fillModelSelectVendorProx();
}

function fillModelSelectVendorProx()
{
	year = document.LVVendorProxForm.year.options[document.LVVendorProxForm.year.selectedIndex].value;
	brand = document.LVVendorProxForm.make.options[document.LVVendorProxForm.make.selectedIndex].value;
	Model = document.LVVendorProxForm.modelId;
	Models(year, brand, Model);
	fillStyleSelectVendorProx();
}

function fillStyleSelectVendorProx()
{
	year = document.LVVendorProxForm.year.options[document.LVVendorProxForm.year.selectedIndex].value;
	model = document.LVVendorProxForm.modelId.options[document.LVVendorProxForm.modelId.selectedIndex].value;
	Style = document.LVVendorProxForm.bstyle;
	Styles(year, model, Style);
}

function initOrderNum()
{
	fillYearSelectOrderNum(document.LVOrderNumForm.year);
}

function fillYearSelectOrderNum(year)
{
	Years(year);
	fillBrandSelectOrderNum();
}

function fillBrandSelectOrderNum()
{
	year = document.LVOrderNumForm.year.options[document.LVOrderNumForm.year.selectedIndex].value;
	make = document.LVOrderNumForm.make;
	Brands(year, make);
	fillModelSelectOrderNum();
}

function fillModelSelectOrderNum()
{
	year = document.LVOrderNumForm.year.options[document.LVOrderNumForm.year.selectedIndex].value;
	brand = document.LVOrderNumForm.make.options[document.LVOrderNumForm.make.selectedIndex].value;
	Model = document.LVOrderNumForm.modelId;
	Models(year, brand, Model);
	fillStyleSelectOrderNum();
}

function fillStyleSelectOrderNum()
{
	year = document.LVOrderNumForm.year.options[document.LVOrderNumForm.year.selectedIndex].value;
	model = document.LVOrderNumForm.modelId.options[document.LVOrderNumForm.modelId.selectedIndex].value;
	Style = document.LVOrderNumForm.bstyle;
	Styles(year, model, Style);
}

function Years(year)
{
	selectList = year;
	selectList.options.length = 0
	j=0
	previousYear=""
	selectList.options[0] = new Option("View By Year", "0");
	for (i = 0; i < vehiclesArray.length; i++)
	{
		if (vehiclesArray[i].year != previousYear)
		{
			selectList.options[j+1] = new Option(vehiclesArray[i].year, vehiclesArray[i].year);
			j++;
			previousYear = vehiclesArray[i].year;
		}
	}
	selectList.options[0].selected = true;
}

function Brands(year, make)
{
	selectList = make;
	selectList.options.length = 0
	j=0
	previousBrand=""
	selectList.options[0] = new Option("View By Make", "0");
	for (i = 0; i < vehiclesArray.length; i++)
	{
		if ((vehiclesArray[i].brand != previousBrand) && vehiclesArray[i].year == year)
		{
			selectList.options[j+1] = new Option(vehiclesArray[i].brand, vehiclesArray[i].brandId);
			j++;
			previousBrand = vehiclesArray[i].brand;
		}
	}
	selectList.options[0].selected = true;
}

function Models(year, brand, Model)
{
	selectList = Model;
	selectList.options.length = 0
	j=0
	previousModel=""
	selectList.options[0] = new Option("View By Model", "0");
	for (i = 0; i < vehiclesArray.length; i++)
	{
		if ((vehiclesArray[i].model != previousModel) && vehiclesArray[i].year == year && vehiclesArray[i].brandId==brand)
		{
			selectList.options[j+1] = new Option(vehiclesArray[i].model, vehiclesArray[i].subModelId);
			j++;
			previousModel = vehiclesArray[i].model;
		}
	}
	selectList.options[0].selected = true;

}

function Styles(year, model, Style)
{
	selectList = Style;
	selectList.options.length = 0
	j=0
	previousStyle=""
	selectList.options[0] = new Option("View By Style", "0");
	for (i = 0; i < vehiclesArray.length; i++)
	{
		if ((vehiclesArray[i].style != previousBrand) && vehiclesArray[i].year == year && vehiclesArray[i].subModelId == model)
		{
			selectList.options[j+1] = new Option(vehiclesArray[i].style, vehiclesArray[i].pvcid);
			j++;
			previousStyle = vehiclesArray[i].style;
		}
	}
	selectList.options[0].selected = true;
}


/*Load States Functions*/


function LoadState()
{
	document.locateVehicleForm.states.options[0]= new Option("View By State","0");
	for(var i=0; i< stateObjectArray.length; i++)
	{
		document.locateVehicleForm.states.options[i+1]= new Option(stateObjectArray[i].name, stateObjectArray[i].abbreviation);
	}
}

function LoadState2()
{
	document.LVStateForm.searchState.options[0]= new Option("View By State","0");
	for(var i=0; i< stateObjectArray.length; i++)
	{
		document.LVStateForm.searchState.options[i+1]= new Option(stateObjectArray[i].name, stateObjectArray[i].abbreviation);
	}
}

/* AJAX Functions */
	var myJSON_Data = null;
	var myDesiredCount = 5;
	var myCurrentPage = 0;
	var myPagesCount = 0;

	var myVehicleYear = "";
	var myVehicleMake = "";
	var myVehicleModel = "";
	var myVehicleStyle = "";

function sendDataVehicle() {
	var url = assembleURLVehicle();

	var pars = assembleParametersVehicle();

	previousActionsVehicle();

	var myAjax = new Ajax.Request( url, {method: 'post', parameters: pars, onComplete: showResponseVehicle, asynchronous: true} );

}

function showResponseVehicle (originalRequest){
	responseActionsVehicle(originalRequest);

	afterActionsVehicle();

	return true;
}


function assembleURLVehicle(){
	var url = "";

	var myCity = document.forms["locateVehicleForm"].city.value;
	var myState = document.forms["locateVehicleForm"].states.value;

	url = "/vehiclesearch_ajax.do?";
	if (myCity != null && myCity != "" && myState != null && myState != ""){
		url += "&postalCode=";
		url += "&searchCity=" + myCity;
		url += "&searchState=" + myState;
		url += "&searchType=1";

	}
	else{
		url += "&postalCode=" + document.forms["locateVehicleForm"].postalCode.value;
//		url += "&searchCity=";
	//	url += "&searchState=";
		url += "&searchType=0";
	}

	url += "&year=" +  document.forms["locateVehicleForm"].year[document.forms["locateVehicleForm"].year.selectedIndex].value;
	url += "&make=" + document.forms["locateVehicleForm"].make[document.forms["locateVehicleForm"].make.selectedIndex].value;
	url += "&modelId=" + document.forms["locateVehicleForm"].modelId[document.forms["locateVehicleForm"].modelId.selectedIndex].value;
	url += "&bstyle=" + document.forms["locateVehicleForm"].bstyle[document.forms["locateVehicleForm"].bstyle.selectedIndex].value;

	url += "&modelDesignator=" + document.forms["locateVehicleForm"].modelDesignator.value;//+ findMMC(st_pvc, vehiclesArrayAuxi);
	url += "&destView=atlantis";
	url += "&returnDataType=JSON";

	return url;
}

function assembleParametersVehicle(){
	var pars = "";

	return pars;
}

//Actions executed before the ajax call is executed
function previousActionsVehicle(){
	showFloater('loadingFormContainer', 'loadingScreen');

	return true;
}

// Actions executed by the ajax call
function responseActionsVehicle(originalRequest){
	myJSON_Data = originalRequest.responseText.evalJSON();
	myDesiredCount =  document.forms['locateVehicleForm'].desiredCount.value;

	myVehicleYear = document.forms["locateVehicleForm"].year[document.forms["locateVehicleForm"].year.selectedIndex].text;
	myVehicleMake = document.forms["locateVehicleForm"].make[document.forms["locateVehicleForm"].make.selectedIndex].text;
	myVehicleModel = document.forms["locateVehicleForm"].modelId[document.forms["locateVehicleForm"].modelId.selectedIndex].text;
	myVehicleStyle = document.forms["locateVehicleForm"].bstyle[document.forms["locateVehicleForm"].bstyle.selectedIndex].text;

	var myFullContentString = "";
	var myContentBody = "";

	myFullContentString = "<div class='DIV_Content_Container'>";
	myFullContentString += "<div class='DIV_Content_Header'>";

	myFullContentString += "<div class='DIV_Rew'>";
	myFullContentString += "<a href='javascript:navigateLinksVehicle(0);'>&lt;</a>&nbsp;&nbsp;<a href='javascript:navigateLinksVehicle(1);'>&lt;&lt;</a>";
	myFullContentString += "</div>";

	myPagesCount = Math.floor((myJSON_Data.size()/myDesiredCount));

	if (myJSON_Data.size()%myDesiredCount != 0){
		myPagesCount++;
	}

	myFullContentString += "<div class='DIV_Nav'>";

	var i = 0;

	for (i = 0; i < myPagesCount; i++){
		myFullContentString += "<a href='javascript:showPageContentVehicle(" + i + ");'>" + (i+1) + "</a>" + "&nbsp;";
	}

	myFullContentString += "</div>";

	myFullContentString += "<div class='DIV_Forw'>";
	myFullContentString += "<a href='javascript:navigateLinksVehicle(2);'>&gt;&gt;</a>&nbsp;&nbsp;<a href='javascript:navigateLinksVehicle(3);'>&gt;</a>";
	myFullContentString += "</div>";

	myFullContentString += "</div>"; //DIV_Content_Header

	myFullContentString += "<div class='DIV_Content_Data' id='DIV_Content_Data'>";
	myFullContentString += "</div>";

	myFullContentString += "</div>"; //DIV_Content_Container

	$('contentData').innerHTML = myFullContentString;


	// After loading, it shows the first page
	showPageContentVehicle(myCurrentPage);

	return true;
}

//Actions executed after the ajax call is executed
function afterActionsVehicle(){
	hideFloater('loadingFormContainer', 'loadingScreen');

	return true;
}


function showPageContentVehicle(myPage){
	var i = 0;
	var myDataString = "";

	var myDataStart = myPage *  myDesiredCount;
	var myDataEnd = myDataStart + myDesiredCount;

	if (myDataEnd > myJSON_Data.size()){
		myDataEnd = myJSON_Data.size();
	}

	for (i = myDataStart; i < myDataEnd; i++){
		myDataString += "<div id='DIV_CAR_INFO'>" + myVehicleYear + " " + myVehicleMake + " " + myVehicleModel + " " +  myVehicleStyle + "</div>";
		myDataString += "<div><span class='boldSpan'>VIN:</span> " + myJSON_Data[i].vin + "</div>";
		myDataString += "<div><span class='boldSpan'>Exterior:</span> " + myJSON_Data[i].extColor.name + "</div>";
		myDataString += "<div><span class='boldSpan'>Interior:</span> " + myJSON_Data[i].intColor.name + "</div>";
		myDataString += "<div><span class='boldSpan'>Other Options:</span> " + returnOtherOptionsVehicle(myJSON_Data[i].otherOptions) + "</div>";
		myDataString += "<div><span class='boldSpan'>Price:</span> " + myJSON_Data[i].promotionPriceFormatted + "</div>";
		myDataString += "<div><span class='boldSpan'>Carried by:</span> " + myJSON_Data[i].dealer.name + "</div>";
		myDataString += "<div id='DIV_Dealer_Address'>" + myJSON_Data[i].dealer.street;
		myDataString += "," + myJSON_Data[i].dealer.city;
		myDataString += "," + myJSON_Data[i].dealer.regionCode;
		myDataString += " " + myJSON_Data[i].dealer.postalcode;
		if (myJSON_Data[i].dealer.postalCode4 != ""){
			myDataString += "-" + myJSON_Data[i].dealer.postalCode4;
		}
		myDataString += "</div>";
	}
	$('DIV_Content_Data').innerHTML = myDataString;
}

function returnOtherOptionsVehicle(myOptionsObject){
	var returnString = "";

	var i = 0;

	for (i = 0; i < myOptionsObject.size(); i++){
		if ((i + 1) == myOptionsObject.size())
		{
			returnString += myOptionsObject[i].name.unescapeHTML();
		}
		else{
			returnString += myOptionsObject[i].name.unescapeHTML() + " - ";
		}

	}

	return returnString;
}

function navigateLinksVehicle(myAction){
//Action:  0 = Back one page, 1 = Back to beggining, 2 = Forward to end, 3 =Forward one page
	var lastPage = myPagesCount - 1;

	switch(myAction){
		case 0:
			if (myCurrentPage > 0){
				myCurrentPage--;
			}
		break;
		case 1:
			if (myCurrentPage != 0){
				myCurrentPage = 0;
			}
		break;
		case 2:
			if (myCurrentPage != lastPage){
				myCurrentPage = lastPage;
			}
		break;
		case 3:
			if (myCurrentPage < lastPage){
				myCurrentPage++;
			}
		break;
	}

	showPageContentVehicle(myCurrentPage);
}

/*Load the vehicle by state*/

function sendDataVehicleState()
{
	var url = assembleURLVehicleState();

	var pars = assembleParametersVehicle();

	previousActionsVehicle();

	var myAjax = new Ajax.Request( url, {method: 'post', parameters: pars, onComplete: showResponseVehicleState, asynchronous: true} );

}

function assembleURLVehicleState(){
	var url = "";
	url = "/vehiclesearch_ajax.do?";

	url += "&searchState=" + document.forms["LVStateForm"].searchState.value;
	url += "&searchType=2";

	url += "&year=" +  document.forms["LVStateForm"].year[document.forms["LVStateForm"].year.selectedIndex].value;
	url += "&make=" + document.forms["LVStateForm"].make[document.forms["LVStateForm"].make.selectedIndex].value;
	url += "&modelId=" + document.forms["LVStateForm"].modelId[document.forms["LVStateForm"].modelId.selectedIndex].value;
	url += "&bstyle=" + document.forms["LVStateForm"].bstyle[document.forms["LVStateForm"].bstyle.selectedIndex].value;

	url += "&modelDesignator=" + document.forms["LVStateForm"].modelDesignator.value;//+ findMMC(st_pvc, vehiclesArrayAuxi);
	url += "&destView=atlantis";
	url += "&returnDataType=JSON";

	return url;
}

function showResponseVehicleState (originalRequest){
	responseActionsVehicleState(originalRequest);

	afterActionsVehicle();

	return true;
}

// Actions executed by the ajax call
function responseActionsVehicleState(originalRequest){
	myJSON_Data = originalRequest.responseText.evalJSON();
	myDesiredCount =  document.forms['LVStateForm'].desiredCount.value;

	myVehicleYear = document.forms["LVStateForm"].year[document.forms["LVStateForm"].year.selectedIndex].text;
	myVehicleMake = document.forms["LVStateForm"].make[document.forms["LVStateForm"].make.selectedIndex].text;
	myVehicleModel = document.forms["LVStateForm"].modelId[document.forms["LVStateForm"].modelId.selectedIndex].text;
	myVehicleStyle = document.forms["LVStateForm"].bstyle[document.forms["LVStateForm"].bstyle.selectedIndex].text;

	var myFullContentString = "";
	var myContentBody = "";

	myFullContentString = "<div class='DIV_Content_Container'>";
	myFullContentString += "<div class='DIV_Content_Header'>";

	myFullContentString += "<div class='DIV_Rew'>";
	myFullContentString += "<a href='javascript:navigateLinksVehicle(0);'>&lt;</a>&nbsp;&nbsp;<a href='javascript:navigateLinksVehicle(1);'>&lt;&lt;</a>";
	myFullContentString += "</div>";

	myPagesCount = Math.floor((myJSON_Data.size()/myDesiredCount));

	if (myJSON_Data.size()%myDesiredCount != 0){
		myPagesCount++;
	}

	myFullContentString += "<div class='DIV_Nav'>";

	var i = 0;

	for (i = 0; i < myPagesCount; i++){
		myFullContentString += "<a href='javascript:showPageContentVehicle(" + i + ");'>" + (i+1) + "</a>" + "&nbsp;";
	}

	myFullContentString += "</div>";

	myFullContentString += "<div class='DIV_Forw'>";
	myFullContentString += "<a href='javascript:navigateLinksVehicle(2);'>&gt;&gt;</a>&nbsp;&nbsp;<a href='javascript:navigateLinksVehicle(3);'>&gt;</a>";
	myFullContentString += "</div>";

	myFullContentString += "</div>"; //DIV_Content_Header

	myFullContentString += "<div class='DIV_Content_Data' id='DIV_Content_Data'>";
	myFullContentString += "</div>";

	myFullContentString += "</div>"; //DIV_Content_Container

	$('contentData').innerHTML = myFullContentString;


	// After loading, it shows the first page
	showPageContentVehicle(myCurrentPage);

	return true;
}

/*Load vehicles by VIN*/

function sendDataVehicleVIN()
{
	var url = assembleURLVehicleVIN();

	var pars = assembleParametersVehicle();

	previousActionsVehicle();

	var myAjax = new Ajax.Request( url, {method: 'post', parameters: pars, onComplete: showResponseVehicleVIN, asynchronous: true} );

}

function assembleURLVehicleVIN(){
	var url = "";
	url = "/vehiclesearch_ajax.do?";

	url += "&VIN=" + document.forms["LVVinForm"].VIN.value;
	url += "&searchType=3";

	url += "&year=" +  document.forms["LVVinForm"].year[document.forms["LVVinForm"].year.selectedIndex].value;
	url += "&make=" + document.forms["LVVinForm"].make[document.forms["LVVinForm"].make.selectedIndex].value;
	url += "&modelId=" + document.forms["LVVinForm"].modelId[document.forms["LVVinForm"].modelId.selectedIndex].value;
	url += "&bstyle=" + document.forms["LVVinForm"].bstyle[document.forms["LVVinForm"].bstyle.selectedIndex].value;

	url += "&modelDesignator=" + document.forms["LVVinForm"].modelDesignator.value;//+ findMMC(st_pvc, vehiclesArrayAuxi);
	url += "&destView=atlantis";
	url += "&returnDataType=JSON";

	return url;
}

function showResponseVehicleVIN (originalRequest){
	responseActionsVehicleVIN(originalRequest);

	afterActionsVehicle();

	return true;
}

// Actions executed by the ajax call
function responseActionsVehicleVIN(originalRequest){
	myJSON_Data = originalRequest.responseText.evalJSON();
	myDesiredCount =  "3";

	myVehicleYear = document.forms["LVVinForm"].year[document.forms["LVVinForm"].year.selectedIndex].text;
	myVehicleMake = document.forms["LVVinForm"].make[document.forms["LVVinForm"].make.selectedIndex].text;
	myVehicleModel = document.forms["LVVinForm"].modelId[document.forms["LVVinForm"].modelId.selectedIndex].text;
	myVehicleStyle = document.forms["LVVinForm"].bstyle[document.forms["LVVinForm"].bstyle.selectedIndex].text;

	var myFullContentString = "";
	var myContentBody = "";

	myFullContentString = "<div class='DIV_Content_Container'>";
	myFullContentString += "<div class='DIV_Content_Header'>";

	myFullContentString += "<div class='DIV_Rew'>";
	myFullContentString += "<a href='javascript:navigateLinksVehicle(0);'>&lt;</a>&nbsp;&nbsp;<a href='javascript:navigateLinksVehicle(1);'>&lt;&lt;</a>";
	myFullContentString += "</div>";

	myPagesCount = Math.floor((myJSON_Data.size()/myDesiredCount));

	if (myJSON_Data.size()%myDesiredCount != 0){
		myPagesCount++;
	}

	myFullContentString += "<div class='DIV_Nav'>";

	var i = 0;

	for (i = 0; i < myPagesCount; i++){
		myFullContentString += "<a href='javascript:showPageContentVehicle(" + i + ");'>" + (i+1) + "</a>" + "&nbsp;";
	}

	myFullContentString += "</div>";

	myFullContentString += "<div class='DIV_Forw'>";
	myFullContentString += "<a href='javascript:navigateLinksVehicle(2);'>&gt;&gt;</a>&nbsp;&nbsp;<a href='javascript:navigateLinksVehicle(3);'>&gt;</a>";
	myFullContentString += "</div>";

	myFullContentString += "</div>"; //DIV_Content_Header

	myFullContentString += "<div class='DIV_Content_Data' id='DIV_Content_Data'>";
	myFullContentString += "</div>";

	myFullContentString += "</div>"; //DIV_Content_Container

	$('contentData').innerHTML = myFullContentString;


	// After loading, it shows the first page
	showPageContentVehicle(myCurrentPage);

	return true;
}


/*Load vehicles by Single Vendor*/

function sendDataVehicleSVector()
{
	var url = assembleURLVehicleSVector();

	var pars = assembleParametersVehicle();

	previousActionsVehicle();

	var myAjax = new Ajax.Request( url, {method: 'post', parameters: pars, onComplete: showResponseVehicleSVector, asynchronous: true} );

}

function assembleURLVehicleSVector(){
	var url = "";
	url = "/vehiclesearch_ajax.do?";

	url += "&vendorId=" + document.forms["LVSVectorForm"].vendorId.value;
	url += "&searchType=4";

	url += "&year=" +  document.forms["LVSVectorForm"].year[document.forms["LVSVectorForm"].year.selectedIndex].value;
	url += "&make=" + document.forms["LVSVectorForm"].make[document.forms["LVSVectorForm"].make.selectedIndex].value;
	url += "&modelId=" + document.forms["LVSVectorForm"].modelId[document.forms["LVSVectorForm"].modelId.selectedIndex].value;
	url += "&bstyle=" + document.forms["LVSVectorForm"].bstyle[document.forms["LVSVectorForm"].bstyle.selectedIndex].value;

	url += "&modelDesignator=" + document.forms["LVSVectorForm"].modelDesignator.value;//+ findMMC(st_pvc, vehiclesArrayAuxi);
	url += "&destView=atlantis";
	url += "&returnDataType=JSON";

	return url;
}

function showResponseVehicleSVector (originalRequest){
	responseActionsVehicleSVector(originalRequest);

	afterActionsVehicle();

	return true;
}

// Actions executed by the ajax call
function responseActionsVehicleSVector(originalRequest){
	myJSON_Data = originalRequest.responseText.evalJSON();
	myDesiredCount =  "3";

	myVehicleYear = document.forms["LVSVectorForm"].year[document.forms["LVSVectorForm"].year.selectedIndex].text;
	myVehicleMake = document.forms["LVSVectorForm"].make[document.forms["LVSVectorForm"].make.selectedIndex].text;
	myVehicleModel = document.forms["LVSVectorForm"].modelId[document.forms["LVSVectorForm"].modelId.selectedIndex].text;
	myVehicleStyle = document.forms["LVSVectorForm"].bstyle[document.forms["LVSVectorForm"].bstyle.selectedIndex].text;

	var myFullContentString = "";
	var myContentBody = "";

	myFullContentString = "<div class='DIV_Content_Container'>";
	myFullContentString += "<div class='DIV_Content_Header'>";

	myFullContentString += "<div class='DIV_Rew'>";
	myFullContentString += "<a href='javascript:navigateLinksVehicle(0);'>&lt;</a>&nbsp;&nbsp;<a href='javascript:navigateLinksVehicle(1);'>&lt;&lt;</a>";
	myFullContentString += "</div>";

	myPagesCount = Math.floor((myJSON_Data.size()/myDesiredCount));

	if (myJSON_Data.size()%myDesiredCount != 0){
		myPagesCount++;
	}

	myFullContentString += "<div class='DIV_Nav'>";

	var i = 0;

	for (i = 0; i < myPagesCount; i++){
		myFullContentString += "<a href='javascript:showPageContentVehicle(" + i + ");'>" + (i+1) + "</a>" + "&nbsp;";
	}

	myFullContentString += "</div>";

	myFullContentString += "<div class='DIV_Forw'>";
	myFullContentString += "<a href='javascript:navigateLinksVehicle(2);'>&gt;&gt;</a>&nbsp;&nbsp;<a href='javascript:navigateLinksVehicle(3);'>&gt;</a>";
	myFullContentString += "</div>";

	myFullContentString += "</div>"; //DIV_Content_Header

	myFullContentString += "<div class='DIV_Content_Data' id='DIV_Content_Data'>";
	myFullContentString += "</div>";

	myFullContentString += "</div>"; //DIV_Content_Container

	$('contentData').innerHTML = myFullContentString;


	// After loading, it shows the first page
	showPageContentVehicle(myCurrentPage);

	return true;
}


/*Load vehicles by Multiple Vendor*/

function sendDataVehicleMVector()
{
	var url = assembleURLVehicleMVector();

	var pars = assembleParametersVehicle();

	previousActionsVehicle();

	var myAjax = new Ajax.Request( url, {method: 'post', parameters: pars, onComplete: showResponseVehicleMVector, asynchronous: true} );

}

function assembleURLVehicleMVector(){
	var url = "";
	url = "/vehiclesearch_ajax.do?";

	url += "&multiVendorIds=" + document.getElementById("Vector1").value;
	url += "&multiVendorIds=" + document.getElementById("Vector2").value;
	url += "&multiVendorIds=" + document.getElementById("Vector3").value;
	url += "&searchType=5";

	url += "&year=" +  document.forms["LVMVectorForm"].year[document.forms["LVMVectorForm"].year.selectedIndex].value;
	url += "&make=" + document.forms["LVMVectorForm"].make[document.forms["LVMVectorForm"].make.selectedIndex].value;
	url += "&modelId=" + document.forms["LVMVectorForm"].modelId[document.forms["LVMVectorForm"].modelId.selectedIndex].value;
	url += "&bstyle=" + document.forms["LVMVectorForm"].bstyle[document.forms["LVMVectorForm"].bstyle.selectedIndex].value;

	url += "&modelDesignator=" + document.forms["LVMVectorForm"].modelDesignator.value;//+ findMMC(st_pvc, vehiclesArrayAuxi);
	url += "&destView=atlantis";
	url += "&returnDataType=JSON";

	return url;
}

function showResponseVehicleMVector (originalRequest){
	responseActionsVehicleMVector(originalRequest);

	afterActionsVehicle();

	return true;
}

// Actions executed by the ajax call
function responseActionsVehicleMVector(originalRequest){
	myJSON_Data = originalRequest.responseText.evalJSON();
	myDesiredCount =  "3";

	myVehicleYear = document.forms["LVMVectorForm"].year[document.forms["LVMVectorForm"].year.selectedIndex].text;
	myVehicleMake = document.forms["LVMVectorForm"].make[document.forms["LVMVectorForm"].make.selectedIndex].text;
	myVehicleModel = document.forms["LVMVectorForm"].modelId[document.forms["LVMVectorForm"].modelId.selectedIndex].text;
	myVehicleStyle = document.forms["LVMVectorForm"].bstyle[document.forms["LVMVectorForm"].bstyle.selectedIndex].text;

	var myFullContentString = "";
	var myContentBody = "";

	myFullContentString = "<div class='DIV_Content_Container'>";
	myFullContentString += "<div class='DIV_Content_Header'>";

	myFullContentString += "<div class='DIV_Rew'>";
	myFullContentString += "<a href='javascript:navigateLinksVehicle(0);'>&lt;</a>&nbsp;&nbsp;<a href='javascript:navigateLinksVehicle(1);'>&lt;&lt;</a>";
	myFullContentString += "</div>";

	myPagesCount = Math.floor((myJSON_Data.size()/myDesiredCount));

	if (myJSON_Data.size()%myDesiredCount != 0){
		myPagesCount++;
	}

	myFullContentString += "<div class='DIV_Nav'>";

	var i = 0;

	for (i = 0; i < myPagesCount; i++){
		myFullContentString += "<a href='javascript:showPageContentVehicle(" + i + ");'>" + (i+1) + "</a>" + "&nbsp;";
	}

	myFullContentString += "</div>";

	myFullContentString += "<div class='DIV_Forw'>";
	myFullContentString += "<a href='javascript:navigateLinksVehicle(2);'>&gt;&gt;</a>&nbsp;&nbsp;<a href='javascript:navigateLinksVehicle(3);'>&gt;</a>";
	myFullContentString += "</div>";

	myFullContentString += "</div>"; //DIV_Content_Header

	myFullContentString += "<div class='DIV_Content_Data' id='DIV_Content_Data'>";
	myFullContentString += "</div>";

	myFullContentString += "</div>"; //DIV_Content_Container

	$('contentData').innerHTML = myFullContentString;


	// After loading, it shows the first page
	showPageContentVehicle(myCurrentPage);

	return true;
}

/*Load vehicles by proximity Vendor*/

function sendDataVehicleVendorProx()
{
	var url = assembleURLVehicleVendorProx();

	var pars = assembleParametersVehicle();

	previousActionsVehicle();

	var myAjax = new Ajax.Request( url, {method: 'post', parameters: pars, onComplete: showResponseVehicleVendorProx, asynchronous: true} );

}

function assembleURLVehicleVendorProx(){
	var url = "";
	url = "/vehiclesearch_ajax.do?";

	url += "&proximity=" + document.forms["LVVendorProxForm"].proximity.value;
	url += "&vendorId=" + document.forms["LVVendorProxForm"].vendorId.value;
	url += "&searchType=6";

	url += "&year=" +  document.forms["LVVendorProxForm"].year[document.forms["LVVendorProxForm"].year.selectedIndex].value;
	url += "&make=" + document.forms["LVVendorProxForm"].make[document.forms["LVVendorProxForm"].make.selectedIndex].value;
	url += "&modelId=" + document.forms["LVVendorProxForm"].modelId[document.forms["LVVendorProxForm"].modelId.selectedIndex].value;
	url += "&bstyle=" + document.forms["LVVendorProxForm"].bstyle[document.forms["LVVendorProxForm"].bstyle.selectedIndex].value;

	url += "&modelDesignator=" + document.forms["LVVendorProxForm"].modelDesignator.value;//+ findMMC(st_pvc, vehiclesArrayAuxi);
	url += "&destView=atlantis";
	url += "&returnDataType=JSON";

	return url;
}

function showResponseVehicleVendorProx (originalRequest){
	responseActionsVehicleVendorProx(originalRequest);

	afterActionsVehicle();

	return true;
}

// Actions executed by the ajax call
function responseActionsVehicleVendorProx(originalRequest){
	myJSON_Data = originalRequest.responseText.evalJSON();
	myDesiredCount =  "3";

	myVehicleYear = document.forms["LVVendorProxForm"].year[document.forms["LVVendorProxForm"].year.selectedIndex].text;
	myVehicleMake = document.forms["LVVendorProxForm"].make[document.forms["LVVendorProxForm"].make.selectedIndex].text;
	myVehicleModel = document.forms["LVVendorProxForm"].modelId[document.forms["LVVendorProxForm"].modelId.selectedIndex].text;
	myVehicleStyle = document.forms["LVVendorProxForm"].bstyle[document.forms["LVVendorProxForm"].bstyle.selectedIndex].text;

	var myFullContentString = "";
	var myContentBody = "";

	myFullContentString = "<div class='DIV_Content_Container'>";
	myFullContentString += "<div class='DIV_Content_Header'>";

	myFullContentString += "<div class='DIV_Rew'>";
	myFullContentString += "<a href='javascript:navigateLinksVehicle(0);'>&lt;</a>&nbsp;&nbsp;<a href='javascript:navigateLinksVehicle(1);'>&lt;&lt;</a>";
	myFullContentString += "</div>";

	myPagesCount = Math.floor((myJSON_Data.size()/myDesiredCount));

	if (myJSON_Data.size()%myDesiredCount != 0){
		myPagesCount++;
	}

	myFullContentString += "<div class='DIV_Nav'>";

	var i = 0;

	for (i = 0; i < myPagesCount; i++){
		myFullContentString += "<a href='javascript:showPageContentVehicle(" + i + ");'>" + (i+1) + "</a>" + "&nbsp;";
	}

	myFullContentString += "</div>";

	myFullContentString += "<div class='DIV_Forw'>";
	myFullContentString += "<a href='javascript:navigateLinksVehicle(2);'>&gt;&gt;</a>&nbsp;&nbsp;<a href='javascript:navigateLinksVehicle(3);'>&gt;</a>";
	myFullContentString += "</div>";

	myFullContentString += "</div>"; //DIV_Content_Header

	myFullContentString += "<div class='DIV_Content_Data' id='DIV_Content_Data'>";
	myFullContentString += "</div>";

	myFullContentString += "</div>"; //DIV_Content_Container

	$('contentData').innerHTML = myFullContentString;


	// After loading, it shows the first page
	showPageContentVehicle(myCurrentPage);

	return true;
}


/*Load vehicles by order number*/

function sendDataVehicleOrderNum()
{
	var url = assembleURLVehicleOrderNum();

	var pars = assembleParametersVehicle();

	previousActionsVehicle();

	var myAjax = new Ajax.Request( url, {method: 'post', parameters: pars, onComplete: showResponseVehicleOrderNum, asynchronous: true} );

}

function assembleURLVehicleOrderNum(){
	var url = "";
	url = "/vehiclesearch_ajax.do?";

	url += "&orderNumber=" + document.forms["LVOrderNumForm"].orderNumber.value;
	url += "&searchType=7";

	url += "&year=" +  document.forms["LVOrderNumForm"].year[document.forms["LVOrderNumForm"].year.selectedIndex].value;
	url += "&make=" + document.forms["LVOrderNumForm"].make[document.forms["LVOrderNumForm"].make.selectedIndex].value;
	url += "&modelId=" + document.forms["LVOrderNumForm"].modelId[document.forms["LVOrderNumForm"].modelId.selectedIndex].value;
	url += "&bstyle=" + document.forms["LVOrderNumForm"].bstyle[document.forms["LVOrderNumForm"].bstyle.selectedIndex].value;

	url += "&modelDesignator=" + document.forms["LVOrderNumForm"].modelDesignator.value;//+ findMMC(st_pvc, vehiclesArrayAuxi);
	url += "&destView=atlantis";
	url += "&returnDataType=JSON";

	return url;
}

function showResponseVehicleOrderNum (originalRequest){
	responseActionsVehicleOrderNum(originalRequest);

	afterActionsVehicle();

	return true;
}

// Actions executed by the ajax call
function responseActionsVehicleOrderNum(originalRequest){
	myJSON_Data = originalRequest.responseText.evalJSON();
	myDesiredCount =  "3";

	myVehicleYear = document.forms["LVOrderNumForm"].year[document.forms["LVOrderNumForm"].year.selectedIndex].text;
	myVehicleMake = document.forms["LVOrderNumForm"].make[document.forms["LVOrderNumForm"].make.selectedIndex].text;
	myVehicleModel = document.forms["LVOrderNumForm"].modelId[document.forms["LVOrderNumForm"].modelId.selectedIndex].text;
	myVehicleStyle = document.forms["LVOrderNumForm"].bstyle[document.forms["LVOrderNumForm"].bstyle.selectedIndex].text;

	var myFullContentString = "";
	var myContentBody = "";

	myFullContentString = "<div class='DIV_Content_Container'>";
	myFullContentString += "<div class='DIV_Content_Header'>";

	myFullContentString += "<div class='DIV_Rew'>";
	myFullContentString += "<a href='javascript:navigateLinksVehicle(0);'>&lt;</a>&nbsp;&nbsp;<a href='javascript:navigateLinksVehicle(1);'>&lt;&lt;</a>";
	myFullContentString += "</div>";

	myPagesCount = Math.floor((myJSON_Data.size()/myDesiredCount));

	if (myJSON_Data.size()%myDesiredCount != 0){
		myPagesCount++;
	}

	myFullContentString += "<div class='DIV_Nav'>";

	var i = 0;

	for (i = 0; i < myPagesCount; i++){
		myFullContentString += "<a href='javascript:showPageContentVehicle(" + i + ");'>" + (i+1) + "</a>" + "&nbsp;";
	}

	myFullContentString += "</div>";

	myFullContentString += "<div class='DIV_Forw'>";
	myFullContentString += "<a href='javascript:navigateLinksVehicle(2);'>&gt;&gt;</a>&nbsp;&nbsp;<a href='javascript:navigateLinksVehicle(3);'>&gt;</a>";
	myFullContentString += "</div>";

	myFullContentString += "</div>"; //DIV_Content_Header

	myFullContentString += "<div class='DIV_Content_Data' id='DIV_Content_Data'>";
	myFullContentString += "</div>";

	myFullContentString += "</div>"; //DIV_Content_Container

	$('contentData').innerHTML = myFullContentString;


	// After loading, it shows the first page
	showPageContentVehicle(myCurrentPage);

	return true;
}

function showTab(tabOn, contentOn)
{
  var mtab1= document.getElementById("tab1");
  var mtab2= document.getElementById("tab2");
  var mtab3= document.getElementById("tab3");
  var mcont1= document.getElementById("content1");
  var mcont2= document.getElementById("content2");
  var mcont3= document.getElementById("content3");

	if(tabOn == "tab1"){
		mtab1.style.background = "url(content/en/images/locateVehicle/selectVehicle/tabs/tab_2008.gif) no-repeat 0 -28px";
		mtab2.style.background = "url(content/en/images/locateVehicle/selectVehicle/tabs/tabs_2009.gif) no-repeat 0 0px"
		mtab3.style.background = "url(content/en/images/locateVehicle/selectVehicle/tabs/tabs_2010.gif) no-repeat 0 0px"
		mcont1.className = "divOn";
		mcont2.className = "divOff";
		mcont3.className = "divOff";
	}

  mtab1.style.background= (tabOn == "tab1") ? "url(content/en/images/locateVehicle/selectVehicle/tabs/tab_2008.gif) no-repeat 0 -28px" : "url(content/en/images/locateVehicle/selectVehicle/tabs/tab_2008.gif) no-repeat 0 0";
  mtab2.style.background= (tabOn == "tab1") ? "url(content/en/images/locateVehicle/selectVehicle/tabs/tab_2007.gif) no-repeat 0 0" : "url(content/en/images/locateVehicle/selectVehicle/tabs/tab_2007.gif) no-repeat 0 -28px";
  mcont1.className= (tabOn == "tab1") ? "divOn" : "divOff";
  mcont2.className= (tabOn == "tab1") ? "divOff" : "divOn";






}