/*
FELSŐ MENÜ SZÍNVÁLTÁS
*/

var same =  Math.floor(Math.random()*1000000);

function jatekwnd(){
  JatekWnd = window.open("index.php?mod=hirdetes&op=sorsolas","jatek","width=300,height=400,top=100,left=100,resizable=no,scrollbars=no,menubar=no,toolbar=no,status=no,location=no,statusbar=no")
}

function getrovatlist(id){
  if (id!='') {
    window.location="index.php?mod=hirdetes&op=listrovat&" + id;
  }
}

function shopchange(changed, ex, ar){
  if (changed.value.match("[a-zA-Z]+")) {
     alert('Csak számokat írhat a mezőbe!');
     changed.value = "0";
  }
  if (changed.value<0) changed.value = "0";
  var val = parseInt(document.feladas.sum.value);
  val = val + (changed.value-ex.value)*ar;
  if (val<=document.feladas.max.value) {
     document.feladas.sum.value = val;
     ex.value = changed.value;
  } else {
     alert('Ehhez nincsen elegendő pontja!')
     changed.value = ex.value;
  }
}

function printit(){
if (window.print) {
    window.print() ;  
    } else {
        var WebBrowser = '<OBJECT ID="WebBrowser1" WIDTH=0 HEIGHT=0 CLASSID="CLSID:8856F961-340A-11D0-A96B-00C04FD705A2"></OBJECT>';
    document.body.insertAdjacentHTML('beforeEnd', WebBrowser);
        WebBrowser1.ExecWB(6, 2);//Use a 1 vs. a 2 for a prompting dialog box    WebBrowser1.outerHTML = "";  
        }
        }

function nyomtat(id){
  PrintItem = window.open("index.php?mod=hirdetes&op=print&ids="+id,"print","width=500,height=500,top=100,left=100,resizable=no,scrollbars=yes,menubar=no,toolbar=no,status=no,location=no")
}

function gyujtokosar(mode, id){
  var gykc = document.getElementById('gykc');
  basketc++;
  if (basketc>0) {
    gykc.innerHTML = '('+basketc+')';
  } else {
    gykc.innerHTML = '()';
  }
  x = screen.width/2-100
  y = screen.height/2-50
  Cart = window.open("index.php?mod=hirdetes&op=basket&mode="+ mode + "&id=" + id,"cart","width=200,height=100,top=" + y + ",left=" + x + ",resizable=no,scrollbars=no,menubar=no,toolbar=no,status=no,location=no")
}

function showkep(id,kwidth,kheight){
  x = screen.width/2-kwidth/2
  y = screen.height/2-kheight/2
  Imgpopup = window.open("index.php?mod=kep&op=bigest&id=" + id,"cart","width="+kwidth+",height="+kheight+",top=" + y + ",left=" + x + ",resizable=no,scrollbars=no,menubar=no,toolbar=no,status=no,location=no")
}

function movein(which,html){
which.style.background='#FF8200'
}

function moveout(which){
which.style.background='#646464'
}

function moveout_left(which){
which.style.background=''
}


function movein_selected(which,html){
which.style.background='#646464'
}

function moveout_selected(which){
which.style.background='#FF8200'
}


function nagy(kep) {
    ablak=window.open('popup.php?kep='+kep,'uj','top=50,left=130,width=250,height=250,scrollbars=0,resizable=0');
    ablak.focus('uj');
}

function popup(url, awidth, aheight) {
    ablak=window.open(url,'hpopup','top=50,left=130,width='+awidth+',height='+aheight+',scrollbars=0,resizable=0');
    ablak.focus('hpopup');
}

function show(x,which) {
// window.alert(which);
    if (x==0)
        {
        document.getElementById(which).style.display = 'block'
        }
   else
    {
    document.getElementById(which).style.display = 'none';  
    };
}

function hide(x,which) {
    if (x==0)
      document.getElementById(which).style.display = 'none';
    }
    
function hidealrovats(which) {
    cnt = 0;    
    alrovat = document.getElementById(which + cnt);
    while (alrovat) {
      alrovat.style.display = 'none';
      cnt++;
      alrovat = document.getElementById(which + cnt);
    } 
  }
  
function confirmdel(szoveg) {
         tovabb = confirm(szoveg);
         if (tovabb==true) {
            document.hirdadmin.action = posturl;
            document.hirdadmin.submit();
         }
}

function setboxes(the_form, do_check)
{
    var elts      = document.forms[the_form].elements['selitems[]'];
    var elts_cnt  = (typeof(elts.length) != 'undefined')
                  ? elts.length
                  : 0;

    if (elts_cnt) {
        for (var i = 0; i < elts_cnt; i++) {
            elts[i].checked = do_check;
        } // end for
    } else {
        elts.checked        = do_check;
    } // end if... else
}

