function startTime()
{
	var today=new Date();
	var h=today.getHours();
	var m=today.getMinutes();
	var s=today.getSeconds();
	var y=today.getFullYear();
	var d=today.getDate();
	var monthstxt=["Sausio", "Vasario", "Kovo", "Balandžio", "Gegužės", "Birželio", "Liepos", "Rugpjūčio", "Rugsėjo", "Spalio", "Lapkričio", "Gruodžio"];
	var month=monthstxt[today.getMonth()];
	
	m=checkTime(m);
	s=checkTime(s);
	document.getElementById('laikas').innerHTML=h+":"+m+":"+s;
	document.getElementById('data').innerHTML=month+" "+d+", "+y;
	t=setTimeout('startTime()',500);
}

function checkTime(i)
{
	if (i<10)
  	{
  		i="0" + i;
  	}
	return i;
}

function addToFavorites(title, url)
{
	if (window.sidebar) // firefox 
	{		
		//window.sidebar.addPanel(title, url, ""); Dont use until it's fixed
   		alert('Spauskite CTRL + D, norėdami pridėti svetainę į adresyną.');
   	}
	else if(window.opera && window.print) // opera
	{ 
		var elem = document.createElement('a');
		elem.setAttribute('href',url);
		elem.setAttribute('title',title);
		elem.setAttribute('rel','sidebar');
		elem.click();
	} 
	else if(document.all) // ie
	{
		window.external.AddFavorite(url, title);
	}
}

function setHomepage(url)
{
	if (document.all)
    {
        document.body.style.behavior='url(#default#homepage)';
  		document.body.setHomePage(url);
    }
    else if (window.sidebar)
    {
    	if(window.netscape)
    	{
         	try
   			{  
	            netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");  
         	}  
         	catch(e)  
         	{  
    			alert("Firefox naršyklėje namų puslapį galima nustatyti tik rankiniu būdų. (Tools -> Options -> Home Page)");  
         	}
    	} 
    	var prefs = Components.classes['@mozilla.org/preferences-service;1'].getService(Components. interfaces.nsIPrefBranch);
    	prefs.setCharPref('browser.startup.homepage', url);
 	}
}

