function velicinaProzora() {
  var myWidth = 0, myHeight = 0;
  if( typeof( window.innerWidth ) == 'number' ) {
    //Non-IE
    myWidth = window.innerWidth;
    myHeight = window.innerHeight;
  } else if( document.documentElement &&
      ( document.documentElement.clientWidth || document.documentElement.clientHeight ) ) {
    //IE 6+ in 'standards compliant mode'
    myWidth = document.documentElement.clientWidth;
    myHeight = document.documentElement.clientHeight;
  } else if( document.body && ( document.body.clientWidth || document.body.clientHeight ) ) {
    //IE 4 compatible
    myWidth = document.body.clientWidth;
    myHeight = document.body.clientHeight;
  }
  ret = new Array();
  ret[0]=myWidth;
  ret[1]=myHeight;
  return ret;
}
function setContainerPos(){
	ws = velicinaProzora();
	if(document.getElementById('mainContainer')){
		mc = document.getElementById('mainContainer');
		v = mc.offsetHeight;
		if(ws[1]>v){
			margin = Math.round(v/2);
		}else{
			margin = Math.round(ws[1]/2);
		}
		mc.style.marginTop="-"+margin+"px";
	}
}

$(document).ready(function(){

  $("#myController").jFlow({
	  slides: "#slides",
	  controller: ".jFlowControl", // must be class, use . sign
	  slideWrapper : "#jFlowSlide", // must be id, use # sign
	  selectedWrapper: "jFlowSelected",  // just pure text, no sign
	  auto: true,		//auto change slide, default true
	  width: "610px",
	  height: "160px",
	  duration: 400, // transition
	  slideInterval: 6000,
	  prev: ".jFlowPrev", // must be class, use . sign
	  next: ".jFlowNext" // must be class, use . sign
  });

  $("#myControllerPartners2").jFlow({
	  slides: "#partnersSlides",
	  controller: ".jFlowControl", // must be class, use . sign
	  slideWrapper : "#jFlowSlidePartners", // must be id, use # sign
	  selectedWrapper: "jFlowSelected2",  // just pure text, no sign
	  auto: true,		//auto change slide, default true
	  width: "658px",
	  height: "85px",
	  duration: 250, // transition
	  slideInterval: 12000,
	  prev: ".jFlowPrev2", // must be class, use . sign
	  next: ".jFlowNext2" // must be class, use . sign
  });
  
  $("a.danLink").simpletooltip()
  
  $(".with-tooltip").simpletooltip();
  
   $("a[rel=popup]").fancybox({
	'transitionIn'		: 'none',
	'transitionOut'		: 'none',
	'titlePosition' 	: 'over',
	'titleFormat'		: function(title, currentArray, currentIndex, currentOpts) {
		return '<span id="fancybox-title-over">' + (currentIndex + 1) + ' / ' + currentArray.length + (title.length ? ' &nbsp; ' + title : '') + '</span>';
	}
});

});

  /**
*
*	simpleTooltip jQuery plugin, by Marius ILIE
*	visit http://dev.mariusilie.net for details
*
**/
(function($){ $.fn.simpletooltip = function(){
	return this.each(function() {
		var text = $(this).attr("title");
		$(this).attr("title", "");
		if(text != undefined) {
			$(this).hover(function(e){
				var tipX = e.pageX + 12;
				var tipY = e.pageY + 12;
				$(this).attr("title", ""); 
				$("body").append("<div id='simpleTooltip' style='position: absolute; z-index: 100; display: none;'>" + text + "</div>");
				if($.browser.msie) var tipWidth = $("#simpleTooltip").outerWidth(true)
				else var tipWidth = $("#simpleTooltip").width()
				$("#simpleTooltip").width(tipWidth);
				$("#simpleTooltip").css("left", tipX).css("top", tipY).fadeIn("medium");
			}, function(){
				$("#simpleTooltip").remove();
				$(this).attr("title", text);
			});
			$(this).mousemove(function(e){
				var tipX = e.pageX + 12;
				var tipY = e.pageY + 12;
				var tipWidth = $("#simpleTooltip").outerWidth(true);
				var tipHeight = $("#simpleTooltip").outerHeight(true);
				if(tipX + tipWidth > $(window).scrollLeft() + $(window).width()) tipX = e.pageX - tipWidth;
				if($(window).height()+$(window).scrollTop() < tipY + tipHeight) tipY = e.pageY - tipHeight;
				$("#simpleTooltip").css("left", tipX).css("top", tipY).fadeIn("medium");
			});
		}
	});
}})(jQuery);

