//functions to validate newsletter info
function isNewsEmail(elm)
{
	if (elm.value.indexOf("@") != "-1" &&
		elm.value.indexOf(".") != "-1" &&
		elm.value != "")
		return true;
	else return false;
}

function isNewsReady(form)
{
	if (isNewsEmail(form.email)== false)
	{
		alert("Please enter a valid Email Address.");
		form.email.focus();
		return false;
	}

return true;
}

function isNewsReady2(form)
{
	if (isNewsEmail(form.fields_email)== false)
	{
		alert("Please enter a valid Email Address.");
		form.fields_email.focus();
		return false;
	}

return true;
}

//function opens new browser window for maps and other external pages

function goThere(the_url, window_name)
	{
	
		var new_window = window.open(the_url, window_name, "height=400,width=640,menubar,location,toolbar,scrollbars,status,resizable");
		new_window.focus();
	 
	}

//function preloads images and creates image rollover on left navigation bar
	var ARROW_ON = new Image();
	ARROW_ON.src = "/media/images/arrow_on.gif" //image when mouse is over link 
	
	var ARROW_OFF = new Image();
    ARROW_OFF.src = "/media/images/arrow_off.gif" //image when mouse is not over link
    
		    
//functions for links
    function imgover(imgname)
    {
    imgname.src=ARROW_ON.src
    }
        
    function imgout(imgname)
    {
    imgname.src=ARROW_OFF.src
    }

//Array function
function MakeArray()
	{
	var args = MakeArray.arguments;
		for (var i =0; i < args.length; i++)
			{
			this[i]=args[i];
			}
	this.length = args.length;
	}


//this array hold the page titles that will appear in the drop-down menu bar for WA
var pagesWA = new MakeArray("WA Cities",
							"Copalis Beach",
							"Ilwaco",
							"Lummi Island",
							"Long Beach",
							"Moclips",
							"Maple Beach",
							"Nahcotta",
							"Ocean Park",
							"Ocean Shores",
							"Pacific Beach",
							"Point Roberts",
							"Seabrook",
							"Seaview",
							"Sekiu",
							"Westport");
//this array holds the corresponding urls of the pages for WA
var urlsWA = new MakeArray("",
							"/pacific-beach-washington.php",
							"/long-beach-washington.php",
							"/lummi-island-washington.php",
							"/long-beach-washington.php",
							"/pacific-beach-washington.php",
							"/pointroberts-maplebeach.php",
							"/long-beach-washington.php",
							"/long-beach-washington.php",
							"/ocean-shores-washington.php",
							"/pacific-beach-washington.php",
							"/pointroberts-maplebeach.php",
							"/pacific-beach-washington.php",
							"/long-beach-washington.php",
							"/sekiu-washington.php",
							"/ocean-shores-washington.php");

//this array hold the page titles that will appear in the drop-down menu bar for OR
var pagesOR = new MakeArray("OR Cities",
							"Arch Cape",
							"Astoria",
							"Bandon",
							"Brookings",
							"Cannon Beach",
							"Coos Bay",
							"Cape Meares",
							"Depoe Bay",
							"Florence",
							"Garibaldi",
							"Gearhart",
							"Gleneden Beach",
							"Gold Beach",
							"Lincoln City",
							"Manzanita",
							"Nehalem",
							"Neskowin",
							"Netarts",
							"Newport",
							"North Bend",
							"Oceanside",
							"Otter Rock",
							"Pacific City",
							"Port Orford",
							"Reedsport",
							"Rockaway",
							"Seal Rock",
							"Seaside",
							"South Beach",
							"Tillamook",
							"Waldport",
							"Warrenton",
							"Wheeler",
							"Yachats");

//this array holds the corresponding urls of the pages for OR
var urlsOR = new MakeArray("",
							"/cannon-beach-oregon.php",
							"/city_page.php?city=4",
							"/bandon-oregon.php",
							"/brookings-harbor-oregon.php",
							"/cannon-beach-oregon.php",
							"/city_page.php?city=18",
							"/oceanside-oregon.php",
							"/depoe-bay-oregon.php",
							"/florence-oregon.php",
							"/rockaway-oregon.php",
							"/seaside-oregon.php",
							"/depoe-bay-oregon.php",
							"/gold-beach-oregon.php",
							"/lincoln-city.php",
							"/manzanita-oregon.php",
							"/manzanita-oregon.php",
							"/pacific-city-oregon.php",
							"/oceanside-oregon.php",
							"/newport-oregon.php",
							"/city_page.php?city=18",
							"/oceanside-oregon.php",
							"/depoe-bay-oregon.php",
							"/pacific-city-oregon.php",
							"/portorford-oregon.php",
							"/city_page.php?city=17",
							"/rockaway-oregon.php",
							"/waldport-oregon.php",
							"/seaside-oregon.php",
							"/newport-oregon.php",
							"/oceanside-oregon.php",
							"/waldport-oregon.php",
							"/city_page.php?city=4",
							"/manzanita-oregon.php",
							"/yachats-oregon.php");

var oceanside = new MakeArray("Cities",
							  "View All",
							"Oceanside",
							"Netarts",
							"Cape Meares");

var oceansideurls = new MakeArray("",
							"/oceanside-oregon.php",
							"/oceanside.php",
							"/netarts.php",
							"/cape-meares.php");

var region1 = new MakeArray("Washington Coast Cities",
							"Pacific Beach, Copalis, Moclips & Seabrook",
							"Ocean Shores & Westport",
							"Ocean Park & Long Beach");

var regionurls1 = new MakeArray("",
							"/pacific-beach-washington.php",
							"/ocean-shores-washington.php",
							"/long-beach-washington.php");

var region2 = new MakeArray("North Oregon Cities",
							"Astoria & Warrenton",
							"Gearhart & Seaside",
							"Cannon Beach & Arch Cape",
							"Manzanita, Nehalem & Wheeler",
							"Rockaway & Garibaldi",
							"Oceanside, Netarts & Tillamook",
							"Pacific City & Neskowin");

var regionurls2 = new MakeArray("",
							"/city_page.php?city=4",
							"/seaside-oregon.php",
							"/cannon-beach-oregon.php",
							"/manzanita-oregon.php",
							"/rockaway-oregon.php",
							"/oceanside-oregon.php",
							"/pacific-city-oregon.php"
							);

var region3 = new MakeArray("Central Oregon Cities",
							"Lincoln City",
							"Gleneden Beach, Depoe Bay & Otter Rock",
							"Newport & South Beach",
							"Waldport & Seal Rock",
							"Yachats",
							"Florence");

var regionurls3 = new MakeArray("",
							"/lincoln-city.php",
							"/depoe-bay-oregon.php",
							"/newport-oregon.php",
							"/waldport-oregon.php",
							"/yachats-oregon.php",
							"/florence-oregon.php");

var region4 = new MakeArray("South Oregon Cities",
							"Reedsport",
							"North Bend & Coos Bay",
							"Bandon",
							"Port Orford",
							"Gold Beach",
							"Brookings");

var regionurls4 = new MakeArray("",
							"/city_page.php?city=17",
							"/city_page.php?city=18",
							"/bandon-oregon.php",
							"/portorford-oregon.php",
							"/gold-beach-oregon.php",
							"/brookings-harbor-oregon.php");

function goPageWA(form)
{
i=form.menu.selectedIndex;
if (i != 0) {
	window.location.href = urlsWA[i];
	}
}

function goPageOR(form)
{
i=form.menu.selectedIndex;
if (i != 0) {
	window.location.href = urlsOR[i];
	}
}

function goRegion1(form)
{
i=form.menu.selectedIndex;
if (i != 0) {
	window.location.href = regionurls1[i];
	}
}

function goOceanside(form)
{
i=form.menu.selectedIndex;
if (i != 0) {
	window.location.href = oceansideurls[i];
	}
}

function goRegion2(form)
{
i=form.menu.selectedIndex;
if (i != 0) {
	window.location.href = regionurls2[i];
	}
}

function goRegion3(form)
{
i=form.menu.selectedIndex;
if (i != 0) {
	window.location.href = regionurls3[i];
	}
}

function goRegion4(form)
{
i=form.menu.selectedIndex;
if (i != 0) {
	window.location.href = regionurls4[i];
	}
}

var pages = new MakeArray("Search A City",
"Copalis Beach",
"Ilwaco",
"Long Beach",
"Moclips",
"Maple Beach",
"Nahcotta",
"Ocean Park",
"Ocean Shores",
"Pacific Beach",
"Point Roberts",
"Seaview",
"Westport",
"Arch Cape",
"Astoria",
"Bandon",
"Brookings",
"Cannon Beach",
"Coos Bay",
"Cape Meares",
"Depoe Bay",
"Florence",
"Garibaldi OR",
"Gearhart",
"Gleneden Beach",
"Gold Beach",
"Lincoln City",
"Manzanita",
"Nehalem",
"Neskowin",
"Netarts",
"Newport",
"North Bend",
"Oceanside",
"Otter Rock",
"Pacific City",
"Port Orford",
"Reedsport",
"Rockaway",
"Seabrook",
"Seal Rock",
"Seaside",
"South Beach",
"Tillamook",
"Waldport",
"Warrenton",
"Wheeler",
"Yachats");



//this array holds the corresponding urls of the pages
var urls = new MakeArray("",
"/pacific-beach-washington.php",
"/long-beach-washington.php",
"/long-beach-washington.php",
"/pacific-beach-washington.php",
"/pointroberts-maplebeach.php",
"/long-beach-washington.php",
"/long-beach-washington.php",
"/ocean-shores-washington.php",
"/pacific-beach-washington.php",
"/pointroberts-maplebeach.php",
"/long-beach-washington.php",
"/ocean-shores-washington.php",
"/cannon-beach-oregon.php",
"/city_page.php?city=4",
"/bandon-oregon.php",
"/brookings-harbor-oregon.php",
"/cannon-beach-oregon.php",
"/city_page.php?city=18",
"/city_page.php?city=9",
"/depoe-bay-oregon.php",
"/florence-oregon.php",
"/city_page.php?city=8",
"/seaside-oregon.php",
"/depoe-bay-oregon.php",
"/gold-beach-oregon.php",
"/lincoln-city.php",
"/manzanita-oregon.php",
"/manzanita-oregon.php",
"/pacific-city-oregon.php",
"/oceanside-oregon.php",
"/newport-oregon.php",
"/city_page.php?city=18",
"/oceanside-oregon.php",
"/depoe-bay-oregon.php",
"/pacific-city-oregon.php",
"/portorford-oregon.php",
"/city_page.php?city=17",
"/rockaway-oregon.php",
"/pacific-beach-washington.php",
"/waldport-oregon.php",
"/seaside-oregon.php",
"/newport-oregon.php",
"/oceanside-oregon.php",
"/waldport-oregon.php",
"/city_page.php?city=4",
"/manzanita-oregon.php",
"/yachats-oregon.php");

//this function determines which page is selected and goes to it
function goPage(form)
{
i=form.menu.selectedIndex;
if (i != 0) {
	window.location.href = urls[i];
	}
}

