
		function newurl(url,name) {
			newwindow = window.open(url,name,'height=768,width=1024,resizable=0');
			if (window.focus) {newwindow.focus()}
			return false;
		}


		window.onresize = myResize;

		function myResize() {

			//if(getWindowWidth()<"1110") { 23.02.
			if(getWindowWidth()<"1410") {

				//$("body").css("overflow", "auto");

			} else {

				$("body").css("overflow", "hidden");

			}
			
			if(getWindowWidth()<"1490") { //23.02.
			//if(getWindowWidth()<"1280") {

				//var scrollOffset = "1280";
				var scrollOffset = "1492"; //23.02.

				//scrollOffset = Math.round((1280-getWindowWidth())/2);
				scrollOffset = Math.round((1492-getWindowWidth())/2); //23.02.
				$.scrollTo(scrollOffset+"px", 5, {axis:'x'} );				
			}
		}
		
		function getWindowWidth() {
			var windowWidth = 0;
			if (typeof(window.innerWidth) == 'number') {
				windowWidth = window.innerWidth;
			}
			else {
				if (	document.documentElement && document.documentElement.clientWidth) {
					windowWidth = document.documentElement.clientWidth;
				}
				else {
					if (document.body && document.body.clientWidth) {
						windowWidth = document.body.clientWidth;
					}
				}
			}
			return windowWidth;
		}

		function CacheImages()
		{
		  if (!document.images) return;

		  var img_names = new Array(
			"portfolio3.png",
			"kontakti5.jpg",
			"1.png",
			"2.png"
		  );

		  var imgs = new Array();

		  for (var i = 0; i < img_names.length; i++)
		  {
			imgs[i] = new Image();
			imgs[i].src = img_names[i];
		  }
		}

		$(document).ready(function() {	
			
			if(getWindowWidth()<"1400") {

				//$("body").css("overflow", "auto");

			} else {

				$("body").css("overflow", "hidden");

			}
			$("#bumbina").show();
			
			CacheImages();


			if(getWindowWidth()<"1490") { //23.02.
			//if(getWindowWidth()<"1280") {

				//var scrollOffset = "1280";
				var scrollOffset = "1492"; //23.02.

				//scrollOffset = Math.round((1280-getWindowWidth())/2);
				scrollOffset = Math.round((1492-getWindowWidth())/2); //23.02.
				$.scrollTo(scrollOffset+"px", 5, {axis:'x'} );				
			}

			tasiite_change_frame();
			bumbinja_change_frame();
			bumbinja_random();

		})

		function hover_item(item,new_src) {
		
			var el = document.getElementById(item);
			el.src=new_src;

			if(new_src=="portfolio-open-image.jpg") {
				$("#kontakti_img").attr("src","kontakti5.jpg");				
			}

			if(new_src=="portfolio_1.jpg") {
				$("#kontakti_img").attr("src","kontakti_3.jpg");
			}

			if(new_src=="aviize_2.jpg") {
				//$("#tasiite_img").attr("src","/fake-tase.jpg");
			}

			if(new_src=="aviize_1.jpg") {
				//$("#tasiite_img").attr("src","/tasiite.gif");
			}

		}

		var gl_timing = false;	

		function ramiishi() {	

			gl_timing = true;

			setTimeout(function(){ if(gl_timing==true){ $("#klienti_img").attr("src","klienti_2.jpg");}} , 500);
			setTimeout(function(){ if(gl_timing==true){ $("#klienti_img").attr("src","klienti_3.jpg");}} , 1000);
			setTimeout(function(){ if(gl_timing==true){ $("#klienti_img").attr("src","klienti_4.jpg");}} , 1500);
			setTimeout(function(){ if(gl_timing==true){ $("#klienti_img").attr("src","klienti_1.jpg");}} , 2150);
		}

		function ramiishi_e() {

			gl_timing=false; // timing bug
			clearTimeout();

			$("#klienti_img").attr("src","klienti_1.jpg");


		}

		var current_frame = 1;
		var current_frame_b = 1;
		var t;
		var tb;
		var tbr;
		var gl_count=0;

		var gl_visible = 1;

		function tasiite_change_frame() {

			t=setTimeout("tasiite_change_frame()",300);

			$("#tasiite_img").attr("src","tasiite_anim_"+current_frame+".png");
			if(current_frame<4) { current_frame = current_frame+1; } else { current_frame=1; }

		}

		function bumbinja_change_frame() {
				$('.bumbinas').hide();

			/*if(gl_visible==1) {

				tb=setTimeout("bumbinja_change_frame()",300);

				$("#bumbina_img").attr("src","bumbinas/"+current_frame_b+".png");
				if(current_frame_b<2) { current_frame_b = current_frame_b+1; } else { current_frame_b=1; }

			}*/

		}

		function go_to(where) {

			window.location=where;

		}

		function bumbinja_random() {
			var rand = Math.ceil(Math.random()*9);
				var main = $("#main").offset();
			if(rand>6)
			{
				$("#bumbina1").show();

				//console.log(main.left + ' - ' + main.top);

				//$("#bumbina1").css('left', main.left+'px');

			}
			else if (rand>3)
			{
				$("#bumbina2").show();
				//$("#bumbina2").css('left', main.left+'px');
			} else {
				$("#bumbina3").show();
			}
			
			tbr=setTimeout("bumbinja_random()", 7000);
			tb=setTimeout("bumbinja_change_frame()",750);
//			tbr=setTimeout("bumbinja_random()", 500);
//			tb=setTimeout("bumbinja_change_frame()",300);

		}

		function openUrl(url)
		{
			newwindow=window.open(url,'name','height=750,width=1024');
			if (window.focus) {newwindow.focus()}
			return false;
		}


