/*
THE ONLY WAY YOUR EVENT LIST WILL GET UPDATED IS BY POINTING TO THIS URL
http://www.weaselsspfld.com/javascript/this_months_mc_events.js

Last Update : Sun, 15 Nov 2009 03:20:25 -0700

this javascript file gets updated by server side code.
don't just copy this file or you'll have outdated events.
point your script tag to the url above.

WFFW

Johnny T
*/
document.write("<script src=\"http://www.weaselsspfld.com/javascript/wms.js\" type=\"text/javascript\"></script>");

	var rallyMap;
	var rallyMapCenter = new GLatLng(38.8402805,-97.6114237);
	var rallyMapZoom = 5;
	var rallyMapRotateSpeed = 5000;
	var rallyMapRotateTimer = 0;
	var rallyMapDivID = "RallyMap";

	var rally_icon = new GIcon();
	rally_icon.image = "http://www.weaselsspfld.com/images/rally_mark.png";
	rally_icon.iconSize = new GSize(30, 23);
	rally_icon.iconAnchor = new GPoint(15, 12);
	rally_icon.infoWindowAnchor = new GPoint(20, 6);
	var rallyGMarkers = new Array();
	var rallies = new Array();
rallies[0]= {title:'Art of the Chopper',description:'SEP. 20-FEB. 8-Art of the Chopper. ClintonPresidential Center, Little Rock. Info: 501-374-4242;www.clintonpresidentialcenter.org',url:'http://www.clintonpresidentialcenter.org',lat:'34.7464809',long:'-92.2895948'};
rallies[1]= {title:'Hot SpringsRally',description:'SEP. 10-13-Hot SpringsRally. Hot Springs. Info: www.thehotspringsrally.com',url:'http://www.thehotspringsrally.com',lat:'34.5037004',long:'-93.0551795'};
rallies[2]= {title:'Golden StateRendezvous',description:'SEP. 18-20-Golden StateRendezvous. ABATE State Run. Frandy Campground, Kernville. Info: 760-384-3254;www.abate.org',url:'http://www.abate.org',lat:'35.7546732',long:'-118.4253627'};
rallies[3]= {title:'th Annual IronStampede',description:'SEP. 19-4th Annual IronStampede. Thundering Herd, Elk Grove HOG. Info: 510 566 2744;www.elkgrovehog.com',url:'http://www.elkgrovehog.com',lat:'38.4087993',long:'-121.3716178'};
rallies[4]= {title:'37th KeyWest Poker Run',description:'SEP. 17-201-37th KeyWest Poker Run. Miami. Info: 305-235-4023; www.petersonskeywestpokerrun.com',url:'http://www.petersonskeywestpokerrun.com',lat:'25.7742658',long:'-80.1936589'};
rallies[5]= {title:'BikerFest',description:'SEP. 9-12-BikerFest.Bill Monroe Campground, Bean Blossom. Info: 812-988-2116; www.ballsbiker.com',url:'http://www.ballsbiker.com',lat:'39.3800926',long:'-86.2645950'};
rallies[6]= {title:'Thunder In TheSand',description:'SEP. 4-7-Thunder In TheSand. Circle of Pride MC, Conesville. Info: 319-726-5322; 563-732-2742;www.circleofpridemc.com',url:'http://www.circleofpridemc.com',lat:'41.3805389',long:'-91.3493423'};
rallies[7]= {title:'26th AnnualSturgis Toy Run',description:'SEP. 4-7-26th AnnualSturgis Toy Run. Sturgis. Info: 269-659-8632; www.sturgistoyrun.com',url:'http://www.sturgistoyrun.com',lat:'41.799217',long:'-85.4191482'};
rallies[8]= {title:'Walnecks SwapMeet',description:'SEP. 13-Walnecks SwapMeet. Calhoun County Fairgrounds, Marshall. Info: 630-985-2097;www.walneckswap.com',url:'http://www.walneckswap.com',lat:'42.2722641',long:'-84.9633148'};
rallies[9]= {title:'Walnecks SwapMeet',description:'SEP. 20-Walnecks SwapMeet. Monroe County Fairgrounds, Monroe. Info: 630-985-2097;www.walneckswap.com',url:'http://www.walneckswap.com',lat:'41.9164343',long:'-83.3977101'};
rallies[10]= {title:'21st AnnualABATE State Rally',description:'SEP. 4-7-21st AnnualABATE State Rally. Meeker County Fairgrounds, Litchfield. Info: 800-224-6570;www.abatemn.org',url:'http://www.abatemn.org',lat:'45.1271847',long:'-94.5280474'};
rallies[11]= {title:'19th AnnualFORR Homecoming Rally',description:'SEP. 4-7-19th AnnualFORR Homecoming Rally. Pulaski County Shrine Club Park, Buckhorn. Info:800-448-3677; www.forr.net',url:'http://www.forr.net',lat:'37.8210601',long:'-92.1868209'};
rallies[12]= {title:'Ride For Kids',description:'SEP. 20-Ride For Kids.St. Louis. Info: 800-253-6530; www.rideforkids.org',url:'http://www.rideforkids.org',lat:'38.6272733',long:'-90.1978889'};
rallies[13]= {title:'M/C SwapMeet',description:'SEP. 27-M/C SwapMeet. Twin Drive In Theater, Independence. Info: 816-228-5811;www.jwswapmeet.com',url:'http://www.jwswapmeet.com',lat:'39.0911161',long:'-94.4155068'};
rallies[14]= {title:'StreetVibrations',description:'SEP. 23-27-StreetVibrations. Reno. Info: 800-200-4557; www.road-shows.com',url:'http://www.road-shows.com',lat:'39.5296329',long:'-119.8138027'};
rallies[15]= {title:'15th AnnualRoar to the Shore Rally',description:'SEP. 10-13-15th AnnualRoar to the Shore Rally. Wildwood. Info: 609-729-8870;www.roartotheshoreonline.com',url:'http://www.roartotheshoreonline.com',lat:'38.9917797',long:'-74.8148894'};
rallies[16]= {title:'3rd AnnualRio Rancho Thunder Rally',description:'SEP. 11-13-3rd AnnualRio Rancho Thunder Rally. Albuquerque. Info: 505-379-3077;www.rioranchothunder.com',url:'http://www.rioranchothunder.com',lat:'35.0844909',long:'-106.6511367'};
rallies[17]= {title:'CherokeeSurvivors Fall Rally',description:'SEP. 11-13-CherokeeSurvivors Fall Rally. Cherokee. Info: 865-977-5858; www.cherokeerally.com',url:'http://www.cherokeerally.com',lat:'35.4711608',long:'-83.3410339'};
rallies[18]= {title:'EasyridersRodeo Tour',description:'SEP. 2-7-EasyridersRodeo Tour. Chillicothe. Info: 800-962-9857; www.easyridersevents.com',url:'http://www.easyridersevents.com',lat:'39.3331197',long:'-82.9824019'};
rallies[19]= {title:'USAMotorcycle Tattoo Classic',description:'SEP. 18-20-USAMotorcycle Tattoo Classic. Stark County Fairgrounds, Canton. Info:330-327-2627; www.usamotorcycle-tattooclassic.com',url:'http://www.usamotorcycle-tattooclassic.com',lat:'40.7989473',long:'-81.378447'};
rallies[20]= {title:'Motorcycle SwapMeet',description:'SEP. 20-Motorcycle SwapMeet. Admiral Twin Drive-In, Tulsa. Info: 816-456-4415; www.jwswapmeet.com',url:'http://www.jwswapmeet.com',lat:'36.1539816',long:'-95.992775'};
rallies[21]= {title:'3rd AnnualFlight 93 Run',description:'SEP. 5-3rd AnnualFlight 93 Run. Curran Fromhold, Prison Complex, Philadelphia. Info:215-708-7928; www.brothersforflight93.com',url:'http://www.brothersforflight93.com',lat:'39.952335',long:'-75.163789'};
rallies[22]= {title:'Rally on theRiver',description:'SEP. 10-13-Rally on theRiver. Splash Magic Campground, Northumberland. Info: 800-243-1056; www.parallyontheriver.com',url:'http://www.parallyontheriver.com',lat:'40.891752',long:'-76.7974654'};
rallies[23]= {title:'Roar in theMountains',description:'SEP. 18-20-Roar in theMountains. Hollidaysburg. Info: 814-215-9022; www.roarinthemountains.com',url:'http://www.roarinthemountains.com',lat:'40.4272949',long:'-78.3889024'};
rallies[24]= {title:'JunebugBoogie Fall Rally',description:'SEP. 24-26-JunebugBoogie Fall Rally. Cookeville. Info: 931-498-2250; www.junebugboogie.com',url:'http://www.junebugboogie.com',lat:'36.162839',long:'-85.5016423'};
rallies[25]= {title:'4th AnnualRide To The River',description:'SEP. 25-27-4th AnnualRide To The River. Apache Pass. Info: 512-446-3211, 866-300-6370;www.apachepass.com',url:'http://www.apachepass.com',lat:'32.3252029',long:'-95.2947998'};
rallies[26]= {title:'th Annual InternationalM/C Speed Trials',description:'SEP. TBA-6th Annual InternationalM/C Speed Trials. Bonneville Salt Flats, Wendover. Info:www.speedtrialsbybub.com',url:'http://www.speedtrialsbybub.com',lat:'40.7371524',long:'-114.0375102'};
rallies[27]= {title:'illingtonClassic Touring Rally',description:'SEP. TBA-KillingtonClassic Touring Rally. Killington. Info: www.killingtonclassic.com',url:'http://www.killingtonclassic.com',lat:'43.6552200',long:'-72.7948226'};
rallies[28]= {title:'28th AnnualOyster Run',description:'SEP. 27-28th AnnualOyster Run. Anacortes. Info: 360-671-7575; www.oysterrun.org',url:'http://www.oysterrun.org',lat:'48.5126045',long:'-122.6126718'};
rallies[29]= {title:'Black RiverRumble Scenic Ride',description:'SEP. 24-27-Black RiverRumble Scenic Ride. NCN North Campground, Black River Falls. Info:888-345-2267; www.blackriverrumble.com',url:'http://www.blackriverrumble.com',lat:'44.2946834',long:'-90.8515311'};
rallies[30]= {title:'27th Hub City MC End of Summer Run',description:'SEP.5-6-27th Hub City MC End of Summer Run. Guernsey. Info: 307-836-2004;307-836-9288',url:'http://www.weaselsspfld.com/events/motorcycle_rally_by_state/WYOMING.php',lat:'42.2696908',long:'-104.7416308'};
	function rallyMapInitializeMap() {
		rallyMap = new GMap(document.getElementById( rallyMapDivID ));
		rallyMap.setCenter( rallyMapCenter, rallyMapZoom );
		rallyMap.enableDoubleClickZoom();
		rallyMap.enableContinuousZoom();
		//rallyMap.addControl(new GSmallMapControl());
		rallyMap.addControl(new GLargeMapControl());
		rallyMap.addControl(new GMapTypeControl());
		rallyMap.addControl(new GScaleControl(), new GControlPosition(G_ANCHOR_BOTTOM_LEFT, new GSize(150,10))) ;
		rallyMap.addControl(new GOverviewMapControl(), new GControlPosition(G_ANCHOR_BOTTOM_RIGHT, new GSize(10,10)));
        	rallyMap.addMapType(G_PHYSICAL_MAP);
		// a little extra from wms.js
        	rallyMap.addMapType(us_topo());
        	rallyMap.addMapType(us_nexrad());
	}

	function loadRallyMap() {
		rallyMapInitializeMap();
		for (var i in rallies) {
			rallyMap.addOverlay( createRallyMarker( i ) );
		}

		// start cycling through rally info windows
		// clicking on a icon will stop the cycleing
		changeRallyMarker();
	}

	// Creates a marker at the given point with the given number label
	function createRallyMarker( index ) {
		var rally = rallies[index];
		var marker = new GMarker( new GLatLng(rally.lat, rally.long), rally_icon );
		GEvent.addListener(marker, "mouseover", function() {
			var r = rallies[index];
			var iwHtml = "<div style='width:300px;'>";
			if( r.url.indexOf("http://www.weaselsspfld.com/") < 0 ) {
				iwHtml += "<img src='http://open.thumbshots.org/image.aspx?url="+r.url+"' style='float:left;width:120px;height:90px;margin:2px;'>";
			}
			iwHtml += "<a href='"+r.url+"' style='font-weight:bold;color:black;' target='_blank'>"+r.title+"</a>";
			iwHtml += "<p>"+r.description+"</p>";
			iwHtml += "</div>";
			marker.openInfoWindowHtml(iwHtml);
		});
		GEvent.addListener(marker, "click", function() {
			clearTimeout(rallyMapRotateTimer);
			rallyMapRotateTimer = setTimeout( "changeRallyMarker();", rallyMapRotateSpeed*4 );
		});

		rallies[index].marker = marker;
		return marker;
	}

	function changeRallyMarker() {
		var index = Math.floor(Math.random()*rallies.length)
		if( index == null )
			index = 0;
		var marker = rallies[index].marker;
		GEvent.trigger(marker,"mouseover");
		rallyMapRotateTimer = setTimeout( "changeRallyMarker();", rallyMapRotateSpeed );
	}

	/* disable javascript errors */
	//function noError(){return true;} 
	//window.onerror = noError;
