var sc_project=3149458;
var sc_invisible=0;
var sc_partition=33;
var sc_security="169b072c";
var t=[0,0,0,0,0,0,0,1];
var ss=0;
function bid(id)
{
	return document.getElementById(id);
}

function setTheme(thisValue,notThis)
{
	if(thisValue!=notThis)
	{
		bid('theme').href='http://213.186.62.212:4444/e-stopwatch/'+thisValue+'.css';
		var cdate=new Date();
		cdate.setTime(cdate.getTime()+1000*60*60*24*7);
		document.cookie="theme="+escape(thisValue)+";expires="+cdate.toGMTString();
	}
}

function setSize(thisValue,notThis)
{
	if(thisValue!=notThis)
	{
		bid('disp').style.font='bold '+thisValue+'px Tahoma';
		var cdate=new Date();
		cdate.setTime(cdate.getTime()+1000*60*60*24*7);
		document.cookie="size="+escape(thisValue)+";expires="+cdate.toGMTString();
	}
}

function stopStart()
{
	if(ss==0)
	{
		ss=1;
		bid('stopStart').style.textDecoration='underline';
	}
	else
	{
		ss=0;
		bid('stopStart').style.textDecoration='none';
	}
	
	t[t[2]]=(new Date()).valueOf();
	t[2]=1-t[2];
	if (0==t[2])
	{
		clearInterval(t[4]);
		t[3]+=t[1]-t[0];
		bid('lap').innerHTML+='<b>'+(t[7]++)+':</'+'b> '+format(t[1]-t[0])+'<br>';
		t[4]=t[1]=t[0]=0;
		setIt();
	}
	else
	{
		t[4]=setInterval('setIt();',64);
	}
}

function setIt()
{
	if (t[2]) t[1]=(new Date()).valueOf();
	t[6].value=format(t[3]+t[1]-t[0]);
}

function format(ms)
{
	var d=new Date(ms+t[5]).toString().replace(/.*([0-9][0-9]:[0-9][0-9]:[0-9][0-9]).*/,'$1');
	var x=String(ms%1000);
	while (x.length<3) x='0'+x;
	d+='.'+x;
	return d;
}

function bodyStart()
{
	if(window.location!='http://{lng_lng}.e-stopwatch.eu/') parent.location.href='http://{lng_lng}.e-stopwatch.eu/';
	else load();
}

function load()
{
	bid('mail').innerHTML='<'+'a h'+'ref="m'+'ailto:'+'m'+'e'+''+'@w'+'alerian'+'.'+'info">'+'me'+''+'@'+'walerian'+'.'+'in'+'fo'+'<'+'/'+'a>';
	bid('tb').innerHTML='<b>e-Stopwatch</'+'b><div> <select onchange="setTheme(this.value,\'{lng_theme}\');"> <option value="{lng_theme}">{lng_theme}</'+'option> <option value="GrayStripes">GrayStripes</'+'option> <option value="DarkStripes">DarkStripes</'+'option> <option value="DarkGreen">DarkGreen</'+'option> <option value="Native">Native</'+'option>  <option value="LightBlue">LightBlue</'+'option> <option value="LightBeige">LightBeige</'+'option> <option value="BlackAndWhite">BlackAndWhite</'+'option> <option value="DarkButGay">DarkButGay</'+'option> </'+'select> <select onchange="setSize(this.value,\'{lng_size}\');"> <option value="{lng_size}">{lng_size}</'+'option> <option value="60">1</'+'option> <option value="120">2</'+'option> <option value="180">3</'+'option> <option value="240">4</'+'option>  <option value="300">5</'+'option> <option value="360">6</'+'option> </'+'select> <select onchange="parent.location.href=\'http://\'+this.value+\'.e-stopwatch.eu/\';"> <option value="{lng_language}">{lng_language}</'+'option> <option value="de">Deutsch</'+'option> <option value="en">English</'+'option> <option value="es">Español</'+'option> <option value="fr">Française</'+'option> <option value="it">Italiano</'+'option> <option value="pl">Polski</'+'option> </'+'select> <input id="info" type="button" onclick="if(this.value==\'{lng_about}\'){bid(\'ib\').style.display=\'block\';this.value=\'{lng_about} (X)\'}else{bid(\'ib\').style.display=\'none\';this.value=\'{lng_about}\';}" onfocus="this.blur();" value="{lng_about}"></'+'div><br>';
	bid('ib').style.display='none';
	t[5]=new Date(1970,1,1,0,0,0,0).valueOf();
	t[6]=bid('disp');
	setIt();
}

document.onkeypress=function(e)
{
	var e=window.event||e;
	var keyunicode=e.charCode||e.keyCode;
	if(keyunicode==32)
	{
		stopStart(bid('stopStart'));
	}
}

