$(document).ready(function(){
	$('#department-announcement-teaser, #department-announcement, #news-headlines, #ezine-signup').corner();
	$('#department-announcement-teaser,#department-announcement').click(function(){$('#department-announcement').slideToggle();});
	$('#full-story').click(function(){$('#full-story').fadeOut('slow');});

	$('#news-stories').cycle({
	    fx:    'fade',
	    pause:  1,
	    cleartype: 1
	});

	// Rollover Images
	$('#section-links img').hover(
		function() {src = $(this).attr('src'); $(this).attr('src',src.replace(/off\./,'on.'));},
		function() {src = $(this).attr('src'); $(this).attr('src',src.replace(/on\./,'off.'));}
	);
	
	$("a.showMe").click(function(){ 
		//$(this).slideUp('slow');
		$(this).parent().slideUp('slow');
		$(this).parent().next().slideDown('slow');
	});	
	$("a.hideM").click(function(){ 
		$(this).parent().slideUp('slow');
		$(this).parent().prev().slideDown('slow');
	});	
		
	//Code for showing hidden forms 
	$("a.link-show").click(function(){ 
		$(".hideme").slideToggle("slow");
	}); 
	
	var readmoretext = false;	
	$("a.displayToggle").click(function() {
		$("div.short",$(this).parent()).toggle();
		$("div.long",$(this).parent()).toggle();
		if($(this).text() != 'close'){
			readmoretext = $(this).text();
			$(this).text('close');
		} else {
			$(this).text(readmoretext);
		}	
	});

	//Code for table sorter
	$.tablesorter.defaults.widgets = ['zebra'];
	$("#contentlisttable").tablesorter(  { headers: { 4: { sorter: false}, 5: { sorter: false} }}  ); 
	$("#contentlisttable2").tablesorter(  { headers: { 2: { sorter: false}, 3: { sorter: false} }}  ); 

});

function readFullStory(headline, story, photo, photocaption) {
	$('#full-story > div h1').html(headline);
    if(photocaption != '') {
		$('#full-story > div h2').html(photocaption).css('display','block');
	} else {
		$('#full-story > div h2').css('display','none');
	}
	if(photo != '') {
		$('#full-story > div img').attr('src','assets/dev_pics/'+photo).css('display','block');
	} else {
		$('#full-story > div img').css('display','none');
	}
	$('#full-story > div p').html(story);
	$('#full-story').fadeIn('slow');
}

/*function switchMenu(obj) {
	var e1 = document.getElementById(obj);
	if (e1.style.display != 'none') {
		e1.style.display = 'none';
	} else {
		e1.style.display = '';
	}
}*/

