// jQuery
jQuery(function() {
	function scrollbarWidth() {
		document.body.style.overflow = 'hidden';
		var width = document.body.clientWidth;
		document.body.style.overflow = 'scroll';
		width -= document.body.clientWidth;
		if(!width) width = document.body.offsetWidth-document.body.clientWidth;
		document.body.style.overflow = '';
		return width;
	}
	$('#content').css({'padding-left':scrollbarWidth()+'px'});
	// Safari Detection
	if($.browser.safari){
		$('body').addClass('safari');
	}
	// Advanced CSS
	$('div.speakerDiv:even').addClass('clear');
	// Menu Effects
	setTimeout(function(){$("#wrapper").maxScaleCompare(["#footer","#header","#headerMenu"],true);},20);
	setTimeout(function(){$("#wrapper").maxScaleCompare(["#footer","#header","#headerMenu"],false);},300);
	$('#headerMenu li a[href*=register], #headerMenu li.current img[src*=register]').parent().attr('id','register-btn');
	// Sign Up & Contact Forms
	$('input[type="text"]').addClass('text');
	$('input[type="submit"]').addClass('submit');
	$('input[type="submit"]').hover(function(){
		$(this).addClass('hover');
	},function(){
		$(this).removeClass('hover');
	});
	// Add to calendar drop down
	$("a#callink").click(function(){
		return false;
	});
	$("li#calendar > ul.dropdown").superfish({
		delay:       500,                             // .5 second delay on mouseout 
      animation:   {opacity:'show',height:'show'},  // fade-in and slide-down animation 
      speed:       'fast',                          // faster animation speed 
      autoArrows:  false,                           // disable generation of arrow mark-up 
      dropShadows: false
	}).find('a').not('#callink').click(function(){
		var url = $(this).attr('href');
		var id = $(this).parent().attr('id');
		if (id == 'outlook' || id == 'ical') {
			document.location.href = url;
		} else {
			window.open(url, 'calendar', 'toolbar=yes, menubar=yes, location=yes, status=yes, scrollbars=yes,resizable=yes, width=800, height=600, left=0, top=0');
		}
		$(this).parent().parent(':hidden').show().css('visibility','visible');
		return false;
	});
	//$("li#calendar > ul.dropdown");.find('ul').bgIframe({opacity:false});
});
