///**************************************///				   
///*****     Browser Detection      *****///	
///**************************************///
function oldIE(){
	if (jQuery.browser.msie && parseInt(jQuery.browser.version) < 7) {
		return true;
	} else {
		return false;
	}
}

$(document).ready(function(){
///**************************************///				   
///*****      Superfish Menus       *****///	
///**************************************///
    $('ul.sf-menu').superfish({				  
		animation:   {height:'show'},
		delay:       1200
	});

///**************************************///				   
///*****         Search Box         *****///	
///**************************************///
    // Hide searchbox hint text when user enters search term
	$(".searchbox").focus( function () { $(this).addClass("searchboxshift"); });
    // Also hide hint text if searchbox is pre-populated with old value by browser
    if ($(".searchbox").val() != '') { $(".searchbox").addClass("searchboxshift"); }


///**************************************///				   
///*****         Event Menu         *****///	
///**************************************///
	if($('#eventSidebar').length > 0) {
	    var $widget = $("#eventSidebar");
	    var $window = $(window);
	    var $offset = $widget.offset();
	    var $initialMargin = $widget.css('marginTop');
		var $slideRegion = $(document).height() - 824;
		
	    $window.scroll(function() {
			if ($window.scrollTop() < $slideRegion) {
				if ($window.scrollTop() > $offset.top) {
					$widget.stop().animate({
						marginTop: $window.scrollTop() - ($offset.top - 120)
					});
				} else {
					$widget.stop().animate({
						marginTop: $initialMargin
					});
				}
			}
	    });
	}
	
	jQuery.extend( jQuery.easing,
	{
		easeOutSine: function (x, t, b, c, d) {
			return c * Math.sin(t/d * (Math.PI/2)) + b;
		},
		easeInBack: function (x, t, b, c, d, s) {
			if (s == undefined) s = 1.70158;
			return c*(t/=d)*t*((s+1)*t - s) + b;
		}
	});
	
	var snsTopHeight = $('#eventSidebar').height() + "px";
	$('ul#snsIcons li span').css( 'top', snsTopHeight ); 
	
	$("a.snsIcon").hover(function() { //Hover over event on list item
		$(this).find("span").show(); //Show the subnav
	} , function() { //on hover out...
		$(this).find("span").hide(); //Hide the subnav
	});

	
///***
});
///***