/*
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:22 -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:'FourCorners Rallies',description:'AUG. 31-SEP. 7-FourCorners Rallies. Southwestern Colorado. Info: www.fourcornersbikerrally.com;www.fourcornersmotorcyclerally.com',url:'http://www.fourcornersbikerrally.com;www.fourcornersmotorcyclerally.com',lat:'37.3470001',long:'-108.7363205'};
rallies[1]= {title:'Walnecks SwapMeet',description:'AUG. 16-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[2]= {title:'2nd AnnualAcross the Border Raid',description:'AUG. 14-16-2nd AnnualAcross the Border Raid. Taylor County Fairgrounds, Bedford. Info: 712-523-2666;www.acrosstheborderraid.com',url:'http://www.acrosstheborderraid.com',lat:'40.6669321',long:'-94.721358'};
rallies[3]= {title:'Hawgstock MotorcycleRally',description:'AUG. 20-23-Hawgstock MotorcycleRally. Winterset. Info: 515-203-6457; www.hawgstock.com',url:'http://www.hawgstock.com',lat:'41.3308237',long:'-94.0138393'};
rallies[4]= {title:'rd AnnualBrians Ride',description:'AUG. 2-3rd AnnualBrians Ride. The Jockey Club, Raynham. Info: www.BriansRideFriends.org',url:'http://www.BriansRideFriends.org',lat:'41.9487118',long:'-71.0731008'};
rallies[5]= {title:'EasyridersRodeo Tour',description:'AUG. 14-16-EasyridersRodeo Tour. Fowlerville. Info: 800-962-9857; www.easyridersevents.com',url:'http://www.easyridersevents.com',lat:'42.6605894',long:'-84.0730142'};
rallies[6]= {title:'M/C SwapMeet',description:'AUG. 23-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[7]= {title:'Thunder atthe Hartland',description:'AUG. 14-16-Thunder atthe Hartland. Gasport. Info: 800-571-4829; www.niagararvresort.com',url:'http://www.niagararvresort.com',lat:'43.1992244',long:'-78.5761394'};
rallies[8]= {title:'6th AnnualRally on the River, Irontown',description:'AUG. 13-16-6th AnnualRally on the River, Irontown. Info: www.rallyontheriver.com',url:'http://www.rallyontheriver.com',lat:'38.5367471',long:'-82.6829406'};
rallies[9]= {title:'Logan CountyRally at the Peak',description:'AUG. 13-16-Logan CountyRally at the Peak. Bellefontaine. Info: www.logancountyohio.com/rally',url:'http://www.logancountyohio.com/rally',lat:'40.3611643',long:'-83.7596557'};
rallies[10]= {title:'WalnecksMotorcycle Swap Meet  and  Shows',description:'AUG. 23-WalnecksMotorcycle Swap Meet  and  Shows. Clark Co. Fairgrounds, Springfield. Info:630-985-2097; www.walneckswap.com',url:'http://www.walneckswap.com',lat:'39.9242266',long:'-83.8088172'};
rallies[11]= {title:'M/C SwapMeet',description:'AUG. 17-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[12]= {title:'Americas9-11 Ride',description:'AUG. 20-22-Americas9-11 Ride. Highland H-D, Somerset. Info: 877-771-0118; www.americas911ride.org',url:'http://www.americas911ride.org',lat:'40.008411',long:'-79.0780831'};
rallies[13]= {title:'Rally on theRiver',description:'AUG. 27-30-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[14]= {title:'69th AnnualSturgis Motorcycle Rally',description:'AUG. 3-9-69th AnnualSturgis Motorcycle Rally. Sturgis. Info: www.sturgismotorcyclerally.com;www.sturgisrallynews.com; www.jackpine-gypsies.com',url:'http://www.sturgismotorcyclerally.com;www.sturgisrallynews.com;',lat:'44.4097069',long:'-103.5090786'};
rallies[15]= {title:'Biker,Easyriders and V-Twin First Annual, Old-School, Ride-In Chopper Show',description:'AUG. 5-Biker,Easyriders and V-Twin First Annual, Old-School, Ride-In Chopper Show. BrokenSpoke Saloon, Sturgis. Info: 800-962-9857',url:'http://www.weaselsspfld.com/events/motorcycle_rally_by_state/SOUTH_DAKOTA.php',lat:'44.4097069',long:'-103.5090786'};
rallies[16]= {title:'Ride For Kids',description:'AUG. 22-Ride For Kids. Salt Lake City. Info:800-253-6530; www.rideforkids.org',url:'http://www.rideforkids.org',lat:'40.7607794',long:'-111.8910474'};
rallies[17]= {title:'17th AnnualBack To The Basics Party',description:'AUG. 7-9-17th AnnualBack To The Basics Party. Concord. Info: 802-695-3329;www.back-to-the-basics.com',url:'http://www.back-to-the-basics.com',lat:'44.4512100',long:'-71.8488082'};
rallies[18]= {title:'RainforestRun',description:'AUG. 14-16-RainforestRun. Forks. Info: www.rainforestrun.com',url:'http://www.rainforestrun.com',lat:'47.950355',long:'-124.3854867'};
rallies[19]= {title:'After SturgisGathering',description:'AUG. 6-9-After SturgisGathering. 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[20]= {title:'Ride the Rock/HamNJam',description:'AUG. 5-Ride the Rock/HamNJam. RodeoBar, Hulett. Info: 307-467-5959; www.hulettrally.com',url:'http://www.hulettrally.com',lat:'44.8299598',long:'-104.7560424'};
	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;
