/*
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, 14 Mar 2010 03:20:12 -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:'State HOGRally',description:'APR. 30-MAY 4-State HOGRally. Tucson. Info: 602-955-2658; www.azstatehogrally.com',url:'http://www.azstatehogrally.com',lat:'32.2217429',long:'-110.926479'};
rallies[1]= {title:'Wild Hog M/CRally  and  Music Festival',description:'APR. 23-26-Wild Hog M/CRally  and  Music Festival. Helena. Info: www.wildhogmusic.org',url:'http://www.wildhogmusic.org',lat:'34.5295471',long:'-90.5917722'};
rallies[2]= {title:'Cal CycleShow and Swap Meet',description:'APR. 5-Nor-Cal CycleShow and Swap Meet. Solano Fairgrounds, Vallejo. Info: 714-557-1846;www.toppingevents.com',url:'http://www.toppingevents.com',lat:'38.1040864',long:'-122.2566367'};
rallies[3]= {title:'Arlen NessBike Show',description:'APR. 19-20-Arlen NessBike Show. San Mateo County Events Center, San Mateo. Info: 866-907-7790;www.arlennessbikeshow.com',url:'http://www.arlennessbikeshow.com',lat:'37.5629917',long:'-122.3255254'};
rallies[4]= {title:'9th AnnualEmerald Coast Bikefest',description:'APR. 24-26-9th AnnualEmerald Coast Bikefest. Emerald Coast Dragway, Holt. Info: 850-537-7223;www.emeraldcoastbikefest.com',url:'http://www.emeraldcoastbikefest.com',lat:'30.7083511',long:'-86.8473815'};
rallies[5]= {title:'12th AnnualLeesburg Bikefest',description:'APR. 24-26-12th AnnualLeesburg Bikefest. Leesburg. Info: 352-365-0053; www.leesburgbikefest.com',url:'http://www.leesburgbikefest.com',lat:'28.810823',long:'-81.8778582'};
rallies[6]= {title:'12thAnnual Thunder Beach Spring Rally',description:'APR. 30-MAY 3-12thAnnual Thunder Beach Spring Rally. Panama City. Info: 850-276-1474;www.thunderbeachproductions.com',url:'http://www.thunderbeachproductions.com',lat:'30.1588129',long:'-85.6602058'};
rallies[7]= {title:'Angel City Spring Rally',description:'APR. 16-19-Angel City Spring Rally. AngelCity, Unadilla. Info: 800-433-7191; www.angelcityrally.com',url:'http://www.angelcityrally.com',lat:'32.2615496',long:'-83.7365656'};
rallies[8]= {title:'Top Gun Ridefor Children',description:'APR. 25-Top Gun Ridefor Children. Hooters, Kennesaw. Info: 770-333-9447; www.topgunrideatlanta.com',url:'http://www.topgunrideatlanta.com',lat:'34.0234337',long:'-84.6154897'};
rallies[9]= {title:'Walnecks SwapMeet',description:'APR. 20-Walnecks SwapMeet. McHenry County Fairgrounds, Woodstock. Info: 630-985-2097;www.walneckswap.com',url:'http://www.walneckswap.com',lat:'42.3147436',long:'-88.4487021'};
rallies[10]= {title:'Motorcycle SwapMeet',description:'APR. 26-Motorcycle SwapMeet. Deltaplex, Grand Rapids. Info: 800-968-4242; www.motorcycleswap.com',url:'http://www.motorcycleswap.com',lat:'42.9633599',long:'-85.6680863'};
rallies[11]= {title:'Walnecks SwapMeet',description:'APR. 26-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[12]= {title:'M/C SwapMeet',description:'APR. 26-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[13]= {title:'26thAnniversary Laughlin River Run',description:'APR. 23-26-26thAnniversary Laughlin River Run. Laughlin. Info: 714-694-2800; 800-357-8223;www.laughlinriverrun.com',url:'http://www.laughlinriverrun.com',lat:'35.1677771',long:'-114.5730208'};
rallies[14]= {title:'Skin and Steel',description:'APR. 19-Skin and Steel.Dome Center, Henrietta. Info: 585-234-0895; www.skinandsteel.com',url:'http://www.skinandsteel.com',lat:'43.0507659',long:'-77.6080703'};
rallies[15]= {title:'CherokeeSurvivors Spring Rally',description:'APR. 24-26-CherokeeSurvivors Spring Rally. Fairgrounds, Cherokee. Info: 800-438-1601;www.cherokeerally.com',url:'http://www.cherokeerally.com',lat:'35.4711608',long:'-83.3410339'};
rallies[16]= {title:'M/C SwapMeet',description:'APR. 13-M/C SwapMeet. State Fair Park, Oklahoma City. Info: 816-456-4415; www.jwswapmeet.com',url:'http://www.jwswapmeet.com',lat:'35.4675602',long:'-97.5164276'};
rallies[17]= {title:'Rendezvouson the Conchos',description:'APR. 16-19-Rendezvouson the Conchos. Fairgrounds, San Angelo. Info: 325-944-2008',url:'http://www.weaselsspfld.com/events/motorcycle_rally_by_state/TEXAS.php',lat:'31.5181198',long:'-100.5157165'};
rallies[18]= {title:'Lone StarRod  and  Kustom Round Up',description:'APR. 17-19-Lone StarRod  and  Kustom Round Up. Travis County Expo Center, Austin. Info:www.lonestarroundup.com',url:'http://www.lonestarroundup.com',lat:'30.267153',long:'-97.7430608'};
rallies[19]= {title:'25th AnnualCrawfish Boil',description:'APR. 18-25th AnnualCrawfish Boil. Moms Biker Bar, Longview. Info: 903-236-9132;www.momsbikerbar.com',url:'http://www.momsbikerbar.com',lat:'32.5007038',long:'-94.7404891'};
rallies[20]= {title:'Hub City MC April FoolsRun',description:'APR. 18-Hub City MC April FoolsRun. 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;
