// jQuery Ready function
$(document).ready(function(){
  //alert("DOM is ready");	


	// custom easing function called "custom" for scrollable
	$.easing.custom = function (x, t, b, c, d) {
		var s = 1.70158; 
		if ((t/=d/2) < 1) return c/2*(t*t*(((s*=(1.525))+1)*t - s)) + b;
		return c/2*((t-=2)*t*(((s*=(1.525))+1)*t + s) + 2) + b;
	}
	

	// did you know scroller
    if (jQuery('#gbl_sidebox_dyk .content').length != 0)
    {
        $('#gbl_sidebox_dyk .content').cycle({
        fx:'fade',        // choose your transition type, ex: fade, scrollUp, shuffle, etc...
        speed: 3000,    // speed of transition
        timeout: 10000,    // time elapsed between start of next transition
        pause: 1,        // pause when mouse hovers over slide
        random: 1        // show slides in random order instead of sequential
        });    
    }
    


	// load the calendar
	 $('#gbl_calendar').fullCalendar({
        // put your options and callbacks here
        events: "/schedule/events.json",		// event JSON feed
		loading: function(bool) {				// loading text
			if (bool) $('#gbl_loading').show();
			else $('#gbl_loading').hide();
		},
		/*
	    eventClick: function(event) {			// open event URL in new window - DISABLED FOR LEGO
	        if (event.url) {
	            window.open(event.url);
	            return false;
	        }
	    },
	    */
		eventRender: function(event, element) {	// load tooltips using qtip plugin
		
		  if ( ($.browser.mozilla) && (navigator.appVersion.indexOf("Mac")!=-1) ) { // for Qtip target: 'mouse' not working in FireFox on Mac, so use non-mouse tooltips
            element.qtip({
                            content : '<strong>' + event.title + '</strong>' + '<br />' + event.venue + '<br />' + event.address,
                            position: {target: false, corner: {tooltip: 'bottomLeft', target: 'topLeft'}, adjust: {y:-5}},
                            style   : {
                            			tip: 'bottomLeft',
                            			name: 'dark',
                            			width: 300,
                            			border: {
                            					  width: 7,
                            					  radius: 5
                            					}
                            		  }
                         });
		  } else { // all other browsers and OS
            element.qtip({
                            content : '<strong>' + event.title + '</strong>' + '<br />' + event.venue + '<br />' + event.address,
                            position: {target: 'mouse', corner: {tooltip: 'bottomLeft', target: 'topLeft'}, adjust: {y:-5}},
                            style   : {
                            			tip: 'bottomLeft',
                            			name: 'dark',
                            			width: 300,
                            			border: {
                            					  width: 7,
                            					  radius: 5
                            					}
                            		  }
                         });
		  } // end if-else
        }
     });
     

     
	// calendar right side nav links
	$('#gbl_sidebox_archives li a').click(function () {
		var monthId = $(this).attr('id');
		$('#gbl_calendar').fullCalendar( 'gotoDate', 2011, monthId ); // month is 0-based, meaning January=0, February=1, etc.
		return false;
    });
     
    if (jQuery('#enter_link').length != 0)
    {           
        jQuery('#enter_link').overlay();    
    }
     if (jQuery('#rules_link').length != 0)
    {           
        jQuery('#rules_link').overlay();    
    }
     if (jQuery('#disclaimer_link').length != 0)
    {           
        jQuery('#disclaimer_link').overlay();    
    }
    
    jQuery('#or_link').click(function(e){
        e.preventDefault();
        jQuery('#disclaimer').hide();
        jQuery("#rules_link").trigger('click');
    });
    
    
    

}); // End of jQuery Ready function





// Functions

