addEvent("username", "focus", function () { inputFocus('username'); } );
addEvent("username", "blur", function () { inputBlur('username'); });
addEvent("password", "focus", function () { inputFocus('password'); } );
addEvent("password", "blur", function () { inputBlur('password'); });
addEvent("mb-name", "focus", function () { inputFocus('mb-name'); } );
addEvent("mb-name", "blur", function () { inputBlur('mb-name'); });
addEvent("mb-btiz-btiz", "focus", function () { inputFocus('mb-btiz-btiz'); } );
addEvent("mb-btiz-btiz", "blur", function () { inputBlur('mb-btiz-btiz'); });
var strPageURL = location.href;
var varPageURL = strPageURL.split("/");
switch (varPageURL[4])
{
    case "signup":
        if (varPageURL[5] == "")
        { 
            FormPricing();
            FormSignUp();
            Calc();
        }
        break;
    case "pricing":
        FormPricing();
        break;
    default:
        break;
}
function FormSignUp()
{
    try
    {
        try
        {
            if (ValueGet("txtcompany") == "Acme Ltd")
            {
                addEvent("txtcompany", "focus", function () { inputFocus('txtcompany'); } );
            } else {
                addEvent("txtcompany", "focus", function () { inputFocusWithValue('txtcompany'); } );
            }
            addEvent("txtcompany", "blur", function () { inputBlur('txtcompany'); });
        } catch (e) { }
        try
        {
            if (ValueGet("txtfullname") == "John Doe")
            {
                addEvent("txtfullname", "focus", function () { inputFocus('txtfullname'); } );
            } else {
                addEvent("txtfullname", "focus", function () { inputFocusWithValue('txtfullname'); } );
            }
            addEvent("txtfullname", "blur", function () { inputBlur('txtfullname'); });
        } catch (e) { }
        try
        {
            if (ValueGet("txtemail") == "someone@somewhere.com")
            {
                addEvent("txtemail", "focus", function () { inputFocus('txtemail'); } );
            } else {
                addEvent("txtemail", "focus", function () { inputFocusWithValue('txtemail'); } );
            }
            addEvent("txtemail", "blur", function () { inputBlur('txtemail'); });
        } catch (e) { }
        try
        {
            if (ValueGet("txtphone") == "01234 567890")
            {
                addEvent("txtphone", "focus", function () { inputFocus('txtphone'); } );
            } else {
                addEvent("txtphone", "focus", function () { inputFocusWithValue('txtphone'); } );
            }
            addEvent("txtphone", "blur", function () { inputBlur('txtphone'); });
        } catch (e) { }
        try
        {
            if (ValueGet("txtusername") == "")
            {
                addEvent("txtusername", "focus", function () { inputFocus('txtusername'); } );
            } else {
                addEvent("txtusername", "focus", function () { inputFocusWithValue('txtusername'); } );
            }
            addEvent("txtusername", "blur", function () { inputBlur('txtusername'); });
        } catch (e) { }
        try
        {
            if (ValueGet("txtpassword") == "")
            {
                addEvent("txtpassword", "focus", function () { inputFocus('txtpassword'); } );
            } else {
                addEvent("txtpassword", "focus", function () { inputFocusWithValue('txtpassword'); } );
            }
            addEvent("txtpassword", "blur", function () { inputBlur('txtpassword'); });
        } catch (e) { }
        try
        {
            if (ValueGet("txtweb") == "www.somewhere.com")
            {
                addEvent("txtweb", "focus", function () { inputFocus('txtweb'); } );
            } else {
                addEvent("txtweb", "focus", function () { inputFocusWithValue('txtweb'); } );
            }
            addEvent("txtweb", "blur", function () { inputBlur('txtweb'); });
        } catch (e) { }
        try
        {
            if (ValueGet("txtaddress") == "123 The Street\nThe Town\nThe County\nPostcode")
            {
                addEvent("txtaddress", "focus", function () { inputFocus('txtaddress'); } );
            } else {
                addEvent("txtaddress", "focus", function () { inputFocusWithValue('txtaddress'); } );
            }
            addEvent("txtaddress", "blur", function () { inputBlur('txtaddress'); });
        } catch (e) { }
        try
        {
            if (ValueGet("txtfooter") == "123 The Street, The Town, The County, Postcode\nRegistered no: 1234567 Tel: 01234 567890 Fax: 01234 567891")
            {
                addEvent("txtfooter", "focus", function () { inputFocus('txtfooter'); } );
            } else {
                addEvent("txtfooter", "focus", function () { inputFocusWithValue('txtfooter'); } );
            }
            addEvent("txtfooter", "blur", function () { inputBlurSimple('txtfooter'); });
        } catch (e) { }
        inputSelect('txtcompany');
    } catch (e)
    {
    }
}
function FormPricing()
{
    addEvent("txtcalcsidebarrecipients", "focus", function () { inputFocusWithValue('txtcalcsidebarrecipients'); } );
    addEvent("txtcalcsidebarrecipients", "blur", function () { inputBlur('txtcalcsidebarrecipients'); });
    inputSelect('txtcalcsidebarrecipients');
    
    Calc();
}
function FormDemoSideBar()
{
    addEvent("txtdemosidebaremail", "focus", function () { inputFocus('txtdemosidebaremail'); } );
    addEvent("txtdemosidebaremail", "blur", function () { inputBlur('txtdemosidebaremail'); });
}
/* Used on the prcing page as a quick calculator */
function Calc()
{
    var lngRecipients = ValueGet('txtcalcsidebarrecipients');
    if (lngRecipients != "")
    {
        var dblPerJob = 10;
        var dblPerRecipient = 0.10;
        var dblTotal = (lngRecipients * dblPerRecipient) + dblPerJob;
        InnerHTMLSet('calctotal', "&pound;" + Comma(Money(dblTotal)));
    } else {
        InnerHTMLSet('calctotal', "");
    }
    return false;
}
