function ct(object, compareto)
{ var objtext = object.value.toLowerCase(); if (object.value.Trim() == '') { object.value = compareto; } }

function cc(object, compareto)
{ if (object.value.toLowerCase().Trim() == compareto.toLowerCase()) { object.select(); } }

function val(object, compareto)
{
    if (object.value.toLowerCase() == compareto.toLowerCase() || object.value.Trim() == '')
    {
        object.select();
        return false;
    }
    else
        return true;
}

function ToggleShoppingCartBoxes(chk)
{
    var chks = document.getElementsByTagName("input");
    
    for (var i=0; i<chks.length; i++)
    {
        if (chks[i].type && chks[i].type == 'checkbox')
        {
            if (chks[i].id && chks[i].id.indexOf('chkItem') != -1)
                chks[i].checked = chk.checked;
        }
    }
}

function homeNewsletterClick(object, compareto)
{
    if (val(object, compareto))
    {
        var filter  = /^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$/;
	    if (filter.test(object.value))
	    {
            object.blur();
            $('div#newslettercontainer').block('<div class="status"><h2>Saving...</h2></div>', { backgroundColor:'transparent', width: '180px' });
            SubmitNewsletter(object.value.Trim(), SubmitNewsletterSuccess);
        }
        else
        {
            object.select();
        }
    }
    return false;
}

function SubmitNewsletterSuccess(result)
{
    $('div#newslettercontainer').unblock();
    document.getElementById('ctl00_txtNewsletterEmailAddress').value = 'Join Our Newsletter';
    $('div#newslettercontainer').block('<div class="status"><h2>Saved!</h2></div>', { backgroundColor:'transparent', width: '180px' });
    setTimeout("$('div#newslettercontainer').unblock();", 600);
}

function AdminNav(str)
{
    if ($get('adminlinkstatus'))
    {
        $get('adminlinkstatus').innerHTML = str;
    }
}

function StripToAlph(str)
{
    var alph = "ABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890";
    var retval = "";
    
    for (i=0;i<str.length;i++)
    {
        if (alph.indexOf(str.substring(i,i+1).toUpperCase()) > -1)
            retval += str.substring(i,i+1);
    }
    return retval;
}

function IsNumeric(str) {
   return /^[-+]?\d+(\.\d+)?$/.test(str);
}

function hasClass(obj, className)
{
    return obj.className.toLowerCase().indexOf(className) > -1;
}