



	function initialize(intialY,intialX,initalZ)
	{
		if (GBrowserIsCompatible())
		{

			var previousLat = querySt("lat");
			var previousLon = querySt("lon");
			var previousZoom = querySt("zoom");
			var previousTraffic = querySt("traffic");
			var previousIncidents = querySt("incidents");
			var previousCameras = querySt("cameras");
			var previousCms = querySt("cms");
			var previousTT = querySt("tt");

			//alert(previousLat + "," + previousLon + "," + previousZoom);

			if(previousLat == undefined || previousLon == undefined || previousZoom == undefined)
			{

			}
			else
			{
				intialY = previousLat;
				intialX = previousLon;
				if		(previousZoom == "8") initalZ = 8;
				else if	(previousZoom == "9") initalZ = 9;
				else if	(previousZoom == "10") initalZ = 10;
				else if	(previousZoom == "11") initalZ = 11;
				else if	(previousZoom == "12") initalZ = 12;
				else if	(previousZoom == "13") initalZ = 13;
				else if	(previousZoom == "14") initalZ = 14;
				else if	(previousZoom == "15") initalZ = 15;
				else initalZ = 8;

			}

			map.setCenter(new GLatLng(intialY, intialX), initalZ);

			if(previousTraffic == undefined || previousIncidents == undefined || previousCameras == undefined  || previousCms == undefined || previousTT == undefined )
			{
			
			}
			else
			{
				if(previousTraffic == "false")
					document.legendForm.checkbox_traffic.checked = false;
					
					
				if(previousIncidents == "false")
					document.legendForm.checkbox_incidents.checked = false;

				if(previousCameras == "false")
					document.legendForm.checkbox_cameras.checked = false;

				if(previousCms == "false")
					document.legendForm.checkbox_cms.checked = false;

				if(previousTT == "true")
				{
					document.legendForm.checkbox_tt.checked = true;		
				}
			}

			IncidentsMgr = new MarkerManager(map);
			CMSMgr = new MarkerManager(map);
			CamerasMgr = new MarkerManager(map);

			setWeather();
			
			var CurrZoom = map.getZoom();
			var bounds2 = new GLatLngBounds();
			bounds2 = map.getBounds();

			document.getElementById("loading").style.display  = "block";

			map.clearOverlays();
			//drawGetAwayPolyLine();
			//drawChains();
			
			
			if(document.legendForm.checkbox_cameras.checked == true)
				drawCameras();

			if(document.legendForm.checkbox_incidents.checked == true)
				drawIncidents();

			if(document.legendForm.checkbox_cms.checked == true)
				drawCMS();
			
			
			
			
			initilizeTrafficImages();
			drawTraffic(CurrZoom, bounds2)
			updateTimestamp();
			

			document.getElementById("loading").style.display  = "none";
			
			        		
			if (!document.legendForm.checkbox_traffic.checked)
			{
				removeTraffic(map.getZoom(), map.getZoom());
			}

		        		
			if (document.legendForm.checkbox_tt.checked)
			{
				drawGetAwayPolyLine();
			}

			GEvent.addListener(map, "zoomend", function(oldLevel, newLevel)
			{
				removeTraffic(oldLevel,newLevel);
			});


			GEvent.addListener(map, "movestart", function()
			{

				document.getElementById("loading").style.display  = "block";

				onMoveStart();

			});

			GEvent.addListener(map, "dragstart", function()
			{
				document.getElementById("loading").style.display  = "block";



			});




			GEvent.addListener(map, "moveend", function()
			{


				var CurrZoom = map.getZoom();
				var bounds2 = new GLatLngBounds();
				bounds2 = map.getBounds();

				panTraffic(CurrZoom, bounds2);
				//refreshGetAwayPolyLine();
				//refreshChains();
				

				if(document.legendForm.checkbox_cameras.checked == true)
					//refreshCameras();
				
				if(document.legendForm.checkbox_incidents.checked == true)
					//refreshIncidents();
					
				if(document.legendForm.checkbox_cms.checked == true)
					//refreshCMS();

				if(document.legendForm.checkbox_tt.checked == true)
				{
					//drawGetAwayPolyLine();
					//removeGetAwayPolyLine();
					refreshGetAwayPolyLine();
				}
				
				if(!document.legendForm.checkbox_incidents.checked &&  !document.legendForm.checkbox_cameras.checked && !document.legendForm.checkbox_cms.checked)
					document.getElementById("loading").style.display  = "none";
					
					
					
					
					
				document.getElementById("loading").style.display  = "none";
				
				setWeather();
				
			});

		}


	}


	function onMoveStart()
	{
				//map.clearOverlays();
				//alert("sadf");
				//removeTraffic(map.getZoom(), map.getZoom());
				//removeGetAwayPolyLine();
				//removeCameras();
				//removeIncidents();
				//removeCMS();
				//removeChains();

	}

	function zoomOutMap()
	{
		map.setZoom(12)
	}


	function zoomInMap()
	{
		map.setZoom(9)
	}


	function refreshMap_old()
	{





		// deallocate everything




		boundz10t1 = null;
		boundz10t2 = null;
		boundz10t3 = null;
		boundz10t4 = null;
		boundz10t5 = null;
		boundz10t6 = null;
		boundz10t7 = null;
		boundz10t8 = null;
		boundz10t9 = null;
		boundz10t10 = null;
		boundz10t11 = null;
		boundz10t12 = null;
		boundz10t13 = null;
		boundz10t14 = null;
		boundz10t15 = null;
		boundz10t16 = null;
		boundz10t17 = null;
		boundz11t18 = null;
		boundz11t19 = null;
		boundz11t20 = null;
		boundz11t21 = null;
		boundz11t22 = null;
		boundz11t23 = null;
		boundz11t24 = null;
		boundz11t25 = null;
		boundz11t26 = null;
		boundz11t27 = null;
		boundz11t28 = null;
		boundz11t29 = null;
		boundz11t30 = null;
		boundz11t31 = null;
		boundz11t32 = null;
		boundz11t33 = null;
		boundz11t34 = null;
		boundz11t35 = null;
		boundz11t36 = null;
		boundz11t37 = null;
		boundz11t38 = null;
		boundz11t39 = null;
		boundz11t40 = null;
		boundz11t41 = null;
		boundz11t42 = null;
		boundz11t43 = null;
		boundz11t44 = null;
		boundz11t45 = null;
		boundz11t46 = null;
		boundz11t47 = null;
		boundz11t48 = null;
		boundz11t49 = null;
		boundz11t50 = null;
		boundz11t51 = null;
		boundz11t52 = null;
		boundz11t53 = null;
		boundz11t54 = null;
		boundz11t55 = null;
		boundz11t56 = null;
		boundz11t57 = null;
		boundz11t58 = null;
		boundz11t59 = null;
		boundz11t60 = null;
		boundz11t61 = null;
		boundz9t62 = null;
		boundz9t63 = null;
		boundz9t64 = null;
		boundz9t65 = null;
		boundz9t66 = null;
		boundz9t67 = null;
		boundz12t68 = null;
		boundz12t69 = null;
		boundz12t70 = null;
		boundz12t71 = null;
		boundz12t72 = null;
		boundz12t73 = null;
		boundz12t74 = null;
		boundz12t75 = null;
		boundz12t76 = null;
		boundz12t77 = null;
		boundz12t78 = null;
		boundz12t79 = null;
		boundz12t80 = null;
		boundz12t81 = null;
		boundz12t82 = null;
		boundz12t83 = null;
		boundz12t84 = null;
		boundz12t85 = null;
		boundz12t86 = null;
		boundz12t87 = null;
		boundz12t88 = null;
		boundz12t89 = null;
		boundz12t90 = null;
		boundz12t91 = null;
		boundz12t92 = null;
		boundz12t93 = null;
		boundz12t94 = null;
		boundz12t95 = null;
		boundz12t96 = null;
		boundz12t97 = null;
		boundz12t98 = null;
		boundz12t99 = null;
		boundz12t10 = null;
		boundz12t10 = null;
		boundz12t10 = null;
		boundz12t10 = null;
		boundz12t10 = null;
		boundz12t10 = null;
		boundz12t10 = null;
		boundz12t10 = null;
		boundz12t10 = null;
		boundz12t10 = null;
		boundz12t11 = null;
		boundz12t11 = null;
		boundz12t11 = null;
		boundz12t11 = null;
		boundz12t11 = null;
		boundz12t11 = null;
		boundz12t11 = null;
		boundz12t11 = null;
		boundz12t11 = null;
		boundz12t11 = null;
		boundz12t12 = null;
		boundz12t12 = null;
		boundz12t12 = null;
		boundz12t12 = null;
		boundz12t12 = null;
		boundz12t12 = null;
		boundz12t12 = null;
		boundz12t12 = null;
		boundz12t12 = null;
		boundz12t12 = null;
		boundz12t13 = null;
		boundz12t13 = null;
		boundz12t13 = null;
		boundz12t13 = null;
		boundz12t13 = null;
		boundz12t13 = null;
		boundz12t13 = null;
		boundz12t13 = null;
		boundz12t13 = null;
		boundz12t13 = null;
		boundz12t14 = null;
		boundz12t14 = null;
		boundz12t14 = null;
		boundz12t14 = null;
		boundz12t14 = null;
		boundz12t14 = null;
		boundz12t14 = null;
		boundz12t14 = null;
		boundz12t14 = null;
		boundz12t14 = null;
		boundz12t15 = null;
		boundz12t15 = null;
		boundz12t15 = null;
		boundz12t15 = null;
		boundz12t15 = null;
		boundz12t15 = null;
		boundz12t15 = null;
		boundz12t15 = null;
		boundz12t15 = null;
		boundz12t15 = null;
		boundz12t16 = null;
		boundz12t16 = null;
		boundz12t16 = null;
		boundz12t16 = null;
		boundz12t16 = null;
		boundz12t16 = null;
		boundz12t16 = null;
		boundz12t16 = null;
		boundz12t16 = null;
		boundz12t16 = null;
		boundz12t17 = null;
		boundz12t17 = null;
		boundz12t17 = null;
		boundz12t17 = null;
		boundz12t17 = null;
		boundz12t17 = null;
		boundz12t17 = null;
		boundz12t17 = null;
		boundz12t17 = null;
		boundz13t18 = null;
		boundz13t18 = null;
		boundz13t18 = null;
		boundz13t18 = null;
		boundz13t18 = null;
		boundz13t19 = null;
		boundz13t19 = null;
		boundz13t19 = null;
		boundz13t19 = null;
		boundz13t19 = null;
		boundz13t20 = null;
		boundz13t20 = null;
		boundz13t21 = null;
		boundz13t21 = null;
		boundz13t21 = null;
		boundz13t21 = null;
		boundz13t22 = null;
		boundz13t22 = null;
		boundz13t22 = null;
		boundz13t22 = null;
		boundz13t22 = null;
		boundz13t22 = null;
		boundz13t23 = null;
		boundz13t23 = null;
		boundz13t23 = null;
		boundz13t23 = null;
		boundz13t23 = null;
		boundz13t24 = null;
		boundz13t24 = null;
		boundz13t24 = null;
		boundz13t24 = null;
		boundz13t24 = null;
		boundz13t25 = null;
		boundz13t25 = null;
		boundz13t26 = null;
		boundz13t26 = null;
		boundz13t26 = null;
		boundz13t27 = null;
		boundz13t27 = null;
		boundz13t27 = null;
		boundz13t28 = null;
		boundz13t28 = null;
		boundz13t28 = null;
		boundz13t28 = null;
		boundz13t29 = null;
		boundz13t29 = null;
		boundz13t30 = null;
		boundz13t30 = null;
		boundz13t30 = null;
		boundz13t31 = null;
		boundz13t31 = null;
		boundz13t31 = null;
		boundz13t31 = null;
		boundz13t31 = null;
		boundz13t32 = null;
		boundz13t32 = null;
		boundz13t32 = null;
		boundz13t32 = null;
		boundz13t32 = null;
		boundz13t33 = null;
		boundz13t33 = null;
		boundz13t34 = null;
		boundz13t34 = null;
		boundz13t34 = null;
		boundz13t35 = null;
		boundz13t35 = null;
		boundz13t35 = null;
		boundz13t36 = null;
		boundz13t36 = null;
		boundz13t36 = null;
		boundz13t37 = null;
		boundz13t37 = null;
		boundz13t37 = null;
		boundz13t38 = null;
		boundz13t38 = null;
		boundz13t38 = null;
		boundz13t38 = null;
		boundz13t39 = null;
		boundz13t39 = null;
		boundz13t39 = null;
		boundz13t40 = null;
		boundz13t40 = null;
		boundz13t40 = null;
		boundz13t40 = null;
		boundz13t42 = null;
		boundz13t17 = null;
		boundz13t18 = null;
		boundz13t18 = null;
		boundz13t18 = null;
		boundz13t18 = null;
		boundz13t18 = null;
		boundz13t19 = null;
		boundz13t19 = null;
		boundz13t19 = null;
		boundz13t19 = null;
		boundz13t19 = null;
		boundz13t20 = null;
		boundz13t20 = null;
		boundz13t20 = null;
		boundz13t20 = null;
		boundz13t20 = null;
		boundz13t20 = null;
		boundz13t20 = null;
		boundz13t20 = null;
		boundz13t21 = null;
		boundz13t21 = null;
		boundz13t21 = null;
		boundz13t21 = null;
		boundz13t21 = null;
		boundz13t21 = null;
		boundz13t22 = null;
		boundz13t22 = null;
		boundz13t22 = null;
		boundz13t22 = null;
		boundz13t23 = null;
		boundz13t23 = null;
		boundz13t23 = null;
		boundz13t23 = null;
		boundz13t23 = null;
		boundz13t24 = null;
		boundz13t24 = null;
		boundz13t24 = null;
		boundz13t24 = null;
		boundz13t24 = null;
		boundz13t25 = null;
		boundz13t25 = null;
		boundz13t25 = null;
		boundz13t25 = null;
		boundz13t25 = null;
		boundz13t25 = null;
		boundz13t25 = null;
		boundz13t25 = null;
		boundz13t26 = null;
		boundz13t26 = null;
		boundz13t26 = null;
		boundz13t26 = null;
		boundz13t26 = null;
		boundz13t26 = null;
		boundz13t26 = null;
		boundz13t27 = null;
		boundz13t27 = null;
		boundz13t27 = null;
		boundz13t27 = null;
		boundz13t27 = null;
		boundz13t27 = null;
		boundz13t27 = null;
		boundz13t28 = null;
		boundz13t28 = null;
		boundz13t28 = null;
		boundz13t28 = null;
		boundz13t28 = null;
		boundz13t28 = null;
		boundz13t29 = null;
		boundz13t29 = null;
		boundz13t29 = null;
		boundz13t29 = null;
		boundz13t29 = null;
		boundz13t29 = null;
		boundz13t29 = null;
		boundz13t29 = null;
		boundz13t30 = null;
		boundz13t30 = null;
		boundz13t30 = null;
		boundz13t30 = null;
		boundz13t30 = null;
		boundz13t30 = null;
		boundz13t30 = null;
		boundz13t31 = null;
		boundz13t31 = null;
		boundz13t31 = null;
		boundz13t31 = null;
		boundz13t31 = null;
		boundz13t32 = null;
		boundz13t32 = null;
		boundz13t32 = null;
		boundz13t32 = null;
		boundz13t32 = null;
		boundz13t33 = null;
		boundz13t33 = null;
		boundz13t33 = null;
		boundz13t33 = null;
		boundz13t33 = null;
		boundz13t33 = null;
		boundz13t33 = null;
		boundz13t33 = null;
		boundz13t34 = null;
		boundz13t34 = null;
		boundz13t34 = null;
		boundz13t34 = null;
		boundz13t34 = null;
		boundz13t34 = null;
		boundz13t34 = null;
		boundz13t35 = null;
		boundz13t35 = null;
		boundz13t35 = null;
		boundz13t35 = null;
		boundz13t35 = null;
		boundz13t35 = null;
		boundz13t35 = null;
		boundz13t36 = null;
		boundz13t36 = null;
		boundz13t36 = null;
		boundz13t36 = null;
		boundz13t36 = null;
		boundz13t36 = null;
		boundz13t36 = null;
		boundz13t37 = null;
		boundz13t37 = null;
		boundz13t37 = null;
		boundz13t37 = null;
		boundz13t37 = null;
		boundz13t37 = null;
		boundz13t37 = null;
		boundz13t38 = null;
		boundz13t38 = null;
		boundz13t38 = null;
		boundz13t38 = null;
		boundz13t38 = null;
		boundz13t38 = null;
		boundz13t39 = null;
		boundz13t39 = null;
		boundz13t39 = null;
		boundz13t39 = null;
		boundz13t39 = null;
		boundz13t39 = null;
		boundz13t39 = null;
		boundz13t40 = null;
		boundz13t40 = null;
		boundz13t40 = null;
		boundz13t40 = null;
		boundz13t40 = null;
		boundz13t40 = null;
		boundz13t41 = null;
		boundz13t41 = null;
		boundz13t41 = null;
		boundz13t41 = null;
		boundz13t41 = null;
		boundz13t41 = null;
		boundz13t41 = null;
		boundz13t41 = null;
		boundz13t41 = null;
		boundz13t41 = null;

		imgz10t1 = null;
		imgz10t2 = null;
		imgz10t3 = null;
		imgz10t4 = null;
		imgz10t5 = null;
		imgz10t6 = null;
		imgz10t7 = null;
		imgz10t8 = null;
		imgz10t9 = null;
		imgz10t10 = null;
		imgz10t11 = null;
		imgz10t12 = null;
		imgz10t13 = null;
		imgz10t14 = null;
		imgz10t15 = null;
		imgz10t16 = null;
		imgz10t17 = null;
		imgz11t18 = null;
		imgz11t19 = null;
		imgz11t20 = null;
		imgz11t21 = null;
		imgz11t22 = null;
		imgz11t23 = null;
		imgz11t24 = null;
		imgz11t25 = null;
		imgz11t26 = null;
		imgz11t27 = null;
		imgz11t28 = null;
		imgz11t29 = null;
		imgz11t30 = null;
		imgz11t31 = null;
		imgz11t32 = null;
		imgz11t33 = null;
		imgz11t34 = null;
		imgz11t35 = null;
		imgz11t36 = null;
		imgz11t37 = null;
		imgz11t38 = null;
		imgz11t39 = null;
		imgz11t40 = null;
		imgz11t41 = null;
		imgz11t42 = null;
		imgz11t43 = null;
		imgz11t44 = null;
		imgz11t45 = null;
		imgz11t46 = null;
		imgz11t47 = null;
		imgz11t48 = null;
		imgz11t49 = null;
		imgz11t50 = null;
		imgz11t51 = null;
		imgz11t52 = null;
		imgz11t53 = null;
		imgz11t54 = null;
		imgz11t55 = null;
		imgz11t56 = null;
		imgz11t57 = null;
		imgz11t58 = null;
		imgz11t59 = null;
		imgz11t60 = null;
		imgz11t61 = null;
		imgz9t62 = null;
		imgz9t63 = null;
		imgz9t64 = null;
		imgz9t65 = null;
		imgz9t66 = null;
		imgz9t67 = null;
		imgz12t68 = null;
		imgz12t69 = null;
		imgz12t70 = null;
		imgz12t71 = null;
		imgz12t72 = null;
		imgz12t73 = null;
		imgz12t74 = null;
		imgz12t75 = null;
		imgz12t76 = null;
		imgz12t77 = null;
		imgz12t78 = null;
		imgz12t79 = null;
		imgz12t80 = null;
		imgz12t81 = null;
		imgz12t82 = null;
		imgz12t83 = null;
		imgz12t84 = null;
		imgz12t85 = null;
		imgz12t86 = null;
		imgz12t87 = null;
		imgz12t88 = null;
		imgz12t89 = null;
		imgz12t90 = null;
		imgz12t91 = null;
		imgz12t92 = null;
		imgz12t93 = null;
		imgz12t94 = null;
		imgz12t95 = null;
		imgz12t96 = null;
		imgz12t97 = null;
		imgz12t98 = null;
		imgz12t99 = null;
		imgz12t100 = null;
		imgz12t101 = null;
		imgz12t102 = null;
		imgz12t103 = null;
		imgz12t104 = null;
		imgz12t105 = null;
		imgz12t106 = null;
		imgz12t107 = null;
		imgz12t108 = null;
		imgz12t109 = null;
		imgz12t110 = null;
		imgz12t111 = null;
		imgz12t112 = null;
		imgz12t113 = null;
		imgz12t114 = null;
		imgz12t115 = null;
		imgz12t116 = null;
		imgz12t117 = null;
		imgz12t118 = null;
		imgz12t119 = null;
		imgz12t120 = null;
		imgz12t121 = null;
		imgz12t122 = null;
		imgz12t123 = null;
		imgz12t124 = null;
		imgz12t125 = null;
		imgz12t126 = null;
		imgz12t127 = null;
		imgz12t128 = null;
		imgz12t129 = null;
		imgz12t130 = null;
		imgz12t131 = null;
		imgz12t132 = null;
		imgz12t133 = null;
		imgz12t134 = null;
		imgz12t135 = null;
		imgz12t136 = null;
		imgz12t137 = null;
		imgz12t138 = null;
		imgz12t139 = null;
		imgz12t140 = null;
		imgz12t141 = null;
		imgz12t142 = null;
		imgz12t143 = null;
		imgz12t144 = null;
		imgz12t145 = null;
		imgz12t146 = null;
		imgz12t147 = null;
		imgz12t148 = null;
		imgz12t149 = null;
		imgz12t150 = null;
		imgz12t151 = null;
		imgz12t152 = null;
		imgz12t153 = null;
		imgz12t154 = null;
		imgz12t155 = null;
		imgz12t156 = null;
		imgz12t157 = null;
		imgz12t158 = null;
		imgz12t159 = null;
		imgz12t160 = null;
		imgz12t161 = null;
		imgz12t162 = null;
		imgz12t163 = null;
		imgz12t164 = null;
		imgz12t165 = null;
		imgz12t166 = null;
		imgz12t167 = null;
		imgz12t168 = null;
		imgz12t169 = null;
		imgz12t170 = null;
		imgz12t171 = null;
		imgz12t172 = null;
		imgz12t173 = null;
		imgz12t174 = null;
		imgz12t175 = null;
		imgz12t176 = null;
		imgz12t177 = null;
		imgz12t178 = null;
		imgz13t182 = null;
		imgz13t186 = null;
		imgz13t187 = null;
		imgz13t188 = null;
		imgz13t189 = null;
		imgz13t191 = null;
		imgz13t194 = null;
		imgz13t196 = null;
		imgz13t197 = null;
		imgz13t199 = null;
		imgz13t201 = null;
		imgz13t207 = null;
		imgz13t211 = null;
		imgz13t215 = null;
		imgz13t218 = null;
		imgz13t219 = null;
		imgz13t220 = null;
		imgz13t221 = null;
		imgz13t223 = null;
		imgz13t225 = null;
		imgz13t227 = null;
		imgz13t229 = null;
		imgz13t230 = null;
		imgz13t231 = null;
		imgz13t232 = null;
		imgz13t234 = null;
		imgz13t235 = null;
		imgz13t242 = null;
		imgz13t243 = null;
		imgz13t245 = null;
		imgz13t248 = null;
		imgz13t249 = null;
		imgz13t254 = null;
		imgz13t258 = null;
		imgz13t264 = null;
		imgz13t265 = null;
		imgz13t268 = null;
		imgz13t274 = null;
		imgz13t275 = null;
		imgz13t278 = null;
		imgz13t282 = null;
		imgz13t284 = null;
		imgz13t285 = null;
		imgz13t286 = null;
		imgz13t293 = null;
		imgz13t295 = null;
		imgz13t300 = null;
		imgz13t301 = null;
		imgz13t304 = null;
		imgz13t312 = null;
		imgz13t314 = null;
		imgz13t315 = null;
		imgz13t317 = null;
		imgz13t318 = null;
		imgz13t321 = null;
		imgz13t322 = null;
		imgz13t324 = null;
		imgz13t325 = null;
		imgz13t326 = null;
		imgz13t331 = null;
		imgz13t333 = null;
		imgz13t342 = null;
		imgz13t346 = null;
		imgz13t349 = null;
		imgz13t354 = null;
		imgz13t356 = null;
		imgz13t358 = null;
		imgz13t365 = null;
		imgz13t366 = null;
		imgz13t367 = null;
		imgz13t370 = null;
		imgz13t372 = null;
		imgz13t379 = null;
		imgz13t380 = null;
		imgz13t381 = null;
		imgz13t382 = null;
		imgz13t383 = null;
		imgz13t391 = null;
		imgz13t392 = null;
		imgz13t398 = null;
		imgz13t403 = null;
		imgz13t405 = null;
		imgz13t406 = null;
		imgz13t409 = null;
		imgz13t420 = null;
		imgz13t179 = null;
		imgz13t180 = null;
		imgz13t181 = null;
		imgz13t183 = null;
		imgz13t184 = null;
		imgz13t185 = null;
		imgz13t190 = null;
		imgz13t192 = null;
		imgz13t193 = null;
		imgz13t195 = null;
		imgz13t198 = null;
		imgz13t200 = null;
		imgz13t202 = null;
		imgz13t203 = null;
		imgz13t204 = null;
		imgz13t205 = null;
		imgz13t206 = null;
		imgz13t208 = null;
		imgz13t209 = null;
		imgz13t210 = null;
		imgz13t212 = null;
		imgz13t213 = null;
		imgz13t214 = null;
		imgz13t216 = null;
		imgz13t217 = null;
		imgz13t222 = null;
		imgz13t224 = null;
		imgz13t226 = null;
		imgz13t228 = null;
		imgz13t233 = null;
		imgz13t236 = null;
		imgz13t237 = null;
		imgz13t238 = null;
		imgz13t239 = null;
		imgz13t240 = null;
		imgz13t241 = null;
		imgz13t244 = null;
		imgz13t246 = null;
		imgz13t247 = null;
		imgz13t250 = null;
		imgz13t251 = null;
		imgz13t252 = null;
		imgz13t253 = null;
		imgz13t255 = null;
		imgz13t256 = null;
		imgz13t257 = null;
		imgz13t259 = null;
		imgz13t260 = null;
		imgz13t261 = null;
		imgz13t262 = null;
		imgz13t263 = null;
		imgz13t266 = null;
		imgz13t267 = null;
		imgz13t269 = null;
		imgz13t270 = null;
		imgz13t271 = null;
		imgz13t272 = null;
		imgz13t273 = null;
		imgz13t276 = null;
		imgz13t277 = null;
		imgz13t279 = null;
		imgz13t280 = null;
		imgz13t281 = null;
		imgz13t283 = null;
		imgz13t287 = null;
		imgz13t288 = null;
		imgz13t289 = null;
		imgz13t290 = null;
		imgz13t291 = null;
		imgz13t292 = null;
		imgz13t294 = null;
		imgz13t296 = null;
		imgz13t297 = null;
		imgz13t298 = null;
		imgz13t299 = null;
		imgz13t302 = null;
		imgz13t303 = null;
		imgz13t305 = null;
		imgz13t306 = null;
		imgz13t307 = null;
		imgz13t308 = null;
		imgz13t309 = null;
		imgz13t310 = null;
		imgz13t311 = null;
		imgz13t313 = null;
		imgz13t316 = null;
		imgz13t319 = null;
		imgz13t320 = null;
		imgz13t323 = null;
		imgz13t327 = null;
		imgz13t328 = null;
		imgz13t329 = null;
		imgz13t330 = null;
		imgz13t332 = null;
		imgz13t334 = null;
		imgz13t335 = null;
		imgz13t336 = null;
		imgz13t337 = null;
		imgz13t338 = null;
		imgz13t339 = null;
		imgz13t340 = null;
		imgz13t341 = null;
		imgz13t343 = null;
		imgz13t344 = null;
		imgz13t345 = null;
		imgz13t347 = null;
		imgz13t348 = null;
		imgz13t350 = null;
		imgz13t351 = null;
		imgz13t352 = null;
		imgz13t353 = null;
		imgz13t355 = null;
		imgz13t357 = null;
		imgz13t359 = null;
		imgz13t360 = null;
		imgz13t361 = null;
		imgz13t362 = null;
		imgz13t363 = null;
		imgz13t364 = null;
		imgz13t368 = null;
		imgz13t369 = null;
		imgz13t371 = null;
		imgz13t373 = null;
		imgz13t374 = null;
		imgz13t375 = null;
		imgz13t376 = null;
		imgz13t377 = null;
		imgz13t378 = null;
		imgz13t384 = null;
		imgz13t385 = null;
		imgz13t386 = null;
		imgz13t387 = null;
		imgz13t388 = null;
		imgz13t389 = null;
		imgz13t390 = null;
		imgz13t393 = null;
		imgz13t394 = null;
		imgz13t395 = null;
		imgz13t396 = null;
		imgz13t397 = null;
		imgz13t399 = null;
		imgz13t400 = null;
		imgz13t401 = null;
		imgz13t402 = null;
		imgz13t404 = null;
		imgz13t407 = null;
		imgz13t408 = null;
		imgz13t410 = null;
		imgz13t411 = null;
		imgz13t412 = null;
		imgz13t413 = null;
		imgz13t414 = null;
		imgz13t415 = null;
		imgz13t416 = null;
		imgz13t417 = null;
		imgz13t418 = null;
		imgz13t419 = null;

		// deallocate everything





		var lat = map.getCenter().lat();
		var lng = map.getCenter().lng();
		var currentZoom = map.getZoom();

		point = null;
		zoom9LonFactor = null;
		zoom9LatFactor = null;
		zoom10LonFactor = null;
		zoom10LatFactor = null;
		zoom11LonFactor = null;
		zoom11LatFactor = null;
		zoom12LonFactor = null;
		zoom12LatFactor = null;
		zoom13LonFactor = null;
		zoom13LatFactor = null;

		imagetype = null;
		map = null;
		testEnvironment = null;
		moveWanted = null;
		filterMarkers = null;
		previousZoom = null;
		mousex = null;
		mousey = null;
		pos = null;
		tooltip = null;
		markerGroups = null;
		
		var trafficCheckbox = document.legendForm.checkbox_traffic.checked;
		var incidentsCheckbox = document.legendForm.checkbox_incidents.checked;
		var camerasCheckbox = document.legendForm.checkbox_cameras.checked;
		var cmsCheckbox = document.legendForm.checkbox_cms.checked;
		var TTCheckbox = document.legendForm.checkbox_tt.checked;

		GUnload();

		//document.location = document.location + "?lat=" + lat + "&lon=" + lng + "&zoom=" + currentZoom;
		var strLocation = document.location;

		var strLocation = (document.location).toString();
		var breakPoint = strLocation.indexOf("?");

		if(breakPoint > -1)
			strLocation = strLocation.substring(0,breakPoint);


		document.location = strLocation + "?lat=" + lat + "&lon=" + lng + "&zoom=" + currentZoom + "&traffic=" + trafficCheckbox  + "&incidents=" + incidentsCheckbox  + "&cameras=" + camerasCheckbox  + "&cms=" + cmsCheckbox + "&tt=" + TTCheckbox;


		updateTimestamp();
		



	}

	function updateTimestamp()
	{
		



		randomNum = Math.floor(Math.random()*10000000);

		if(true)
			var IncdientsUrl = "./data/Timestamp.xml?" + randomNum.toString();
		else
			var IncdientsUrl = "http://map.commuteview.net/data/Timestamp.xml?" + randomNum.toString();

		var request = GXmlHttp.create();
		request.open("GET", IncdientsUrl, true);


	      	request.onreadystatechange = function() {


				if (request.readyState == 4) {
					var xmlDoc = request.responseXML;

					var markers = xmlDoc.documentElement.getElementsByTagName("lastupdated");

					for (var i = 0; i < markers.length; i++) {
						var timestampText = markers[i].getElementsByTagName("lastupdatedtime")[0].childNodes[0].nodeValue;
						//alert(timestampText);
						document.getElementById("timestamp").innerHTML  = timestampText;
					}

				}
	      	}



     		request.send(null);


		
	}
	
	
	function refreshMap()
	{


		document.getElementById("loading").style.display  = "block";


		var lat = map.getCenter().lat();
		var lng = map.getCenter().lng();
		var currentZoom = map.getZoom();
		
		travelTimesDrawn = false;

		var CurrZoom = map.getZoom();
		var bounds2 = new GLatLngBounds();
		bounds2 = map.getBounds();


		map.clearOverlays();




		IncidentsMgr.clearMarkers();
		CamerasMgr.clearMarkers();
		CMSMgr.clearMarkers();




		

		if (document.legendForm.checkbox_incidents.checked)
		{		
			drawIncidents();
		}
		
		if (document.legendForm.checkbox_cms.checked)
		{		
			drawCMS();
		}

		if (document.legendForm.checkbox_cameras.checked)
		{		
			drawCameras();
		}




		
		reInitilizeTrafficImages();
		drawTraffic(CurrZoom, bounds2)
		
		updateTimestamp();




		if (!document.legendForm.checkbox_traffic.checked)
		{
			removeTraffic(map.getZoom(), map.getZoom());
		}


		if (document.legendForm.checkbox_tt.checked)
		{
			drawGetAwayPolyLine();
		}



		document.getElementById("loading").style.display  = "none";




	}







	function trim(str) {
		return str.replace(/^\s+|\s+$/g,"");
	}


	function WaitandTurnOffMoveWanted()
	{
		timer = setTimeout("TurnOffMoveWanted()",2000); // 2 secs
		return false;
	}


	function TurnOffMoveWanted()
	{
		moveWanted = 1;
	}




	function showTooltip(marker)
	{
		tooltip.innerHTML = marker.tooltip;
		var point=map.getCurrentMapType().getProjection().fromLatLngToPixel(map.getBounds().getSouthWest(),map.getZoom());
		var offset=map.getCurrentMapType().getProjection().fromLatLngToPixel(marker.getPoint(),map.getZoom());
		var anchor=marker.getIcon().iconAnchor;
		var width=marker.getIcon().iconSize.width;
		var pos = new GControlPosition(G_ANCHOR_BOTTOM_LEFT, new GSize(offset.x - point.x - anchor.x + width,- offset.y + point.y +anchor.y));
		pos.apply(tooltip);
		tooltip.style.visibility="visible";
		}

		// ===== This function is invoked when the mouse goes over an entry in the side_bar =====
		// It launches the tooltip on the icon
		function mymouseover(i) {
		showTooltip(gmarkers[i])
		}
		// ===== This function is invoked when the mouse leaves an entry in the side_bar =====
		// It hides the tooltip
		function mymouseout() {
		tooltip.style.visibility="hidden";
	}




var intervalId;

intervalId = setInterval("autoRefresh()", 300000);  // 10 minutes



function reCenter(area)
{
	document.getElementById("loading").style.display  = "block";
	
	newY = 33.983056;
	newX = -118.098907;
	newZ = 10;
	
	if(area =="LA")
	{
		newY = 33.983056;
		newX = -118.098907;
		newZ = 10;
	}


	if(area =="OC")
	{
		newY = 33.786334;
		newX = -117.762451;
		newZ = 10;
	}
	
	if(area =="IE")
	{
		newY = 34.021212;
		newX = -117.497156;
		newZ = 10;
	}


	if(area =="VN")
	{
		newY = 34.230803;
		newX = -118.731995;
		newZ = 10;
	}	

	
	if(area =="SD")
	{
		newY = 32.898519;
		newX = -117.101898;
		newZ = 10;
	}


	if(area =="ES")
	{
		newY = 33.915652;
		newX = -118.351593;
		newZ = 12;
	}
	
	

	
	map.setCenter(new GLatLng(newY, newX), newZ);
	document.getElementById("loading").style.display  = "none";
	
	//setWeather();
}


function setWeather()
{
	var lat = map.getCenter().lat();
	var lng = map.getCenter().lng();
	var weatherHtml ="";


	clearWeather();


	//alert(lat + ", " + lng);
	
	if(lat > 33.801365 && lat < 34.356604 && lng < -116.814880 && lng > -117.583923) // riverside
	{
		document.getElementById("left-weather-section-riv").style.display = 'block';
	}
	else if(lat > 33.368920 && lat < 33.821903 && lng < -117.421875 && lng > -118.061829) // orange county
	{
		document.getElementById("left-weather-section-oc").style.display = 'block';
	}
	else if(lat > 32.546196 && lat < 33.639166 && lng < -116.466064 && lng > -117.677307) // sd
	{
		document.getElementById("left-weather-section-sd").style.display = 'block';
	}
	else if(lat > 33.905452 && lat < 34.244427 && lng < -118.484802 && lng > -119.006653) // vn
	{
		document.getElementById("left-weather-section-vn").style.display = 'block';
	}
	else if(lat > 33.824489 && lat < 33.985199 && lng < -118.229370 && lng > -118.494415) // es
	{
		document.getElementById("left-weather-section-es").style.display = 'block';
	}	
	else	// los angeles
	{
		document.getElementById("left-weather-section-la").style.display = 'block';
	}
	
	
	
}

function clearWeather()
{
	document.getElementById("left-weather-section-la").style.display = 'none';
	document.getElementById("left-weather-section-oc").style.display = 'none';
	document.getElementById("left-weather-section-riv").style.display = 'none';
	document.getElementById("left-weather-section-sd").style.display = 'none';
	document.getElementById("left-weather-section-vn").style.display = 'none';
	document.getElementById("left-weather-section-es").style.display = 'none';
}


function autoRefresh()
{
	refreshMap();
}



function querySt(ji) {
	hu = window.location.search.substring(1);
		gy = hu.split("&");
		for (i=0;i<gy.length;i++)
		{
			ft = gy[i].split("=");
			if (ft[0] == ji)
			{
				return ft[1];
			}
		}
}




function toggleLegend() {

	if(legendHidden == 0)
	{
		document.getElementById("legend").src = "./images/legend_minimized.jpg";
		var pos = new GControlPosition(G_ANCHOR_TOP_LEFT, new GSize(480,535));
		pos.apply(document.getElementById("legendDiv"));
		document.getElementById("map-canvas").appendChild(document.getElementById("legendDiv"));
		legendHidden = 1;
	}

	else
	{
		document.getElementById("legend").src = "./images/legend.jpg";
		var pos = new GControlPosition(G_ANCHOR_TOP_LEFT, new GSize(480,377));
		pos.apply(document.getElementById("legendDiv"));
		document.getElementById("map-canvas").appendChild(document.getElementById("legendDiv"));
		legendHidden = 0;
	}

}



function leavingSite(newSiteHREF, newSiteName)
{
   //reloadGIF();
   win = window.open('');
   win.document.writeln("<html><head>");
   win.document.writeln("<title>You Are Now Leaving the El Segundo Area ITS Traffic Web Site</title>");
   win.document.writeln("	<meta http-equiv='Content-Type' content='text/html; charset=iso-8859-1'>");
   win.document.writeln("	<meta name='Posted' contents='02/19/2003'>");
   
    win.document.writeln("	<link rel='stylesheet' type='text/css' href='./css/styles_nobg.css'>");



   win.document.writeln("</head><body bgcolor='#FFFFFF'>");
   win.document.writeln("<hr align='center' width='500'>");
   win.document.writeln("<br clear=all />");
   win.document.writeln("<p align=center><font face='Lucida Grande','Trebuchet MS',Verdana,Tahoma,Arial color='#909090'><b>You Are Now Leaving the<br />El Segundo Area ITS Traffic Information<br />Web Site</b></font></p>");
   win.document.writeln("<br clear=all />");
   win.document.writeln("<hr align='center' width='500'>");
   win.document.writeln("<table width='500' align='center'>");
   win.document.writeln("<tr><td>");
   win.document.writeln("<p align='center'><font face='Lucida Grande','Trebuchet MS',Verdana,Tahoma,Arial color='#909090'><br><B>You are about to access<br /><A href='"+newSiteHREF+"'>"+newSiteName+"</a></B><br><br></font></p>");
   win.document.writeln("</td></tr>");
   win.document.writeln("<tr><td><p align='justify'><font face='Lucida Grande','Trebuchet MS',Verdana,Tahoma,Arial color='#909090' size='1'><strong>Please note:</strong></font>");
   win.document.writeln("<font face='Lucida Grande','Trebuchet MS',Verdana,Tahoma,Arial color='#909090' size='1'>Links to web sites outside of this Traffic Information site are offered for your convenience");
   win.document.writeln(" in accessing related information. Please be aware that when you exit this web site,");
   win.document.writeln(" you are subject to the privacy policy of the new site. ");
   win.document.writeln("&nbsp;The El Segundo Area ITS does not attest to the accuracy of information provided by linked sites,");
   win.document.writeln(" and such information does not necessarily represent the viewpoint of the El Segundo Area ITS. </font></p>");
   win.document.writeln("</td></tr></table>");
   win.document.writeln("<p><div align='center'></div>");
   win.document.writeln("<P></P>");
   win.document.writeln("<br /><p align='center'>");
   win.document.writeln("<A href='"+newSiteHREF+"'>Continue</a>");
   win.document.writeln("&nbsp;&nbsp; <B>OR</B> &nbsp;&nbsp;");
   win.document.writeln("<a href='javascript:window.close()'>Close Window</a>");
   win.document.writeln("</p><br><center><p><b>Thank you for visiting.</b></p></center></td>");
   win.document.writeln("<td width='76'></td></tr></table></font>");
   win.document.writeln("</body></html>");
   win.document.close();
   win.focus();
}



function openCaltransConstructionWindow(fwy)
{
	var uri = "http://www.dot.ca.gov/cgi-bin/roads.cgi?roadnumber=" + fwy;
	popupWin = window.open(uri, 'CaltransConstr', 'status,resizable,scrollbars,width=600,height=600');
}


function OpenHelp()
{
	var properties = 'height=400,width=500,scrollbars=yes,resizable=yes';
	var W = window.open("help.html","",properties);


}
