$(window).ready( function() {

	$("#menu").css("cursor", "pointer");
	$("#photo").css("cursor", "pointer");
	$("#foto").css("cursor", "pointer");
	
	$("#photo").toggle( function() {
		var randT = Math.round(Math.random() * 60) + 1;
		var randL = Math.round(Math.random() * 60) + 1;
		$("body").css("background-image", "none");
		$("#foto").animate( {
			top : randT+"%",
			left : randL+"%"
		}, "100").animate( {
			opacity :"show"
		}, "300");
	}, function() {
		$("#foto").unload(
		$("#foto").animate( {
			opacity :"hide"
		}, "300"));
		$("body").css("background", "#FFF url(\"../img/logo.jpg\") no-repeat fixed 50% 50%");
	});
	$("#foto").click(function(){
		$("#foto").unload(
				$("#foto").animate( {
					opacity :"hide"
				}, "300"));
				$("body").css("background", "#FFF url(\"../img/logo.jpg\") no-repeat fixed 50% 50%");
		});
	var divs = new Array("mail", "phone", "icq");
	$("#menu").toggle( function() {
		for ( var i = 0; i < divs.length; i++) {
			var randT = Math.round(Math.random() * 87) + 1;
			var randL = Math.round(Math.random() * 87) + 1;

			$("#" + divs[i]).animate( {
				top :randT + "%",
				left :randL + "%"
			}, "100").animate( {
				opacity :"show"
			}, "300");
		}
	}, function() {
		for ( var i = 0; i < divs.length; i++) {
			$("#" + divs[i]).animate( {
				opacity :"hide"
			}, "300");
		}
	});
	/* - - - - - */
	$(".en").click( function() {
		$("#copy").html("Andrey N. Vasiliev &#169; 2008");
		$("#menu").css("right","61px").html("Contact");
		$("#photo").html("My photo");
	});
	$(".ru").click( function() {
		$("#copy").html("Андрей Васильев &#169; 2008");
		$("#menu").css("right","43px").html("Контакты");
		$("#photo").html("Фото");

	});
	$("#lang > img").hover( function() {
		$(this).css("cursor", "pointer");
	});

});
