// JavaScript Document
// otwiera okienko o danych rozmiarach X i Y
function site(url, x, y, pos)
{
	if(typeof(x) == 'undefined')
		x = 900;
	
	if(typeof(y) == 'undefined')
		y = 700;
	
	if(typeof(pos) == 'undefined')
		pos = 1;
	
	if(pos)
	{
		x_offset = (window.screen.width-x)/2;
		y_offset = (window.screen.height-y)/2;
	}
	else
	{
		x_offset = 0;
		y_offset = 0;
	}

	okno = window.open(""+url+"", "Okienko", "toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=0,resizeable=0,width="+x+",height="+y+",left="+x_offset+",top="+y_offset+"");
	
}

// zabezpieczenie anty-spamowe
/*
function mail_to(adres)
{
	adres = adres.replace('_at_', '@');
	adres = adres.replace(/_dot_/g, '.');
	window.location = 'mailto:'+adres;
}
*/

function mail_to(adres)
{
	adres = adres.replace('_malpka_', '@');
	adres = adres.replace(/_kropka_/g, '.');
	window.location = 'mailto:'+adres;
}

function del_special_chars()
{
	var obj = document.forms[0].cena;
	
	obj.value=obj.value.replace(/ /g, '');
	obj.value=obj.value.replace(/\./g, '');
	obj.value=obj.value.replace(/\,/g, '');
}

function setTableHeight()
{
	var heights = new Array();
	
	for(i=0; i<3; i++)
	{
		heights[i] = parseInt($('tab'+(i+1)).offsetHeight);
	}
	
	max_h = Math.max(heights[0], heights[1]);
	max_h = Math.max(max_h, heights[2]);
	
	for(i=1; i<4; i++)
	{
		$('tab'+i).style.height = max_h+'px';
	}
}

function addLoadEvent(func) { 
	  var oldonload = window.onload; 
	  if (typeof window.onload != 'function') { 
	    window.onload = func; 
	  } else { 
	    window.onload = function() { 
	      if (oldonload) { 
	        oldonload(); 
	      } 
	      func(); 
	    } 
	  } 
}


