$(document).ready(function() {
	
	/*
	$("#inner").dropShadow();
	
	if($.browser.msie && $.browser.version=="9.0"){
		$("#inner").redrawShadow();
		$(window).resize(function() {
			$("#inner").redrawShadow();
		});
	}
	/*
	
	if($.browser.msie && $.browser.version=="7.0"){
		$('#inner').center(true);
		//$("#inner").redrawShadow();
	}
	
	/*
	if($.browser.msie && $.browser.version=="6.0"){
		$("#inner").removeShadow();
	}
	*/
	
	$("#image_only_cycle").cycle('fade');
	$("#standard_cycle").cycle('fade');
	
	$(".small_thumbnail").live("click", function(){
		var src = $(this).attr('href');
		if (src != $('#small_thumbnails_main_image').attr('src').replace(/\?(.*)/,'')) {
			$('#small_thumbnails_main_image').stop().animate({opacity:'0'},function(){
					$(this).attr('src',src);
			}).load(function(){
					$(this).stop().animate({opacity:'1'});
			});
		}
		return false;
	});
	
	$("div.large_thumbnail_container").live("click", function(){
		var href = $(this).find("a").attr("href");
		window.location = href;
	});
	
	if($('#active_page_anchor').length != 0){
		$('div.#content_col2').scrollTo( $('#active_page_anchor') );
	}
	/*if($('#publications_active').length != 0){
		$('div.#content_col2').scrollTo( $('#publications_active') );
	}*/
	
	$('#header a').click(function() {
		$('#header_nav li a').each(function(index) {
			$(this).removeClass('active');
		});
	});
	
	$('#header_nav li a').click(function() {
		$(this).addClass('active');
	});
	
	$.address.crawlable(true);
	
	$.address.change(function(event) {
		if(event.value != '/'){
			$('#content_container').load(event.value + ' #content', function(){
				$.swapImage(".swapImage");
				$("#image_only_cycle").cycle('fade');
				$("#standard_cycle").cycle('fade');
				
				if($('#active_page_anchor').length != 0){
					$('div.#content_col2').scrollTo( $('#active_page_anchor') );
				}
				
			});
			
		}
	});
	
	$("a.ajax_link").live("click", function(){
		$.address.value($(this).attr('href'));
		return false;
	});
	
	// FOR THE PORTAL
	$("div.category").live("click", function(){
		var href = $(this).find("a").attr("href");
		window.location = href;
	});
	
});
$.swapImage(".swapImage");
