/*
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, 05 Sep 2010 03:20:06 -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:'Easyriders/VTwin Bike Show Tour',description:'JAN. 10-11-Easyriders/VTwin Bike Show Tour.LA Fairplex, Pomona. Info: 800-962-9857; www.easyridersevents.com',url:'http://www.easyridersevents.com',lat:'34.0552886',long:'-117.7522793'};
rallies[1]= {title:'Rod Customand Motorcycle Show',description:'JAN. 20-22-Rod Customand Motorcycle Show. Cow Palace, San Francisco. Info: 209-744-8090;www.sfcustomshow.com',url:'http://www.sfcustomshow.com',lat:'37.7749295',long:'-122.4194155'};
rallies[2]= {title:'31st Annual Motorcycle Show and  Swap',description:'JAN. 31-FEB. 1-31st Annual Motorcycle Show and  Swap. National Western Complex, Denver. Info:www.comotorcycleshowandswap.com',url:'http://www.comotorcycleshowandswap.com',lat:'39.7391536',long:'-104.9847034'};
rallies[3]= {title:'10th AnnualNortheast Motorcycle Expo',description:'JAN. 3-4-10th AnnualNortheast Motorcycle Expo. Connecticut Expo Center, Hartford. Info: www.kevmarv.com',url:'http://www.kevmarv.com',lat:'41.7637111',long:'-72.6850932'};
rallies[4]= {title:'Wicked Wheels Weekend Bike  and Car Show',description:'JAN. 10-11-Wicked Wheels Weekend Bike  and Car Show. Timber Creek Inn  and  Suites, Sandwich. Info:www.wickedwheelsweekend.com',url:'http://www.wickedwheelsweekend.com',lat:'41.6458634',long:'-88.6217432'};
rallies[5]= {title:'Motorcycle Swap Meet  and  Parts Expo',description:'JAN. 31-FEB.1-Motorcycle Swap Meet  and  Parts Expo. McCormick Place, Chicago. Info:www.paragonspromotion.com',url:'http://www.paragonspromotion.com',lat:'41.850033',long:'-87.6500523'};
rallies[6]= {title:'28th Annual Hangover Rally',description:'JAN. 1-28th Annual Hangover Rally. Mid-WestMC Clubhouse, Indianapolis. Info: www.midwestmc.com',url:'http://www.midwestmc.com',lat:'39.7683765',long:'-86.1580423'};
rallies[7]= {title:'Easyriders Bike Show',description:'JAN. 31-Easyriders Bike Show. InternationalConvention Center, Louisville. Info: 800-962-9857; www.easyridersevents.com',url:'http://www.easyridersevents.com',lat:'38.2542376',long:'-85.'};
rallies[8]= {title:'9th Annual Northeast MotorcycleExpo',description:'JAN. 10-11-9th Annual Northeast MotorcycleExpo. Shiners Auditorium, Wilmington. Info: 978-688-8888; www.kevmarv.com',url:'http://www.kevmarv.com',lat:'42.5464828',long:'-71.1736669'};
rallies[9]= {title:'SpringfieldMotorcycle Show',description:'JAN. 16-18-SpringfieldMotorcycle Show. Eastern States Expo, W. Springfield. Info: 413-467-2171;www.osegshows.com',url:'http://www.osegshows.com',lat:'42.1014831',long:'-72.589811'};
rallies[10]= {title:'International Motorcycle Show',description:'JAN. 2-4-International Motorcycle Show.Michigan Rock Financial Showplace, Novi. Info: 800-331-5706;www.motorcycleshows.com',url:'http://www.motorcycleshows.com',lat:'42.48059',long:'-83.4754913'};
rallies[11]= {title:'Wide Open Bike Show',description:'JAN. 10-11-Wide Open Bike Show. MetropolitanCommunity College, Kansas City. Info: www.wideopencycle.com',url:'http://www.wideopencycle.com',lat:'39.0997266',long:'-94.5785667'};
rallies[12]= {title:'12th Annual Northeast MotorcycleExpo',description:'JAN. 24-25-12th Annual Northeast MotorcycleExpo. Rockingham Park, Salem. Info: 978-688-8888; www.kevmarv.com',url:'http://www.kevmarv.com',lat:'42.7884226',long:'-71.2008933'};
rallies[13]= {title:'Motorcycle Spectacular',description:'JAN. 10-11-Motorcycle Spectacular. GardenState Exhibit Center, Somerset. Info: 386-252-3101; www.cycleprousa.com',url:'http://www.cycleprousa.com',lat:'40.4976041',long:'-74.4884868'};
rallies[14]= {title:'Walnecks Swap Meet',description:'JAN. 6-Walnecks Swap Meet. Clark CountyFairgrounds, Springfield. Info: 630-985-2097; www.walneckswap.com',url:'http://www.walneckswap.com',lat:'39.9242266',long:'-83.8088172'};
rallies[15]= {title:'PhiladelphiaMotorcycle Expo',description:'JAN. 24-25-PhiladelphiaMotorcycle Expo. Valley Forge Convention Center, King of Prussia. Info:973-663-6377; www.fastlanebikershows.com',url:'http://www.fastlanebikershows.com',lat:'40.0892746',long:'-75.3960211'};
	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;
