

function vi(nu)
{
		$(".viii").hide();
		$(".i"+nu).show();
}

po = Array();
po[0]="left";
po[1]="top";
po[2]=-1;
po[3]=1;

var poz;
$(document).ready(function(){
	var heiW = $(document).height();
	var heiE = $("#page").height();
	var marTB = 0;
	if (heiW>heiE)	{marTB = (heiW-heiE)/2;}
	$(".index").css({margin: marTB+"px auto"});
	$(document).pngFix(); 
});

$(window).load(function () {
	
	
	$(".index img").animate({"opacity":0.8}, 1000);
	poz =  $("#Iportf").position();
	
	$(".index table").hover(function(){
		poz =  $(this).position();
		$(this).stop().css({"z-index":10}).animate({left: poz.left*1 + po[rand(2,3)]*rand(5,12)+"px",top: poz.top*1 +po[rand(2,3)]*rand(5,12)+"px"}, 600);
	},function(){
		$(this).stop().animate({left: poz.left,"top":poz.top}, 400).css({"z-index":1});
	});
	
	$("#topnavi li a").hover(function(){
		$(this).stop().animate({"left": "-5px"}, 200).animate({"left": "5px"}, 300).animate({"left": "0px"}, 200);
	},function(){
		$(this).stop().animate({"left": 0}, 400);
	});
	
	$(".index img").hover(function(){
		$(this).stop().css({"z-index":10}).animate({width: "100%","opacity":1}, 400);
	},function(){
		$(this).stop().animate({width: "90%","opacity":0.8}, 400).css({"z-index":1});
	});
	
	$("#fore li a").hover(function(){
		$(this).children("span.wite").stop().animate({"opacity": "1"}, 100).animate({"opacity": "0"}, 300).parent("a").children("span.ssil").animate({"opacity": "0.6"}, 100);
	},function(){
		$(this).children("span.ssil").stop().animate({"opacity": "0"}, 100);
	});
	$("td").hover(function(){$("#jquery_jplayer_1").jPlayer("play");},function(){});
	$("a").hover(function(){$("#jquery_jplayer_1").jPlayer("play");},function(){});
	$(".fsz").click(function(){   $("#jquery_jplayer_1").jPlayer("play");});
	
	$(".fsz").hover(function(){
			$(this).stop().animate({"opacity": "0.2"}, 100).animate({"opacity": "1"}, 200);
		},function(){
			$(this).stop().animate({"opacity": "0.8"}, 500);
			});
			
	$(".minimg").hover(function(){
		
		$(this).stop().animate({"opacity": "0.2"}, 100).animate({"opacity": "1"}, 200);
	},function(){
		$(this).stop().animate({"opacity": "0.8"}, 500);
	});

});

function nuk()
{
	$(this).stop().animate({"opacity": "0.2"}, 100).animate({"opacity": "1"}, 200);
}


/* for menu */
var IE;
	var st = 1, rt =0;
	var top = -180;
	var k = 0.50;

	var menuActive = 0;
	
	
	function menus (num)
	{
		if (num!=menuActive)
		{
			menuClose ();
			menuActive=num;
			$(".menu"+num).stop(false,true).css({display: ""});		
			$(".menu"+num).stop(false,true).children(".ev").animate({left: "0", opacity: "1"}, 200);		
			$(".menu"+num).stop(false,true).children(".od").animate({left: "0", opacity: "1"}, 200);
		}
	}
	
	function menuClose ()
	{
		$('#topnav ul li ul').css({display: "none"});
		
		menuActive=0;	
	}
	
	$(function (){
		menuClose ();
			$('ul#topnavi li').hover(
				function() {
					$(this).find('ul').show();		
					$(this).find('ul:first').stop(false,true).children(".ev").animate({left: "0", opacity: "1"}, 200);		
					$(this).find('ul:first').stop(false,true).children(".od").animate({left: "0", opacity: "1"}, 200);
				},
				function() {
					$(this).find('ul').stop(false,true).children(".ev").animate({left: "-50px", opacity: "0"}, 200);		
					$(this).find('ul').stop(false,true).children(".od").animate({left: "50px", opacity: "0"}, 200);	
					setTimeout(function(){
							$(this).find('ul').hide();
					},200);
					$(this).find('ul').stop(false,true).css({display: "none"});
				}
			);    
	});
	
	$(function (){
			$('ul.men li div').hover(
				function() {		
					$(this).find('a.sveta').stop(false,true).animate({opacity: "1"}, 500);
				},
				function() {
					$("a.sveta").stop(false,true).animate({opacity: "0"}, 500);
					}
			);    
	});


function rand (min, max) {
    var argc = arguments.length;
    if (argc === 0) {
        min = 0;
        max = 2147483647;
    } else if (argc === 1) {
        throw new Error('Warning: rand() expects exactly 2 parameters, 1 given');
    }
    return Math.floor(Math.random() * (max - min + 1)) + min;
}
