var divLogin;

var tdLogin;

var tdContent;

var txtEmail;

function OpenLogin(){

    divLogin = document.getElementById('divLogin');

    tdLogin = document.getElementById('tdLogin');

    tdContent = document.getElementById('tdContent');

    txtEmail = document.getElementById('txtEmail');

    txtPassword = document.getElementById('txtPassword');

    

    if (divLogin.style.display == 'block'){

	divLogin.style.display = 'none';

    }else{

        divLogin.style.display = 'block';

        divLogin.style.left = tdLogin.offsetLeft + tdContent.offsetLeft - 1;

        divLogin.style.width = tdLogin.offsetWidth;

        if (txtEmail.value.length == 0) {

            txtEmail.value = GetCookie('Login');

	    if (txtEmail.value.length == 0) {

		txtEmail.focus();

	    }else{

            	txtPassword.focus();

	    }

        }

    }

    document.forms[0].action = "https://www.auctionpipeline.com/Logon.aspx?A=FWIAA";

}

function RepositionElements(){

    if (divLogin) divLogin.style.left = tdLogin.offsetLeft + tdContent.offsetLeft - 1;

}

function SubmitForm(){

    txtEmail = document.getElementById('txtEmail');

    document.cookie = 'Login=' + escape(txtEmail.value) + '; expires=Thu, 01 Jan 2015 23:59:59 GMT';

    document.forms[0].submit();

}

function CheckSendLogin(e){

    if (e.keyCode == 13) {

        SubmitForm();

        e.keyCode = 0;

    }

}

function GoToReg(){

    window.location = 'https://www.auctionpipeline.com/signup.aspx?A=FWIAA';

}

function GoToForgot(){

    window.location = 'https://www.auctionpipeline.com/forgotpassword.aspx?A=FWIAA';

}



function GetCookie(sName)

{

  // cookies are separated by semicolons

  var aCookie = document.cookie.split("; ");

  for (var i=0; i < aCookie.length; i++)

  {

    // a name/value pair (a crumb) is separated by an equal sign

    var aCrumb = aCookie[i].split("=");

    if (sName == aCrumb[0]) 

      return unescape(aCrumb[1]);

  }



  // a cookie with the requested name does not exist

  return '';

}