$(document).ready(function(){
	$('a.inline').colorbox({width:"400px", height:"400px", iframe:true});
	$('a.lightbox').colorbox();
	
	$('#events dl:odd').addClass('zebra');
	
	$("img.rollovers").hover(function(){
		this.src = this.src.replace("_off","_on");
		},
		function(){
			this.src = this.src.replace("_on","_off");
		}
	);
	
	$("a.jqbookmark").click(function(event){
		event.preventDefault();
		var url = this.href;
		var title = this.title;
		
		if (window.sidebar) { // Mozilla Firefox Bookmark
			window.sidebar.addPanel(title, url,"");
		} else if( window.external ) { // IE Favorite
			window.external.AddFavorite( url, title);
		} else if(window.opera) { // Opera 7+
			return false; // do nothing
		} else { 
			 alert('Unfortunately, this browser does not support the requested action,'
			 + ' please bookmark this page manually.');
		}
	
	});
	
	$("ul.dropdown li").dropdown();
	
	$('#nav>li>ul').hide();
    $('#nav>li').mouseover(function(){
        // create a reference to the active element (this)
        // so we don't have to keep creating a jQuery object
        $heading = $(this);
        // check to see if any sub menus are open
        if ($heading.siblings().find('ul:visible').size()!=0) {
            // close open sub menus
            $heading.siblings().find('ul:visible').slideUp(100, function(){
                // open current menu if it's closed
                $heading.find('ul:hidden').slideDown(100);
            });
        }
        else {
            // open current menu if it's closed
            $heading.find('ul:hidden').slideDown(100);
        }
    });
});

$.fn.dropdown = function() {
	$(this).hover(function(){
		$(this).addClass("hover");
		$('> .dir',this).addClass("open");
		$('ul:first',this).css('visibility', 'visible');
	},function(){
		$(this).removeClass("hover");
		$('.open',this).removeClass("open");
		$('ul:first',this).css('visibility', 'hidden');
	});
}
