var progres_bar;
var t;
$(function()
{
	$("div#preloader").css({"height": $("#content").height()});
	$("img#ipreloader").css("margin-top", (($("#content").height()/2)-32));
	
	$("#icon_move_up").hover(function(){
		t = setInterval(function(){
			$("#content").scrollTop($("#content").scrollTop()-5);
		}, 30);
	}, function(){
		clearInterval(t);
	});
	$("#icon_move_down").hover(function(){
		t = setInterval(function(){
			$("#content").scrollTop($("#content").scrollTop()+5);
		}, 30);
	}, function(){
		clearInterval(t);
	});

	$("#open").click(function()
	{
		$("#slide_menu_top").slideDown("slow");
		$("#open").hide();
		$("#close").show();
		return false
	});
	$("#close").click(function()
	{
		$("#slide_menu_top").slideUp("slow");
		$("#open").show();
		$("#close").hide();
		return false
	});
	$("#progress_one").hover(function()
	{
		clearInterval(progres_bar);
		$("#progress_box").hide();
		$("#progress_box_two").hide();
		$("#progress_box_three").hide();
		$("#progress_box_one").fadeIn();
		return false;
	},
	function()
	{
	progres_bar = setInterval(function(){
		$("#progress_box_one").hide();
		$("#progress_box_two").hide();
		$("#progress_box_three").hide();
		$("#progress_box").fadeIn();
		clearInterval(progres_bar);
	}, 10000);
	
	});
	$("#progress_two").hover(function()
	{
		clearInterval(progres_bar);
		$("#progress_box").hide();
		$("#progress_box_one").hide();
		$("#progress_box_three").hide();
		$("#progress_box_two").fadeIn();
		return false;
	},
	function()
	{
	progres_bar = setInterval(function(){
		$("#progress_box_one").hide();
		$("#progress_box_two").hide();
		$("#progress_box_three").hide();
		$("#progress_box").fadeIn();
		clearInterval(progres_bar);
	}, 10000);
	
	});
	$("#progress_three").hover(function()
	{
		clearInterval(progres_bar);
		$("#progress_box").hide();
		$("#progress_box_one").hide();
		$("#progress_box_two").hide();
		$("#progress_box_three").fadeIn();
		return false;
	},
	function()
	{
	progres_bar = setInterval(function(){
		$("#progress_box_one").hide();
		$("#progress_box_two").hide();
		$("#progress_box_three").hide();
		$("#progress_box").fadeIn();
		clearInterval(progres_bar);
	}, 10000);
	
	});
});

function load_site(name)
{

	$.ajax({
	url:"site.php",
	timeout:10000,
	type:"POST",
	async:true,
	data:{name: name},
	dataType:"html",
	success:function(data) {
		$("#site_content").empty();
		$("#site_content").append(data);

		delete data;
	},
	error:function()
	{
		alert("Error");
	},
	beforeSend:function()
	{
		$("#site_content").fadeOut("fast", function(){
			$("#content").scrollTop(0);
			$("div#preloader").fadeIn("fast");
		});

	},
	complete:function()
	{
		
		$("#preloader").fadeOut("fast", function(){
			$("#site_content").fadeIn("fast");
		});
	}
	});


}
