function maildo (kto,konto,domena,temat) {
  window.location='mailto:'+kto+'<'+konto+'@'+domena+'>?Subject='+temat;
}
function go(x) {
	var j=x.options[x.selectedIndex].value;	
	if(j != "")
	parent.location = j;
}

function Emot(text) {
	var txtarea = document.wpis.tresc;
	text = ' ' + text + ' ';
	if (txtarea.createTextRange && txtarea.caretPos) {
		var caretPos = txtarea.caretPos;
		caretPos.text = caretPos.text.charAt(caretPos.text.length - 1) == ' ' ? caretPos.text + text + ' ' : caretPos.text + text;
		txtarea.focus();
	} else {
		txtarea.value  += text;
		txtarea.focus();
	}
}

function p()
{
window.status=';-P'; return false;
}

function fotoal(i)
{
var l=(screen.width - 300) / 2 ;
var t=(screen.height - 300) / 2 ;
window.open('foto.php?id='+i,'foto','width=300, height=300, left=' + l + ', top=' + t + ', scrollbars=no, resizable=no, alwaysOnTop').focus(); 
}

function fotoaln(i)
{
var l=(screen.width - 300) / 2 ;
var t=(screen.height - 300) / 2 ;
window.open('foton.php?id='+i,'foto','width=300, height=300, left=' + l + ', top=' + t + ', scrollbars=no, resizable=no, alwaysOnTop').focus(); 
}

function checkAll() 
	{
	for(i = 0; i < document.lista.elements.length; i++) 
		{
		if(document.lista.elements[i].type == 'checkbox') 
			{
			document.lista.elements[i].click();
			}
		}
	}



function przesun_poplayer(sze,wys)
{
	var c = document.getElementById('poplayer');

	if (!c)
		return false;
	
	if (c.style)
		c = c.style;
	
	if (window.innerHeight)
		ih = window.innerHeight;
	else
		ih = document.body.clientHeight;
	
	if (window.innerWidth)
		iw = window.innerWidth;
	else
		iw = document.body.clientWidth;
	
	
	if (document.all) { 
		
		c.pixelLeft = sze + document.body.scrollLeft;
		c.pixelTop = wys + document.body.scrollTop;
	
	} else {
		c.left = sze + window.pageXOffset;
		c.top = wys + window.pageYOffset;
	
	}
setTimeout('przesun_poplayer(' + sze + ',' + wys+ ')',50); 

}

function ocwjazd(o)
{
var nro= new Array;
nro[1]='<div class="tekstm" style="margin-left:5px;">1</div>';
nro[2]='<div class="tekstm" style="margin-left:20px;">2</div>';
nro[3]='<div class="tekstm" style="margin-left:35px;">3</div>';
nro[4]='<div class="tekstm" style="margin-left:50px;">4</div>';
nro[5]='<div class="tekstm" style="margin-left:65px;">5</div>';
nro[6]='<div class="tekstm" style="margin-left:80px;">6</div>';
document.getElementById('nroc').innerHTML=nro[o];
for(i = 1; i < o+1; i++) 
	{
document.getElementById('oc'+i).style.backgroundColor='Maroon';
	}
}

function oczjazd(o)
{
var c = new Array;
c[1]='#f8f8f8';
c[2]='#f2f2f2';
c[3]='#eeeeee';
c[4]='#dddddd';
c[5]='#cccccc';
c[6]='#bbbbbb';

for(i = 1; i < o+1; i++) 
	{
document.getElementById('oc'+i).style.backgroundColor=c[i];
}
document.getElementById('nroc').innerHTML='<div class="tekst" style="width:90px;text-align:center;">?</div>';
}


function pokaz_blok(n)
{
if (document.getElementById(n).style.display=='none') document.getElementById(n).style.display='block';
else document.getElementById(n).style.display='none';
}

function dodaj_odbiorce(n)
{
document.wpis.odbiorca.value=n;
pokaz_blok('odbiorcy');
}

function album_tab(a,u)
{	
 document.getElementById('album3').style.display='none';
	  document.getElementById('album4').style.display='block';
	 theDate = new Date();
    var s = document.createElement ('script');
    s.type = 'text/javascript';
    s.src = 'profil_album_tab.php?album=' + a + '&id=' + u + '&' + theDate.getTime().toString(10);
    document.body.appendChild (s);
}

function foto_tab(a)
{	
 document.getElementById('foto_sel').style.display='none';
	  document.getElementById('foto4').style.display='block';
	 theDate = new Date();
    var s = document.createElement ('script');
    s.type = 'text/javascript';
    s.src = 'profil_album_foto.php?id=' + a + '&' + theDate.getTime().toString(10);
    document.body.appendChild (s);
}

function albumy_tab(a)
{
if(a == '1') {
	   document.getElementById('album1').style.display='none';
	  document.getElementById('album2').style.display='block'; }
else {
	   document.getElementById('album2').style.display='none';
	   document.getElementById('album1').style.display='block'; }
}

function pokaz_emoty()
{	 
if(document.getElementById('blok_emotow').style.display == 'none')
	{
 	document.getElementById('blok_emotow').style.display='none';
	 document.getElementById('blok_czekaj').style.display='block';
	 theDate = new Date();
    var s = document.createElement ('script');
    s.type = 'text/javascript';
    s.src = 'pokaz_emoty.php?t=' + theDate.getTime().toString(10);
    document.body.appendChild (s);
	}
else
	{
	document.getElementById('blok_czekaj').style.display='none';
	 document.getElementById('blok_emotow').style.display='none';
	}
}

function info_tab(t,id,stt)
{
for(i = 1; i < 5; i++) 
	{
document.getElementById('info'+i).style.display='none';
	}
document.getElementById('info'+t).style.display='block';
if(t==3)
	{
	document.getElementById('znajomi_sel').style.display='none';
	document.getElementById('blok_czekaj_z').style.display='block';
 theDate = new Date();
    var s = document.createElement ('script');
    s.type = 'text/javascript';
    s.src = 'profil_znajomi_tab.php?id=' + id + '&str=' + stt + '&t=' + theDate.getTime().toString(10);
    document.body.appendChild (s);
	}
}

function wpisy_tab(id,stt)
{
document.getElementById('wpisy_podtab').style.display='none';
document.getElementById('blok_czekaj_w').style.display='block';
theDate = new Date();
var s = document.createElement ('script');
s.type = 'text/javascript';
s.src = 'profil_wpisy_tab.php?id=' + id + '&str=' + stt + '&t=' + theDate.getTime().toString(10);
document.body.appendChild (s);
}

function displayWindow(url, width, height) {
        var Win = window.open(url,"displayWindow",'width=' + width + ',height=' + height + ',resizable=0,scrollbars=yes,menubar=yes' );
}


function getRelativePos(obj){
	var pos = {offsetLeft:0,offsetTop:0};
	while(obj!=null){
		pos.offsetLeft += obj.offsetLeft;
		pos.offsetTop += obj.offsetTop;
		obj = isIE ? obj.parentElement : obj.offsetParent;
	}
	return pos;
}

sfHover = function() {
	var sfEls = document.getElementById('nav').getElementsByTagName("li");
	for (var i=0; i<sfEls.length; i++) {
		sfEls[i].onmouseover=function() {
			this.className+=" sfhover";
		}
		sfEls[i].onmouseout=function() {
			this.className=this.className.replace(new RegExp(" sfhover\\b"), "");
		}
	}
}
if (window.attachEvent) window.attachEvent("onload", sfHover);
