// JavaScript Document

function LoadState(){
document.getElementById('states').options[0]= new Option("-- View By State--","#");
for(var i=0; i< stateObjectArray.length; i++){
		document.getElementById('states').options[i+1]= new Option(stateObjectArray[i].name, stateObjectArray[i].abbreviation);
	}
}


function LoadService(){
	document.getElementById('services').options[0]= new Option("-- View By Service Type --","#");
	for(var i=0; i< ServiceTypeArray.length; i++){
			document.getElementById('services').options[i+1]= new Option(ServiceTypeArray[i].name, ServiceTypeArray[i].id);
	}
}


function redirectState(optSelected){
	var section =  window.location.href;
	var param;

	if (section.indexOf("fleet") > -1){
		param="fleet";
	}
	if (section.indexOf("smallbusiness") > -1){
		param="smallbusiness";
		
	}
	if (section.indexOf("contactus") > -1){
		param="contactus";
		
	}
	if (section.indexOf("sitemap") > -1){
		param="sitemap";
		
	}
	window.location.href="/finddealer/svmlocator/index_" + stateObjectArray[optSelected.selectedIndex-1].abbreviation + ".jsp?section="+param +"&selected="+stateObjectArray[optSelected.selectedIndex-1].abbreviation;	
	
}


function redirectService(optSelected){
	var section =  window.location.href;
	var param;

	if (section.indexOf("fleet") > -1){
		param="fleet";
	}
	if (section.indexOf("smallbusiness") > -1){
		param="smallbusiness";
		
	}
	if (section.indexOf("contactus") > -1){
		param="contactus";
		
	}
	if (section.indexOf("sitemap") > -1){
		param="sitemap";
		
	}
	window.location.href="/finddealer/svmlocator/index_" + ServiceTypeArray[optSelected.selectedIndex-1].id + ".jsp?section="+param +"&selected="+ServiceTypeArray[optSelected.selectedIndex-1].id;	
}

function selectedOption(idObject){
	var valueSelected=document.getElementById('hselected').value;
	document.getElementById(idObject).value = valueSelected;
}
