
	var subS = null;
	var mainS = null;
	
		function findMenu(elem){
			if(elem == currElem)
				return false;
			/*
			$(".options").each(function(){	
				$(this).removeClass("menuItemHover");
			});*/resetMenus();
			elem.addClass("menuItemHover");
			toggleSubMenus(elem.attr("id"));
			if(mainS)
				clearTimeout(mainS);
			mainS = setTimeout('resetMenus()',5000);
		}
			
		function findSubMenu(elem){
			$(".subMenuItem").each(function(){	
				$(this).removeClass("subMenuItemHover");
			});
			elem.addClass("subMenuItemHover");
		}

		function resetMenus(){
			currElem = null;
			$(".options").each(function(){	
				$(this).removeClass("menuItemHover");
			});
			$(".subMenuItem").each(function(){	
				$(this).removeClass("subMenuItemHover");
			});
			$(".subMenuHolder").each(function(){
				if(! $(this).is(":hidden"))
					$(this).slideUp("slow");
					$(this).css("display","none");
			});
		}

		function toggleSubMenus(clss){
			if(mainS)
				clearTimeout(mainS);
			$(".subMenuHolder").each(function(){
				if(! $(this).is(":hidden"))
					$(this).slideUp("slow");
					//$(this).css("display","none");
			});
			$(".subMenuHolder").each(function(){
				if($(this).is(":hidden") && $(this).get(0) == $(".subMenuHolder."+clss).get(0))
					$(".subMenuHolder."+clss).slideDown("slow");
			});
		}
	
		function toggleOptions(jObj){
			$(".activeRightElemHold").each(function(){
				if($(this).attr("isBig") == 1){
					$(this).animate({height:20},500);
					//$(this).css("height","20")
					$(this).attr("isBig","0");
				}								
			});
			jObj.attr("isBig",1);
			jObj.animate({height:150},500);
		}

		function actBanner(el){
			currBanElem = ++el;
			var pScroll = 200;
			var sTime = 1000;
			if(currBanElem > $("#bannerCount").val()){
				currBanElem=1;
				pScroll=pScroll*($("#bannerCount").val()-1);
				sTime=sTime*$("#bannerCount").val()/2;
				//alert("dizem za "+pScroll);
				$('.activeContentHolder').animate({scrollTop: '-='+pScroll+'px'}, sTime);
				bannerTick = setTimeout("actBanner(currBanElem);",5000);
				$(".bannerName").each(function(){
					$(this).removeClass("bannerNameHover");
					if($(this).attr("curr") == currBanElem)
						$(this).addClass("bannerNameHover");
				});
				setTimeout('switchBannerTxt(currBanElem)',1000);
				return;
			}
			$('.activeContentHolder').animate({scrollTop: '+='+pScroll+'px'}, sTime);
			$(".bannerName").each(function(){
				$(this).removeClass("bannerNameHover");
				if($(this).attr("curr") == currBanElem)
					$(this).addClass("bannerNameHover");
			});
			setTimeout('switchBannerTxt(currBanElem)',1000);
			bannerTick = setTimeout("actBanner(currBanElem);",5000);
		}

		function getBanner(el){
			var pos = el-currBanElem;
			if(pos>0){
				$('.activeContentHolder').animate({scrollTop: '+='+Math.abs(pos*200)+'px'}, 500);
			} else {
				$('.activeContentHolder').animate({scrollTop: '-='+Math.abs(pos*200)+'px'}, 500);
			}
			currBanElem = el;
			$(".bannerName").each(function(){
				$(this).removeClass("bannerNameHover");
				if($(this).attr("curr") == currBanElem)
					$(this).addClass("bannerNameHover");
			});
			setTimeout('switchBannerTxt(currBanElem)',1000);
		}

		function switchBannerTxt(currBanElem){
			$(".bannerDesc").each(function(){
				$(this).hide();
				if($(this).attr("curr") == currBanElem)
				$(this).show("slow");
			});
		}

		var currElem = null;
		var currBanElem = 0;
		var bannerTick = null;
		$(document).ready(function(){
			/* Body scroling */

			// initialize scrollable 
			$("div.scrollable").scrollable({ 
				vertical:true,  
				clickable:false,
				size: 1 
			// use mousewheel plugin 
			}).mousewheel();   

			$(".browse").mousedown(function(){
				if($(this).attr("isUp") == 1)
					$(this).find('img').attr("src","_style/images/arrow_bl_up.gif");
				else
					$(this).find('img').attr("src","_style/images/arrow_bl_down.gif");
			});
			$(".browse").mouseup(function(){
				if($(this).attr("isUp") == 1)
					$(this).find('img').attr("src","_style/images/arrow_up.gif");
				else
					$(this).find('img').attr("src","_style/images/arrow_down.gif");

				var pScroll = 120;
				if($(this).attr("whos"))
					if($(this).attr("isUp") == 1){
						/*$('.bodyNextPage').removeClass("disabled");*/
						$('#'+$(this).attr("whos")).animate({scrollTop: '-='+pScroll+'px'}, 500);
					} else {
						$('#'+$(this).attr("whos")).animate({scrollTop: '+='+pScroll+'px'}, 500);
						/*
						if($('#bodyText').offset().top-$('#bodyText').height()>0)
							$(this).addClass("disabled");*/
					}
			});
			$(".bodyHeightHolder").mouseover().mousescroll(function(objEvent, intDelta){
				if (intDelta > 0){
					$(this).animate({scrollTop: '-=120px'}, 100);
				}
				else if (intDelta < 0){
					$(this).animate({scrollTop: '+=120px'}, 100);
				}
			});
			// animates main menu 
			$(".options").mouseenter(function(){
				if(currElem && $(this).get(0) == currElem.get(0))
					return false;
				findMenu($(this));
				currElem = $(this);
			});	

			$(".subMenuItem").mouseenter(function(){
				if(mainS)
					clearTimeout(mainS);
				findSubMenu($(this));
			});	
			$(".subMenuItem").mouseout(function(){
				mainS = setTimeout('resetMenus()',1000);
			});	

			// ACTIVE ELEMS 

			// dodeli event 
			$(".activeRightElemHold").click(function(){
				if($(this).attr("isBig") == 1)
					return false;
				toggleOptions($(this));
			});
			// setuj pocetni 
			$(".activeRightElemHold").each(function(){
				if($(this).attr("isBig") == 1)
					toggleOptions($(this));		
			});
			
			$(".activeRightElemHoldElem").mouseenter(function(){
				$(".activeRightElemHoldElem").each(function(){
					$(this).removeClass("activeRightElemHoldElemHover");
				});
				$(this).addClass("activeRightElemHoldElemHover");
			});

			$(".Linkable").each(function(){
				if($(this).attr("href") != ""){
					$(this).html($(this).html()+'<img src="_style/images/arrow_bl_link.gif" align="AbsMiddle">');
					$(this).mouseenter(function(){
						$(this).css("cursor","pointer");
						$(this).css("color","gray");
					});
					$(this).mouseout(function(){
						$(this).css("cursor","default");
						$(this).css("color","black");
					});
					$(this).click(function(){
						if($(this).attr("remote") == 0)
							document.location = "index.cfm?menu="+$(this).attr("href");
						else
							window.open($(this).attr("href"));
						//alert('odo na link '+$(this).attr("href"));
					});
				}
			});

			var pos = $(".menuHolder").position();
			//$(".MenuStripe").css("top",pos.top+40);
			//$(".MenuStripe").css("top",pos.top+40);
			pos.top+=40;
			$(".MenuStripe").animate({top: "+"+pos.top+"px"}, 2000);

			$(".bannerName").click(function(){
				clearTimeout(bannerTick);
				getBanner($(this).attr("curr"));
				bannerTick = setTimeout("actBanner(currBanElem);",10000);
			});
			bannerTick = setTimeout("actBanner(currBanElem);",1000);
		});
