	function topimg(l_plotis,l_aukstis,imgurl,base)
	{
		var l_aukstis2 = l_aukstis + 0;		// lango aukstis
		var l_plotis2 = l_plotis + 0;			// 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='+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 topimg2(l_plotis,l_aukstis,imgurl,image_numb,base)
	{
		var l_aukstis2 = l_aukstis + 0;		// lango aukstis
		var l_plotis2 = l_plotis + 0;			// 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/topimg2.php?imgurl='+imgurl+'&n='+image_numb+' ','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 n = Math.random();
		var newWindow = window.open(''+base+'inc/topvideo.php?video='+videourl,'V','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 + 0;		// lango aukstis
		var l_plotis2 = l_plotis + 0;			// 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?imgurl'+imgurl, 'I'+title2, '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 toppage(l_plotis,l_aukstis,id,base)
	{
		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/toppage.php?'+id+'..','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 startCountdown(){
	   
	   for (i=0; i<20; i++) {
		   if (g_iCount[i]>0) {
			   if( (g_iCount[i] - 1) >= 0){
				   
					   g_iCount[i] = g_iCount[i] - 1;
						
					   vsego_s=g_iCount[i];
					   vsego_m=g_iCount[i]/60;
					   vsego_c=g_iCount[i]/(60*60);
					   vsego_d=g_iCount[i]/(24*60*60);			   
								   
					   casy = Math.floor(vsego_c-Math.floor(vsego_d)*24 );
					   minuty = Math.floor(vsego_m-Math.floor(vsego_c)*60 );
					   secund = Math.floor(vsego_s-Math.floor(vsego_m)*60 );
					   
					   vsego_d=Math.floor(vsego_d);
					   
					   vsego_d=''+vsego_d;
					   casy=''+casy;
					   minuty=''+minuty;
					   secund=''+secund;
					   
					   if (vsego_d.length==1) vsego_d='0'+vsego_d; 
					   if (casy.length==1) casy='0'+casy; 
					   if (minuty.length==1) minuty='0'+minuty;
					   if (secund.length==1) secund='0'+secund;
					   
					  document.getElementById('days'+i).innerHTML = vsego_d;
					  document.getElementById('hour'+i).innerHTML = casy;
					  document.getElementById('minut'+i).innerHTML = minuty;
					  document.getElementById('sec'+i).innerHTML = secund;
					 
					  
                      
			   }
		   }   
	   }
	   setTimeout('startCountdown()',1000);
}
//-----------------------------------------------------------------------------------
var old_id = Number(10);
old_id=0;
function pages(block,page,sm) {
	xmlHttp=createXmlHttpRequestObject()
	if (xmlHttp==null)
	{
		alert ("Narykle nepalaiko HTTP Request / Pasirinkimas neimanomas");
		return;
	} 
	var url="act/results.php";
	
	xmlHttp.onreadystatechange=function()
		{
			if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete") {
				var act_response = xmlHttp.responseText.split('::');
				
				
				if (block!='') {
					document.getElementById('results').innerHTML = act_response[1];	
					document.getElementById('allpoints').innerHTML = act_response[2];
					
					document.getElementById('res'+block).style.display = 'none';
					document.getElementById('restext'+block).style.display = '';
					
					document.getElementById('rescont'+block).className = 'result_bar_text_container2';
					document.getElementById('resbg'+block).className = 'result_bar_text_container2bg';
					
					
					
					if ( old_id!='0' ) {
						document.getElementById('res'+old_id).style.display = '';
						document.getElementById('restext'+old_id).style.display = 'none';
						
						document.getElementById('rescont'+old_id).className = 'result_bar_link_container_02';
						document.getElementById('resbg'+old_id).className = '67';
					}
					old_id=block;
				} else {
					//document.getElementById('results').innerHTML = "test";
				}	
				
				
				//
			}
		}
	xmlHttp.open("POST",url,true);
	// if ($i==$current_page) echo 'numbers_03'; else echo 'numbers_01'; 
	// if ($i==$current_page) echo 'numbers_02'; else echo 'number_element';
	
	if(sm==0){
		parameters = "block="+block+"&page="+page;
	}else if(sm!='order'){
		parameters = "block="+block+"&page="+page+"&sm=1";
	}else if(sm=='order'){
		parameters = "block="+block+"&page="+page+"&order=1";	
	}	
	xmlHttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
	xmlHttp.setRequestHeader("Content-length", parameters.length);
	xmlHttp.setRequestHeader("Connection", "close");
	xmlHttp.send(parameters);
}
function auto(block,page,sm) {
	xmlHttp=createXmlHttpRequestObject()
	if (xmlHttp==null)
	{
		alert ("Narykle nepalaiko HTTP Request / Pasirinkimas neimanomas");
		return;
	} 
	var url="act/auto.php";
	
	xmlHttp.onreadystatechange=function()
		{
			if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete") {
				var act_response = xmlHttp.responseText.split('::');
				
				
				if (block!='') {
					document.getElementById('results').innerHTML = act_response[1];	
					document.getElementById('allpoints').innerHTML = act_response[2];
					
					document.getElementById('res'+block).style.display = 'none';
					document.getElementById('restext'+block).style.display = '';
					
					document.getElementById('rescont'+block).className = 'result_bar_text_container2';
					document.getElementById('resbg'+block).className = 'result_bar_text_container2bg';
					
					
					
					if ( old_id!='0' ) {
						document.getElementById('res'+old_id).style.display = '';
						document.getElementById('restext'+old_id).style.display = 'none';
						
						document.getElementById('rescont'+old_id).className = 'result_bar_link_container_02';
						document.getElementById('resbg'+old_id).className = '67';
					}
					old_id=block;
				} else {
					//document.getElementById('results').innerHTML = "test";
				}	
				
				
				//
			}
		}
	xmlHttp.open("POST",url,true);
	// if ($i==$current_page) echo 'numbers_03'; else echo 'numbers_01'; 
	// if ($i==$current_page) echo 'numbers_02'; else echo 'number_element';
	
	if(sm==0){
		parameters = "block="+block+"&page="+page;
	}else if(sm!='order'){
		parameters = "block="+block+"&page="+page+"&sm=1";
	}else if(sm=='order'){
		parameters = "block="+block+"&page="+page+"&order=1";	
	}	
	xmlHttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
	xmlHttp.setRequestHeader("Content-length", parameters.length);
	xmlHttp.setRequestHeader("Connection", "close");
	xmlHttp.send(parameters);
}
