/*
Script for using existing form values to populate additional fields
*/



//setup onload function
if(typeof window.addEventListener != 'undefined')
{
		//.. gecko, safari, konqueror and standard
		window.addEventListener('load', generic, false);
}
else if(typeof document.addEventListener != 'undefined')
{
		//.. opera 7
		document.addEventListener('load', generic, false);
}
else if(typeof window.attachEvent != 'undefined')
{
		//.. win/ie
		window.attachEvent('onload', generic);
}
else
{
		//.. mac/ie5 and anything else that gets this far
		
		//if there's an existing onload function
		if(typeof window.onload == 'function')
		{
			//store it
			var existing = onload;
			
			//add new onload handler
			window.onload = function()
			{
					//call existing onload function
					existing();
					
					//call generic onload function
					generic();
			};
		}
		else
		{
				//setup onload function
				window.onload = generic;
		}
}

function populateDealerFields(installstory){
	
	if(installstory.dealer_populate.checked){
		installstory.dealer_first_name.value = installstory.first_name.value;
		installstory.dealer_last_name.value = installstory.last_name.value;
		installstory.dealer_email.value = installstory.email.value;
		installstory.dealer_company_name.value = installstory.company_name.value;
		installstory.dealer_address1.value = installstory.address1.value;
		installstory.dealer_address2.value = installstory.address2.value;
		installstory.dealer_address3.value = installstory.address3.value;
		installstory.dealer_city.value = installstory.city.value;
		installstory.dealer_state.value = installstory.state.value;
		installstory.dealer_zip.value = installstory.zip.value;
		document.installstory.dealer_country.selectedIndex = document.installstory.country.selectedIndex;
	}
		
}