function topimgx_news2(l_plotis,l_aukstis,imgurl,title,base)
	{
		var l_aukstis2 = l_aukstis + 20;		// lango aukstis
		var l_plotis2 = l_plotis + 20;			// lango plotis
		if (title!=true) { var title2 = (Math.round((Math.random()*999)+1)); }	else { var title2="mg"; }
		var winl = screen.width/2-l_plotis/2;
		var wint = screen.height/2-l_aukstis/2;
		var newWindow = window.open("/inc/topimg_news_02.php?image="+imgurl+"&title="+title+"","","height="+l_aukstis+",width="+l_plotis+",top="+wint+",left="+winl+", buttons=no, scrollbars=no, location=no, menubar=no, resizable=no, status=no, directories=no, toolbar=no, titlebar=no");
	}
	
function topimg(l_plotis,l_aukstis,imgurl,base)
	{
		var l_aukstis2 = l_aukstis + 20;		// lango aukstis
		var l_plotis2 = l_plotis + 20;			// lango plotis
		var winl = screen.width/2-l_plotis/2;
		var wint = screen.height/2-l_aukstis/2;
		var n = Math.random();
		var newWindow = window.open(''+base+'inc/topimg.php?'+imgurl+'..','I','height='+l_aukstis2+',width='+l_plotis2+',top='+wint+',left='+winl+',  buttons=no, scrollbars=no, location=no, menubar=no, resizable=no, status=no, directories=no, toolbar=no');
	}
	/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
	function topprod(l_plotis,l_aukstis,imgurl,base)
	{
		var l_aukstis2 = l_aukstis;		// lango aukstis
		var l_plotis2 = l_plotis;			// lango plotis
		var winl = screen.width/2-l_plotis/2;
		var wint = screen.height/2-l_aukstis/2;
		var n = Math.random();
		var newWindow = window.open(''+base+'inc/topprod.php?'+imgurl+'..','P','height='+l_aukstis2+',width='+l_plotis2+',top='+wint+',left='+winl+',  buttons=no, scrollbars=no, location=no, menubar=no, resizable=no, status=no, directories=no, toolbar=no');
	}
	/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
	function topvideo(videourl,base)
		{
			var l_aukstis = 240 + 80;		// lango aukstis
			var l_plotis = 320 + 20;		// lango plotis
			var winl = screen.width/2-l_plotis/2;
			var wint = screen.height/2-l_aukstis/2;
			var newWindow = window.open('http://www.kvadratu.lt/inc/topvideo.php?video='+videourl,'0','height='+l_aukstis+',width='+l_plotis+',top='+wint+',left='+winl+',  buttons=no, scrollbars=no, location=no, menubar=no, resizable=no, status=no, directories=no, toolbar=no');
	}
	/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
	function topvideo2(videourl,base)
		{
			var l_aukstis = 240 + 101;		// lango aukstis
			var l_plotis = 320 + 20;		// lango plotis
			var winl = screen.width/2-l_plotis/2;
			var wint = screen.height/2-l_aukstis/2;
			var newWindow = window.open('http://www.kvadratu.lt/inc/topvideo2.php?video='+videourl,'0','height='+l_aukstis+',width='+l_plotis+',top='+wint+',left='+winl+',  buttons=no, scrollbars=no, location=no, menubar=no, resizable=no, status=no, directories=no, toolbar=no');
	}
	/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
	function topvideo3(videourl,base)
		{
			var l_aukstis = 240 + 101;		// lango aukstis
			var l_plotis = 320 + 20;		// lango plotis
			var winl = screen.width/2-l_plotis/2;
			var wint = screen.height/2-l_aukstis/2;
			var newWindow = window.open('http://www.kvadratu.lt/inc/topvideo3.php?video='+videourl,'0','height='+l_aukstis+',width='+l_plotis+',top='+wint+',left='+winl+',  buttons=no, scrollbars=no, location=no, menubar=no, resizable=no, status=no, directories=no, toolbar=no');
	}
	/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
	function topaudio(audiourl,base)
	{
		var l_aukstis = 30 + 10;		// lango aukstis
		var l_plotis = 210 + 10;		// lango plotis
		var winl = screen.width/2-l_plotis/2;
		var wint = screen.height/2-l_aukstis/2;
		var n = Math.random();
		var newWindow = window.open(''+base+'inc/topaudio.php?'+audiourl+'..','I','height='+l_aukstis+',width='+l_plotis+',top='+wint+',left='+winl+',  buttons=no, scrollbars=no, location=no, menubar=no, resizable=no, status=no, directories=no, toolbar=no');
	}
	/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
	function topimgx(l_plotis,l_aukstis,imgurl,title,base)
	{
		var l_aukstis2 = l_aukstis + 20;		// lango aukstis
		var l_plotis2 = l_plotis + 20;			// lango plotis
		if (title!=true) { var title2 = (Math.round((Math.random()*999)+1)); }	else { var title2="mg"; }
		var winl = screen.width/2-l_plotis/2;
		var wint = screen.height/2-l_aukstis/2;
		var newWindow = window.open(" "+base+"inc/topimg.php?image="+imgurl+"&title="+title+"","","height="+l_aukstis+",width="+l_plotis+",top="+wint+",left="+winl+", buttons=no, scrollbars=no, location=no, menubar=no, resizable=no, status=no, directories=no, toolbar=no, titlebar=no");
	}
	function topimgx_news(l_plotis,l_aukstis,imgurl,title,base)
	{
		var l_aukstis2 = l_aukstis + 20;		// lango aukstis
		var l_plotis2 = l_plotis + 20;			// lango plotis
		if (title!=true) { var title2 = (Math.round((Math.random()*999)+1)); }	else { var title2="mg"; }
		var winl = screen.width/2-l_plotis/2;
		var wint = screen.height/2-l_aukstis/2;
		var newWindow = window.open("/inc/topimg_news.php?image="+imgurl+"&title="+title+"","","height="+l_aukstis+",width="+l_plotis+",top="+wint+",left="+winl+", buttons=no, scrollbars=no, location=no, menubar=no, resizable=no, status=no, directories=no, toolbar=no, titlebar=no");
	}
	function topimgx_news2(l_plotis,l_aukstis,imgurl,title,base)
	{
		var l_aukstis2 = l_aukstis + 20;		// lango aukstis
		var l_plotis2 = l_plotis + 20;			// lango plotis
		if (title!=true) { var title2 = (Math.round((Math.random()*999)+1)); }	else { var title2="mg"; }
		var winl = screen.width/2-l_plotis/2;
		var wint = screen.height/2-l_aukstis/2;
		var newWindow = window.open("/inc/topimg_news_02.php?image="+imgurl+"&title="+title+"","","height="+l_aukstis+",width="+l_plotis+",top="+wint+",left="+winl+", buttons=no, scrollbars=no, location=no, menubar=no, resizable=no, status=no, directories=no, toolbar=no, titlebar=no");
	}
	/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
	function send_link()
	{
		
		l_plotis = 400;
		l_aukstis = 220;
		var winl = screen.width/2-l_plotis/2;
		var wint = screen.height/2-l_aukstis/2;
		var n = Math.random();
		var newWindow = window.open('http://www.kedainietis.lt/inc/send_link.php','P','height='+l_aukstis+',width='+l_plotis+',top='+wint+',left='+winl+', buttons=no, scrollbars=no, location=no, menubar=no, resizable=no, status=no, directories=no, toolbar=no');
	}
	
	function print_wind(news)
	{
		
		l_plotis = 650;
		l_aukstis = 600;
		var winl = screen.width/2-l_plotis/2;
		var wint = screen.height/2-l_aukstis/2;
		var n = Math.random();
		var newWindow = window.open('http://www.kedainietis.lt/inc/print.php?news='+news,'P','height='+l_aukstis+',width='+l_plotis+',top='+wint+',left='+winl+', buttons=no, scrollbars=yes, location=no, menubar=no, resizable=no, status=no, directories=no, toolbar=no');
	}
	
	function setsmile(smiley)
	{
		document.getElementById('text').value+=smiley;
	}
	function replay_message(replay)
	{
		document.getElementById('text').value+=":replay:"+replay+":replay:";
	}
	
	function badmessage(id) {
			if (confirm("Ar tikrai komentaras netinkamas?")) {
					document.getElementById('bad').value=id;
					document.getElementById('bad_coment').submit();
			} else {
				
			}

	}
	function topimgx_news2(l_plotis,l_aukstis,imgurl,title,base)
	{
		var l_aukstis2 = l_aukstis + 20;		// lango aukstis
		var l_plotis2 = l_plotis + 20;			// lango plotis
		if (title!=true) { var title2 = (Math.round((Math.random()*999)+1)); }	else { var title2="mg"; }
		var winl = screen.width/2-l_plotis/2;
		var wint = screen.height/2-l_aukstis/2;
		var newWindow = window.open("/inc/topimg_news_02.php?image="+imgurl+"&title="+title+"","","height="+l_aukstis+",width="+l_plotis+",top="+wint+",left="+winl+", buttons=no, scrollbars=no, location=no, menubar=no, resizable=no, status=no, directories=no, toolbar=no, titlebar=no");
	}
	
	
	function submenu(id) {
		if (  document.getElementById(id).style.display == 'none' ) {
			document.getElementById(id).style.display = '';
			
		} else {
			document.getElementById(id).style.display = 'none';
		}
		
	}
	// Skalbimu tab perjungimas
	var oldtab_id = Number(10);
	oldtab_id = 'tab_01';
	
	function tabselect(id) {
		if ( oldtab_id!=0 ){
			document.getElementById(oldtab_id).style.borderBottom = '0px';
			document.getElementById(oldtab_id+'_layer').style.display = 'none';
		}
		document.getElementById(id).style.borderBottom = '1px solid #fff';
		document.getElementById(id+'_layer').style.display = '';
		oldtab_id = id;
	}
	//=======================
	
	// Naujienu Tab perjingims
	var oldnewstab_id = Number(10);
	oldnewstab_id = 'n_tab_01';
	
	function news_tabselect(id) {
		if ( oldnewstab_id!=0 ){
			document.getElementById(oldnewstab_id).style.borderBottom = '0px';
			document.getElementById(oldnewstab_id+'_layer').style.display = 'none';
		}
		document.getElementById(id).style.borderBottom = '1px solid #fff';
		document.getElementById(id+'_layer').style.display = '';
		oldnewstab_id = id;
	}
	//========================
	
	function badmessage(id) {
			if (confirm("Ar tikrai komentaras netinkamas?")) {
					document.getElementById('bad').value=id;
					document.getElementById('bad_coment').submit();
			} else {
				
			}

	}
	
	<!-- Begin TIme funciot
	var timerID = null;
	var timerRunning = false;
	function stopclock (){
	if(timerRunning)
	clearTimeout(timerID);
	timerRunning = false;
	}
	function showtime () {
	var now = new Date();
	var hours = now.getHours();
	var minutes = now.getMinutes();
	var seconds = now.getSeconds()
	var timeValue = "" + ((hours >12) ? hours :hours)
	if (timeValue == "0") timeValue = 0;
	timeValue += ((minutes < 10) ? ":0" : ":") + minutes
	//timeValue += ((seconds < 10) ? ":0" : ":") + seconds
	timeValue += (hours >= 12) ? " " : " "
	//document.clock.face.value = timeValue;//data_container
	document.getElementById('time_now').innerHTML = timeValue;
	timerID = setTimeout("showtime()",1000);
	timerRunning = true;
	}
	function startclock() {
	stopclock();
	showtime();
	}
	// End -->
	
	var skelbimai_text = '';
	function symbols_max() {
			len = document.getElementById('text').value.length;
			document.getElementById('count_chars').innerHTML=len;
			if ( len>149 ) {
				document.getElementById('text').value = skelbimai_text;
			} else {
				skelbimai_text	= document.getElementById('text').value;
			}
	}
	
	// AJAX FUNCTIONS
	
var old_id = Number(10);
var prev_id = Number(10);
var image_number = Number(100);
old_id=0;
image_number=1;

function images(block,page,sm) {
	
	//document.getElementById('content').innerHTML='<div style="margin-left:200px;"><img src="img/loading_01.gif">&nbsp; krauna...</div>';
	//document.getElementById('loading').className = 'loading_block_01';
	
	if ( block>0  ) {
		
		document.getElementById('loading_image').style.display = '';
		document.getElementById('gallery_image').className = 'loading_block_02'; 
	}
	
	
	
	
	xmlHttp=createXmlHttpRequestObject()
	if (xmlHttp==null)
	{
		alert ("Narykle nepalaiko HTTP Request / Pasirinkimas neimanomas");
		return;
	} 
	var url="/uvs/act/ajax.php";
	
	
	
	
	xmlHttp.onreadystatechange=function()
		{
			if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete") {
						
					
				if ( xmlHttp.responseText!=='undefined' ) {
						
					var act_response = xmlHttp.responseText.split(':::');
					
					if ( block>0 ) {
						document.getElementById('gallery_image').innerHTML = act_response[1];
						document.getElementById('image_counter').innerHTML = act_response[4];
						
						if ( document.getElementById('gallery_image').innerHTML == 'undefined' ) {
							images(block,page,sm);
						}
						document.getElementById('loading_image').style.display = 'none';
						document.getElementById('gallery_image').className = 'loaing_block_image'; 
						old_id = act_response[2];
						image_number = act_response[3];
						Lightview.updateViews();
					}
					
				} else {
					xmlHttp.open("POST",url,true);
				}
				
				//
			}
		}
	xmlHttp.open("POST",url,true);
	
	
	
	
	parameters = "block="+block+"&next="+old_id+"&number="+image_number;
	
	xmlHttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
	xmlHttp.setRequestHeader("Content-length", parameters.length);
	xmlHttp.setRequestHeader("Connection", "close");
	xmlHttp.send(parameters);
	
	
}
	// AJAX FUNCTIONS
	
	// IVIKAIAI
	function next_ivikis () {
		if ( ivikis_now >= ivikiai_all ) {
			ivikis_now = 0;
			document.getElementById('ivikis_'+(ivikiai_all)).style.display='none';
		} else {
			document.getElementById('ivikis_'+(ivikis_now)).style.display='none';
		}
		document.getElementById('ivikis_'+(ivikis_now+1)).style.display='';
		
		
		ivikis_now++;
		document.getElementById('ivikiai_counter').innerHTML = ivikis_now;
		
	}
	function prev_ivikis () {
		if ( ivikis_now <= 1 ) {
			ivikis_now = (ivikiai_all+1);
			document.getElementById('ivikis_'+(1)).style.display='none';
		} else {
			document.getElementById('ivikis_'+(ivikis_now)).style.display='none';
		}
		document.getElementById('ivikis_'+(ivikis_now-1)).style.display='';
		ivikis_now--;
		document.getElementById('ivikiai_counter').innerHTML = ivikis_now;
	}
	// IVIKAIAI
	
	function timeline(id){
		if ( document.getElementById(id).style.display != 'none'  ) {
			document.getElementById(id).style.display = 'none';
		} else {
			document.getElementById(id).style.display = '';	
		}
	}
	
	function replay_message(replay)
	{
		document.getElementById('text').value+="{replay}"+replay+"{replay}";
	}
	
	
	//  MEssages functions [begin]
	
	function WriteMmessage(to_id,action,mess_id)
	{
		if ( mess_id > 0  ) {
			
			var l_aukstis = 500;
			var l_plotis = 555;
			
		} else {
			
			var l_aukstis = 393;
			var l_plotis = 555;
			
		}
		var l_aukstis2 = l_aukstis + 20;		// lango aukstis
		var l_plotis2 = l_plotis + 20;			// lango plotis
		var winl = screen.width/2-l_plotis/2;
		var wint = screen.height/2-l_aukstis/2;
		var n = Math.random();
		window.open('http://'+top.location.host+'/uvs/inc/inc_usermailsend.php?send_to='+to_id+'&mes='+mess_id,'I','height='+l_aukstis2+',width='+l_plotis2+',top='+wint+',left='+winl+',  buttons=no, scrollbars=no, location=no, menubar=no, resizable=no, status=no, directories=no, toolbar=no');
	}
	function MessageClose(id) {
			TitleAlert = false;
			update_user('read',id,'');
			document.getElementById('message_now_content').style.display = 'none';
	}
	
	var old_title = document.title;
	var title_i = 0;
	var TitleAlert = true;
	var runTitleAlertOnce = true;
	function MessageTitleAlert(text) {
		if ( title_i==0 ) {
			title_i = 1;
			document.title = text;
		} else {
			title_i = 0;
			document.title = old_title;
		}
		if ( TitleAlert ) {
			setTimeout("MessageTitleAlert('"+text+"')",1000);
		} else {
			document.title = old_title;
		}
	}
	
	function DelMessages() {
		var answer = confirm ("Trinti žinutės?")
		if (answer) {
			document.getElementById('messages_form_action').submit();
		} else {
			
		}
		
	}
	// MEssages function [end]