/*
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:20 -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:'Bama BikeFest Summer Rally',description:'JUL. 7-12-Bama BikeFest Summer Rally. Forkland. Info: 334-289-5213; www.bamabikefest.com',url:'http://www.bamabikefest.com',lat:'32.64800',long:'-87.88300'};
rallies[1]= {title:'HollisterMotorcycle Rally',description:'JUL. 10-12-HollisterMotorcycle Rally. Hollister. Info: www.horsepowerpromotions.com',url:'http://www.horsepowerpromotions.com',lat:'36.8524545',long:'-121.4016021'};
rallies[2]= {title:'CalendarBike Show',description:'JUL. 18-19-CalendarBike Show. Queen Mary, Long Beach. Info: 562-435-3511; www.FastDates.com',url:'http://www.FastDates.com',lat:'33.7669623',long:'-118.1892348'};
rallies[3]= {title:'20thAnniversary Top of the Rockies Rally',description:'JUL. 23-26-20thAnniversary Top of the Rockies Rally. Paonia. Info: www.coloradobeemers.com',url:'http://www.coloradobeemers.com',lat:'38.8683204',long:'-107.5920017'};
rallies[4]= {title:'Top Gun Ride ForChildren',description:'JUL. 4-Top Gun Ride ForChildren. Hooters, Kennesaw. Info: 678-325-5900; www.topgunrideatlanta.com',url:'http://www.topgunrideatlanta.com',lat:'34.0234337',long:'-84.6154897'};
rallies[5]= {title:'8th AnnualPOW MIA Awareness Rally and MC Rodeo',description:'JUL. 24-26-8th AnnualPOW MIA Awareness Rally and MC Rodeo. Bannock County Fairgrounds, Pocatello.Info: www.powmiarodeo.org',url:'http://www.powmiarodeo.org',lat:'42.8713032',long:'-112.4455344'};
rallies[6]= {title:'Black MagicCustoms Bike Show',description:'JUL. 5-Black MagicCustoms Bike Show. Timber Inn Creek Best Western, Sandwich. Info: 815-786-1977',url:'http://www.weaselsspfld.com/events/motorcycle_rally_by_state/ILLINOIS.php',lat:'41.6458634',long:'-88.6217432'};
rallies[7]= {title:'4th AnnualNite Flite Poker Run',description:'JUL. 18-24th AnnualNite Flite Poker Run. ABATE. Info: www.centralilabate.org',url:'http://www.centralilabate.org',lat:'40.9269599',long:'-90.3824996'};
rallies[8]= {title:'24th Annual ABATEFreedom Rally',description:'JUL. 2-4-24th Annual ABATEFreedom Rally. Freedom Park, Algonia. Info: 641-858-5001;www.abateiowafreedomrally.com',url:'http://www.abateiowafreedomrally.com',lat:'43.0711097',long:'-94.2295913'};
rallies[9]= {title:'Black BikeWeekend',description:'JUL. 3-5-Black BikeWeekend. Detroit. Info: 313-717-8386; www.vip-platinumelite.com',url:'http://www.vip-platinumelite.com',lat:'42.331427',long:'-83.0457538'};
rallies[10]= {title:'JustRide, Upper Michigan Motorcycle Week',description:'JUL. 25-AUG. 2-JustRide, Upper Michigan Motorcycle Week. Upper Peninsula. Info: www.upcruising.com',url:'http://www.upcruising.com',lat:'46.3733787',long:'-85.7390823'};
rallies[11]= {title:'M/C SwapMeet',description:'JUL. 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[12]= {title:'BeartoothIron Horse Rally',description:'JUL. 17-19-BeartoothIron Horse Rally. Beartooth Harley, Red Lodge. Info: 888-827-2663;406-446-9856; www.beartoothrally.com',url:'http://www.beartoothrally.com',lat:'45.1857782',long:'-109.2468211'};
rallies[13]= {title:'5th AnnualSteel Thunder M/C Charity Run',description:'JUL. 26-5th AnnualSteel Thunder M/C Charity Run. Montvale. Info: 201-930-8952;www.steelthunder.org',url:'http://www.steelthunder.org',lat:'41.0467635',long:'-74.0229173'};
rallies[14]= {title:'20th AnnualAmerican Voyager Association 2009 International Rally',description:'JUL. 14-16-20th AnnualAmerican Voyager Association 2009 International Rally. Santa Fe. Info:www.amervoyassoc.org',url:'http://www.amervoyassoc.org',lat:'35.6869752',long:'-105.937799'};
rallies[15]= {title:'Freedom BikeFest',description:'JUL. 2-5-Freedom BikeFest. Fayetteville. Info: 727-433-2222; www.freedombikefest.com',url:'http://www.freedombikefest.com',lat:'35.0526641',long:'-78.8783585'};
rallies[16]= {title:'23rd AnnualWetzelland',description:'JUL. 24-26-23rd AnnualWetzelland. Van Wert. Info: 419-587-3826; www.wetzelmc.com',url:'http://www.wetzelmc.com',lat:'40.8694927',long:'-84.5841223'};
rallies[17]= {title:'18th AnnualAMA Vintage Motorcycle Days',description:'JUL. 24-26-18th AnnualAMA Vintage Motorcycle Days. Mid-Ohio Sports Car Course, Lexington.Info:www.amadirectlink.com/vmd/2008',url:'http://www.amadirectlink.com/vmd/2008',lat:'40.6786691',long:'-82.5823931'};
rallies[18]= {title:'31st AnnualWing Ding',description:'JUL. 2-5-31st AnnualWing Ding. Tulsa. Info: 800-843-9460; www.wing-ding.org',url:'http://www.wing-ding.org',lat:'36.1539816',long:'-95.992775'};
rallies[19]= {title:'Motorcycle SwapMeet',description:'JUL. 12-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[20]= {title:'GettysburgBike Week',description:'JUL. 9-11-GettysburgBike Week. Gettysburg. Info: 800-374-7540; www.gettysburgbikeweek.com',url:'http://www.gettysburgbikeweek.com',lat:'39.8309293',long:'-77.2310955'};
rallies[21]= {title:'EasyridersRodeo Tour',description:'JUL. 17-19-EasyridersRodeo Tour. Butler County Fairgrounds, Prospect. Info: 800-962-9857;www.easyridersevents.com',url:'http://www.easyridersevents.com',lat:'40.9045084',long:'-80.0464473'};
rallies[22]= {title:'Summer BikeFest',description:'JUL. 17-19-Summer BikeFest. Carlisle. Info: 717-243-7855; www.carsatcarlisle.com',url:'http://www.carsatcarlisle.com',lat:'40.2014771',long:'-77.1888704'};
rallies[23]= {title:'95thAnniversary Bash',description:'JUL. TBA-95thAnniversary Bash. Reading MC Grounds, Oley. Info: 610-987-6422;www.readingmc.com',url:'http://www.readingmc.com',lat:'40.3828620',long:'-75.7896423'};
rallies[24]= {title:'Sturgis Riders Rally',description:'JUL. 3-5-Sturgis Riders Rally. Sturgis. Info:www.sturgisridersrally.com',url:'http://www.sturgisridersrally.com',lat:'44.4097069',long:'-103.5090786'};
rallies[25]= {title:'CusterCruisin',description:'JUL. 30-AUG. 9-CusterCruisin. Custer. Info: 605-673-2244; www.custercruisin.com',url:'http://www.custercruisin.com',lat:'43.7666507',long:'-103.5988057'};
rallies[26]= {title:'DeadmansCurve Rally',description:'JUL. 17-19-DeadmansCurve Rally. Pulaski. Info: 931-363-2411, 931-478-0076;www.deadmanscurverally.com',url:'http://www.deadmanscurverally.com',lat:'35.1998023',long:'-87.0308412'};
rallies[27]= {title:'7th AnnualBear Bones Bash',description:'JUL. 10-12-7th AnnualBear Bones Bash. Hazens Notch Campground, Lowell. Info: 802-744-6612;www.hazensnotchcampground.com',url:'http://www.hazensnotchcampground.com',lat:'44.7916564',long:'-72.4570617'};
	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;
