// ccbounds.js
//	Javascript to handle PPLite Congestion Charging Boundary
//
//	Initial version, TD, 14-Fen-2007
//

ccMinX = 0;
ccMaxX = 0;
ccMinY = 0;
ccMaxY = 0;
ccMpp = 0; 
ccCycle = 0;

function ccLoad ( minx, maxx, miny, maxy, mpp, tns_ccz_lez, maptype ) {
	
	var url = "layer_image.php";
	url += "?minx=" + minx + "&maxx=" + maxx + "&miny=" + miny + "&maxy=" + maxy ;
	url += "&mpp=" + metresPerPixel + "&imgwid=600&imghgt=400";
	url += "&maptype=" + maptype;	// Add maptype to know which CC Zone to draw.


	if ( 0 == tns_ccz_lez )	{
		// Traffic News
		var elem = document.getElementById ( "ccDiv" );
		if ( !elem ) return;
		
		// HW: Added filter:alpha for IE6 SP2 browsers.
		// Note opacity is also in display.php::displayCreateCCDiv.
		elem.innerHTML = "<img id=\"ccImage\" style=\"filter:alpha(opacity=10);\" border=\"0px\" width=\"600px\" height=\"400px\" src=\"" + url + "\" />";
		
	} else if ( 1 == tns_ccz_lez ) {
		// Congestion Charging
		url += "&cc";
		
		var elem = document.getElementById ( "ccDiv" );
		if ( !elem ) return;
			
		// HW: Added filter:alpha for IE6 SP2 browsers.
		// Note opacity is also in display.php::displayCreateCCDiv.
		elem.innerHTML = "<img id=\"ccImage\" style=\"filter:alpha(opacity=50);\" border=\"0px\" width=\"600px\" height=\"400px\" src=\"" + url + "\" />";
	
		var elem1 = document.getElementById ( "ccEdgeDiv" );
		if ( !elem1 ) return;
		
		url += "&drawedge";
		
		// HW: Added filter:alpha for IE6 SP2 browsers.
		// Note opacity is also in display.php::displayCreateCCDiv.
		elem1.innerHTML = "<img id=\"ccEdgeImage\" style=\"filter:alpha(opacity=100);\" border=\"0px\" width=\"600px\" height=\"400px\" src=\"" + url + "\" />";
			
	} else { // ( 2 == tns_ccz_lez )
		// Low Emission Zone
		url += "&lez";

		var elem = document.getElementById ( "ccDiv" );
		if ( !elem ) return;
			
		// HW: Added filter:alpha for IE6 SP2 browsers.
		// Note opacity is also in display.php::displayCreateCCDiv.
		elem.innerHTML = "<img id=\"ccImage\" style=\"filter:alpha(opacity=50);\" border=\"0px\" width=\"600px\" height=\"400px\" src=\"" + url + "\" />";
	
		var elem1 = document.getElementById ( "ccEdgeDiv" );
		if ( !elem1 ) return;
		
		url += "&drawedge";
		
		// HW: Added filter:alpha for IE6 SP2 browsers.
		// Note opacity is also in display.php::displayCreateCCDiv.
		elem1.innerHTML = "<img id=\"ccEdgeImage\" style=\"filter:alpha(opacity=100);\" border=\"0px\" width=\"600px\" height=\"400px\" src=\"" + url + "\" />";
			
	}
	
	ccMinX = minx;
	ccMaxX = maxx;
	ccMinY = miny;
	ccMaxY = maxy;
	ccMpp = metresPerPixel; 
}
	
//	Called from the parent with no direct access to extents and mpp...
function ccReload ( tns_ccz_lez, maptype ) {

	ccLoad ( ccMinX, ccMaxX,  ccMinY, ccMaxY, ccMpp, tns_ccz_lez, maptype );

	}
