
$(document).ready(function(){

	if(document.getElementById('baner_0')!=undefined)
	{
		$("#baner_0").fadeIn(1000,function(){
			intervalID2 = setInterval("refresh_baner()", 5000);
		});
		
		$(".lin0").css('background','#6cc7ee');
		$(".lin0").css('color','#ffffff');
	}

	$('#next').click(function(){
		if(baner<baners-1)baner++; else baner = 0;
		showslide(baner);
	});
	$('#prev').click(function(){
		if(baner>0)baner--; else baner = baners-1;
		showslide(baner);
	});

	$("div#controller").jFlow({
            slides: "#slides",
            width: "112px",
            height: "158px"
        });
		
		$("div#controller8").jFlow2({
            slides: "#slides8",
            width: "430px",
            height: "19px"
        });


	$('.jez').mouseover(function(){
		$('.roz').slideDown(100);
	});
	$('a.zoom').lightBox();
	
	
	
});

var baners = 0;
var baner = 0;
function showslide(i)
{
	baner = i;
	clearInterval(intervalID2);
	//refresh_baner();
	//intervalID2 = setInterval("refresh_baner()", 5000);
	
	$("#baner_"+baner).css('z-index','2');
	$(".lin"+baner).css('background','#6cc7ee');
	$(".lin"+baner).css('color','#ffffff');

	$("#baner_"+baner).fadeIn(120,function()
	{
		for(i=0;i<baners;i++)
		{
			if(i!=baner)
			{
				$("#baner_"+i).css('display','none');
				$("#baner_"+baner).css('z-index','0');
			}
		}
	});
	
	for(i=0;i<baners;i++)
		{
			if(i!=baner)
			{
				
				$(".lin"+i).css('background','#d9dde0');
				$(".lin"+i).css('color','#797d85');
			}
		}
}
function refresh_baner()
{
	if(baner<baners-1)
	baner++; else baner = 0;

	$("#baner_"+baner).css('z-index','2');
	$(".lin"+baner).css('background','#6cc7ee');
	$(".lin"+baner).css('color','#ffffff');

	$("#baner_"+baner).fadeIn(1000,function()
	{
		for(i=0;i<baners;i++)
		{
			if(i!=baner)
			{
				$("#baner_"+i).css('display','none');
				$("#baner_"+baner).css('z-index','0');
			}
		}
	});
	for(i=0;i<baners;i++)
		{
			if(i!=baner)
			{
				$(".lin"+i).css('background','#d9dde0');
				$(".lin"+i).css('color','#797d85');
			}
		}

}


function getMousePos(e) { //you need the 'e', although it does NOT need to be defined
    //NS
    if (document.layers || document.getElementById && !document.all) {
        o = (window.innerWidth - 955) / 2;
        hide_preview(e.pageX - o, e.pageY)
        //document.getElementById("test").innerHTML=(e.pageX-o)+" "+(e.pageY)

    }
    //IE
    else if (document.body && document.all) {
		o = (document.body.clientWidth - 955) / 2;
        hide_preview(window.event.clientX - o, window.event.clientY)
        //document.getElementById("test").innerHTML=(window.event.clientX-o)+" "+(window.event.clientY)
    }

}

if (!window.captureEvents) document.onmousemove = getMousePos
if (window.captureEvents) {
    window.captureEvents(Event.MOUSEMOVE)
    window.onmousemove = getMousePos //e should not be defined
}



function hide_preview(x, y) {
    if ((x < 800 || x > 970) || (y < 2 || y > 100)) {
		$('.roz').slideUp(100);
    }
}

function getIEVersionNumber() {
    var ua = navigator.userAgent;
    var MSIEOffset = ua.indexOf("MSIE ");

    if (MSIEOffset == -1) {
        return 0;
    } else {
        return parseFloat(ua.substring(MSIEOffset + 5, ua.indexOf(";", MSIEOffset)));
    }
}

	


