function newImage(src) {
  if (document.images) {
    var image = new Image();
    image.src = src;
    return image;
  }
}

// preload images for navigation
function preloadImages() {
	var home = newImage("images/navigation/home.gif");
	var home_red = newImage("images/navigation/home_red.gif");
	var new_equipment = newImage("images/navigation/new_equipment.gif");
	var new_equipment_red = newImage("images/navigation/new_equipment_red.gif");
	var used_equipment = newImage("images/navigation/used_equipment.gif");
	var used_equipment_red = newImage("images/navigation/used_equipment_red.gif");
	var rental = newImage("images/navigation/rental.gif");
	var rental_red = newImage("images/navigation/rental_red.gif");
	var parts = newImage("images/navigation/parts.gif");
	var parts_red = newImage("images/navigation/parts_red.gif");
	var service = newImage("images/navigation/service.gif");
	var service_red = newImage("images/navigation/service_red.gif");
	var contact_info = newImage("images/navigation/contact_info.gif");
	var contact_info_red = newImage("images/navigation/contact_info_red.gif");
	var about_us = newImage("images/navigation/about_us.gif");
	var about_us_red = newImage("images/navigation/about_us_red.gif");
	var locations = newImage("images/navigation/locations.gif");
	var locations_red = newImage("images/navigation/locations_red.gif");
	var careers = newImage("images/navigation/careers.gif");
	var careers_red = newImage("images/navigation/careers_red.gif");
	var news_events = newImage("images/navigation/news_events.gif");
	//var news_events_red = newImage("images/navigation/news_events_red.gif");
	var about_pape = newImage("images/navigation/about_pape.gif");
	//var about_pape_red = newImage("images/navigation/about_pape_red.gif");
}

function papePopup(url)
{
	return papePopupSized(url, 500, 800);
}

function papePopOnTop(url)
{
	window.open(url, 'popupWindow', 'location=1,status=1,scrollbars=1,toolbar=1,menubar=1,resizable=1,height=500,width=800');
}

function papePopupSized(url, height, width)
{
	window.open(url, 'popupWindow', 'location=1,status=1,scrollbars=1,toolbar=1,menubar=1,resizable=1,height=' + height + ',width=' + width + '');
	return false;
}

function locationsToggle(location_div_id)
{
	document.getElementById('ca_div').style.display = 'none';
	document.getElementById('or_div').style.display = 'none';
	document.getElementById('wa_div').style.display = 'none';
	
	location_div = document.getElementById(location_div_id);
	location_div.style.display = 'block';
}
	
function locations2Toggle(location_div_id)
{
	document.getElementById('eureka_ca_div').style.display = 'none';
	document.getElementById('fremont_ca_div').style.display = 'none';
	document.getElementById('sacramento_ca_div').style.display = 'none';
	document.getElementById('santa_rosa_ca_div').style.display = 'none';
	document.getElementById('salinas_ca_div').style.display = 'none';
	document.getElementById('concord_ca_div').style.display = 'none';
	document.getElementById('central_point_or_div').style.display = 'none';
	document.getElementById('eugene_or_div').style.display = 'none';
	document.getElementById('yakima_wa_div').style.display = 'none';
	document.getElementById('spokane_wa_div').style.display = 'none';
	document.getElementById('seattle_wa_div').style.display = 'none';
	document.getElementById('fife_wa_div').style.display = 'none';
	document.getElementById('pasco_wa_div').style.display = 'none';
	document.getElementById('bellingham_wa_div').style.display = 'none';
	document.getElementById('arlington_wa_div').style.display = 'none';
	document.getElementById('wenatchee_wa_div').style.display = 'none';
	document.getElementById('hubbard_or_div').style.display = 'none';
	document.getElementById('portland_or_div').style.display = 'none';
	document.getElementById('reno_nv_div').style.display = 'none';

	location_div = document.getElementById(location_div_id);
	location_div.style.display = 'block';
}
	
function insertFlash(filename)
{
	document.write('<OBJECT VIEWASTEXT><param name="height" value="353"/><param name="width" value="756"/><param name="codeBase" value="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0"/><param name="classid" value="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"/><PARAM NAME="_cx" VALUE="20003"/><PARAM NAME="_cy" VALUE="9366"/><PARAM NAME="FlashVars" VALUE=""/><PARAM NAME="Movie" VALUE="flash/' + filename + '"/><PARAM NAME="Src" VALUE="flash/' + filename + '"/><PARAM NAME="WMode" VALUE="Window"/><PARAM NAME="Play" VALUE="-1"/><PARAM NAME="Loop" VALUE="-1"/><PARAM NAME="Quality" VALUE="High"/><PARAM NAME="AllowScriptAccess" VALUE=""/><PARAM NAME="Scale" VALUE="ShowAll"/><PARAM NAME="DeviceFont" VALUE="0"/><PARAM NAME="EmbedMovie" VALUE="0"/><PARAM NAME="BGColor" VALUE="FFFFFF"/><PARAM NAME="SWRemote" VALUE=""/><PARAM NAME="MovieData" VALUE=""/><PARAM NAME="SeamlessTabbing" VALUE="1"/><PARAM NAME="AllowNetworking" VALUE="all"/><PARAM NAME="AllowFullScreen" VALUE="false"/><embed width="756" height="353" align="" menu="true" loop="true" play="true" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" name="myMovieName" bgcolor="#FFFFFF" quality="high" src="flash/' + filename + '"> </embed></OBJECT>');
}