function showLookUp()
    {
        var obj = document.getElementById("Button1")
        if (obj != null)
        {
            obj.visible=true;
               
        }
        else
        {
            alert('Show look up is null'); 
        } 
    }  
function HideLookUp(email)
    {
    
        var obj = document.getElementById("Button1")
        if (obj != null)
        {
            obj.visible=false;
            email.focus();  
        }
          else
        {
            alert('hide look up is null'); 
        
        }
         }
         
         
var expDays = 30;
var exp = new Date();
exp.setTime(exp.getTime() + (expDays*24*60*60*1000));

function getCookieVal (offset) 
    {
        var endstr = document.cookie.indexOf (";", offset);
        if (endstr == -1)
        endstr = document.cookie.length;
        return unescape(document.cookie.substring(offset, endstr));
    }
    
function GetCookie (name) 
    {
        var arg = name + "=";
        var alen = arg.length;
        var clen = document.cookie.length;
        var i = 0;
        while (i < clen) 
            {
                var j = i + alen;
                if (document.cookie.substring(i, j) == arg)
                    return getCookieVal (j);
            i = document.cookie.indexOf(" ", i) + 1;
            if (i == 0) break;
            }
            return null;
      }
    
    
function SetCookie2 (name, value) 
    {
        var argv = SetCookie.arguments;
        var argc = SetCookie.arguments.length;
        var expires = (argc > 2) ? argv[2] : null;
        var path = (argc > 3) ? argv[3] : null;
        var domain = (argc > 4) ? argv[4] : null;
        var secure = (argc > 5) ? argv[5] : false;
        document.cookie = name + "=" + escape (value) +
        ((expires == null) ? "" : ("; expires=" + expires.toGMTString())) +
        ((path == null) ? "" : ("; path=" + path)) +
        ((domain == null) ? "" : ("; domain=" + domain)) +
        ((secure == true) ? "; secure" : "");
    }


function loadLoginCookie(username, password,loginCookieID)
{
    var myUN=document.getElementById(username);
    if (myUN != null)
        {
            var cookieValue=GetCookie(loginCookieID);
            if (cookieValue != null)
                {
                //alert('not null');
                    myUN.text=cookieValue;
                    var myPW = document.getElementById(password);
                    if (myPW != null)
                    {
                    //alert('focus pw');
                        myPW.focus();
                    }
                    else
                    {
                    //alert('focus un2');
                        myPW.focus();
                    } 
                    //password1.focus();
                }
            else
                {
                //alert('null');
                //alert('focus un1');
                    myUN.focus();
                } 
        }
}

function ShowPasswordLookupDiv(control)
{
    var pwd = document.getElementById(control  + "LoginControlPasswordLookup");
    var log = document.getElementById(control  + "LoginControlLoginPanel");
    var but = document.getElementById(control  + "_btnLogin");           
    if (log != null)
    {
        //hide the login boxes
        log.style.display='none';
    
        //Set btnLogin.visible = false to set focus to the other button
        if (but != null)
        {
            but.visible=false;
        }
        else
        {
            alert('ShowPasswordLookupDiv: but is null');
        }
    }
    else
    {
        alert("ShowPasswordLookupDiv: '" + control + "' is null"); 
    } 
    if (pwd != null)
    {
        //show the paswword boxes
        pwd.style.display='';

    }
    else
    {
        alert("ShowPasswordLookupDiv: '" + control + "LoginControlPasswordLookup' is null"); 
    }
    
    //Focus
    //alert(control);
    document.getElementById(control + "_txtSnark").focus();  
}

function ShowLoginPanel(control)
{
    var pwd = document.getElementById(control  + "LoginControlPasswordLookup");
    var log = document.getElementById(control  + "LoginControlLoginPanel");
    var but = document.getElementById(control  + "_btnLookupEmail");
    if (log != null)
    {
        //show the login boxes
        log.style.display='';
        
        //Make btnLookupEmail hidden
        if (but != null)
        {
            but.visible=false;
        }
        else
        {
            alert('but is null');
        }
    }
    else
    {
        alert("ShowLoginPanel: '" + control + "LoginControlLoginPanel' is null"); 
    }
    
    if (pwd != null)
    {
        //hide the password boxes
        pwd.style.display='none';
    }
    else
    {
        alert("ShowLoginPanel: '" + control + "LoginControlPasswordLookup' is null"); 
    } 
}

function checkEnter(e,control)
{ 
    var characterCode;
    if(e && e.which)
    {
        //if which property of event object is supported (NS4)
        e = e
        characterCode = e.which //character code is contained in NN4's which property
    }
    else
    {
        e = event
        characterCode = e.keyCode //character code is contained in IE's keyCode property
    }

    if(characterCode == 13)
    {
        //if generated character code is equal to ascii 13 (if enter key)
        document.forms[0].submit() //submit the form
        
        //=======================================================
        //var log = document.getElementById(control);
        //if (log != null)
        //{
            //log.PasswordEntered=true;
            //alert('checkEnter: log.PasswordEntered=true');
        //}
        //else
        //{
            //alert('checkEnter: log is null');
        //}
        //=======================================================
    
             
        
        return false 
    }
    else
    {
        return true 
    }
}

function Redirect(url)
{
    window.location = url;
    return true;
}