/*nifty corners layout*/



window.onload=function(){

Nifty("div#container");

Nifty("div#content,div#nav","same-height small");

Nifty("div#header,div#footer","small");

Nifty("ul.postnav a","transparent");

Nifty("div#about li","tl bottom big fixed-height");

}
// validation goodies

// Declaring valid date character, minimum year and maximum year

var dtCh = "/";
var minYear = 1900;
var maxYear = 2100;

 // check that they entered enough info

    function xCheckValidity(theForm)
        {
        var returnval = true;
        alert("dog " + theForm.giftproduct.selectedIndex);
        }

    function CheckValidity(theForm)
        {
        var errormessage = new String();

        // Put field checks below this point.
        if (WithoutContent(theForm.recipname.value))
            {
            errormessage += "\nWe need the Recipient's name.";
            }

        if (WithoutContent(theForm.recipaddress.value))
            {
            errormessage += "\nWe need the Recipient's street address.";
            }

        if (WithoutContent(theForm.recipcity.value))
            {
            errormessage += "\nWe need the Recipient's city.";
            }

        if (WithoutContent(theForm.recipstate.value))
            {
            errormessage += "\nPlease verify the Recipient's state.";
            }

        if (WithoutContent(theForm.recipzip.value))
            {
            errormessage += "\nWe need the Recipient's ZIP code.";
            }
        if (WithoutContent(theForm.buyername.value))
            {
            errormessage += "\nWe need the Buyer's name.";
            }
        if (WithoutContent(theForm.buyeraddress.value))
            {
            errormessage += "\nPlease enter your street address.";
            }
        if (WithoutContent(theForm.buyercity.value))
            {
            errormessage += "\nPlease enter the name of your city.";
            }
        if (WithoutContent(theForm.buyerstate.value))
            {
            errormessage += "\nPlease enter your state.";
            }
        if (WithoutContent(theForm.buyerzip.value))
            {
            errormessage += "\nPlease enter your ZIP code.";
            }
        if (WithoutContent(theForm.buyeremail.value))
            {
            errormessage += "\nPlease enter your email address.";
            }

        if (theForm.sendvia.selectedIndex == 0)
            {
            errormessage += "\nShould the Gift Certificate be sent via E-mail - or by US Mail ?";
            }

        // Put field checks above this point.
        if (errormessage.length > 2)
            {
            alert('NOTE:' + errormessage);
            return false;
            }

        return true;
        }

    function WithoutContent(ss)
        {
        if (ss.length > 0)
            {
            return false;
            }

        return true;
        }

    function NoneWithContent(ss)
        {
        for (var i = 0; i < ss.length; i++)
            {
            if (ss[i].value.length > 0)
                {
                return false;
                }
            }

        return true;
        }

    function NoneWithCheck(ss)
        {
        for (var i = 0; i < ss.length; i++)
            {
            if (ss[i].checked)
                {
                return false;
                }
            }

        return true;
        }

    function WithoutCheck(ss)
        {
        if (ss.checked)
            {
            return false;
            }

        return true;
        }

    function WithoutSelectionValue(ss)
        {
        for (var i = 0; i < ss.length; i++)
            {
            if (ss[i].selected)
                {
                if (ss[i].value.length)
                    {
                    return false;
                    }
                }
            }

        return true;
        }

    function isInteger(s)
        {
        var i;

        for (i = 0; i < s.length; i++)
            {
            // Check that current character is number.
            var c = s.charAt(i);

            if (((c < "0") || (c > "9")))
                return false;
            }

        // All characters are numbers.
        return true;
        }

    function stripCharsInBag(s, bag)
        {
        var i;
        var returnString = "";

        // Search through string's characters one by one.
        // If character is not in bag, append to returnString.
        for (i = 0; i < s.length; i++)
            {
            var c = s.charAt(i);

            if (bag.indexOf(c) == -1)
                returnString += c;
            }

        return returnString;
        }

    function daysInFebruary(year)
        {
        // February has 29 days in any year evenly divisible by four,
        // EXCEPT for centurial years which are not also divisible by 400.
        return (((year % 4 == 0) && ((!(year % 100 == 0)) || (year % 400 == 0))) ? 29 : 28);
        }

    function DaysArray(n)
        {
        for (var i = 1; i <= n; i++)
            {
            this[i] = 31

            if (i == 4 || i == 6 || i == 9 || i == 11)
                {
                this[i] = 30
                }

            if (i == 2)
                {
                this[i] = 29
                }
            }

        return this
        }

    function calcAmount()
        {
        var addon = 0;
        var frm = document.orderform;
        var oDDL = frm.sendvia;
        var x = oDDL.options[oDDL.selectedIndex].text;
        var wheredollar = x.indexOf('$')

        if (wheredollar != -1)
            addon = parseFloat(x.substring(wheredollar + 1)); // just strip out any amount in the dropdown

        frm.amount.value = (frm.amount.value * 1) + (addon * 1);
        }

