
function getCalendar( pev, pho ) {
    new Ajax.Request('/inc/ajax_getcalendar.php', {
	method: 'post',
	parameters: { ev: pev, ho: pho },
	onSuccess: function(transport) {
	    $('naptar').innerHTML = transport.responseText;
	}
    });
}


function ar(szam) {
    return number_format(szam, 2, ',', ' ');
}


function changeFullCost( szam ) {
    $('cost_misc').innerHTML = ar(szam);
    $('cost_full').innerHTML = ar(fullCost + szam);
}


var currMenu;
function showMenu(menu, szoveg, link) {
    if (currMenu == menu) return 0;

    var topmenu = document.getElementById('topmenu');
    var lista = topmenu.getElementsByTagName('LI');
    for(var i in lista) {
        lista[i].innerHTML = '<div></div>';
        if (lista[i] == menu) {
             currMenu = menu;
             lista[i].innerHTML += (link ? '<a href="'+link+'">' : '') + szoveg + (link ? '</a>' : '');
        }
    }
}


function toggleMMBox( elem ) {
//    Effect.toggle(elem.id + '_opts', 'blind');
    elem.blur();
    $(elem.id + '_opts').style.display = ($(elem.id + '_opts').style.display == 'block' ? 'none' : 'block');
    elem.className = (elem.className == 'mm_open' ? 'mm_close' : 'mm_open');
}


/*********** ablakos cuccok ************/

function berlet_ablak(oldal, link) {
    var ablak = window.open("inc/ablak_" + oldal + ".php?" + link, "ablak", "width=610, height=500, scrollbars=yes, status=no");
    ablak.focus();
}

// megnyitja a kepnezegeto ablakot
function kepnez(kep) {
    var gal = window.open("inc/galeria_kepnez.php?kep=" + kep, "gal", "width=780, height=650, scrollbars=yes");
    gal.focus();
}

// hiper-szuper ablak-atmeretezo
function resizeOuterTo(w,h) {
    if (parseInt(navigator.appVersion)>3) {
	if (navigator.appName=="Netscape") {
	    window.outerWidth=w;
	    window.outerHeight=h;
	} else window.resizeTo(w,h);
    }
}

/********** regisztracios cuccosok ***********/
function disable_cim() {
    if (document.frm.szlacimegy.checked) {
	document.frm.szla_cim_irsz.disabled = true;
	document.frm.szla_cim_varos.disabled = true;
	document.frm.szla_cim_utca.disabled = true;
    } else {
	document.frm.szla_cim_irsz.disabled = false;
	document.frm.szla_cim_varos.disabled = false;
	document.frm.szla_cim_utca.disabled = false;
    }
}
function disable_nev() {
    if (document.frm.szlanevegy.checked) {
	document.frm.szla_nev.disabled = true;
    } else {
	document.frm.szla_nev.disabled = false;
    }
}


function number_format( number, decimals, dec_point, thousands_sep ) {
    // http://kevin.vanzonneveld.net
    // +   original by: Jonas Raoni Soares Silva (http://www.jsfromhell.com)
    // +   improved by: Kevin van Zonneveld (http://kevin.vanzonneveld.net)
    // +     bugfix by: Michael White (http://getsprink.com)
    // +     bugfix by: Benjamin Lupton
    // +     bugfix by: Allan Jensen (http://www.winternet.no)
    // +    revised by: Jonas Raoni Soares Silva (http://www.jsfromhell.com)
    // +     bugfix by: Howard Yeend
    // +    revised by: Luke Smith (http://lucassmith.name)
    // +     bugfix by: Diogo Resende
    // +     bugfix by: Rival
    // %        note 1: For 1000.55 result with precision 1 in FF/Opera is 1,000.5, but in IE is 1,000.6
    // *     example 1: number_format(1234.56);
    // *     returns 1: '1,235'
    // *     example 2: number_format(1234.56, 2, ',', ' ');
    // *     returns 2: '1 234,56'
    // *     example 3: number_format(1234.5678, 2, '.', '');
    // *     returns 3: '1234.57'
    // *     example 4: number_format(67, 2, ',', '.');
    // *     returns 4: '67,00'
    // *     example 5: number_format(1000);
    // *     returns 5: '1,000'
    // *     example 6: number_format(67.311, 2);
    // *     returns 6: '67.31'
 
    var n = number, prec = decimals;
    n = !isFinite(+n) ? 0 : +n;
    prec = !isFinite(+prec) ? 0 : Math.abs(prec);
    var sep = (typeof thousands_sep == "undefined") ? ',' : thousands_sep;
    var dec = (typeof dec_point == "undefined") ? '.' : dec_point;
 
    var s = (prec > 0) ? n.toFixed(prec) : Math.round(n).toFixed(prec); //fix for IE parseFloat(0.55).toFixed(0) = 0;
 
    var abs = Math.abs(n).toFixed(prec);
    var _, i;
 
    if (abs >= 1000) {
        _ = abs.split(/\D/);
        i = _[0].length % 3 || 3;
 
        _[0] = s.slice(0,i + (n < 0)) +
              _[0].slice(i).replace(/(\d{3})/g, sep+'$1');
 
        s = _.join(dec);
    } else {
        s = s.replace('.', dec);
    }
 
    return s;
}
