function getURLParameters(paramName) {
				var sURL = window.document.URL.toString();
				var ans='';
				if (sURL.indexOf("?") > 0) {
					var arrURLParams = window.location.search.substring(1).split("&");
					var arrParamNames = new Array(arrURLParams.length);
					var arrParamValues = new Array(arrURLParams.length);
					var i = 0;
					for (i=0;i<arrURLParams.length;i++) {
						var sParam =  arrURLParams[i].split("=");
						arrParamNames[i] = sParam[0];
						if (sParam[1] != "")
							arrParamValues[i] = unescape(sParam[1]);
						else
							arrParamValues[i] = "";
						if (arrParamNames[i]==paramName)
							ans = arrParamValues[i];
					}
				}
				return ans
			}




function GetURL(x, y, w, s, e, n, width, height){
            //		r = "http://www.esdm.no-ip.com/scripts/mapserv460.exe?map=C:/Inetpub/wwwroot/Mapserverservice/Map/WMSHostingDemo.map";
            	var r = ''+WMSURL+'';
                    //alert(r);
		    r+="&SERVICE=WMS";
		    r+="&SRS=EPSG:4326";
		    r+="&VERSION=1.1.1";
		    r+="&REQUEST=GetFeatureInfo";
		    r+="&X=" + parseInt(x);
		    r+="&Y=" + parseInt(y);
		    r+="&QUERY_LAYERS=CNESpolylines,CNESpolygons,CNESpoints";
		    r+="&LAYERS=CNESpolylines,CNESpolygons,CNESpoints";
		    r+="&INFO_FORMAT=text/html";
		    r+="&BBOX="+w+","+s+","+e+","+n;
		    r+="&WIDTH="+parseInt(width)+"&HEIGHT="+ parseInt(height);
		    r+="&FEATURE_COUNT=10";
		    return r;
	    }

function get_cookie ( cookie_name )
{
  var results = document.cookie.match ( cookie_name + '=(.*?)(;|$)' );

  if ( results )
    return ( unescape ( results[1] ) );
  else
    return null;
}

function delete_cookie ( cookie_name )
{
  //alert (cookie_name);
  var cookie_date = new Date ( );  // current date & time
  cookie_date.setTime ( cookie_date.getTime() - 1 );
  document.cookie = cookie_name += "=; expires=" + cookie_date.toGMTString();
  //alert (cookie_name += "=; expires=" + cookie_date.toGMTString());
}

function set_cookie ( name, value, exp_y, exp_m, exp_d, path, domain, secure )
{
  var cookie_string = name + "=" + escape ( value );

  if ( exp_y )
  {
    var expires = new Date ( exp_y, exp_m, exp_d );
    cookie_string += "; expires=" + expires.toGMTString();
  }

  if ( path )
        cookie_string += "; path=" + escape ( path );

  if ( domain )
        cookie_string += "; domain=" + escape ( domain );
  
  if ( secure )
        cookie_string += "; secure";
  
  document.cookie = cookie_string;
}

// BEGIN SMALLSEARCHMAP
function displaySmallSearchMap()
{
// WMS STUFF FROM wms236.js
var MAGIC_NUMBER=6356752.3142;
var WGS84_SEMI_MAJOR_AXIS = 6378137.0;
var WGS84_ECCENTRICITY = 0.0818191913108718138;

var DEG2RAD=0.0174532922519943;
var PI=3.14159267;

//Default image format, used if none is specified
var FORMAT_DEFAULT="image/png";

//Google Maps Zoom level at which we switch from Mercator to Lat/Long.
var MERC_ZOOM_DEFAULT = 15;
function dd2MercMetersLng(p_lng) {
	return WGS84_SEMI_MAJOR_AXIS * (p_lng*DEG2RAD);
}

function dd2MercMetersLat(p_lat) {
	var lat_rad = p_lat * DEG2RAD;
	return WGS84_SEMI_MAJOR_AXIS * Math.log(Math.tan((lat_rad + PI / 2) / 2) * Math.pow( ((1 - WGS84_ECCENTRICITY * Math.sin(lat_rad)) / (1 + WGS84_ECCENTRICITY * Math.sin(lat_rad))), (WGS84_ECCENTRICITY/2)));
}

CustomGetTileUrl=function(a,b,c) {
	if (this.myMercZoomLevel == undefined) {
    	this.myMercZoomLevel = MERC_ZOOM_DEFAULT;
	}

	if (this.myFormat == undefined) {
    	this.myFormat = FORMAT_DEFAULT;
	}

	if (typeof(window['this.myStyles'])=="undefined") this.myStyles="";
	var lULP = new GPoint(a.x*256,(a.y+1)*256);
	var lLRP = new GPoint((a.x+1)*256,a.y*256);
	var lUL = G_NORMAL_MAP.getProjection().fromPixelToLatLng(lULP,b,c);
	var lLR = G_NORMAL_MAP.getProjection().fromPixelToLatLng(lLRP,b,c);

	// switch between Mercator and DD if merczoomlevel is set
	// NOTE -it is now safe to use Mercator exclusively for all zoom levels (if your WMS supports it)
	// so you can just use the two lines of code below the IF (& delete the ELSE)
	
	if (this.myMercZoomLevel!=0 && map.getZoom() < this.myMercZoomLevel) {
		var lBbox=dd2MercMetersLng(lUL.x)+","+dd2MercMetersLat(lUL.y)+","+dd2MercMetersLng(lLR.x)+","+dd2MercMetersLat(lLR.y);
		//Change for GeoServer - 41001 is mercator and installed by default.
		var lSRS="EPSG:54004";
	} else {
		var lBbox=lUL.x+","+lUL.y+","+lLR.x+","+lLR.y;
		var lSRS="EPSG:4326";
	} 
	var lURL=this.myBaseURL;
	lURL+="&REQUEST=GetMap";
	lURL+="&SERVICE=WMS";
	lURL+="&VERSION=1.1.1";
	lURL+="&LAYERS="+this.myLayers;
	lURL+="&STYLES="+this.myStyles;
	lURL+="&FORMAT="+this.myFormat;
	// these lines removed to allow ESDM CallCropGIF.aspx to return transp overlay
	//lURL+="&BGCOLOR=0xFFFFFF";
	//lURL+="&TRANSPARENT=TRUE";
	lURL+="&SRS="+lSRS;
	lURL+="&BBOX="+lBbox;
	lURL+="&WIDTH=256";
	lURL+="&HEIGHT=256";
	lURL+="&reaspect=false";
	//document.write(lURL + "<br/>")
	//alert(" url is " + lURL);
	return lURL;
}

function customOpacity() { return this.myOpacity; }
// END WMS STUFF

	if (GBrowserIsCompatible())
	{

		var allowedBounds = new GLatLngBounds(new GLatLng(55,-8), new GLatLng(60.0,4));
		var map = new GMap2(document.getElementById(MapDivID));

    // add custom copyright collection
    var copyrightstatement='';

    var copyright = new GCopyright(1, new GLatLngBounds(new GLatLng(-90, -180), new GLatLng(90, 180)), 0, copyrightstatement);
    var copyrightCollection = new GCopyrightCollection('');
    copyrightCollection.addCopyright(copyright);

	var myTileLayer = new GTileLayer(copyrightCollection,1,17);


    //	var myTileLayer = new GTileLayer(new GCopyrightCollection(""),1,17);
    //        myTileLayer.myBaseURL='http://www.esdm.no-ip.com/scripts/mapserv460.exe?map=C:/Inetpub/wwwroot/Mapserverservice/Map/WMSNHEdemo.map&'
        myTileLayer.myBaseURL='http://www.tilecache.no-ip.com/CallCropGIF.aspx?' + WMSURL + '';
	//myTileLayer.myBaseURL=WMSURL;
        myTileLayer.myLayers='CNESpoints';
        // get GIF format - IE6 doesn't support transp PNG
        myTileLayer.myFormat='image/gif';
	myTileLayer.getTileUrl=CustomGetTileUrl;
	myTileLayer.myOpacity=1;
        myTileLayer.getOpacity=customOpacity;
		
        var layer1=[G_NORMAL_MAP.getTileLayers()[0],myTileLayer];
		var custommap1 = new GMapType(layer1, G_NORMAL_MAP.getProjection(), "Blah");
		map.addMapType(custommap1);
		
		map.setCenter(new GLatLng(57.5,-6.8), 6);
		map.addControl(new GSmallMapControl());

		var mt = map.getMapTypes();
		for (var i=0; i<mt.length; i++) {
		    mt[i].getMinimumResolution = function() {return 5;}
        
        map.setMapType(custommap1);

		GEvent.addListener(map, "click", function(marker, point) {
		    map.clearOverlays();

		    if (marker) {
			map.removeOverlay(marker);
			document.forms[0].ctl00_ContentPlaceHolder1_txtOSRef.value = "";
		    }
		    else {
			map.addOverlay(new GMarker(point));
			var ll2 = new LatLng(point.y, point.x);
			var os2 = ll2.toOSRef();
			document.forms[0].ctl00_ContentPlaceHolder1_txtEasting.value = os2.easting.toFixed(0);
			document.forms[0].ctl00_ContentPlaceHolder1_txtNorthing.value = os2.northing.toFixed(0);
			document.forms[0].ctl00_ContentPlaceHolder1_txtOSRef.value = os2.toSixFigureString();
		    }
		});

		GEvent.addListener(map, "move", function() {
		    checkBounds();
		});

		function checkBounds()
		{
		    if (allowedBounds.contains(map.getCenter())) {
			return;
		    }

		    var C = map.getCenter();
		    var X = C.lng();
		    var Y = C.lat();

		    var AmaxX = allowedBounds.getNorthEast().lng();
		    var AmaxY = allowedBounds.getNorthEast().lat();
		    var AminX = allowedBounds.getSouthWest().lng();
		    var AminY = allowedBounds.getSouthWest().lat();

		    if (X < AminX) {X = AminX;}
		    if (X > AmaxX) {X = AmaxX;}
		    if (Y < AminY) {Y = AminY;}
		    if (Y > AmaxY) {Y = AmaxY;}

		    map.setCenter(new GLatLng(Y,X));
		} 
        
<!-- Set cookies defining current view extent -->

		GEvent.addListener(map, 'moveend',function(){
		//alert ('setting cookie');
		set_cookie ( "minLat",map.getBounds().getSouthWest().lat() );
		set_cookie ( "maxLat",map.getBounds().getNorthEast().lat());
		set_cookie ( "minLong",map.getBounds().getSouthWest().lng() );
		set_cookie ( "maxLong",map.getBounds().getNorthEast().lng() );
		});

}
}
}
// END SMALLSEARCHMAP

//BEGIN BIG MAP
function displayBigMap()
{
//alert('here');
    if (GBrowserIsCompatible()) {

      // This function picks up the click and opens the corresponding info window
      //function myclick(i) {
      //  gmarkers[i].openInfoWindowHtml(htmls[i]);
      //}


<!-- WMS SCRIPT STARTS HERE -->

    var MAGIC_NUMBER=6356752.3142;
    var WGS84_SEMI_MAJOR_AXIS = 6378137.0;
    var WGS84_ECCENTRICITY = 0.0818191913108718138;

    var DEG2RAD=0.0174532922519943;
    var PI=3.14159267;

    //Default image format, used if none is specified
    var FORMAT_DEFAULT="image/png";

    //Google Maps Zoom level at which we switch from Mercator to Lat/Long.
    var MERC_ZOOM_DEFAULT = 15;
    function dd2MercMetersLng(p_lng) {
	    return WGS84_SEMI_MAJOR_AXIS * (p_lng*DEG2RAD);
    }

    function dd2MercMetersLat(p_lat) {
	    var lat_rad = p_lat * DEG2RAD;
	    return WGS84_SEMI_MAJOR_AXIS * Math.log(Math.tan((lat_rad + PI / 2) / 2) * Math.pow( ((1 - WGS84_ECCENTRICITY * Math.sin(lat_rad)) / (1 + WGS84_ECCENTRICITY * Math.sin(lat_rad))), (WGS84_ECCENTRICITY/2)));
    }

    CustomGetTileUrl=function(a,b,c) {
	    if (this.myMercZoomLevel == undefined) {
    	    this.myMercZoomLevel = MERC_ZOOM_DEFAULT;
	    }

	    if (this.myFormat == undefined) {
    	    this.myFormat = FORMAT_DEFAULT;
	    }

	    if (typeof(window['this.myStyles'])=="undefined") this.myStyles="";
	    var lULP = new GPoint(a.x*256,(a.y+1)*256);
	    var lLRP = new GPoint((a.x+1)*256,a.y*256);
	    var lUL = G_NORMAL_MAP.getProjection().fromPixelToLatLng(lULP,b,c);
	    var lLR = G_NORMAL_MAP.getProjection().fromPixelToLatLng(lLRP,b,c);

	    // switch between Mercator and DD if merczoomlevel is set
	    // NOTE -it is now safe to use Mercator exclusively for all zoom levels (if your WMS supports it)
	    // so you can just use the two lines of code below the IF (& delete the ELSE)
    	
	    if (this.myMercZoomLevel!=0 && map.getZoom() < this.myMercZoomLevel) {
		    var lBbox=dd2MercMetersLng(lUL.x)+","+dd2MercMetersLat(lUL.y)+","+dd2MercMetersLng(lLR.x)+","+dd2MercMetersLat(lLR.y);
		    //Change for GeoServer - 41001 is mercator and installed by default.
		    var lSRS="EPSG:54004";
	    } else {
		    var lBbox=lUL.x+","+lUL.y+","+lLR.x+","+lLR.y;
		    var lSRS="EPSG:4326";
	    } 
	    var lURL=this.myBaseURL;
	    lURL+="&REQUEST=GetMap";
	    lURL+="&SERVICE=WMS";
	    lURL+="&VERSION=1.1.1";
	    lURL+="&LAYERS="+this.myLayers;
	    lURL+="&STYLES="+this.myStyles;
	    lURL+="&FORMAT="+this.myFormat;
	    // these lines removed to allow ESDM CallCropGIF.aspx to return transp overlay
	    //lURL+="&BGCOLOR=0xFFFFFF";
	    //lURL+="&TRANSPARENT=TRUE";
	    lURL+="&SRS="+lSRS;
	    lURL+="&BBOX="+lBbox;
	    lURL+="&WIDTH=256";
	    lURL+="&HEIGHT=256";
	    lURL+="&reaspect=false";
	    //document.write(lURL + "<br/>")
	    //alert(" url is " + lURL);
	    return lURL;
    }

    function customOpacity() { return this.myOpacity; }
		

<!-- WMS SCRIPT ENDS HERE -->

      var map = new GMap2(document.getElementById(MapDivID));
      map.disableDoubleClickZoom()
      map.enableInfoWindow()
      map.enableScrollWheelZoom()
      var allowedBounds = new GLatLngBounds(new GLatLng(55,-8), new GLatLng(60.0,4));
      
//	      var map = new GMap2(document.getElementById('map'));
      map.addControl(new GLargeMapControl());
      map.addControl(new GMapTypeControl());
      map.addControl(new GScaleControl());
      map.addControl(new GOverviewMapControl());

// set view extent

         if(MapDivID=='SingleMap')
        	  {
		      if (CentreLong != '') {
		        map.setCenter(new GLatLng(CentreLat,CentreLong), 14);
		      } else { 
		        map.setCenter(new GLatLng(57.5,-6.8), 7);
		      }

		  }
		  else
		  // MultiMap can have extent on URL or set from data selection
        	  {
        	    //map.addControl(new GOverviewMapControl());
        	    
        	  	var x = getURLParameters("X");
				var y = getURLParameters("Y");
				var mapScale = getURLParameters("mapScale");
				
              			if (x!=''){
              
				map.setCenter(new GLatLng(parseFloat(y),parseFloat(x)), parseFloat(mapScale));
				
                // BUT override this if we have a cookie
				if ( get_cookie ( "minLat" ) )
					{
						var minLat = get_cookie ( "minLat" );
						var maxLat = get_cookie ( "maxLat" );
						var minLong = get_cookie ( "minLong" );
						var maxLong = get_cookie ( "maxLong" );
						var bounds = new GLatLngBounds;
						bounds.extend(new GLatLng(minLat, minLong));
						bounds.extend(new GLatLng(maxLat, maxLong));
						map.setCenter(bounds.getCenter(), map.getBoundsZoomLevel(bounds)); 
					}

              
              			} else {
        	      if (selMinLong != '') {
            	    
		            map.setCenter(new GLatLng((parseFloat(selMinLat) + parseFloat(selMaxLat))/2,(parseFloat(selMinLong)+parseFloat(selMaxLong))/2));
                    // set bounds     
	                var bounds = new GLatLngBounds();
	                var point = new GLatLng(parseFloat(selMinLat),parseFloat(selMinLong));
	                bounds.extend(point);
	                var point = new GLatLng(parseFloat(selMaxLat),parseFloat(selMaxLong));
	                bounds.extend(point);
	                // don't let it zoom too close - max = 14
	                map.setZoom(Math.min(map.getBoundsZoomLevel(bounds),14));
        	      } else { 
		            map.setCenter(new GLatLng(57.5,-6.8), 6);
		          } // END IF (MinLong != '')
              }
		  } // END IF (MapDivID=='SingleMap')

<!-- INCLUDE WMS LAYER HERE (START)-->

      // add custom copyright collection
      var copyrightstatement='<br/>Crown Copyright. All rights reserved.<br/>Western Isles Council Licence No.1000229965<br/>';
      var copyright = new GCopyright(1, new GLatLngBounds(new GLatLng(-90, -180), new GLatLng(90, 180)), 0, copyrightstatement);
      var copyrightCollection = new GCopyrightCollection('');
      copyrightCollection.addCopyright(copyright);

//	var myTileLayer = new GTileLayer(new GCopyrightCollection(""),1,17);
	var myTileLayerData = new GTileLayer(copyrightCollection,1,17);
	var myTileLayerBase = new GTileLayer(copyrightCollection,1,17);
        
       //http://www.tilecache.no-ip.com/CallCrop.aspx? is ESDM proxy that gets larger image and returns the middle bit, to avoid tile edge effects
    	//CallcropGIF returns transp GIF if frmat set to gif below
    	myTileLayerData.myBaseURL='http://www.tilecache.no-ip.com/CallCropGIF.aspx?'+ WMSURL +'&';
    	//alert(myTileLayerData.myBaseURL);
	//myTileLayerData.myBaseURL=WMSURL + '&';
    	// if there is a filter, add it to the URL
    	if (strUIDFilter !='') myTileLayerData.myBaseURL+='UID='+strUIDFilter+'&';
    	//alert(myTileLayerData.myBaseURL);
    	//ONLY USE CALLCACHE.ASPX when base mapping all set up correctly, otherwise have to clear cached files from web1 server
    	//myTileLayerBase.myBaseURL='http://www.tilecache.no-ip.com/CallCache.aspx?http://www.cnes-smr.no-ip.com/cnes-wms/scripts/mapserv.exe?map=d:/websites/CNES-WMS/Map/CNES_WMS_basemaps.map&';
	//http://194.83.245.248 is the CNES server where MapServer is working (not working on http://194.83.245.247)    	
	//myTileLayerBase.myBaseURL='http://www.tilecache.no-ip.com/CallCache.aspx?http://194.83.245.248/smr-wms/scripts/mapserv.exe?map=d:/smr/CNES-WMS/Map/CNES_WMS_basemaps.map&';
	myTileLayerBase.myBaseURL='http://www.tilecache.no-ip.com/CallCache.aspx?http://smrmap.cne-siar.gov.uk/scripts/mapserv.exe?map=d:/smr/CNES-WMS/Map/CNES_WMS_basemaps.map&';

	//myTileLayerBase.myBaseURL='http://194.83.245.248/cnes-wms/scripts/mapserv.exe?map=d:/smr/CNES-WMS/Map/CNES_WMS_basemaps.map&';

    	// layers are drawn in the order specified here
    	myTileLayerData.myLayers='CNESpolygons,CNESpolylines,CNESpoints';
	myTileLayerBase.myLayers='OS50k';
	// get GIF format - IE6 doesn't support transp PNG
	myTileLayerData.myFormat='image/gif';
    	myTileLayerBase.myFormat='image/png';
	myTileLayerData.getTileUrl=CustomGetTileUrl;
	myTileLayerBase.getTileUrl=CustomGetTileUrl;
	myTileLayerData.myOpacity=1;
	myTileLayerBase.myOpacity=1;
    	myTileLayerData.getOpacity=customOpacity;
    	myTileLayerBase.getOpacity=customOpacity;
	
	// suppress GM base mapping if client base maps are displaying
	//var zoom = map.getZoom();
	//alert(zoom);
	//if (zoom < 13 ) {
        var layer1=[G_NORMAL_MAP.getTileLayers()[0],myTileLayerBase,myTileLayerData];
    	//    } else {
    	//    var layer1=[myTileLayerBase,myTileLayerData];
    	//    }
    	var layer2=[G_SATELLITE_MAP.getTileLayers()[0],myTileLayerData];
    	//var layer3=[G_HYBRID_MAP.getTileLayers()[0],myTileLayerData];
    	var layer4=[G_PHYSICAL_MAP.getTileLayers()[0],myTileLayerData];
	var SMRmap = new GMapType(layer1, G_NORMAL_MAP.getProjection(), "SMR on map");
	var SMRaerial = new GMapType(layer2, G_NORMAL_MAP.getProjection(), "SMR on aerials");
	var SMRterrain = new GMapType(layer4, G_NORMAL_MAP.getProjection(), "SMR on terrain");

	map.addMapType(SMRmap);
	map.addMapType(SMRaerial);
	map.addMapType(SMRterrain);

	map.removeMapType(G_NORMAL_MAP);
	map.removeMapType(G_SATELLITE_MAP);
	map.removeMapType(G_HYBRID_MAP);

	var mt = map.getMapTypes();
	for (var i=0; i<mt.length; i++) {
		mt[i].getMinimumResolution = function() {return 5;}
	}

// if user clicks show info window
		GEvent.addListener(map,"click",
		   function (overlay, point)
		   {
		        if(overlay)
		        { return; }
		   	    var pti = new GLatLng(point.y,point.x);
		        addInfoTipMarker(pti);
		    }
		);



// Adds InfoTip when clicked
	   function addInfoTipMarker(pti){
	   	var p = new GPoint(pti);
		// code from Lance on the Google Maps Group

		var b = map.getBounds();
		var sw = b.getSouthWest();
		var ne = b.getNorthEast();
		var w = sw.lng();
		var e = ne.lng();
		var n = ne.lat();
		var s = sw.lat();
		var ts = s;
		var tw = w;
		if(n<s) { s=n; n = ts; }
		if(e<w){ w=e; e = tw; }
		if(s<-90)s=-90;
		if(n>90)n=90;
		if(e>180)e=180;
		if(w<-180)w=-180;

		var span_ew = Math.abs(e - w);
		var span_ns = Math.abs(n - s);

		// Evaluate width and height of current map DIV

		CurrentMapDIV = document.getElementById(MapDivID);
		CurrentMapDIVHeight=parseInt(CurrentMapDIV.style.height);
		CurrentMapDIVWidth=parseInt(CurrentMapDIV.style.width);

		var width  = CurrentMapDIVWidth * span_ew / span_ns;
		var height = CurrentMapDIVHeight;

		var x = (pti.x - w) * width/span_ew;
		var y = (n - pti.y) * height/span_ns;

		var label1 = 'Info';
		//var label2 = 'Details';
		var htm = "";
		//var html2 = "You clicked on <br>" + pti;

		var URL = GetURL(x, y, w, s, e, n, width, height);
		//alert(URL);
		//htm += '<a href="javascript:zoomIn('+p+');">Zoom In</a>&nbsp;|&nbsp;<a href="javascript:zoomOut('+p+');">Zoom Out</a><br><br>';
		htm += "<iframe marginwidth=\"10\" name=\"WMSToolTip\" id=\"WMSToolTip\" frameborder=0 style=\"width:300px;height:75px;border: 0px;\" src=\"";
		htm += URL;
		htm += "\" ></iframe>";
		//failing in IE ?
		//alert(htm);
		//map.openInfoWindow(pti,"Hello World"); 
		//openInfoWindowHtml(pti,"<b>Hello World</b>"); 

		map.openInfoWindowHtml(pti, htm);
		
        	//		map.openInfoWindowTabsHtml(pt, [new GInfoWindowTab(label1,html1), new GInfoWindowTab(label2,html2)])

	    }

		



		  
// Set cookies defining current view extent (not single rec map)
	if(MapDivID!='SingleMap') {
		GEvent.addListener(map, 'moveend',function(){
		
		set_cookie ( "minLat",map.getBounds().getSouthWest().lat() );
		set_cookie ( "maxLat",map.getBounds().getNorthEast().lat());
		set_cookie ( "minLong",map.getBounds().getSouthWest().lng() );
		set_cookie ( "maxLong",map.getBounds().getNorthEast().lng() );
		
		});
	}
		  
// Switch to WMS view here - THIS NEEDS TO BE AT THE END!!!
          //alert('setting map');
          if(MapDivID=='SingleMap')
        	  {
		          map.setMapType(SMRmap);
		      } else {
		          map.setMapType(SMRmap);
		      }
		  
		}
    else {
      alert("Sorry, the Google Maps API is not compatible with this browser");
    }
}
    


