/**
  * This javascript file contains methods that cause bugs in the JS compression
  *
  */

  
/**
  * Create and ADD the custom map
  *
  * @return null
  */ 
function addcustomMapWhite(){
	if(!initCustomMap){return;}

	var copyrightCollection = new GCopyrightCollection('White edition');
	copyrightCollection.addCopyright(new GCopyright(1, new GLatLngBounds(new GLatLng(-90, -180),new GLatLng(90, 180) ),	0, " by SMARTposition"));	
		
	var tilelayers = [new GTileLayer(copyrightCollection,1,17)];
	
	tilelayers[0].getTileUrl = function(a,b) {	
		return "http://www.liveposition.nl/tracking/gfx/tiles/white_tile.gif";
	};
	
	var customMap = new GMapType(tilelayers, new GMercatorProjection(19), 'White',{errorMessage:"No customized map available"});
	
	// add the custom map to map
	map.addMapType(customMap);
}//end addcustomMap function

/**
  * Create and ADD the custom map
  *
  * @param, mapName
  * @param, mapCopyright
  * @param, tileUrl
  */ 
function addCustomMap(mapName,mapCopyright,tileUrl){
	// Create a copyright entry 
	var copyright = new GCopyright(12, new GLatLngBounds(new GLatLng(-90, -180),new GLatLng(90, 180) ),	15, mapName);

	// Create a copyright collection
	// and add the copyright to it
	var copyrightCollection = new GCopyrightCollection(mapCopyright);
	copyrightCollection.addCopyright(copyright);	

	// Create the GTileLayer
	// and apply the CustomGetTileUrl to it
	var tilelayers = [new GTileLayer(copyrightCollection,13,15)];
	tilelayers[0].getTileUrl = function(a,b) {
		b=17-b;
		return tileUrl + a.x+"_"+a.y+"_"+b+".gif";
	};
	customMap = new GMapType(tilelayers, new GMercatorProjection(19), mapCopyright,{errorMessage:_mMapError});
	
	// add the custom map to map
	map.addMapType(customMap);
}//end function addcustomMap()

/**
  * add custom map with different opacity
  *
  *
  */
function addcustomMapOpacity(){
	if(!initCustomMap) return;

	// Create tile layers
    var tileCountry= new GTileLayer(new GCopyrightCollection(""),1,12);
	
	tileCountry.myFormat='image/gif';	    
  
    tileCountry.myOpacity=0.49;
    tileCountry.getOpacity=function customOpacity() {
	   return this.myOpacity;
	};  

	tileCountry.getTileUrl= function(a,b) {	
		return "http://www.liveposition.nl/tracking/tiles/white_tile.gif";
	}

 	var layer3=[G_SATELLITE_MAP.getTileLayers()[0],tileCountry];    
 	var layer2=[G_NORMAL_MAP.getTileLayers()[0],tileCountry];  	
 	
  	var custommap3 = new GMapType(layer3, G_SATELLITE_MAP.getProjection(), "Sat-White", G_SATELLITE_MAP); 
  	var custommap2 = new GMapType(layer2, G_NORMAL_MAP.getProjection(), "Map-White", G_NORMAL_MAP);       
	
	map.addMapType(custommap3);
	map.addMapType(custommap2);
    	
}//end addcustomMapOpacity function
