<!--

var d = document;
var go = 1;

function getObj(id)
{
    if (d.getElementById) return d.getElementById(id);
    else if (d.all) return d.all(id);
    else if (d.layers) return d.layers[id];
    else return null;
}

function showHint(id)
{
    var hint = getObj(id);
    if (hint != null) hint.style.display = 'block';
}

function hideHint(id)
{
    var hint = getObj(id);
    if (hint != null) hint.style.display = 'none';
}

var confirmDeleteMsg = 'Biztosan törölni szeretné?';
var defaultConfirmValue = 'yes';
var confirmUpdateMsg = 'Biztosan módosítani szeretné?';



function confirmLink(link, confirmMsg, confirmValue)
{
    if (confirmMsg == '') confirmMsg = confirmDeleteMsg;
    if (confirm(confirmMsg)){
        if (confirmValue == '') confirmValue = defaultConfirmValue;
        var confirmText = '&confirm=' + confirmValue;

        if (typeof(link.href) != 'undefined'){
            var url = link.href;
            var i = url.lastIndexOf('#');
            if (i > -1) url = url.substring(0, i) + confirmText + url.substring(i);
            else url = url + confirmText;
            link.href = url;
        }
        return true;
    }
    return false;
}

function confirmButton(queryStr, confirmMsg, confirmValue)
{
    if (confirmMsg == '') confirmMsg = confirmDeleteMsg;
    if (confirm(confirmMsg)){
        if (confirmValue == '') confirmValue = defaultConfirmValue;
        var confirmText = '&confirm=' + confirmValue;

        queryStr = queryStr + confirmText;
        addURL(queryStr);
        return true;
    }
    return false;
}

function confirmUpdateButton(queryStr, confirmMsg, confirmValue)
{
    if (confirmMsg == '') confirmMsg = confirmUpdateMsg;
    if (confirm(confirmMsg)){
        if (confirmValue == '') confirmValue = defaultConfirmValue;
        var confirmText = '&confirm=' + confirmValue;

        queryStr = queryStr + confirmText;
        addURL(queryStr);
        return true;
    }
    return false;
}


var defaultCheckOnColor = '#e7e7e7';
var defaultCheckOffColor = '#ffffff';
var doCheck = true;

function checkRow(row, value)
{
    var checkbox = row.getElementsByTagName('input')[0];
    var className;

    if (checkbox && checkbox.type=='checkbox' && checkbox.name=='M_CHECKED[]'){
        if (doCheck){
            checkbox.checked = (value === true || value === false) ? value : !checkbox.checked;
        }
        else doCheck = true;

        className = row.className;
        if (checkbox.checked){
            if (className.indexOf('_marked') == -1) className = className + '_marked';
        }
        else className = className.replace('_marked', '');
        row.className = className;
    }
}

function multiSubmit(select, formName)
{
    var confirmMsg = 'Biztosan szeretné végrehajtani a kiválasztott műveletet?\r\n\r\n' + select.options[select.selectedIndex].text;
    if (confirm(confirmMsg)){
        var form = eval('d.'+formName);
        form.submit();
    }
    else select.selectedIndex = 0;
}

function checkAll(list)
{
    var table = getObj(list);
    var checkbox;

    if (table != 'null'){
        var rows = table.getElementsByTagName('tr');
        for (var i=0; i<rows.length; i++) checkRow(rows[i], true);
    }
    return false;
}

function unCheckAll(list)
{
    var table = getObj(list);
    var checkbox;

    if (table != 'null'){
        var rows = table.getElementsByTagName('tr');
        for (var i=0; i<rows.length; i++) checkRow(rows[i], false);
    }
    return false;
}

function openclose(pic, id, pic_open, pic_close)
{
    var form = getObj(id);
    if (form != null){
          if (form.style.display == 'none'){
            if (pic_close != '') pic.src = pic_close;
            form.style.display = 'block';
        }
        else
        {
            if (pic_open != '') pic.src = pic_open;
              form.style.display = 'none'
        }
   }
   return false;
}


function recolor(obj, color)
{
    obj.style.background = color;
}

var swapImg = new Array();
var swapImages = new Array();

function preloadImages()
{
    for (var i=0; i<swapImages.length; i++){
        img1 = new Image();
        img1.src = swapImages[i][0];
        img2 = new Image();
        img2.src = swapImages[i][1];
        swapImg[i] = new Array(img1, img2);
    }
}

function swap(img, idx, act)
{
    img.src = swapImg[idx][act].src;
}

function changeCheckbox(id, img)
{
    var checkbox = getObj(id);

    if (checkbox != 'null'){
        checkbox.checked = !checkbox.checked;
        img.src = checkbox.checked ? '/img/aloldal/box_bal/pipa_on.gif' : '/img/aloldal/box_bal/pipa_off.gif';
        //img.className = checkbox.checked ? 'checkboxImage_ON' : 'checkboxImage_OFF';
    }
}

/* Számlázási adatok másolása a szállítási adatokhoz */

function copy_address(form)
{
    form.fh_szall_nev.value     = form.fh_szaml_nev.value;
    form.fh_szall_irszam.value  = form.fh_szaml_irszam.value;
    form.fh_szall_varos.value   = form.fh_szaml_varos.value;
    form.fh_szall_cim.value     = form.fh_szaml_cim.value;
}

function copy_address_order(form)
{
    form.ko_szall_nev.value     = form.ko_szaml_nev.value;
    form.ko_szall_irszam.value  = form.ko_szaml_irszam.value;
    form.ko_szall_varos.value   = form.ko_szaml_varos.value;
    form.ko_szall_cim.value     = form.ko_szaml_cim.value;
}

function copy_address_vasarlo(form)
{
    form.fh_orsz_ID.value    = form.fh_szcorsz_ID.value;
    form.fh_irsz.value        = form.fh_szcirsz.value;
    form.fh_telep.value        = form.fh_szctelep.value;
    form.fh_kerulet.value    = form.fh_szckerulet.value;
    form.fh_cim.value        = form.fh_szccim.value;
}

function copy_address_galeria(form)
{
    form.fh_szhorsz_ID.value    = form.fh_tporsz_ID.value;
    form.fh_szhirsz.value        = form.fh_tpirsz.value;
    form.fh_szhtelep.value        = form.fh_tptelep.value;
    form.fh_szhkerulet.value    = form.fh_tpkerulet.value;
    form.fh_szhcim.value        = form.fh_tpcim.value;
}

function copy_address_galeria2(form)
{
    form.fh_levorsz_ID.value    = form.fh_tporsz_ID.value;
    form.fh_levirsz.value        = form.fh_tpirsz.value;
    form.fh_levtelep.value        = form.fh_tptelep.value;
    form.fh_levkerulet.value    = form.fh_tpkerulet.value;
    form.fh_levcim.value        = form.fh_tpcim.value;
}

function copy_address_galeria3(form)
{
    form.fh_szcorsz_ID.value    = form.fh_tporsz_ID.value;
    form.fh_szcirsz.value        = form.fh_tpirsz.value;
    form.fh_szctelep.value        = form.fh_tptelep.value;
    form.fh_szckerulet.value    = form.fh_tpkerulet.value;
    form.fh_szccim.value        = form.fh_tpcim.value;
}

function copy_address_galeria4(form)
{
    form.fh_orsz_ID.value    = form.fh_tporsz_ID.value;
    form.fh_irsz.value        = form.fh_tpirsz.value;
    form.fh_telep.value        = form.fh_tptelep.value;
    form.fh_kerulet.value    = form.fh_tpkerulet.value;
    form.fh_cim.value        = form.fh_tpcim.value;
}

function copy_address_bolt(form)
{
    form.fh_szhorsz_ID.value    = form.fh_tporsz_ID.value;
    form.fh_szhirsz.value    = form.fh_tpirsz.value;
    form.fh_szhtelep.value    = form.fh_tptelep.value;
    form.fh_szhkerulet.value    = form.fh_tpkerulet.value;
    form.fh_szhcim.value        = form.fh_tpcim.value;
}

function copy_address_bolt2(form)
{
    form.fh_levorsz_ID.value    = form.fh_tporsz_ID.value;
    form.fh_levirsz.value        = form.fh_tpirsz.value;
    form.fh_levtelep.value        = form.fh_tptelep.value;
    form.fh_levkerulet.value    = form.fh_tpkerulet.value;
    form.fh_levcim.value        = form.fh_tpcim.value;
}

function copy_address_bolt3(form)
{
    form.fh_szcorsz_ID.value    = form.fh_tporsz_ID.value;
    form.fh_szcirsz.value        = form.fh_tpirsz.value;
    form.fh_szctelep.value        = form.fh_tptelep.value;
    form.fh_szckerulet.value    = form.fh_tpkerulet.value;
    form.fh_szccim.value        = form.fh_tpcim.value;
}

function copy_address_bolt4(form)
{
    form.fh_orsz_ID.value    = form.fh_tporsz_ID.value;
    form.fh_irsz.value        = form.fh_tpirsz.value;
    form.fh_telep.value        = form.fh_tptelep.value;
    form.fh_kerulet.value    = form.fh_tpkerulet.value;
    form.fh_cim.value        = form.fh_tpcim.value;
}


function topmenu(text)
{
    getObj('topMenu').innerHTML = text;
}

function change_c_allapot(value)
{
    var cn_ido, cn_helyszin, cn_ido_tol, cn_ido_ig;

    cn_ido = getObj('cn_ido');
    cn_helyszin = getObj('cn_helyszin');
    cn_ido_tol = getObj('cn_ido_tol');
    cn_ido_ig = getObj('cn_ido_ig');

    if (cn_ido!=null) cn_ido.style.display = 'none';
    if (cn_helyszin!=null) cn_helyszin.style.display = 'none';
    if (cn_ido_tol!=null) cn_ido_tol.style.display = 'none';
    if (cn_ido_ig!=null) cn_ido_ig.style.display = 'none';

    switch (value){
        case 'T':
            if (cn_ido!=null) cn_ido.style.display = '';
            if (cn_helyszin!=null) cn_helyszin.style.display = '';
            break;

        case 'V':
            if (cn_ido_tol!=null) cn_ido_tol.style.display = '';
            if (cn_ido_ig!=null) cn_ido_ig.style.display = '';
            break;
    }
    return;
}

function chatlogin()
{
    if (document.chatlogin != null) document.chatlogin.submit();
    else alert('Kérjük előbb jelentkezzen be');
}

function changeMuvag(muvag)
{
    if (!d.form.al_kifejezesmod_ID || !aKifMod) return;

    d.form.al_kifejezesmod_ID.options.length = 0;

    for (var i=0,j=0;i<aKifMod.length;i++){
        if (aKifMod[i][0] == muvag && aKifMod[i][1] > 0){
            d.form.al_kifejezesmod_ID.options[j++] = new Option(aKifMod[i][2], aKifMod[i][1]);
        }
    }

    //if (muvag==1 || muvag==4)
    //    var allow = false; // festő, grafikus
    //else
    //    var allow = true;
    var allow = true;
    d.form.al_besorolas_ID.disabled = allow ? false : true;
    d.form.al_stilus_ID.disabled = allow ? false : true;
    d.form.al_alap_ID.disabled = allow ? false : true;
}

function ChangeImages(src1,img,i)
{
    var main_image = $('#main_image').attr('src')
    $('#main_image').attr('src', src1.replace("thumb", "main_img"))
    $('#m_image').attr('href',$('#main_image').attr('src').replace("main_img/",""));
    $('#image'+i).attr('src',main_image.replace("main_img","thumb"));

}

function req_mh_alap()
{
    var becs_ertek = $('#becs_ertek').val();
    if(becs_ertek != '')
    {
        alert('Ha megadta a tárgy becsült értékét, akkor az értékmeghatározás alapját is kötelező megadni!');
    }
}

function delImage(img,field,id)
{
    if(confirm("Biztosan törölni akarja a(z) "+field.substr(5,1)+" számú képet?"))
    {
        $.ajax({
            type: "POST",
            url:  "http://local.alkotoportal.hu/inc/ajax.php",
            data: "op=del_detail_image&image="+img+"&field="+field+"&id="+id,
            success: function(msg){
                if(msg == 1)
                {
                    document.location.reload();
                }
            //alert(msg)
            }
        });
    }
}

-->
