/*
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:08 -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:'Autorama',description:'FEB. 6-8-Autorama. CalExpo Fairgrounds, Sacramento. Info: 877-236-0632; www.rodshows.com',url:'http://www.rodshows.com',lat:'38.5815719',long:'-121.4943996'};
rallies[1]= {title:'38th AnnualTri-State Swap Meet',description:'FEB. 7-8-38th AnnualTri-State Swap Meet. Nat. Western Stock Show Complex. Denver. Info:www.tristateswapmeet.com',url:'http://www.tristateswapmeet.com',lat:'39.7391536',long:'-104.9847034'};
rallies[2]= {title:'2nd AnnualShovelhead, Panhead, Knucklehead Show',description:'FEB. 22-2nd AnnualShovelhead, Panhead, Knucklehead Show. Caribbean Club, MM 104, Key Largo. Info:305-289-5442; southernmost.abateflorida.com',url:'http://www.weaselsspfld.com/events/motorcycle_rally_by_state/FLORIDA.php',lat:'25.0865151',long:'-80.4472802'};
rallies[3]= {title:'ABATEBikeweek Campground',description:'FEB. 27-MAR. 8-ABATEBikeweek Campground. Volusia County Fairgrounds. Deland. Info: 386-943-9610;www.abateflorida.com',url:'http://www.abateflorida.com',lat:'29.028318',long:'-81.3031179'};
rallies[4]= {title:'BikeWeek',description:'FEB. 27-MAR. 8-BikeWeek. Daytona Beach. Info: 386-255-0981; www.officialbikeweek.com',url:'http://www.officialbikeweek.com',lat:'29.2108147',long:'-81.0228331'};
rallies[5]= {title:'eLand BikeRally',description:'FEB. 28-DeLand BikeRally. DeLand. Info: www.delandbikerally.com',url:'http://www.delandbikerally.com',lat:'29.028318',long:'-81.3031179'};
rallies[6]= {title:'5th AnnualCabin Fever Party',description:'FEB. 21-25th AnnualCabin Fever Party. Galesburg. Info: www.centralilabate.org',url:'http://www.centralilabate.org',lat:'40.9478158',long:'-90.3712395'};
rallies[7]= {title:'7th AnnualNortheast Motorcycle Expo',description:'FEB. 7-8-7th AnnualNortheast Motorcycle Expo. Bayside Expo, Boston. Info: 978-688-8888;www.kevmarv.com',url:'http://www.kevmarv.com',lat:'42.3584308',long:'-71.0597732'};
rallies[8]= {title:'Motorcycle SwapMeet',description:'FEB. 8-Motorcycle SwapMeet. Lenawee County Fairgrounds, Adrian. Info: 517-547-6255',url:'http://www.weaselsspfld.com/events/motorcycle_rally_by_state/MICHIGAN.php',lat:'41.8975471',long:'-84.0371659'};
rallies[9]= {title:'Motorcycle SwapMeet',description:'FEB. 8-Motorcycle SwapMeet. Rock Finacial Showplace, Novi. Info: 800-968-4242; www.motorcycleswap.com',url:'http://www.motorcycleswap.com',lat:'42.48059',long:'-83.4754913'};
rallies[10]= {title:'otorcycle SwapMeet  and  Parts Expo',description:'FEB. 15-Motorcycle SwapMeet  and  Parts Expo. Wing Stadium, Kalamazoo. Info: www.paragonspromotion.com',url:'http://www.paragonspromotion.com',lat:'42.2917069',long:'-85.5872286'};
rallies[11]= {title:'Heart of theLakes Chapter ABATE Pool and Dart Tourny',description:'FEB. 7-Heart of theLakes Chapter ABATE Pool and Dart Tourny. Play Time, Perham. Info: 218-849-5021',url:'http://www.weaselsspfld.com/events/motorcycle_rally_by_state/MINNESOTA.php',lat:'46.5944042',long:'-95.5725415'};
rallies[12]= {title:'onnie SmithBike Show',description:'FEB. 21-Donnie SmithBike Show. Mayo Center, Rochester. Info: www.donniesmithbikeshow.com',url:'http://www.donniesmithbikeshow.com',lat:'44.0216306',long:'-92.4698992'};
rallies[13]= {title:'Wide OpenBike Show',description:'FEB. 14-15-Wide OpenBike Show. Family Arena, St. Charles. Info: www.wideopencycle.com',url:'http://www.wideopencycle.com',lat:'38.78394',long:'-90.4812298'};
rallies[14]= {title:'Easyriders/VTwin Bike Show Tour',description:'FEB.13-15-Easyriders/VTwin Bike Show Tour. Veterans Memorial, Columbus. Info:800-962-9857; www.easyridersevents.com',url:'http://www.easyridersevents.com',lat:'39.9611755',long:'-82.9987942'};
rallies[15]= {title:'12th AnnualMotorcycle Show',description:'FEB. 21-22-12th AnnualMotorcycle Show. State Fair Park, Oklahoma City. Info: 816-456-4415;www.jwswapmeet.com',url:'http://www.jwswapmeet.com',lat:'35.4675602',long:'-97.5164276'};
rallies[16]= {title:'Mid-Atlantic MC Spectacular',description:'FEB. 3-4-Mid-Atlantic MC Spectacular. DullesExpo Center, Chantilly. Info: 386-252-3101; www.cycleprousa.com',url:'http://www.cycleprousa.com',lat:'38.8942786',long:'-77.4310992'};
rallies[17]= {title:'Seattle Roadster Show',description:'FEB. 27-MAR. 1-Seattle Roadster Show. QwestField Event Center, Seattle. Info: 877-236-0632; www.rodshows.com',url:'http://www.rodshows.com',lat:'47.6062095',long:'-122.3320708'};
rallies[18]= {title:'BATE LobbyDay',description:'FEB. 26-ABATE LobbyDay. State Capitol, Madison. Info: www.abatewis.org',url:'http://www.abatewis.org',lat:'43.0730517',long:'-89.4012302'};
	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;
