    var faqsReady = false;
    
    $(document).ready(function() {
        SetupFAQs();
        SetupScrollToAnchors();
    });
    
    var openFaq = '';
    function SetupFAQs()
    {
        if(!faqsReady)
        {                
            $(".faq > dt").click(function()
                {
                    $(".faq > dd:not(.remove)").slideUp(400);
                    
                    if(this != openFaq)
                    {
                        $(this).next("dd").next("dd").slideDown(400);
                        openFaq = this;
                    }
                    else
                    {
                    openFaq = '';
                    }
                    
                }
            );
        }
        faqsReady=true;
        $(".faq > dd:not(.remove)").hide();
    }

    function SetupScrollToAnchors()
    {
        $('a[href*=#]').click(function()
        {
            if (location.pathname.replace(/^\//,'') == this.pathname.replace(/^\//,'')&& location.hostname == this.hostname)
            {
                var $target = $(this.hash);
                $target = $target.length && $target || $('[name=' + this.hash.slice(1) +']');
                if ($target.length)
                {
                    var targetOffset = $target.offset().top;
                    $('html,body').animate({scrollTop: targetOffset}, 500);
                    return false;
                }
            }
        });
    }
    
    var resizeCalled=false;
    function PlacePopup(isResizing) {
        if(!resizeCalled) {
            if(document.documentElement.clientHeight) {
                screenheight = document.documentElement.clientHeight;
            } else {
                screenheight = $(window).height();
            }
            w = ($(window).width());
            h = (screenheight); // <-- visible screen portion
            
            if((screenheight+100)<=$("html").height()) 
            {
                h_full = ($("html").height()); // <-- full length of scrollable content        
            } else {
                h_full = ($("body").height()); // <-- full length of scrollable content        
            }
            var scrollTop = window.pageYOffset || $.boxModel && document.documentElement.scrollTop || document.body.scrollTop;
            
            $(".cover").width(w);
            if(h>h_full) $(".cover").height(h);
            else $(".cover").height(h_full);
            
            $(".coverInner").width(w);
            
            if(h>h_full) $(".coverInner").height(h);
            else $(".coverInner").height(h_full);
            
            // place the popup in center of screen
            if(isResizing) $(".Popup").animate({top:(((h/2)-($(".Popup").height()/2)))-50+scrollTop, left:((w/2)-($(".Popup").width()/2))}, 250, "swing"); 
            else $(".Popup").css({top:(((h/2)-($(".Popup").height()/2)))-50+scrollTop, left:((w/2)-($(".Popup").width()/2))}); 
                        
            //ie6 fix:
            resizeCalled = true;
            setTimeout("resizeCalled = false", 10)
        }
    }
