jQuery(document).ready(function () {

 //  Body no select 
function disableselect(e){
return false
}

function reEnable(){
return true
}

//if IE4+
document.onselectstart=new Function ("return false")

//if NS6
if (window.sidebar){
document.onmousedown=disableselect
document.onclick=reEnable
}

	$.address.init(function(event) {
		
	
	}).change(function(event){
		if(event.value!="/"){ 
			loadContent(event.value);
		}else{
			loadContent("main.php");
		}
		setButtonClass($("a[href='" +event.value.substring(1,event.value.length)+ "']"))
	})
	
	function setButtonClass(theButton){
	
		$('.nav a').removeClass("active");
		theButton.addClass("active");
		
		
			$.address.title($.address.title().split(' | ')[0] + ' | ' + $('a[class="active"]').text());
	}	
	
	var contentLoader;
	
	function loadContent(content){
		$(".content").fadeOut(300,function(){
		
			$(".preloader").show();
								
    $('.nav a').bind('click', function() {
		pause_slideshow();  
    });


            /*	if(contentLoader){
				contentLoader.abort();
			}
			contentLoader = $.ajax({
    			url: content,
    			success: function(){
					$(".content").fadeIn(400);
					$(".content").show()
					$(".preloader").hide();
					var theImage = $('.content').find('img');
					theImage.preload({placeholder:'src/images/preloader.gif', onRequest: function(){theImage.fadeOut()}, onRequest:function(){theImage.fadeOut(0);}, onFinish:function(){theImage.fadeIn("slow")}});
    			}
			}); */
			
			

			
			
			
			$(this).load(content, function(){
			$(this).fadeIn(500);
			$(".preloader").hide();
			var theImage = $('.content').find('#Loading-thumb');
			theImage.preload({placeholder:'images/loading.gif', onComplete:function(data){$(data.original).fadeOut(0);$(data.original).fadeIn('slow')}});
				

			});
		})
	}
	
	
	
	
	
	
	
	
	
	
	
})				

