﻿
Type.registerNamespace("Weather2.MapSearch");

Weather2.MapSearch.MapArgs = function(divID, center, zoomlevel, style, fixed, mode, scale) {
   /// <summary>
   ///   Virtual Earth Arguments
   /// </summary>
   /// <param name="divID">The ID of the div to create the map</param>
   /// <param name="center">The centre of the initial map view - type VELatLong</param>
   /// <param name="zoomlevel">The initial zoom level 1-19</param>
   /// <param name="style">The map style - type VEMapStyle</param>
   /// <param name="fixed">Is the map fixed = not interactive</param>
   /// <param name="mode">The map mode - type VEMapMode</param>
   /// <param name="scale">The map scale - type VEDistanceUnit </param>
   
    
    
    var from_map_search = "0";
    
    var aid=0;
    
    var bfound = 0;
    
    readForecastCookiValues();
    
    if ($get('ctl00_MiddleContentHolder_from_map_search'))               
        from_map_search=$get('ctl00_MiddleContentHolder_from_map_search').value;
       
    
    if (from_map_search=="1")
    {
        if ($get('ctl00_MiddleContentHolder_activity_id'))
        {
            if ($get('ctl00_MiddleContentHolder_activity_id').value == $get('ctl00_MiddleContentHolder_mapActivity_ID').value)
            {
                this.Center = new VELatLong($get('ctl00_MiddleContentHolder_mapLatitude').value, $get('ctl00_MiddleContentHolder_mapLongitude').value);
        
                this.Zoomlevel= 8 ;
                
                bfound=1;
            
            }            
        }
    }
    
    
    if (bfound==0)    
    {        
        this.Center = center;
        this.Zoomlevel = zoomlevel;
    }
    
    this.DivID = divID;
    this.Style = style;
    this.Fixed = fixed;
    this.Scale = scale;
    this.Mode = mode;
        
}

function readCookie(name) {
	var nameEQ = name + "=";
	var ca = document.cookie.split(';');
	for(var i=0;i < ca.length;i++) {
		var c = ca[i];
		while (c.charAt(0)==' ') c = c.substring(1,c.length);
		if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length,c.length);
	}
	return null;
}

function readForecastCookiValues()
{
    if ($get('ctl00_MiddleContentHolder_from_map_search') && readCookie('FromMapSearch')!=null)               
        $get('ctl00_MiddleContentHolder_from_map_search').value = readCookie('FromMapSearch') ;
        
    if ($get('ctl00_MiddleContentHolder_mapActivity_ID') && readCookie('MapActivity_ID'))               
        $get('ctl00_MiddleContentHolder_mapActivity_ID').value = readCookie('MapActivity_ID') ;              
    
    if ($get('ctl00_MiddleContentHolder_mapLatitude') && readCookie('MapLatitude'))               
        $get('ctl00_MiddleContentHolder_mapLatitude').value = readCookie('MapLatitude') ;              
        
    if ($get('ctl00_MiddleContentHolder_mapLongitude') && readCookie('MapLongitude'))               
        $get('ctl00_MiddleContentHolder_mapLongitude').value = readCookie('MapLongitude') ;                      
    
}

Weather2.MapSearch.MapArgs.registerClass('Weather2.MapSearch.MapArgs');

if (typeof(Sys) !== "undefined") Sys.Application.notifyScriptLoaded();



