// JavaScript Document
$.event.special.tripleclick = {

    setup: function(data, namespaces) {
        var elem = this, $elem = jQuery(elem);
        $elem.bind('click', jQuery.event.special.tripleclick.handler);
    },

    teardown: function(namespaces) {
        var elem = this, $elem = jQuery(elem);
        $elem.unbind('click', jQuery.event.special.tripleclick.handler)
    },

    handler: function(event) {
        var elem = this, $elem = jQuery(elem), clicks = $elem.data('clicks') || 0;
        clicks += 1;
        if ( clicks === 3 ) {
            clicks = 0;

            // set event type to "tripleclick"
            event.type = "tripleclick";

            // let jQuery handle the triggering of "tripleclick" event handlers
            jQuery.event.handle.apply(this, arguments)
        }
        $elem.data('clicks', clicks);
    }

};


function my_kwicks(){
    $('.kwicks').kwicks({
		duration: 300,   
        max: 120,  
        spacing:  0  
    });
}  

 $(document).ready(function(){					
	my_kwicks();

var $webMonkey = $("#monkey"),
		$joke;


$webMonkey.bind("tripleclick", function() {
    
        $tempDiv = $("<div />", {
            "class": "overlay",
            css: {
                position: "absolute",
                top: 0,
                left: 0,
                right: 0,
                "z-index": 9999,
                bottom: 0,
                background: "rgba(0,0,0,0.8)",
                "text-align": "center"
            }
        
        })
        
        $joke = $("<div />", {
            text: "This site was designed by one cool monkey!",
            id: "monkey",
            css: {
                "font-size": "60px",
                paddingTop: 60,
                color: "white",
                "text-shadow": "0 0 10px black",
                "text-align": "center",
                position: "relative"
            }
        
        }).appendTo($tempDiv);
        
        $("#aspnetForm").append($tempDiv);
        
        setTimeout("window.location = 'http://www.uwbookstore.com/';", 4000);
        
    });
});
