// remap jQuery to $
(function($) {

    // 	Simple jQuery slideToggle effect (used in the menu)
    if ((navigator.userAgent.match(/iPhone/i)) || (navigator.userAgent.match(/iPod/i)) || (navigator.userAgent.match(/iPad/i))) {
        $("#menu-trigger").click(function() {
            $("#header").find("div#menu").slideToggle("fast");
            return true;
        });
    } else {
        $("#menu-trigger").click(function() {
            $("#header").find("div#menu").slideToggle("slow");
            return true;	
        });
    }
    
    
    // SlideDeck Plugin http://www.slidedeck.com/ (on home page)
//    $('#home #slidedeck_frame_01 .slidedeck').slidedeck({
//        autoPlay: true,
//        cycle: false,
//        transition: 'linear',
//        speed: 300,
//        autoPlayInterval: 2000
//    });

    
	// Cycle Plugin 
	// http://jquery.malsup.com/cycle/
	$('#slideshow') 
	.before('<div id="count">') 
	.cycle({ 
	    fx:     'scrollLeft', 
	    speed:  'slow', 
	    timeout: 0, 
	    pager:  '#count',
	    autostop: 1,
	    pause: 1,
	    next: '#slideshow' 
	});
	
	
	// tablesorter
	$("#myTable").tablesorter(); 

	

})(this.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);

