
function initTileOverlay()
{
	//Copyright information for custom tile layer
	//Do to smaller size of the print map, the copyright info is shortened
	if (!printMap)
	{
		var copyright = new GCopyright(1,new GLatLngBounds(new GLatLng(40.5,-89),new GLatLng(40.525,-88.98)),15, '<a href="http://www.ilstu.edu/home/diversity/">An equal opportunity/affirmative action university encouraging diversity.</a> &bull; <a href="http://www.ilstu.edu/home/privacy/web_privacy_notice.pdf">Privacy Statement</a> ');
	}
	else
	{
		var copyright = new GCopyright(1,new GLatLngBounds(new GLatLng(40.5,-89),new GLatLng(40.525,-88.98)),15, '<a href="http://www.ilstu.edu/home/diversity/">A university encouraging diversity.</a> &bull; <a href="http://www.ilstu.edu/home/privacy/web_privacy_notice.pdf">Privacy Statement</a> ');
	}
	var copyrightCollection = new GCopyrightCollection('&copy; 2011 &bull; Illinois State University:');
	
	copyrightCollection.addCopyright(copyright);
	
	//The copyrightCollection consists of '15' through '18' zoom levels (copyrightCollection, 15,18)
	//For the function below, 'b'= zoom level, and 'a' = tile parameter

	var gtl = new GTileLayer(copyrightCollection, 15,18, {isPng:true});
		
	//getTileURL retrieves the indexed tile images that will replace the Google map tiles of the zoom level
	  //The measurements of the tiles being relaced is dependant on the center coordinates
		//a.x = x-axis tile measurement for 'b'
		//a.y = y-axis tile measurement for 'b'
	//The replacement tile images are created and named by running a javascript within Adobe Photoshop CS3 or higher
	//which uses the top left tile coordinates and zoom level to carve and name the resulting images
	//in sequence using "a.x" and "a.y" within the image name - 
		//     "  Name_a.x_a.y  " for the top left (beginning) tile of the zoom level and continuing until the last "Name_a.x_a.y" is reached

	//Populate the arrays with the highest and lowest x and y coordinates
	//Start at zoom 15, and do west then east coordinate bounds x
	//For y, do north then south bounds
	var xMain = [ 8282, 8285, 16564, 16570, 33128, 33140, 66256, 66281 ];
	var yMain = [ 12342, 12345, 24685, 24692, 49370, 49383, 98740, 98768 ];

	//If you want to add additional areas outside the main bounds, create additional coordinate arrays
	//If the bounds are the same, list the same number twice
	var xPropControl = [ 8284, 8284, 16568, 16568, 33136, 33136, 66272, 66272 ];
	var yPropControl = [ 12340, 12340, 24680, 24680, 49361, 49361, 98722, 98723 ];

	gtl.getTileUrl=function(a,b)
	{
		if (b>=15 && b<=18)
		{
			var s = (b-15)*2;
			
			//Include an if statement for each created array
			if (a.x>=xMain[s] && a.x<=xMain[s+1] && a.y>=yMain[s] && a.y<=yMain[s+1]) 
			{
				return splitTileServer(b, a.x, a.y, xMain[s]);
			}
			else if (a.x>=xPropControl[s] && a.x<=xPropControl[s+1] && a.y>=yPropControl[s] && a.y<=yPropControl[s+1]) 
			{
				return splitTileServer(b, a.x, a.y, xPropControl[s]);
				//return "/images/TileOverlays/WebMap_Tiles/Zoom" + b + "/" + b + "_"+a.x+"_"+a.y+".png"	
			}
			else 
			{
				return "http://google.com/mapfiles/transparent.gif";
			}
		}
	}

	customMap = new GMapType([G_NORMAL_MAP.getTileLayers()[0], gtl],
								   G_NORMAL_MAP.getProjection(),'Campus',{errorMessage:"Out of bounds"});

	map.addMapType(customMap);
}

//Spreads the loading of Campus Map tiles across 4 domains
function splitTileServer(zoom, xCord, yCord, leftMostCord)
{
	var base="Zoom" + zoom + "/" + zoom + "_"+xCord+"_"+yCord+".png";

	var num = xCord - leftMostCord;
	num -= Math.floor(num/4) * 4;
	return mapImagesUrl[num] + base;
}
