
String.prototype.trim = function () {
    return this.replace(/^\s*/, "").replace(/\s*$/, "");
} 

function navToGC(url, width, height) 
{
    var arg = "menubar=yes,titlebar=yes,toolbar=yes,scrollbars=yes,resizable=yes,location=yes,width=" + width + ",height=" + height;        
    window.open(url,"_GolfChannel", arg, false);
    // url, window-name, featrures, replaceHistory
}


function InitTeeTime(areaVal) {
    var dt = new Date();
    document.getElementById("teeTimeFrom").value = (dt.getMonth() + 1) + "/" + dt.getDate() + "/" + dt.getFullYear();
    dt.setDate(dt.getDate() + 7); // 7 more days.
    document.getElementById("teeTimeTo").value = (dt.getMonth() + 1) + "/" + dt.getDate() + "/" + dt.getFullYear();
    PopulateAreaDropDown();
//    document.getElementById('teeTimeAreaDD').value = areaVal;
//    document.getElementById('teeTimeAreaDD').selectedIndex = 157;
/*
    for (var i = 0; i < document.getElementById('teeTimeAreaDD').options.length; i++) {
        if (document.getElementById('teeTimeAreaDD').options[i].text == areaVal) {	   
            document.getElementById('teeTimeAreaDD').selectedIndex = i;
	    break;
	}
    }*/
}


// Tee Time Search to golfnow.com
function searchTeeTime() {
    var url = getSearchTeeTimeUrl();
    if(url == "")
	return;
    navToGC(url, 1024, 768);
}




function getSearchTeeTimeUrl() {
    var areaName = document.getElementById('teeTimeAreaDD').value;
    if(areaName == "")
	return areaName;
	

    var longAreaName = document.getElementById('teeTimeAreaDD').options[document.getElementById('teeTimeAreaDD').selectedIndex].text;
    longAreaName = BuildGCSubLink(longAreaName);
    var startDate = document.getElementById("teeTimeFrom").value;
    var endDate = document.getElementById("teeTimeTo").value;
    // http://www.golfnow.com/sanfrancisco/tee-times/golf-courses/california—-san-francisco/search?FDT=4/29/2009&TDT=5/2/2009
    var url = "http://www.golfnow.com/" + areaName + "/search?FDT=" + startDate + "&TDT=" + endDate;
    return url;
}


function AreaInfo(val, txt) {
    this.text = txt;
    this.value = val;   
    
}

function PopulateAreaDropDown() {
    var areas = new Array();

areas[0] = new AreaInfo("", "Select an Area");
areas[1] = new AreaInfo("/alabama/tee-times/golf-courses/alabama---birmingham/", "Alabama - Birmingham");
areas[2] = new AreaInfo("/alabama/tee-times/golf-courses/alabama---montgomery/", "Alabama - Montgomery");
areas[3] = new AreaInfo("/alabama/tee-times/golf-courses/alabama---rtj--trail/", "Alabama - RTJ  Trail");
areas[4] = new AreaInfo("/phoenix/tee-times/golf-courses/arizona---casa-grande/", "Arizona - Casa Grande");
areas[5] = new AreaInfo("/lasvegas/tee-times/golf-courses/arizona---colorado-river/", "Arizona - Colorado River");
areas[6] = new AreaInfo("/phoenix/tee-times/golf-courses/arizona---flagstaff/", "Arizona - Flagstaff");
areas[7] = new AreaInfo("/phoenix/tee-times/golf-courses/arizona---n-central-phoenix/", "Arizona - N Central Phoenix");
areas[8] = new AreaInfo("/phoenix/tee-times/golf-courses/arizona---ne-phoenix/", "Arizona - NE Phoenix");
areas[9] = new AreaInfo("/phoenix/tee-times/golf-courses/arizona---nw-phoenix/", "Arizona - NW Phoenix");
areas[10] = new AreaInfo("/phoenix/tee-times/golf-courses/arizona---prescott/", "Arizona - Prescott");
areas[11] = new AreaInfo("/phoenix/tee-times/golf-courses/arizona---s-central-phoenix/", "Arizona - S Central Phoenix");
areas[12] = new AreaInfo("/phoenix/tee-times/golf-courses/arizona---se-phoenix/", "Arizona - SE Phoenix");
areas[13] = new AreaInfo("/tucson/tee-times/golf-courses/arizona---southern-arizona/", "Arizona - Southern Arizona");
areas[14] = new AreaInfo("/phoenix/tee-times/golf-courses/arizona---sw-phoenix/", "Arizona - SW Phoenix");
areas[15] = new AreaInfo("/tucson/tee-times/golf-courses/arizona---tucson/", "Arizona - Tucson");
areas[16] = new AreaInfo("/sanfrancisco/tee-times/golf-courses/ca---antiochdelta/", "California - Antioch/Delta");
areas[17] = new AreaInfo("/sacramento/tee-times/golf-courses/california---central-valley/", "California - Central Valley");
areas[18] = new AreaInfo("/sacramento/tee-times/golf-courses/california---foothills/", "California - Foothills");
areas[19] = new AreaInfo("/sacramento/tee-times/golf-courses/california---fresno/", "California - Fresno");
areas[20] = new AreaInfo("/inlandempire/tee-times/golf-courses/california---inland-empire/", "California - Inland Empire");
areas[21] = new AreaInfo("/losangeles/tee-times/golf-courses/california---los-angeles/", "California - Los Angeles");
areas[22] = new AreaInfo("/sanfrancisco/tee-times/golf-courses/ca---marin/", "California - Marin");
areas[23] = new AreaInfo("/sanfrancisco/tee-times/golf-courses/ca---napasonoma/", "California - Napa/Sonoma");
areas[24] = new AreaInfo("/sanfrancisco/tee-times/golf-courses/ca---north-solano--yolo-/", "California - North Solano / Yolo ");
areas[25] = new AreaInfo("/sacramento/tee-times/golf-courses/california---north-state/", "California - North State");
areas[26] = new AreaInfo("/sanfrancisco/tee-times/golf-courses/ca---oaklandeast-bay/", "California - Oakland/East Bay");
areas[27] = new AreaInfo("/orangecounty/tee-times/golf-courses/california---orange-county/", "California - Orange County");
areas[28] = new AreaInfo("/palmsprings/tee-times/golf-courses/california---palm-springs/", "California - Palm Springs");
areas[29] = new AreaInfo("/sanfrancisco/tee-times/golf-courses/ca---sac-private/", "California - Sac Private");
areas[30] = new AreaInfo("/sacramento/tee-times/golf-courses/california---sacramento/", "California - Sacramento");
areas[31] = new AreaInfo("/sandiego/tee-times/golf-courses/california---san-diego/", "California - San Diego");
areas[32] = new AreaInfo("/sanfrancisco/tee-times/golf-courses/search", "California - San Francisco Bay Area");
areas[33] = new AreaInfo("/sanfrancisco/tee-times/golf-courses/ca---san-josesouth-bay/", "California - San Jose/South Bay");
areas[34] = new AreaInfo("/sanfrancisco/tee-times/golf-courses/ca---santa-cruzmonterey/", "California - Santa Cruz/Monterey");
areas[35] = new AreaInfo("/sanfrancisco/tee-times/golf-courses/ca---sfpeninsula/", "California - SF/Peninsula");
areas[36] = new AreaInfo("/sanfrancisco/tee-times/golf-courses/ca---tri-valleyeast-bay/", "California - Tri-Valley/East Bay");
areas[37] = new AreaInfo("/denver/tee-times/golf-courses/colorado---colorado-springs", "Colorado - Colorado Springs");
areas[38] = new AreaInfo("/denver/tee-times/golf-courses/colorado---denver", "Colorado - Denver");
areas[39] = new AreaInfo("/denver/tee-times/golf-courses/colorado---grand-junctionmontrose/", "Colorado - Grand Junction/Montrose");
areas[40] = new AreaInfo("/denver/tee-times/golf-courses/colorado---greeley/", "Colorado - Greeley");
areas[41] = new AreaInfo("/denver/tee-times/golf-courses/colorado---mountain/", "Colorado - Mountain");
areas[42] = new AreaInfo("/newengland/tee-times/golf-courses/connecticut---hartford/", "Connecticut - Hartford");
areas[43] = new AreaInfo("/philadelphia/tee-times/golf-courses/delaware---wilmington/", "Delaware - Wilmington");
areas[44] = new AreaInfo("/jacksonville/tee-times/golf-courses/fl---amelia-island--fernandina/", "Florida - Amelia Island / Fernandina");
areas[45] = new AreaInfo("/tampa/tee-times/golf-courses/florida---clearwaterst-pete/", "Florida - Clearwater/St. Pete");
areas[46] = new AreaInfo("/tampa/tee-times/golf-courses/florida-%e2%80%93-downtown-tampa-ne/", "Florida - Downtown Tampa/ NE");
areas[47] = new AreaInfo("/miami/tee-times/golf-courses/florida---ft-lauderdale/", "Florida - Ft. Lauderdale");
areas[48] = new AreaInfo("/tampa/tee-times/golf-courses/florida---ft-myersnaples/", "Florida - Ft. Myers/Naples");
areas[49] = new AreaInfo("/jacksonville/tee-times/golf-courses/fl---jacksonville-east-and-beaches/", "Florida - Jacksonville East &amp; Beaches");
areas[50] = new AreaInfo("/jacksonville/tee-times/golf-courses/fl---jacksonville-east-central/", "Florida - Jacksonville East Central");
areas[51] = new AreaInfo("/jacksonville/tee-times/golf-courses/fl---jacksonville-south-and-st-augustine/", "Florida - Jacksonville South &amp; St. Augustine");
areas[52] = new AreaInfo("/jacksonville/tee-times/golf-courses/fl---jacksonville-west/", "Florida - Jacksonville West");
areas[53] = new AreaInfo("/jacksonville/tee-times/golf-courses/fl---lake-city--gainesville/", "Florida - Lake City / Gainesville");
areas[54] = new AreaInfo("/tampa/tee-times/golf-courses/florida---lakelandsebring/", "Florida - Lakeland/Sebring");
areas[55] = new AreaInfo("/miami/tee-times/golf-courses/florida---martinst-lucie/", "Florida - Martin/St. Lucie");
areas[56] = new AreaInfo("/miami/tee-times/golf-courses/florida---miami/", "Florida - Miami");
areas[57] = new AreaInfo("/tampa/tee-times/golf-courses/florida-%e2%80%93-n-tampabrooksville/", "Florida - N. Tampa/Brooksville");
areas[58] = new AreaInfo("/orlando/tee-times/golf-courses/florida---orlando-attractions/", "Florida - Orlando Attractions");
areas[59] = new AreaInfo("/orlando/tee-times/golf-courses/florida---orlando-clermont/", "Florida - Orlando Clermont");
areas[60] = new AreaInfo("/orlando/tee-times/golf-courses/florida---orlando-disney/", "Florida - Orlando Disney");
areas[61] = new AreaInfo("/orlando/tee-times/golf-courses/florida---orlando-downtown/", "Florida - Orlando Downtown");
areas[62] = new AreaInfo("/orlando/tee-times/golf-courses/florida---orlando-northeast/", "Florida - Orlando Northeast");
areas[63] = new AreaInfo("/orlando/tee-times/golf-courses/florida---orlando-ocala/", "Florida - Orlando Ocala");
areas[64] = new AreaInfo("/orlando/tee-times/golf-courses/florida---orlando-space-coast/", "Florida - Orlando Space Coast");
areas[65] = new AreaInfo("/orlando/tee-times/golf-courses/florida---orlando-west/", "Florida - Orlando West");
areas[66] = new AreaInfo("/miami/tee-times/golf-courses/florida---palm-beach/", "Florida - Palm Beach");
areas[67] = new AreaInfo("/pensacola/tee-times/golf-courses/florida---pensacola/", "Florida - Pensacola");
areas[68] = new AreaInfo("/tampa/tee-times/golf-courses/florida---sarasotabradenton/", "Florida - Sarasota/Bradenton");
areas[69] = new AreaInfo("/atlanta/tee-times/golf-courses/georgia---athens/", "Georgia - Athens");
areas[70] = new AreaInfo("/atlanta/tee-times/golf-courses/georgia---atlanta-central/", "Georgia - Atlanta Central");
areas[71] = new AreaInfo("/atlanta/tee-times/golf-courses/georgia---atlanta-east/", "Georgia - Atlanta East");
areas[72] = new AreaInfo("/atlanta/tee-times/golf-courses/georgia---atlanta-north/", "Georgia - Atlanta North");
areas[73] = new AreaInfo("/atlanta/tee-times/golf-courses/georgia---atlanta-south/", "Georgia - Atlanta South");
areas[74] = new AreaInfo("/atlanta/tee-times/golf-courses/georgia---atlanta-west/", "Georgia - Atlanta West");
areas[75] = new AreaInfo("/atlanta/tee-times/golf-courses/georgia---augusta/", "Georgia - Augusta");
areas[76] = new AreaInfo("/coastalgeorgia/tee-times/golf-courses/ga---coastal-georgia/", "Georgia - Coastal Georgia");
areas[77] = new AreaInfo("/atlanta/tee-times/golf-courses/georgia---gainesville/", "Georgia - Gainesville");
areas[78] = new AreaInfo("/atlanta/tee-times/golf-courses/georgia---macon---mid-ga/", "Georgia - Macon - Mid GA");
areas[79] = new AreaInfo("/atlanta/tee-times/golf-courses/georgia---ne-ga-mountains/", "Georgia - NE GA Mountains");
areas[80] = new AreaInfo("/hawaii/tee-times/golf-courses/hawaii---big-island/", "Hawaii - Big Island");
areas[81] = new AreaInfo("/hawaii/tee-times/golf-courses/hawaii---kauai/", "Hawaii - Kauai");
areas[82] = new AreaInfo("/hawaii/tee-times/golf-courses/hawaii---maui/", "Hawaii - Maui");
areas[83] = new AreaInfo("/hawaii/tee-times/golf-courses/hawaii---molokai/", "Hawaii - Molokai");
areas[84] = new AreaInfo("/hawaii/tee-times/golf-courses/hawaii---oahu/", "Hawaii - Oahu");
areas[85] = new AreaInfo("/illinois/tee-times/golf-courses/illinois---central/", "Illinois - Central");
areas[86] = new AreaInfo("/illinois/tee-times/golf-courses/illinois---chicago-north/", "Illinois - Chicago North");
areas[87] = new AreaInfo("/illinois/tee-times/golf-courses/illinois---chicago-south/", "Illinois - Chicago South");
areas[88] = new AreaInfo("/illinois/tee-times/golf-courses/illinois---chicago-west/", "Illinois - Chicago West");
areas[89] = new AreaInfo("/illinois/tee-times/golf-courses/illinois---st-louis/", "Illinois - St. Louis");
areas[90] = new AreaInfo("/indianapolis/tee-times/golf-courses/indiana---indianapolis/", "Indiana - Indianapolis");
areas[91] = new AreaInfo("/indianapolis/tee-times/golf-courses/indiana---nw/", "Indiana - NW");
areas[92] = new AreaInfo("/indianapolis/tee-times/golf-courses/indiana---se/", "Indiana - SE");
areas[93] = new AreaInfo("/indianapolis/tee-times/golf-courses/indiana---southern-indiana/", "Indiana - Southern Indiana");
areas[94] = new AreaInfo("/kansas/tee-times/golf-courses/kansas---coffeyville/", "Kansas - Coffeyville");
areas[95] = new AreaInfo("/lexington/tee-times/golf-courses/kentucky---lexington/", "Kentucky - Lexington");
areas[96] = new AreaInfo("/lexington/tee-times/golf-courses/kentucky---louisville/", "Kentucky - Louisville");
areas[97] = new AreaInfo("/lexington/tee-times/golf-courses/kentucky---southern-kentucky/", "Kentucky - Southern Kentucky");
areas[98] = new AreaInfo("/louisiana/tee-times/golf-courses/louisiana---baton-rouge/", "Louisiana - Baton Rouge");
areas[99] = new AreaInfo("/louisiana/tee-times/golf-courses/louisiana---baton-rouge-brec/", "Louisiana - Baton Rouge BREC");
areas[100] = new AreaInfo("/louisiana/tee-times/golf-courses/louisiana---central-louisiana/", "Louisiana - Central Louisiana");
areas[101] = new AreaInfo("/louisiana/tee-times/golf-courses/louisiana---no-north-shore/", "Louisiana - N.O. North Shore");
areas[102] = new AreaInfo("/louisiana/tee-times/golf-courses/louisiana---new-orleans-metro/", "Louisiana - New Orleans Metro");
areas[103] = new AreaInfo("/louisiana/tee-times/golf-courses/louisiana---north-louisiana/", "Louisiana - North Louisiana");
areas[104] = new AreaInfo("/louisiana/tee-times/golf-courses/louisiana---sw-louisiana/", "Louisiana - SW Louisiana");
areas[105] = new AreaInfo("/newengland/tee-times/golf-courses/search", "MA - Massachusetts");
areas[106] = new AreaInfo("/baltimore/tee-times/golf-courses/maryland---baltimoredc/", "Maryland - Baltimore/DC");
areas[107] = new AreaInfo("/newengland/tee-times/golf-courses/massachusetts---boston/", "Massachusetts - Boston");
areas[108] = new AreaInfo("/newengland/tee-times/golf-courses/massachusetts---cape-codeplymouth/", "Massachusetts - Cape Cod/Plymouth");
areas[109] = new AreaInfo("/newengland/tee-times/golf-courses/massachusetts---central-and-eastern-mass/", "Massachusetts - Central &amp; Eastern Mass");
areas[110] = new AreaInfo("/newengland/tee-times/golf-courses/massachusetts---springfield/", "Massachusetts - Springfield");
areas[111] = new AreaInfo("/detroit/tee-times/golf-courses/michigan---central-michigan/", "Michigan - Central Michigan");
areas[112] = new AreaInfo("/detroit/tee-times/golf-courses/michigan---north-michigan/", "Michigan - North Michigan");
areas[113] = new AreaInfo("/detroit/tee-times/golf-courses/michigan---se-michigan/", "Michigan - SE Michigan");
areas[114] = new AreaInfo("/detroit/tee-times/golf-courses/michigan---sw-michigan/", "Michigan - SW Michigan");
areas[115] = new AreaInfo("/minneapolis/tee-times/golf-courses/minnesota---minneapolis/", "Minnesota - Minneapolis");
areas[116] = new AreaInfo("/mississippi/tee-times/golf-courses/mississippi---jackson/", "Mississippi - Jackson");
areas[117] = new AreaInfo("/mississippi/tee-times/golf-courses/mississippi---mississippi/", "Mississippi - Mississippi");
areas[118] = new AreaInfo("/stlouis/tee-times/golf-courses/missouri---branson/", "Missouri - Branson/Springfield");
areas[119] = new AreaInfo("/kansascity/tee-times/golf-courses/missouri---kansas-city/", "Missouri - Kansas City");
areas[120] = new AreaInfo("/kansascity/tee-times/golf-courses/missouri---lake-of-the-ozarks/", "Missouri - Lake of the Ozarks");
areas[121] = new AreaInfo("/stlouis/tee-times/golf-courses/missouri---st-louis/", "Missouri - St. Louis");
areas[122] = new AreaInfo("/omaha/tee-times/golf-courses/nebraska---lincoln/", "Nebraska - Lincoln");
areas[123] = new AreaInfo("/omaha/tee-times/golf-courses/nebraska---omaha-metro/", "Nebraska - Omaha Metro");
areas[124] = new AreaInfo("/omaha/tee-times/golf-courses/nebraska---southeast-nebraska/", "Nebraska - Southeast Nebraska");
areas[125] = new AreaInfo("/lasvegas/tee-times/golf-courses/nevada---las-vegas/", "Nevada - Las Vegas");
areas[126] = new AreaInfo("/lasvegas/tee-times/golf-courses/nevada---mesquite/", "Nevada - Mesquite");
areas[127] = new AreaInfo("/lasvegas/tee-times/golf-courses/nevada---pahrump/", "Nevada - Pahrump");
areas[128] = new AreaInfo("/reno/tee-times/golf-courses/nevada---renocarson/", "Nevada - Reno/Carson");
areas[129] = new AreaInfo("/newengland/tee-times/golf-courses/new-hampshire---nh/", "New Hampshire - NH");
areas[130] = new AreaInfo("/atlantic-city/tee-times/golf-courses/new-jersey---atlantic-city/", "New Jersey - Atlantic City");
areas[131] = new AreaInfo("/atlantic-city/tee-times/golf-courses/new-jersey---north-new-jersey/", "New Jersey - North New Jersey");
areas[132] = new AreaInfo("/atlantic-city/tee-times/golf-courses/new-jersey---south-new-jersey/", "New Jersey - South New Jersey");
areas[133] = new AreaInfo("/newmexico/tee-times/golf-courses/new-mexico---centralalbuquerque/", "New Mexico - Central/Albuquerque");
areas[134] = new AreaInfo("/newmexico/tee-times/golf-courses/new-mexico---northern/", "New Mexico - Northern");
areas[135] = new AreaInfo("/newyork/tee-times/golf-courses/new-york---ny-metro/", "New York - NY Metro");
areas[136] = new AreaInfo("/newyork/tee-times/golf-courses/new-york---western/", "New York - Western");
areas[137] = new AreaInfo("/charlotte/tee-times/golf-courses/north-carolina---asheville/", "North Carolina - Asheville");
areas[138] = new AreaInfo("/charlotte/tee-times/golf-courses/north-carolina---charlotte/", "North Carolina - Charlotte");
areas[139] = new AreaInfo("/charlotte/tee-times/golf-courses/north-carolina---greensboro/", "North Carolina - Greensboro");
areas[140] = new AreaInfo("/charlotte/tee-times/golf-courses/north-carolina---pinehurst/", "North Carolina - Pinehurst");
areas[141] = new AreaInfo("/charlotte/tee-times/golf-courses/north-carolina---raleighdurham/", "North Carolina - Raleigh/Durham");
areas[142] = new AreaInfo("/cleveland/tee-times/golf-courses/ohio---akroncanton/", "OH - Cincinnati/Dayton");
areas[143] = new AreaInfo("/cleveland/tee-times/golf-courses/ohio---akroncanton/", "Ohio - Akron/Canton");
areas[144] = new AreaInfo("/cleveland/tee-times/golf-courses/ohio---cleveland/", "Ohio - Cleveland");
areas[145] = new AreaInfo("/cleveland/tee-times/golf-courses/ohio---columbus/", "Ohio - Columbus");
areas[146] = new AreaInfo("/cleveland/tee-times/golf-courses/ohio---mansfield/", "Ohio - Mansfield");
areas[147] = new AreaInfo("/cleveland/tee-times/golf-courses/ohio---toledo/", "Ohio - Toledo");
areas[148] = new AreaInfo("/cleveland/tee-times/golf-courses/ohio---youngstown/", "Ohio - Youngstown");
areas[149] = new AreaInfo("/oklahomacity/tee-times/golf-courses/oklahoma---central-oklahoma/", "Oklahoma - Central Oklahoma");
areas[150] = new AreaInfo("/cincinnati/tee-times/golf-courses/oh---cincinnatidayton/", "Oklahoma - NE Oklahoma");
areas[151] = new AreaInfo("/portland/tee-times/golf-courses/oregon---central-oregon/", "Oregon - Central Oregon");
areas[152] = new AreaInfo("/portland/tee-times/golf-courses/oregon---oregon-coast/", "Oregon - Oregon Coast");
areas[153] = new AreaInfo("/portland/tee-times/golf-courses/oregon---portland---east/", "Oregon - Portland - East");
areas[154] = new AreaInfo("/portland/tee-times/golf-courses/oregon---portland---west/", "Oregon - Portland - West");
areas[155] = new AreaInfo("/portland/tee-times/golf-courses/oregon---willamette-valley/", "Oregon - Willamette Valley");
areas[156] = new AreaInfo("/philadelphia/tee-times/golf-courses/pennsylvania---philadelphia/", "Pennsylvania - Philadelphia");
areas[157] = new AreaInfo("/pittsburgh/tee-times/golf-courses/pennsylvania---pittsburgh/", "Pennsylvania - Pittsburgh");
areas[158] = new AreaInfo("/southcarolina/tee-times/golf-courses/south-carolina---charleston/", "South Carolina - Charleston");
areas[159] = new AreaInfo("/southcarolina/tee-times/golf-courses/south-carolina---columbia/", "South Carolina - Columbia");
areas[160] = new AreaInfo("/southcarolina/tee-times/golf-courses/south-carolina---hilton-head/", "South Carolina - Hilton Head");
areas[161] = new AreaInfo("/southcarolina/tee-times/golf-courses/south-carolina---myrtle-beach/", "South Carolina - Myrtle Beach");
areas[162] = new AreaInfo("/knoxville/tee-times/golf-courses/tennessee---knoxville/", "Tennessee - Knoxville");
areas[163] = new AreaInfo("/memphis/tee-times/golf-courses/tennessee---memphis-tunica/", "Tennessee - Memphis/ Tunica");
areas[164] = new AreaInfo("/nashville/tee-times/golf-courses/tennessee---nashville/", "Tennessee - Nashville");
areas[165] = new AreaInfo("/austin/golf-courses/texas---dallas-ftworth/", "Texas - Dallas/Ft. Worth");
areas[166] = new AreaInfo("/austin/golf-courses/texas---houston/", "Texas - Houston");
areas[167] = new AreaInfo("/austin/golf-courses/texas---nese-austin/", "Texas - NE/SE Austin");
areas[168] = new AreaInfo("/austin/golf-courses/texas---nwsw-austin/", "Texas - NW/SW Austin");
areas[169] = new AreaInfo("/austin/golf-courses/texas---san-antonio/", "Texas - San Antonio");
areas[170] = new AreaInfo("/austin/golf-courses/texas---south-texas/", "Texas - South Texas");
areas[171] = new AreaInfo("/oklahomacity/tee-times/golf-courses/texas---southern-oklahoma/", "Texas - Southern Oklahoma");
areas[172] = new AreaInfo("/lasvegas/golf-courses/utah--st-george/", "Utah - St. George");
areas[173] = new AreaInfo("/newengland/golf-courses/vermont--vermont-golf/", "Vermont - Vermont Golf");
areas[174] = new AreaInfo("/washingtondc/golf-courses/virginia--richmond/", "Virginia - Richmond");
areas[175] = new AreaInfo("/spokane/golf-courses/washington--central/", "Washington - Central");
areas[176] = new AreaInfo("/spokane/golf-courses/washington--easternidaho/", "Washington - Eastern/Idaho");
areas[177] = new AreaInfo("/seattle/golf-courses/washington--golfnow-country-club/", "Washington - SW Washington");
areas[178] = new AreaInfo("/spokane/golf-courses/washington--western/", "Washington - Western");
areas[179] = new AreaInfo("/washingtondc/tee-times/golf-courses/washington-dc-%e2%80%93-md--eastern-shore/", "Washington DC - MD / Eastern Shore");
areas[180] = new AreaInfo("/washingtondc/tee-times/golf-courses/washington-dc---metromd/", "Washington DC - Metro/MD");
areas[181] = new AreaInfo("/washingtondc/tee-times/golf-courses/washington-dc---washington--pa/", "Washington DC - Washington / PA");
areas[182] = new AreaInfo("/washingtondc/golf-courses/washington-dc---metromd/", "Washington DC - Washington/VA");
areas[183] = new AreaInfo("/milwaukee/golf-courses/wisconsin--centralgreen-bay/", "Wisconsin - Central/Green Bay");
areas[184] = new AreaInfo("/milwaukee/tee-times/golf-courses/wisconsin---geneva-lakes/", "Wisconsin - Geneva Lakes");
areas[185] = new AreaInfo("/milwaukee/golf-courses/wisconsin--greater-milwaukee/", "Wisconsin - Greater Milwaukee");
areas[186] = new AreaInfo("/greenbay/tee-times/golf-courses/wisconsin---madisondells/", "Wisconsin - Madison/Dells");
areas[187] = new AreaInfo("/greenbay/tee-times/golf-courses/wisconsin---westnorthwest/", "Wisconsin - West/Northwest");


    areas[188] = new AreaInfo("/ontario/teetimes/golf-courses/canada--torontogta/", "Canada - ON Toronto/GTA");
    areas[189] = new AreaInfo("/ontario/teetimes/golf-courses/canada--burlingtonhamilton", "Canada - ON Burlington/Hamilton");
    areas[190] = new AreaInfo("/ontario/teetimes/golf-courses/canada--on-niagara", "Canada - ON Niagara");
    areas[191] = new AreaInfo("/ontario/teetimes/golf-courses/canada--peterborougheast", "Canada - ON Peterborough/East");
    areas[192] = new AreaInfo("/ontario/teetimes/golf-courses/canada--kitchenerwest", "Canada - ON Kitchener/West");
    areas[193] = new AreaInfo("/ontario/teetimes/golf-courses/canada--simcoenorth", "Canada - ON Simcoe/North");
   
   

/*  
    areas[0] = new AreaInfo("sacramento", "California - Central Valley");
    areas[1] = new AreaInfo("sacramento", "California - Foothills");
    areas[2] = new AreaInfo("inlandempire", "California - Inland Empire");
    areas[3] = new AreaInfo("losangeles", "California - Los Angeles");
    areas[4] = new AreaInfo("sacramento", "California - North State");
    areas[5] = new AreaInfo("orangecounty", "California - Orange County");
    areas[6] = new AreaInfo("palmsprings", "California - Palm Springs");
    areas[7] = new AreaInfo("sacramento", "California - Sac Private");
    areas[8] = new AreaInfo("sacramento", "California - Sacramento");
    areas[9] = new AreaInfo("sandiego", "California - San Diego");
    areas[10] = new AreaInfo("sanfrancisco", "California - San Francisco");
    areas[11] = new AreaInfo("sanfrancisco", "California - SF East Bay");
    areas[12] = new AreaInfo("sanfrancisco", "California - SF Monterey Bay");
    areas[13] = new AreaInfo("sanfrancisco", "California - SF North Bay");
    areas[14] = new AreaInfo("sanfrancisco", "California - SF South Bay");
    areas[15] = new AreaInfo("sacramento", "California - South Central Valley");
*/   
   
    var dd = document.getElementById("teeTimeAreaDD");

    for (var i = 0, len = areas.length; i < len; ++i) {
        var optn = document.createElement("OPTION");
        optn.text = areas[i].text;
        optn.value = areas[i].value;
        dd.options.add(optn);
	//if (i == 157) dd.selectedIndex = 157;
    }
}


function BuildGCSubLink(val)
{
    var vals = val.split("-");   
    var subLinks = vals[1].split(" ");    
    var link = vals[0].trim() + "---";    
    var first = true;    
    for(var i = 0; i < subLinks.length; i++)
    {
        if(subLinks[i].length > 0)
        {
            if(first == false)
            {
                link += "-" + subLinks[i];
            }
            else        
            {   
                link += subLinks[i];
                first = false;
            }
        }
    }    
    return link;
}






function PopulateDestinationDropDown() {
    var areas = new Array();

    areas[0] = new AreaInfo("", "Select a destination");
    areas[1] = new AreaInfo("p1=22.553147;p2=-160.532227;p3=18.609807;p4=-154.319458", "Hawaii");
    areas[2] = new AreaInfo("p1=32.5;p2=-81.1;p3=32.1;p4=-80.4", "Hilton Head");
    areas[3] = new AreaInfo("p1=55.3;p2=-10.4;p3=51.45;p4=-5.4", "Ireland");
    areas[4] = new AreaInfo("p1=30.7315;p2=-82.138;p3=29.78;p4=-81.22", "Jacksonville");
    areas[5] = new AreaInfo("p1=36.362693;p2=-115.41137;p3=35.926313;p4=-114.88403", "Las Vegas");
    areas[6] = new AreaInfo("p1=26.041;p2=-80.5;p3=25.3;p4=-80", "Miami");
    areas[7] = new AreaInfo("p1=45.825;p2=-86.4;p3=44;p4=-83.25", "Michigan");
    areas[8] = new AreaInfo("p1=33.9;p2=-79.1;p3=33.5;p4=-78.5", "Myrtle Beach");
    areas[9] = new AreaInfo("p1=26.82;p2=-82.2;p3=25.9;p4=-81.37", "Naples");
    areas[10] = new AreaInfo("p1=50.08797;p2=-94.50446;p3=42.02256;p4=-74.59136", "Ontario");
    areas[11] = new AreaInfo("p1=28.9;p2=-82;p3=28.1;p4=-81", "Orlando");
    areas[12] = new AreaInfo("p1=34.2;p2=-113.52;p3=32.65;p4=-110.78", "Phoenix Scottsdale");
    areas[13] = new AreaInfo("p1=35.4;p2=-79.76;p3=35;p4=-79.18", "Pinehurst");
    areas[14] = new AreaInfo("p1=47.1;p2=-64.5;p3=45.9;p4=-61.8", "Prince Edward Island");
    areas[15] = new AreaInfo("p1=30.070639;p2=-99.0565538406372;p3=28.982114;p4=-97.891899", "San Antonio Texas");
    areas[16] = new AreaInfo("p1=33.45;p2=-118.11;p3=32.5;p4=-116.85", "San Diego");
    areas[17] = new AreaInfo("p1=58.84;p2=-7.98;p3=54.7;p4=-0.13", "Scotland");
    areas[18] = new AreaInfo("p1=28.747;p2=-83;p3=27.2;p4=-82.147", "Tampa");
    areas[19] = new AreaInfo("p1=32.55;p2=-111.38;p3=31.6;p4=-110.15", "Tucson");
    areas[20] = new AreaInfo("p1=39.68;p2=-80.53;p3=37.2;p4=-75.85", "Washington DC");
    

    var dd = document.getElementById("destinationDD");
    for (var i = 0, len = areas.length; i < len; ++i) {
        var optn = document.createElement("OPTION");
        optn.text = areas[i].text;
        optn.value = areas[i].value;
        dd.options.add(optn);
    }
}


function changeDest(dd) {
    var areaVal = dd.value;
    var areaName = dd.options[dd.selectedIndex].text;

    if (areaVal != "") {
        var newLocation = "";
        var indexOfDestination = location.href.toLowerCase().indexOf("destination");
        var baseLocation = "";

        if (indexOfDestination > 0) {
            baseLocation = location.href.substring(0, indexOfDestination);
        }
        newLocation = baseLocation + "Destination/p=" + areaName + ";" + areaVal + ".html";
        window.location = newLocation;
    }
}

function SetDestinationDropDown(val) {    
    var dropDown = document.getElementById('destinationDD');
    for (var i = 0; i < dropDown.options.length; i++) {
        if (dropDown.options[i].text.toLowerCase() == val.toLowerCase()) {
            dropDown.selectedIndex = i;
            break;
        }
	}
}


