// JavaScript Document

//var url = location.href;
//var lang = "";
//(url.indexOf("/en/") > 0)?lang="en":null;
//(url.indexOf("/it/") > 0)?lang="it":null;
//if(lang=="") {lang="sr"}

var tip_sr = ["кликните за преглед услуга", "изаберите услугу"];
var tip_en = ["click to view services", "select a service"];
var tip_it = ["clicca per vedere i servizi", "scegli un servizio"];
var tip = tip_sr;
if (lang == "en") {tip = tip_en}
if (lang == "it") {tip = tip_it}

	$(document).ready(function() {
		
		$(".link-box").css('display', 'none');
		$(".service-box").hover(
								function() { 
									$("h2", this).css('color','#f58220');
									$(".tip", this).css({'text-decoration' : 'underline', 'color' : '#666'})
								},
								function() { 
									$("h2", this).css('color','#2d5385');
									$(".tip", this).css({'text-decoration' : 'none', 'color' : '#999'})
								}
		);
		$(".service-box").bind("click", function (e) {
			  var minus = 155;
			  if ($(" + .link-box", this ).hasClass("open") == false) {

				  if ($(this).prev().hasClass("open")) {
					  minus += $(this).prev().height()+30;
				  }
				  $(".open" ).slideUp("fast").removeClass("open");
			  }
			  
			  if ($(" + .link-box", this ).css("display") == "none")
			  {
				  var offset = $(this).offset();
				  var y = offset.top;
				  window.scrollTo(0,y-minus); 
			  }
				
			  $(" + .link-box", this ).slideToggle("fast").toggleClass("open");
			  ($(".tip", this).html() == tip[0]) ? $(".tip", this).html(tip[1]):$(".tip",this).html(tip[0]);
			  
		  
		});;						   
	})
	
	

