/*
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, 07 Mar 2010 03:20:16 -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:'Legend of theMotorcycle',description:'MAY 2-Legend of theMotorcycle. Half Moon Bay. Info: 415-673-7980; www.LegendoftheMotorcycle.com',url:'http://www.LegendoftheMotorcycle.com',lat:'37.4635519',long:'-122.4285862'};
rallies[1]= {title:'MotorcycleMadness',description:'MAY 15-17-MotorcycleMadness. Santa Maria Fair Park. Info: 805-686-2007;www.horsepowerpromotions.com',url:'http://www.horsepowerpromotions.com',lat:'34.9530337',long:'-120.4357191'};
rallies[2]= {title:'Fallen BikersMemorial Rally',description:'MAY 22-24-Fallen BikersMemorial Rally. Chafee County Fairgrounds, Salida. Info:www.memorialdayrally.com',url:'http://www.memorialdayrally.com',lat:'38.5347193',long:'-105.9989022'};
rallies[3]= {title:'Big Bikes BigHearts Motorcycle Run',description:'MAY 17-Big Bikes BigHearts Motorcycle Run. Oak Lawn. Info: 708-425-6867; www.parklawn.com',url:'http://www.parklawn.com',lat:'41.7108662',long:'-87.7581081'};
rallies[4]= {title:'29th AnnualRide-in Reunion  and  Campout',description:'MAY 22-29th AnnualRide-in Reunion  and  Campout. Oquawka. Info: www.centralilabate.org',url:'http://www.centralilabate.org',lat:'40.931982',long:'-90.9470863'};
rallies[5]= {title:'21st AnnualValpo-Fest',description:'MAY 24-21st AnnualValpo-Fest. Porter County Expo Center, Valparaiso. Info: 800-800-6034;www.valpo-fest.com; www.paragonspromotion.com',url:'http://www.valpo-fest.com;',lat:'41.4730948',long:'-87.0611412'};
rallies[6]= {title:'17th Annual Hog Wild Rodeo',description:'MAY 15-17-17th Annual Hog Wild Rodeo. Circleof Pride MC, Conesville. Info: 515-299-4636; www.circleofpridemc.com',url:'http://www.circleofpridemc.com',lat:'41.3805389',long:'-91.3493423'};
rallies[7]= {title:'Walnecks SwapMeet',description:'MAY 3-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[8]= {title:'37th Annual Blessingof the Bikes Festival',description:'MAY 16-18-37th Annual Blessingof the Bikes Festival. Municipal Airport, Baldwin. Info: 800-800-6034;www.paragonspromotion.com',url:'http://www.paragonspromotion.com',lat:'43.9011229',long:'-85.8517287'};
rallies[9]= {title:'20th AnnualBikers with a Mission Motorcycle Run',description:'MAY 3-20th AnnualBikers with a Mission Motorcycle Run. Kansas City. Info: 816-914-5119;www.bikerswithamission.org',url:'http://www.bikerswithamission.org',lat:'39.0997266',long:'-94.5785667'};
rallies[10]= {title:'Branson Rock,Ride, Remember Motorcycle Rally',description:'MAY 14-17-Branson Rock,Ride, Remember Motorcycle Rally. Branson. Info: 800-342-6230;www.bransonmotorcyclerally.com',url:'http://www.bransonmotorcyclerally.com',lat:'36.6436731',long:'-93.2185144'};
rallies[11]= {title:'M/C SwapMeet',description:'MAY 17-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[12]= {title:'FORR MidAmerica Freedom Rally',description:'MAY 22-25-FORR MidAmerica Freedom Rally. Buckhorn. Info: www.midamericafreedomrally.com',url:'http://www.midamericafreedomrally.com',lat:'37.8210601',long:'-92.1868209'};
rallies[13]= {title:'Rally at theRiver',description:'MAY 28-31-Rally at theRiver. Salisbury. Info: 704-223-2944; www.rallyattheriver.com',url:'http://www.rallyattheriver.com',lat:'35.6709727',long:'-80.4742261'};
rallies[14]= {title:'Motorcycle SwapMeet',description:'MAY 3-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[15]= {title:'32nd AnnualFossil Campout',description:'MAY 22-26-32nd AnnualFossil Campout. Bear Hollow, Fossil. Info: 877-552-2283; www.fossilcampout.com',url:'http://www.fossilcampout.com',lat:'45.1027183',long:'-120.1318206'};
rallies[16]= {title:'Rally onthe River',description:'MAY 29-JUN. 7-Rally onthe River. Splash Magic Campground, Northumberland. Info: 800-243-1056;www.parallyontheriver.com',url:'http://www.parallyontheriver.com',lat:'40.891752',long:'-76.7974654'};
rallies[17]= {title:'th AnnualMyrtle Beach Bike Week',description:'MAY TBA-9th AnnualMyrtle Beach Bike Week. Myrtle Beach. Info: www.myrtlebeachbikeweek.com',url:'http://www.myrtlebeachbikeweek.com',lat:'33.6890603',long:'-78.8866943'};
rallies[18]= {title:'yrtle BeachSpring Motorcycle Rally',description:'MAY TBA-Myrtle BeachSpring Motorcycle Rally. Myrtle Beach. Info: www.chdda.com',url:'http://www.chdda.com',lat:'33.6890603',long:'-78.8866943'};
rallies[19]= {title:'Deadmans CurveRally',description:'MAY 8-10-Deadmans CurveRally. Pulaski. Info: 931-363-2411, 931-478-0076; www.deadmanscurverally.com',url:'http://www.deadmanscurverally.com',lat:'35.1998023',long:'-87.0308412'};
rallies[20]= {title:'6th AnnualHawg Holler Bike Fest',description:'MAY 14-17-6th AnnualHawg Holler Bike Fest. Atwood. Info: 731-571-0125; www.clayfarminc.com',url:'http://www.clayfarminc.com',lat:'36.0106353',long:'-88.7148437'};
rallies[21]= {title:'3rd AnnualHawgs N Hills Rally',description:'MAY 1-3-3rd AnnualHawgs N Hills Rally. Llano. Info: www.hawgsnhills.com',url:'http://www.hawgsnhills.com',lat:'30.7593452',long:'-98.6750379'};
rallies[22]= {title:'13th AnnualHill Country Run',description:'MAY 1-3-13th AnnualHill Country Run. Luckenbach. Info: 830-997-6982; www.hillcountryrun.com',url:'http://www.hillcountryrun.com',lat:'30.3594608',long:'-98.8490371'};
rallies[23]= {title:'13th AnnualHill Country Run',description:'MAY 1-3-13th AnnualHill Country Run. Luckenbach. Info: 866-TEX-FEST; www.hillcountryrun.com',url:'http://www.hillcountryrun.com',lat:'30.3594608',long:'-98.8490371'};
rallies[24]= {title:'Motorcycle andTattoo Show',description:'MAY 23-Motorcycle andTattoo Show. RGV Show Event Facility, Mercedes. Info: 956-686-3718;www.txbikeshow.com',url:'http://www.txbikeshow.com',lat:'26.1497977',long:'-97.9136112'};
rallies[25]= {title:'3rd Annual BobBuford Memorial Childrens Run',description:'MAY 17-3rd Annual BobBuford Memorial Childrens Run. Guernsey. Info: 307-532-6550, 307-421-2490',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;
