
(function($){

    $("li.browse").hoverIntent({
        over: function(){
            $(this).children('ul').slideDown();
            $(this).children('a').css("background-position", "-479px -47px");
        },
        timeout: 500,
        out: function(){
            $(this).children('ul').slideUp('fast');
            $(this).children('a').css("background-position", "-479px 7px");
        }
    });

    $(".browse_btn").click( function(event){
        $(this).children('ul').slideDown();
        $(this).children('a').css("background-position", "-479px -47px");
        return false;
    });


    $('#top_tuts_widget a.close_btn').click(function(event){
        event.preventDefault();
        $('#top_tuts_widget').toggleClass('closed');
        $.cookie('widget', $('#top_tuts_widget').attr('class'));
    })

    $('#top_tuts_widget').attr('class', $.cookie('widget'));

    $(function(){

        $('#slider_container').loopedSlider({
            container: '#slider',
            slides: "#slides", 
            containerClick: false,
            hoverPause: false
        });

        $("a[rel^='prettyPhoto']").prettyPhoto({
            social_tools: false,
            deeplinking: false,
			theme: 'pp_default'
        });

        $("a[rel^='prettyPhoto']").attr('title', $('h1').text());
        
        // var swfData = "swf/Tutorial.swf?width=751&height=451&flashvars=data="+getXmlDataForFlash();
        // $("a[rel^='prettyPhoto']").attr('href', swfData );

        $('.three_column li').each( function(index){
            if(index % 3 === 0){
                $(this).addClass('first')
            }
        });
    });


})(window.jQuery);



// usage: log('inside coolFunc',this,arguments);
// paulirish.com/2009/log-a-lightweight-wrapper-for-consolelog/
window.log = function(){
  log.history = log.history || [];   // store logs to an array for reference
  log.history.push(arguments);
  if(this.console){
    console.log( Array.prototype.slice.call(arguments) );
  }
};



// catch all document.write() calls
// (function(doc){
//   var write = doc.write;
//   doc.write = function(q){ 
//     log('document.write(): ',arguments); 
//     if (/docwriteregexwhitelist/.test(q)) write.apply(doc,arguments);  
//   };
// })(document);



