/*
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:46 -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:'24th AnnualVerde Valley Toy Run',description:'NOV. 23-24th AnnualVerde Valley Toy Run. Walmart, Cottonwood. Info: 928-634-1447; www.vvtr.com',url:'http://www.vvtr.com',lat:'34.7391876',long:'-112.0098791'};
rallies[1]= {title:'25th AnnualVerde Valley Toy Run',description:'NOV. 22-25th AnnualVerde Valley Toy Run. Walmart, Cottonwood. Info: 928-634-1447; www.vvtr.com',url:'http://www.vvtr.com',lat:'34.7391876',long:'-112.0098791'};
rallies[2]= {title:'6th Annual ToyRun',description:'NOV. 15-6th Annual ToyRun. Little Rock. Info: 501-258-0239; www.heavenlyriders.com',url:'http://www.heavenlyriders.com',lat:'34.7464809',long:'-92.2895948'};
rallies[3]= {title:'24th AnnualToy Run',description:'NOV. 22-23-24th AnnualToy Run. H-D, Jonesboro. Info: 870-238-9360',url:'http://www.weaselsspfld.com/events/motorcycle_rally_by_state/ARKANSAS.php',lat:'35.8422967',long:'-90.7042791'};
rallies[4]= {title:'Flame RidersToy Run',description:'NOV. 29-Flame RidersToy Run. Backyard Antiques, Clinton. Info: 501-884-6396',url:'http://www.weaselsspfld.com/events/motorcycle_rally_by_state/ARKANSAS.php',lat:'35.5914666',long:'-92.4604361'};
rallies[5]= {title:'South EastArkansas Toy Run',description:'NOV. 29-South EastArkansas Toy Run. Crossett. Info: 870-364-3008',url:'http://www.weaselsspfld.com/events/motorcycle_rally_by_state/ARKANSAS.php',lat:'33.1281779',long:'-91.9612427'};
rallies[6]= {title:'BoozefightersFood and Toy Drive',description:'NOV. 15-BoozefightersFood and Toy Drive. PJs Roadhouse, Placerville. Info: 530-676-3716;www.boozefighters21.com',url:'http://www.boozefighters21.com',lat:'38.7296252',long:'-120.798546'};
rallies[7]= {title:'Santa Claus ToyRun',description:'NOV. 22-Santa Claus ToyRun. Renegade Classics, Modesto. Info: 800-326-3666; www.renegadeevents.com',url:'http://www.renegadeevents.com',lat:'37.6390972',long:'-120.9968782'};
rallies[8]= {title:'Santa Claus ToyRun',description:'NOV. 22-Santa Claus ToyRun. Renegade Classics, Fresno. Info: 800-326-3666; www.renegadeevents.com',url:'http://www.renegadeevents.com',lat:'36.7477272',long:'-119.7723661'};
rallies[9]= {title:'Santa Claus ToyRun',description:'NOV. 22-Santa Claus ToyRun. Renegade Classics, Sacramento. Info: 800-326-3666; www.renegadeevents.com',url:'http://www.renegadeevents.com',lat:'38.5815719',long:'-121.4943996'};
rallies[10]= {title:'Fall RockyMountain Motorcycle Show and Swap Meet',description:'NOV. 15-16- Fall RockyMountain Motorcycle Show and Swap Meet. The Ranch, Loveland. Info: 970)669-5589; www.hawgwildcc.com.',url:'http://www.hawgwildcc.com.',lat:'40.3977612',long:'-105.0749801'};
rallies[11]= {title:'3rd AnnualBigs Poker Run',description:'NOV. 30-3rd AnnualBigs Poker Run. Everglades Motorcycle, Naples. Info: 239-404-7006;www.lvsbikergroupfl.com',url:'http://www.lvsbikergroupfl.com',lat:'26.1420358',long:'-81.7948103'};
rallies[12]= {title:'6th AnnualHogs On The High Seas Rally-Western Caribbean',description:'NOV. 1-8-6th AnnualHogs On The High Seas Rally-Western Caribbean. Cape Canaveral. Info:800-444-8795; www.hogsonthehighseas.com',url:'http://www.hogsonthehighseas.com',lat:'28.4058366',long:'-80.6047732'};
rallies[13]= {title:'2nd Annual ToysFor Tots',description:'NOV. 15-2nd Annual ToysFor Tots. Augusta. Info: 706-849-6632',url:'http://www.weaselsspfld.com/events/motorcycle_rally_by_state/GEORGIA.php',lat:'33.4709702',long:'-81.9748379'};
rallies[14]= {title:'Giant MotorcycleSwap Meet',description:'NOV. 1-Giant MotorcycleSwap Meet. Rock Financial Showplace, Novi. Info: 800-968-4242;www.motorcycleswap.com',url:'http://www.motorcycleswap.com',lat:'42.48059',long:'-83.4754913'};
rallies[15]= {title:'24th AnnualToys For Tots M/C Run',description:'NOV. 25-24th AnnualToys For Tots M/C Run. Cycle Barn, Waveland. Info: 228-392-1801;www.asgardmc.com',url:'http://www.asgardmc.com',lat:'30.2868632',long:'-89.3761587'};
rallies[16]= {title:'25th AnnualToys For Tots M/C Run',description:'NOV. 29-25th AnnualToys For Tots M/C Run. Cycle Barn, Waveland. Info: 228-392-1801;www.asgardmc.com',url:'http://www.asgardmc.com',lat:'30.2868632',long:'-89.3761587'};
rallies[17]= {title:'Liberty HOG10th Annual Toy Run',description:'NOV. 16-Liberty HOG10th Annual Toy Run. Liberty Harley-Davidson, Rahway. Info: 732-859-8629; www.libertyhog.net',url:'http://www.libertyhog.net',lat:'40.6081591',long:'-74.2776468'};
rallies[18]= {title:'16th Annual RioRancho Toy Run',description:'NOV. 16-16th Annual RioRancho Toy Run. Rio Rancho. Info: 505-604-4326; www.rioranchotoyrun.org',url:'http://www.rioranchotoyrun.org',lat:'35.233375',long:'-106.6644716'};
rallies[19]= {title:'Toys for Tots Motorcycle Ride',description:'NOV.29-Toys for Tots Motorcycle Ride. Heritage Park, Los Lunas. Info: 505-991-4564',url:'http://www.weaselsspfld.com/events/motorcycle_rally_by_state/NEW_MEXICO.php',lat:'34.806166',long:'-106.7333599'};
rallies[20]= {title:'7th AnnualParade and Toy Run',description:'NOV. 15-17th AnnualParade and Toy Run. Maggie Valley. Info: www.blueridgethunder.org',url:'http://www.blueridgethunder.org',lat:'35.5211410',long:'-83.0640716'};
rallies[21]= {title:'ABATE Toy Run',description:'NOV. 22-ABATE Toy Run.Wal Mart, Trexlertown. Info: 570-386-8021; www.lvabate.org',url:'http://www.lvabate.org',lat:'40.5501976',long:'-75.5980682'};
rallies[22]= {title:'Iron Angels',description:'NOV. 14-16-Iron Angels.TVE Fairgrounds, Liberty. Info: 936-334-0558; www.bikerralliesoftexas.com',url:'http://www.bikerralliesoftexas.com',lat:'30.057993',long:'-94.7954784'};
	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;
