function float(obj)
{
	obj.style.left = document.body.clientWidth - 210;
	obj.style.top = 10;
}

function select(obj, fieldID, value)
{
    var siblings = obj.parentNode.childNodes;
    var field = document.getElementById(fieldID);
    
    for (var i = 0; i < siblings.length; i++)
        siblings[i].className = "Item";
        
    obj.className = "Item Selected";
    
    if (field != null)
        field.value = value;
}

function CreditCardHighlighter(americanExpressLogoID, discoverLogoID, mastercardLogoID, visaLogoID)
{
    this.americanExpressLogo = (americanExpressLogoID == null ? null : document.getElementById(americanExpressLogoID));
    this.discoverLogo = (discoverLogoID == null ? null : document.getElementById(discoverLogoID));
    this.mastercardLogo = (mastercardLogoID == null ? null : document.getElementById(mastercardLogoID));
    this.visaLogo = (visaLogoID == null ? null : document.getElementById(visaLogoID));
    this.highlight = function(value)
    {
        value = value.replace(/[-\s]/g, "");

        if (this.americanExpressLogo != null)
        {
            if (value.match(/^(34|37)\d{13}$/))
                this.americanExpressLogo.className = "CreditCardLogo Selected";
            else
                this.americanExpressLogo.className = "CreditCardLogo";
        }

        if (this.discoverLogo != null)
        {
            if (value.match(/^6011\d{12}$/))
                this.discoverLogo.className = "CreditCardLogo Selected";
            else
                this.discoverLogo.className = "CreditCardLogo";
        }

        if (this.mastercardLogo != null)
        {
            if (value.match(/^5[1-5]\d{14}$/))
                this.mastercardLogo.className = "CreditCardLogo Selected";
            else
                this.mastercardLogo.className = "CreditCardLogo";
        }

        if (this.visaLogo != null)
        {
            if (value.match(/^4\d{15}$/))
                this.visaLogo.className = "CreditCardLogo Selected";
            else
                this.visaLogo.className = "CreditCardLogo";
        }
    };
}

function FitToWindow()
{
    var contentDiv = document.getElementById("Content");
    var height = (typeof window.innerHeight != 'undefined' ? window.innerHeight : document.documentElement.clientHeight);

    contentDiv.height = (height - 275);
}
