function f_clientWidth() {
	return f_filterResults (
		window.innerWidth ? window.innerWidth : 0,
		document.documentElement ? document.documentElement.clientWidth : 0,
		document.body ? document.body.clientWidth : 0
	);
}
function f_clientHeight() {
	return f_filterResults (
		window.innerHeight ? window.innerHeight : 0,
		document.documentElement ? document.documentElement.clientHeight : 0,
		document.body ? document.body.clientHeight : 0
	);
}
function f_scrollLeft() {
	return f_filterResults (
		window.pageXOffset ? window.pageXOffset : 0,
		document.documentElement ? document.documentElement.scrollLeft : 0,
		document.body ? document.body.scrollLeft : 0
	);
}
function f_scrollTop() {
	return f_filterResults (
		window.pageYOffset ? window.pageYOffset : 0,
		document.documentElement ? document.documentElement.scrollTop : 0,
		document.body ? document.body.scrollTop : 0
	);
}

function f_filterResults(n_win, n_docel, n_body) {
	var n_result = n_win ? n_win : 0;
	if (n_docel && (!n_result || (n_result > n_docel)))
		n_result = n_docel;
	return n_body && (!n_result || (n_result > n_body)) ? n_body : n_result;
}

function hirlevelTeszt( nlid, email, rss ) {
  email = window.prompt('E-mail cím:',email);
  if ( email ){
    if( rss ) {
      location.href='sendthem.php?nlid=' + nlid + '&email=' + email + '&rss';
    } else {
      location.href='sendthem.php?nlid=' + nlid + '&email=' + email;
    }
  }
}

function openCode( rlid, uid, par ) {
  //var panel = document.createElement("tr");
  //document.getElementById('nl_list').appendChild( panel );
  document.getElementById('codeLayer').style.visibility = 'visible';
  var codeParagraph = document.getElementById('code');
  //var codeSrc = document.createElement("img");
  //codeSrc.src = 'subtest.php?r='+rlid+'&u='+uid;
  //codeParagraph.appendChild( codeSrc );
  //var f = fopen('showsubform.php');
  //alert(f);
  codeParagraph.innerHTML = codeTemplate;
}

function closeCode() {
  document.getElementById('codeLayer').style.visibility = 'hidden';
}

function activateWait() {
  document.getElementById('waitscreen').style.visibility = 'visible';
}

function showLoader( b ) {
  var loader = document.getElementById('loader');
  if( b ) {
    loader.style.visibility = 'visible';
    loader.style.left = ((f_scrollLeft() + f_clientWidth()/3) - 15) + 'px';
    loader.style.top = ((f_scrollTop() + f_clientHeight()/4) - 15) + 'px';
  } else {
    loader.style.visibility = 'hidden';
  }
}

function deleteRSSHir( nlid, hirid ) {
  if( !confirm( "Biztosan töröljük?" ) ) {
    return false;
  }
  document.getElementById( 'rsshir'+hirid ).parentNode.removeChild( document.getElementById( 'rsshir'+hirid ) );
  var src = "del_rss_hir.php?nlid="+nlid+"&aid="+hirid;
  var newScript = document.createElement("img");
  newScript.src = src;
}

