function OpenDialogWindow(dialog_url,dialog_name,w,h)
{
var win = null;
leftPosition = (screen.width) ? (screen.width-w)/2 : 0;
topPosition = (screen.height) ? (screen.height-h)/2 : 0;
settings =
'height='+h+',width='+w+',top='+topPosition+',left='+leftPosition+'menubar=no,scrollbars=no,status=no'
win = window.open(dialog_url,dialog_name,settings)
if(win.window.focus){win.window.focus();}
}

function Confirm_Torles(kerdes, url)
{
  if (confirm(kerdes))
  {
    window.location.href=url;
  }
}

function SetHomePage(id, url, szoveg)
{
  if (window.external)
  {
    document.getElementById(id).style.behavior='url(#default#homepage)';
    document.getElementById(id).setHomePage(url);
  }
  else
  {
    alert(szoveg);
  }
}

function AddToFavorites(url, cim)
{
  if (window.external)
  {
    window.external.AddFavorite(url,cim);
  }
  else
  {
    window.sidebar.addPanel(cim, url, '');
  }
}

function Hir_Form_Add_File(id, fajl, nev)
{
  table = document.getElementById('hir_form_hir_fajlok');
  var row = document.createElement("TR");
  row.setAttribute("id", "filerow_"+id);

  var td1 = document.createElement("TD");

  var a1 = document.createElement("A");
  a1.setAttribute("href", "../uploaded_files/hirek/"+fajl);
  a1.setAttribute("target", "_blank");
  a1.innerHTML = nev;

  td1.appendChild(a1);
  td1.appendChild(document.createTextNode(" ["));

  var a2 = document.createElement("A");
  a2.setAttribute("href", "#");
  a2.onclick=function()
	{
		if (confirm('Biztosan törli?'))
		{
			OpenDialogWindow('hir_fajlok.php?id='+id+'&del','wndDelFile',300,150);
		}
	}
  a2.innerHTML = "töröl";

  td1.appendChild(a2);
  td1.appendChild(document.createTextNode("]"));

  row.appendChild(td1);

  table.appendChild(row);
}

function Hir_Form_Del_File(id)
{
  table = document.getElementById('hir_form_hir_fajlok');
  row = document.getElementById('filerow_'+id);
  table.removeChild(row);
}

function Hir_Form_Add_Kep(nev)
{
  image = document.getElementById('hir_form_hir_kep_img');
  image.setAttribute("src", nev);
  image_p = document.getElementById('hir_form_hir_kep_p');
  image_p.style.display = "";

  image_del = document.getElementById('hir_form_hir_kep_del');
  image_del.setAttribute("src", "../modules/hirek/img/del_pic.gif");
  image_del.style.cursor = "pointer";
  image_del.onclick=function() { OpenDialogWindow('hir_kep.php?file='+nev+'&del','wndAddKep','300','150'); }

  hir_kep = document.getElementById('hir_kep');
  hir_kep.setAttribute("value", nev);
}

function Hir_Form_Del_Kep()
{
  image = document.getElementById('hir_form_hir_kep_img');
  image.setAttribute("src", "");
  image_p = document.getElementById('hir_form_hir_kep_p');
  image_p.style.display = "none";

  image_del = document.getElementById('hir_form_hir_kep_del');
  image_del.setAttribute("src", "../modules/hirek/img/del_pic_d.gif");
  image_del.style.cursor = "default";
  image_del.onclick = function() {}

  hir_kep = document.getElementById('hir_kep');
  hir_kep.setAttribute("value", "");
}


function Required_Check(params)
{
  var ok = true;
  var n=0;

  while ((n < params.length) && (ok))
  {
    if (document.getElementById(params[n]['id']).value == '')
    {
      ok = false;
      alert("'"+params[n]['name']+"' nincs megadva!");
    }
    n++;
  }

  return ok;
}

function showLoadingPage()
{
  if (document.getElementById)
  {  // DOM3 = IE5, NS6
    document.getElementById('hidepage').style.display = '';
    document.getElementById('content').style.display = 'none';
  } else
  {
    if (document.layers)
    {  // Netscape 4
      document.hidepage.display = '';
      document.content.display = 'none';
    } else
    {  // IE 4
      document.all.hidepage.style.display = '';
      document.all.content.style.display = 'none';
    }
  }
}

function showContentPage()
{
  if (document.getElementById)
  {  // DOM3 = IE5, NS6
    document.getElementById('hidepage').style.display = 'none';
    document.getElementById('content').style.display = '';
  } else
  {
    if (document.layers)
    {  // Netscape 4
      document.hidepage.display = 'none';
      document.content.display = '';
    } else
    {  // IE 4
      document.all.hidepage.style.display = 'none';
      document.all.content.style.display = '';
    }
  }
}

function Validate_Extension(fname, extensions)
{
  picext = fname.substring(picpath.lastIndexOf(''));

  if (extensions.indexOf(picext.toUpperCase()) > -1)
    return True;
  else
    return False;
}

