window.onresize = function winresize()
  {
  reposlayers();
  }
window.onload = function winload()
  {
  init();
  }
function popup(kep, scroll)
  {
  if (scroll == null)
    {
    scroll = 'no';
    }
  page = '../favat/gallery/popup.php?kepfile=' + kep + '&scroll=' + scroll;
  w = 1;
  h = 1;
  l = 0;
  t = 0;
  settings = 'scrollbars=' + scroll + ',resizable=no,status=no,menubar=yes,width=' + w + ',height=' + h + ',left=' + l + ',top=' + t + ',screenX=' + l + ',screenY=' + t;
  win = window.open(page, 'popup21', settings);
  win.focus();
  }
function popupleiras(page, scroll, w, h)
  {
  if (w == null)
    {
    w = 721;
    }
  if (h == null)
    {
    h = 452;
    }
  h = h - 20;
  if (scroll == null)
    {
    scroll = 'no';
    }
  l = (window.screen.width - (w + 10)) / 2;
  t = (window.screen.height - (h + 75 + 62)) / 2;
  settings = 'scrollbars=' + scroll + ',resizable=no,status=no,menubar=no,width=' + w + ',height=' + h + ',left=' + l + ',top=' + t + ',screenX=' + l + ',screenY=' + t;
  win = window.open(page, 'popup1', settings);
  win.focus();
  }
function popupsitemap(page, scroll, w, h)
  {
  if (w == null)
    {
    w = 570;
    }
  if (h == null)
    {
    h = 430;
    }
  h = h - 20;
  if (scroll == null)
    {
    scroll = 'yes';
    }
  l = (window.screen.width - (w + 10)) / 2;
  t = (window.screen.height - (h + 55 + 62)) / 2;
  settings = 'scrollbars=' + scroll + ',resizable=no,status=no,menubar=yes,width=' + w + ',height=' + h + ',left=' + l + ',top=' + t + ',screenX=' + l + ',screenY=' + t;
  win = window.open(page, 'popupsitemap', settings);
  win.focus();
  }
function popupfull(page)
  {
  w = (window.screen.width - 10);
  h = (window.screen.height - 35);
  scrollb = 'no';

  l = (window.screen.availWidth - (w + 10)) / 2;
  t = (window.screen.height - (h + 35)) / 2;
  settings = 'scrollbars=' + scrollb + ',resizable=yes,status=nos,menubar=no,width=' + w + ',height=' + h + ',left=' + l + ',top=' + t + ',screenX=' + l + ',screenY=' + t;
  win = window.open(page, 'popup2', settings);
  win.focus();
  }
function reloadpage(init)
  { //reloads the window if Nav4 resized
  if (init == true)
    with (navigator)
      {
      if ((appName == "Netscape") && (parseInt(appVersion) == 4))
        {
        document.MM_pgW = innerWidth;
        document.MM_pgH = innerHeight;
        onresize = reloadpage;
        }
      }
  else if (innerWidth != document.MM_pgW || innerHeight != document.MM_pgH)
    location.reload();
  }
reloadpage(true);
function findobj2(n, d)
  { //v4.01
  var p, i, x;
  if (!d)
    d = document;
  if ((p = n.indexOf("?")) > 0 && parent.frames.length)
    {
    d = parent.frames[n.substring(p + 1)].document;
    n = n.substring(0, p);
    }
  if (!(x = d[n]) && d.all)
    x = d.all[n];
  for (i = 0; !x && i < d.forms.length; i++)
    x = d.forms[i][n];
  for (i = 0; !x && d.layers && i < d.layers.length; i++)
    x = findobj2(n, d.layers[i].document);
  if (!x && d.getElementById)
    x = d.getElementById(n);
  return x;
  }
function changeproperty(obj, theProp, theValue)
  { //v6.0
  obj = findobj(obj);
  if (obj && (theProp.indexOf("style.") == -1 || obj.style))
    {
    if (theValue == true || theValue == false)
      eval("obj." + theProp + "=" + theValue);
    else
      {
      if (theProp == "style.display" && theValue == "none" && navigator.userAgent.indexOf('MSIE') == -1)
        {
        obj.style.display = 'block';
        obj.style.visibility = 'hidden';
        }
      else if (theProp == "style.display" && theValue == "block" && navigator.userAgent.indexOf('MSIE') == -1)
        {
        obj.style.display = 'block';
        obj.style.visibility = 'visible';
        }
      else
        eval("obj." + theProp + "='" + theValue + "'");
      }
    }
  }
function findobj3(item)
  {
  if (window.mmIsOpera)
    return (document.getElementById(item));
  if (document.all)
    return (document.all[item]);
  if (document.getElementById)
    return (document.getElementById(item));
  return (false);
  }
function xpos(img)
  {
  img = findobj(img);
  x = 0;
  if (!document.layers)
    {
    var onWindows = navigator.platform ? navigator.platform == "Win32" : false;
    var macIE45 = document.all && !onWindows && getExplorerVersion() == 4.5;
    var par = img;
    var lastOffset = 0;
    while (par)
      {
      if (par.leftMargin && !onWindows)
        x += parseInt(par.leftMargin);
      if ((par.offsetLeft != lastOffset) && par.offsetLeft)
        x += parseInt(par.offsetLeft);
      if (par.offsetLeft != 0)
        lastOffset = par.offsetLeft;
      par = macIE45 ? par.parentElement : par.offsetParent;
      }
    }
  else if (img.x)
    x += img.x;
  return x;
  }
function ypos(img)
  {
  img = findobj(img);
  y = 0;
  if (!document.layers)
    {
    var onWindows = navigator.platform ? navigator.platform == "Win32" : false;
    var macIE45 = document.all && !onWindows && getExplorerVersion() == 4.5;
    var par = img;
    var lastOffset = 0;
    while (par)
      {
      if (par.topMargin && !onWindows)
        y += parseInt(par.topMargin);
      if ((par.offsetTop != lastOffset) && par.offsetTop)
        y += parseInt(par.offsetTop);
      if (par.offsetTop != 0)
        lastOffset = par.offsetTop;
      par = macIE45 ? par.parentElement : par.offsetParent;
      }
    }
  else if (img.y >= 0)
    y += img.y;
  return y;
  }
function findobj(imgname)
  {
  var obj = findobj2(imgname) || findobj3(imgname) || document.images[imgname] || document.links[imgname] || document.anchors[imgname];
  return obj;
  }
function reposlayer(mit, mihez, deltax, deltay)
  {
  changeproperty(mit, 'style.left', xpos(mihez) + deltax);
  changeproperty(mit, 'style.top', ypos(mihez) + deltay);
  }
function reposlayers()
  {
  reposlayer('palackarea', 'anchor1', 0, -20);
  changeproperty('palackarea', 'style.display', 'block');
  if (navigator.userAgent.indexOf('Opera') != -1)
    {
    document.body.className += ''; // force opera and other browsers to reflow (refresh)
    }
  }
function iepngfix()
  {
  var ua = navigator.userAgent.toLowerCase();
  if ((ua.indexOf("msie") != -1) && (ua.indexOf("opera") == -1) && (ua.indexOf("webtv") == -1))
    {
    for (i = 0; i < document.images.length; i++)
      {
      if (document.images[i].name != "notransp")
        {
        document.images[i].style.filter = "progid:DXImageTransform.Microsoft.AlphaImageLoader(src='" + document.images[i].src + "',sizingMethod='scale')";
        document.images[i].src = "1x1_transparent.gif"
        }
      }
    }
  }
function init()
  {
  //iepngfix();
  reposlayers();
  }
var actualmenu = "";
function hideactivemenu()
  {
  var layer = actualmenu;
  if (layer != "")
    {
    changeproperty(layer, 'style.display', 'none');
    }
  }
var timeout;
function showMenu(layer, visible, over)
  {
  if (visible)
    actualmenu = layer;
  window.clearTimeout(timeout);
  if (visible)
    {
    changeproperty(layer, 'style.display', 'block');
    }
  else
    {
    changeproperty(layer, 'style.display', 'none');
    }
  window.status = over;
  if (over == 0)
    timeout = window.setTimeout("hideactivemenu()", 2000);
  }
function popup(kep, scroll)
  {
  if (scroll == null)
    {
    scroll = 'no';
    }
  page = '../favat/galeria/popup.php?kepfile=' + kep + '&scroll=' + scroll;
  w = 1;
  h = 1;
  l = 0;
  t = 0;
  settings = 'scrollbars=' + scroll + ',resizable=no,status=no,menubar=no,width=' + w + ',height=' + h + ',left=' + l + ',top=' + t + ',screenX=' + l + ',screenY=' + t;
  win = window.open(page, 'popup', settings);
  win.focus();
  }
function CreateBookmarkLink()
  {
  title = document.title;
  url= location.href;
  if (window.sidebar)
    { // Mozilla Firefox Bookmark	
    window.sidebar.addPanel(title, url, "");
    }
  else if (window.external)
    { // IE Favorite	
    window.external.AddFavorite(url, title);
    }
  else
    { 
	alert("Az ön által használt böngésző nem támogatja ezt a funkciót!")
    }

	
  }

function getCookieVal(offset)
    {
    var endstr = document.cookie.indexOf(";", offset);

    if (endstr == -1)
        endstr = document.cookie.length;

    return unescape(document.cookie.substring(offset, endstr));
    }

function GetCookie(name)
    {
    var arg = name + "=";

    var alen = arg.length;
    var clen = document.cookie.length;
    var i = 0;

    while (i < clen)
        {
        var j = i + alen;

        if (document.cookie.substring(i, j) == arg)
            return getCookieVal(j);

        i = document.cookie.indexOf(" ", i) + 1;

        if (i == 0)
            break;
        }

    return null;
    }

function SetCookie(name, value)
    {
    var argv = SetCookie.arguments;

    var argc = SetCookie.arguments.length;
    var expires = (argc > 2) ? argv[2] : null;
    var path = (argc > 3) ? argv[3] : null;
    var domain = (argc > 4) ? argv[4] : null;
    var secure = (argc > 5) ? argv[5] : false;
    document.cookie = name + "=" + escape (value) + 
    ((expires == null) ? "" : ("; expires=" + expires.toGMTString())) + 
    ((path == null) ? "" : ("; path=" + path)) +  
    ((domain == null) ? "" : ("; domain=" + domain)) +    
    ((secure == true) ? "; secure" : "");
    }

function DeleteCookie(name)
    {
    var exp = new Date();

    exp.setTime(exp.getTime() - 1);
    var cval = GetCookie(name);
    document.cookie = name + "=" + cval + "; expires=" + exp.toGMTString();
    alert('A kosárból az összes termék ürítve lett!');
    }

function kosarba(kukiname, azonosito, darab, sender_form)
    {
    if (darab > 0)
        {
        text = GetCookie(kukiname);

        if (darab == 'flush')
            {
            text = null;
            }

        if (text == null)
            {
            text = "*";
            }

        else
            {
            text = GetCookie(kukiname);
            }

        if (darab != 'flush')
            {
            text = text + azonosito + '!' + darab + '*';
            }

        SetCookie(kukiname, text);
        alert('A termék a kosárba került!');
        str = 'document.' + sender_form + '.db.value="";';
        eval(str);
        }

    else
        {
        alert('Hibás darabszám!');
        }
    }

function torolcookie(azonosito)
    {
    tempcookie = "";

    a = GetCookie('kosar');
    stringarray = a.split("*");

    for (i = 0; i < stringarray.length - 1; i++)
        {
        if (i != azonosito)
            {
            tempcookie += stringarray[i] + "*";
            }
        }

    SetCookie("kosar", tempcookie);
    window.location.reload();
    }
