//var tempLink;

$(function(){
/*
 	$(document).pngFix(); 
	positionFooter();
        
    $(window)
      .scroll(positionFooter)
      .resize(positionFooter);
    
    function positionFooter() {
      var docHeight = $(document.body).height() - $("#sticky-footer-push").height();
      if(docHeight < $(window).height()){
        var diff = $(window).height() - docHeight;
        if (!$("#sticky-footer-push").length > 0) {
          $("#footer").before('<div id="sticky-footer-push"></div>');
        }
        $("#sticky-footer-push").height(diff);
      } 
    }
	
	//on load init
					   
	var hash = window.location.hash.substr(1);
	var href = $('#nav li a').each(function(){
		var href = $(this).attr('href');
		if(hash==href.substr(0,href.length-5)){
			var toLoad = hash+'.html #page';
			$('#page').load(toLoad)
		}											
	});
	
*/
	$('#nav li a').click(function(){
		this.blur();
		var toLoad = $(this).attr('href') + '#loadedContent';
		
		$("#nav li a").removeClass("activeButton");
		$(this).addClass("activeButton");
		
		//tempLink.css({'background-color' : 'black'});
		//$(this).css({'background-color' : 'yellow'});
		
		//tempLink = $(this);
		
		$('.small').cycle('stop').remove();
		$('.big').cycle('stop').remove();
		
		$('#page').html('');
		//$('#page').fadeOut('fast', loadContent) ;//.load(toLoad,null,showNewContent());
		
		loadContent();
		
		function loadContent() {
			$('#page').load(toLoad);
		}
		function showNewContent() {
			$('#page').show();
			$('#loadpage').fadeIn('normal');
			$('#newslides').slideIn('normal');
		}

		return false;
	});
	/*
	$('.small').cycle({
	fx:     'fade', 
    random:  1,
	delay:  2000, 
    speed:  1000
    });
	
	$('.big').cycle({ 
	fx:     'fade', 
    random:  1,
    delay:  3000, 
    speed:  1000
    });
    
    $('#headerslide').cycle({ 
	fx:     'fade', 
    random:  1,
    delay:  3000, 
    speed:  3000
    });
*/
});