$(document).ready(function(){
    try {
    if($.cookie("zoom")!=0)
    {
        $zoom=parseInt($.cookie("zoom"));
        $('.scale,.scale *').each(function(){
            if($(this).css('font-size').indexOf('px')==-1)
            {
                $fs=sizetopx($(this).css('font-size').indexOf('px'));
            }
            else
            {
                $fs=parseInt($(this).css('font-size'))
            }
            $fs=$fs+$zoom
            $(this).css('font-size',$fs+'px')
        });
    }
    else
    {
        $.cookie("zoom",0);
    }
    }
    catch($error) {
        $.cookie("zoom",0);
    }
    $('#Au').click(function(){
        $zoom=parseInt($.cookie("zoom"));
        $zoom=$zoom+1;
        if($zoom>2)
        {
            return false;
        }
        $.cookie("zoom",$zoom);
        $('.scale,.scale *').each(function(){
            if($(this).css('font-size').indexOf('px')==-1)
            {
                $fs=sizetopx($(this).css('font-size').indexOf('px'));
            }
            else
            {
                $fs=parseInt($(this).css('font-size'))
            }
            $fs=$fs+1
            $(this).css('font-size',$fs+'px')
        });
        return false;
    });
    $('#Ar').click(function(){
        $zoom=0;
        $.cookie("zoom",$zoom);
        $('.scale,.scale *').removeAttr('style');        
        return false;
    });
    $('#Ad').click(function(){
        $zoom=parseInt($.cookie("zoom"));
        $zoom=$zoom-1;
        if($zoom<-2)
        {
            return false;
        }
        $.cookie("zoom",$zoom);
        $('.scale,.scale *').each(function(){
            $fs=parseInt($(this).css('font-size'))
            if($(this).css('font-size').indexOf('px')==-1)
            {
                $fs=sizetopx($(this).css('font-size').indexOf('px'));
            }
            else
            {
                $fs=parseInt($(this).css('font-size'))
            }
            $fs=$fs-1
            $(this).css('font-size',$fs+'px')
        });        
        return false;
    });
    $('.hovertxt').hover(function(){
    {
        offset = $('.nudgelink').offset()
        $('#dmdtxt').css('left',offset.left +'px');
        $('#dmdtxt').show();
    }
    },function(){
        $('#dmdtxt').hide();
    });

    $("ul.sf-menu").superfish({ 
            speed:       '0',
            disableHI:   true,
            animation:   {zindex:'show'}  // fade-in and slide-down animation
    }); 
});

function formcheck()
{    
    if( $("#i27").val()=="")
    {
        alert('Please include your first name');
        return false;
    }
    if($("#i37").val()=="")
    {
        alert('Please include your last name');
        return false;
    }    
    if($('[name=contactby]:checked').val() == "Email")
    {
        if($("#i32").val().indexOf('@')==-1)
        {
            alert('Please include your email address');
            return false;
        }            
    }
    if($('[name=contactby]:checked').val() == "Phone")
    {
        if($("#i38").val().length < 10)
        {
            alert('Please include your phone number');
            return false;
        }                    
    }
    if($('[name=contactby]:checked').val() == "Mail")
    {
        if( $("#i35").val().length < 7 )
        {
            alert('Please include your mailing address');
            return false;
        }
        if( $("#i40").val().length < 2 )
        {
            alert('Please include your state code');
            return false;
        }
        if( $("#i41").val().length < 5 )
        {
            alert('Please include your zip code');
            return false;
        }        
    }
    return true;
}
function sizetopx($size)
{
    if($size=="xx-small")
        return 9;
    if($size=="x-small")
        return 10;
    if($size=="smaller")
        return 10;
    if($size=="small")
        return 13;
    if($size=="medium")
        return 16;
    if($size=="large")
        return 18;
    if($size=="x-large")
        return 24;
    if($size=="xx-large")
        return 32;
    
    return 12;
}