/*  ###########################################################################
    date:       April 2009
    author:     Egor Kloos
    ########################################################################### */
    
     
/*
    var gaJsHost = (("https:" == document.location.protocol) ? "https://ssl." : "http://www.");
    $.getScript(gaJsHost + "google-analytics.com/ga.js", function(){
        var pageTracker = _gat._getTracker("UA-81032-1");
        pageTracker._initData();
        pageTracker._trackPageview();
    });
*/

    

    $(document).ready(function(){
            
        // validate the form when it is submitted
        $(':input[name="required[]"]').attr('name',function(index){return "required[" + index + "]"}); /* FIX FOR NAME ARRAY ISSUE NEEDED IN EXPRESSION ENGINE */
        $("label span.required").parent().next(":input").addClass("required");
        $("form").each(function(){$(this).validate();});  

        
        /* BLOCK HOVER ############################################################ */

        $('.article-lists article').each(function(){
            var r = $(this);
            if((r.find('a.readon').length)>0){
                var l = r.find('a.readon').eq(0);
                var h = l.attr('href');
                l.hide()
                r.hover(function(){
                    $(this).addClass('hover');
                },function(){
                    $(this).removeClass('hover');
                });
                r.click(function(){
                    location.href = h;
                });
            }
        });

        $("#tagline").after('<div id="pull-view">V</div>')
        $("#pull-view").bind('click', function(){
            var h = $(this).parents('header:first');
            $(this).toggleClass("open");
            if ($(this).hasClass("open")) {
                $(this).text("^")
                if(h.css("background-position-y")=="") h.css("background-position","left top");
                h.animate( { backgroundPositionY:"bottom" }, { queue:false, duration:700 } )
                    .animate( {height:"500px" }, 700 );
            } else {
                $(this).text("V")
                h.animate( { backgroundPosition:"left center" }, { queue:false, duration:700 } )
                .animate( {height:"100px" }, 700, function(){
                    if(h.css("background-position-y")=="") h.css("background-position","left center");
                });
            }
        });
        

       //if($.browser.mozilla)alert($.browser.version)
        var n = document.getElementsByTagName('article')[0];
        if (n.childNodes.length <= 1) {
            $('body').addClass('old').prepend("<strong style='display:block;padding:1em;color:#900;background:gold;'>This is an old browser that doesn't support HTML5 and will not display correctly. </strong>");
            document.styleSheets[0].disabled = true;
        }
    });
    
    

    
    
    

    
