$(document).ready(function(){

	generateSprites(".navT", "current-", true, 350, "fade");
	generateSprites(".nav", "current-", true, 350, "fade");
	

	$.fn.cycle.defaults = { 
	    timeout:       4000,  // milliseconds between slide transitions (0 to disable auto advance) 
	    speed:         1000,  // speed of the transition (any valid fx speed value) 
	    next:          null,  // id of element to use as click trigger for next slide 
	    prev:          null,  // id of element to use as click trigger for previous slide 
	    before:        null,  // transition callback (scope set to element to be shown) 
	    after:         null,  // transition callback (scope set to element that was shown) 
	    height:       'auto', // container height 
	    sync:          1,     // true if in/out transitions should occur simultaneously 
	    fit:           0,     // force slides to fit container 
	    pause:         0,     // true to enable "pause on hover" 
	    delay:         0,     // additional delay (in ms) for first transition (hint: can be negative) 
	    slideExpr:     null   // expression for selecting slides (if something other than all children is required) 
	};

	$('#slideshow').cycle()

	$('#affiliations').cycle()

	$("a[rel^='prettyPhoto']").prettyPhoto({
		theme:'light_square',
		showTitle: false
	});
	


	$('.readMore').click(function () { 
		//$('#contentLoader').fadeIn(500);
		var elemId = $(this).attr('id');
		//alert($(this).attr('class'))
		var currentPage = 'pages/'+$(this).attr('id')+'.html';
		$('#contentLoader').load(currentPage);
		$('#column').fadeOut(200, function(){
			$('#contentLoader').fadeIn(200);
			$('#gallery a').lightBox();
		});
		
    });

	$('.backButton').live("click", function(){
			$('#column').fadeIn(500);
			$('#contentLoader').fadeOut(200, function(){
				$('#contentLoader').unload();
			});
	 });

	$(".rollover").hover(function() {
		$(this).attr("src", $(this).attr("src").split(".").join("-hover."));
	}, function() {
		$(this).attr("src", $(this).attr("src").split("-hover.").join("."));
	});
 

	$("#printButton").click(function () { 
		$('#interior').jqprint();  
    });

	$(".pseudoClick").hover(function () {
		$(this).addClass("hover");
    }, function () {
		$(this).removeClass("hover");
    });

	var originalFontSize = $('html').css('font-size');
	$(".resetFont").click(function(){
		$('html').css('font-size', originalFontSize);
	});
	  
	// Increase Font Size
	$(".increaseFont").click(function(){
		var currentFontSize = $('html').css('font-size');
		var currentFontSizeNum = parseFloat(currentFontSize, 10);
		var newFontSize = currentFontSizeNum*1.2;
		$('html').css('font-size', newFontSize);
			return false;
	});
	  
	// Decrease Font Size
	$(".decreaseFont").click(function(){
		var currentFontSize = $('html').css('font-size');
		var currentFontSizeNum = parseFloat(currentFontSize, 10);
		var newFontSize = currentFontSizeNum*0.8;
		$('html').css('font-size', newFontSize);
	    	return false;
	});
	
	var click = false;
	
	$("#toggleFont").click(function(){
		var currentFontSize = $('html').css('font-size');
		var currentFontSizeNum = parseFloat(currentFontSize, 10);
		//alert(currentFontSizeNum);
		if(click==true) {
			var newFontSize = currentFontSizeNum-2;
			click=false;
		} else {
			var newFontSize = currentFontSizeNum+2;
			click=true;
		}
		$('html').css('font-size', newFontSize);
	    	return false;
	});

	$(".slideClick").click(function () {
		if ($(".introHidden").is(":hidden")) {
		$(".introHidden").slideDown("slow");
	} else {
		$(".introHidden").slideUp("slow");
	}
	});

});
