
function deliverActiveX(content)
{
	document.write(content);
}

function helpBoxOpen(tytul, tresc)
{
	$('komunikat').style.display='block';
	$('tytulKomunikatu').innerHTML = tytul;
  	$('trescKomunikatu').innerHTML = tresc;
}

function helpBoxClose()
{
	$('komunikat').style.display='none';
	$('tytulKomunikatu').innerHTML = '';
  	$('trescKomunikatu').innerHTML = '';
}


function checkFriendInfo()
{
	if (!checkmail($('nadawcaEmail'))) {
		helpBoxOpen('Uwaga!', 'Podaj swój poprawny adres e-mail');
		return;
	}
	if (!checkmail($('odbiorcaEmail'))) {
		helpBoxOpen('Uwaga!', 'Podaj poprawny adres e-mail odbiorcy');
		return;
	}
	$('friendInfo').submit();
}

function checkmail (obj)
{
	var field = obj;
	var str = field.value;
	if (window.RegExp) {
	  var reg1str = "(@.*@)|(\\.\\.)|(@\\.)|(\\.@)|(^\\.)";
	  var reg2str = "^.+\\@(\\[?)[a-zA-Z0-9\\-\\.]+\\.([a-zA-Z]{2,4}|[0-9]{1,3})(\\]?)$";
	  var reg1 = new RegExp(reg1str);
	  var reg2 = new RegExp(reg2str);
	  if (!reg1.test(str) && reg2.test(str)){

		//document.form.submit();
		return 1;
	  }
	  field.focus();
	  field.select();
	  return 0;
	} else {
	  if(str.indexOf("@") >= 0)
		return 1;
	  field.focus();
	  field.select();
	  return 0;
	}
}

function boxOpen(id)
{
	$(id).style.display='block';
}

function boxClose(id)
{
	$(id).style.display='none';
}

function $(id) { return document.getElementById(id) }

function rewriteFlash(object_id){
	var object_var = document.getElementById(object_id);
	object_var.innerHTML = object_var.innerHTML;
}
