function setCookie(name, value, expire) 
{   
  document.cookie = name + "=" + escape(value) + 
                    ((expire== null) ? "" : ("; expires=" + expire.toGMTString()));
}
  
function getCookie(Name) 
{   
  var search = Name + "=";
  
  if (document.cookie.length > 0) 
  {       
    offset = document.cookie.indexOf(search);
    if (offset != -1) 
    {          
      offset += search.length;          
      end = document.cookie.indexOf(";", offset);
      
      if (end == -1)             
        end = document.cookie.length;
        
      return unescape(document.cookie.substring(offset, end))    
    }    
  }
}

function SetView(View)
{
  var today = new Date();
  var expires = new Date();

  alert('Mode: ' + View);
  expires.setTime(today.getTime() + 1000*60*60*24*365);
  setCookie("applabpageview", View, expires);
}
  
function GetView()
{
  var strView = null;
  
  if (EnableWebMap)
  {
    if (document.cookie == "") 
    {
      alert("Turn on cookies to store Web View");
    }
    else
    {
      strView = getCookie("applabpageview");
 
      if (strView == null)
      {
        strView = "map";
        SetView(strView);
      }
    
      if ((strView == "map") && ((window.name == "")))
      {
        alert('Switching View to Map; Put link in when map ready');
//      location.replace("http://216.110.15.140/applab/main/startpage.htm", "http://216.110.15.140/applab/main/startpage.htm");
      }
    }
  }
}


