$(document).ready(function() {
	var current = "";
	t=document.getElementById("harakteristiki_img");
	h=document.getElementById("otvarqne_img");
	d=document.getElementById("start");
	z=d.innerHTML;
	$("#content").html(z);
	
	$('#nav #harakteristiki a').click(function(){		
		if(t.src == "http://tunador.com/images/description.jpg") {
		var toLoad = "start";	
		} else {
		var toLoad = $(this).attr('href');
		}
		$('#content').hide('fast',loadContent);
		$('#load').remove();
		$('#wrapper').append('<span id="load">LOADING...</span>');
		$('#load').fadeIn('normal');
		window.location.hash = $(this).attr('href');
		function loadContent() {
			d=document.getElementById(toLoad);
			z=d.innerHTML;
			$("#content").html(z,'',showNewContent());
		}
		function showNewContent() {
			$('#content').show('normal',hideLoader());
			if(t.src=='http://tunador.com/images/features.jpg') {
			t.src='http://tunador.com/images/description.jpg';	
			} else {
			t.src='http://tunador.com/images/features.jpg';
			}
		}
		function hideLoader() {
			$('#load').fadeOut('normal');
		}
		return false;
		
	});
	
	$('#nav #otvarqne a').click(function(){		
		if(h.src == "http://tunador.com/images/description.jpg") {
		var toLoad = "start";	
		} else {
		var toLoad = $(this).attr('href');
		}
		$('#content').hide('fast',loadContent);
		$('#load').remove();
		$('#wrapper').append('<span id="load">LOADING...</span>');
		$('#load').fadeIn('normal');
		window.location.hash = $(this).attr('href');
		function loadContent() {
			d=document.getElementById(toLoad);
			z=d.innerHTML;
			$("#content").html(z,'',showNewContent());
		}
		function showNewContent() {
			$('#content').show('normal',hideLoader());
			if(h.src=='http://tunador.com/images/description.jpg') {
			h.src='http://tunador.com/images/opening.jpg';	
			} else {
			h.src='http://tunador.com/images/description.jpg';
			}
		}
		function hideLoader() {
			$('#load').fadeOut('normal');
		}
		return false;
		
	});
	
	function back(){						  
		var toLoad = $(this).attr('href');
		$('#content').hide('fast',loadContent);
		$('#load').remove();
		$('#wrapper').append('<span id="load">LOADING...</span>');
		$('#load').fadeIn('normal');
		window.location.hash = $(this).attr('href');
		function loadContent() {
			d=document.getElementById("start");
			z=d.innerHTML;
			$("#content").html(z,'',showNewContent());
		}
		function showNewContent() {
			$('#content').show('normal',hideLoader());
		}
		function hideLoader() {
			$('#load').fadeOut('normal');
		}
		return false;
		
	}


});