function popup(url,name,width,height,position,wplus,hplus,focus,left,top,menubar,status,toolbar,scrollbar,resizable,scrx,scry,directories,loc) {
	if ( !url ) return false;
	if ( !name ) name = 'popupWin';
	if ( !width ) width = '';
	if ( !height ) height = '';
	if ( !directories ) directories = 'no';
	if ( !loc ) loc = 'no';
	if ( !menubar ) menubar = 'no';
	if ( !status ) status = 'no';
	if ( !toolbar ) toolbar = 'no';
	if ( !scrollbar ) scrollbar = 'no';
	if ( !resizable ) resizable = 'no';
	if ( !scrx ) scrx = '100';
	if ( !scry ) scry = '100';
	if ( !left ) left = '100';
	if ( !top ) top = '100';
	if ( wplus ) width  += wplus;
	if ( hplus ) height += hplus;

	if ( position == '1' ) {
		var winleft = (screen.width - width) / 2;
		var wintop = (screen.height -  height) / 2;
	} else {
		var winleft = left;
		var wintop = top;
	}

    var popupWin = window.open(url,name,'width='+width+'px,height='+height+'px,left='+winleft+',top='+wintop+',menubar='+menubar+',status='+status+',toolbar='+toolbar+',scrollbars='+scrollbar+',resizable='+resizable+',screenX='+scrx+',screenY='+scry+'directories='+directories+',location='+loc);

	if ( focus ) popupWin.focus();
}

function copyField(from, to) {
  document.getElementById(to).value = document.getElementById(from).value;
}

function set(input) {

  input.value = '';
}

function leave(input) {

  input.value = (input.value == '') ? input.defaultValue : input.value;
}
function changeImage(img, img_src) {

  img.src = img_src;
}

function toggle( table ) {

    table_obj = document.getElementById(table);
	
	to = table_obj.style.display == 'none' ? 'block': 'none';

	table_obj.style.display = to;


}

var old_table_02 = '';
var is_opened_02  = 'none';

function toggle_02( table ) {

    table_obj = document.getElementById(table);
    is_opened_02 = table_obj.style.display;

    if (old_table_02 != '' && is_opened_02 == 'none') {
        old_table_obj = document.getElementById(old_table_02);
        old_table_obj.style.display = 'none';		
		document.getElementById('cat_'+old_table_02).style.fontWeight = "normal";
    }

    if (old_table_02 != table || is_opened_02 == 'none') {
        table_obj.style.display = 'block';
		document.getElementById('cat_'+table).style.fontWeight = "bold";
    }

    old_table_02 = table;
}

var old_table_image = '';
var is_opened_image  = 'none';

function toggle_image( image ) {

    table_obj = document.getElementById(image);
    is_opened_image = table_obj.style.display;

	if (image != 'i01')
	{
		document.getElementById('i01').style.display = 'none';
	}

    if (old_table_image != '' && is_opened_image == 'none') {
        old_table_obj = document.getElementById(old_table_image);
        old_table_obj.style.display = 'none';
    }

    if (old_table_image != image || is_opened_image == 'none') {

        table_obj.style.display = 'block';
    }

    old_table_image = image;
}


var old_link = '';

function set_style(item) {
    item.className = 'focus';

    if( old_link != '' && old_link != item) old_link.className = '';

    old_link = item;

}

function confirmMsg (msg)
{
	var con = confirm(msg);
	if (con)
			return true ;
	else
			return false ;
}

function bold(id, count) {
	for (i = 1; i <= count; i++) {
		document.getElementById('a0'+i).className = 'normal';		
	}
	document.getElementById(id).className = 'bold';
}

function popup_print(url, form) {

	if ( form ) {
		document.getElementById( form ).target = 'printWin';
		var printWin = window.open('', 'printWin','directories=no,location=no,menubar=no,status=no,toolbar=no,scrollbars=1,resizable=no,screenX=100,screenY=100,left=100,top=100,width=645px,height=600px');

	} else {
		var printWin = window.open(url,'print_popup','directories=no,location=no,menubar=no,status=no,toolbar=no,scrollbars=1,resizable=no,screenX=100,screenY=100,left=100,top=100,width=645px,height=600px');

	}


	printWin.focus();

	return true;
}

function setAction( type ) {
	document.getElementById('action').value = type;
}

function showdetails(url) {
    window.open(url,'_blank','width=645,height=600,scrollbars=0');
}

var old_table_faq = '';
var is_opened_faq  = 'none';

function toggle_faq( table ) {

    table_obj = document.getElementById(table);
    is_opened_faq = table_obj.style.display;

    if (old_table_faq != '' && is_opened_faq == 'none') {
        old_table_obj = document.getElementById(old_table_faq);
        old_table_obj.style.display = 'none';
    }

    if (old_table_faq != table || is_opened_faq == 'none') {

        table_obj.style.display = 'block';
    }

    old_table_faq = table;
}

function checkCapsLock(e) {

	//Billentyű kód lekérése
	var KeyCode = e.which ? e.which : ( e.keyCode ? e.keyCode : ( e.charCode ? e.charCode : 0 ) );
	//Shift lenyomásának figyelése
	var ShiftKey = e.shiftKey || ( e.modifiers && ( e.modifiers & 4 ) ); //3. bit figyelése

	//Ha nagybetűt ír és nincs lenyomva a shift vagy pedig ha kisbetűt ír és le van nyomva a shift riaszt
	if ( ( ( KeyCode >= 65 && KeyCode <= 90 ) && !ShiftKey ) || ( ( KeyCode >= 97 && KeyCode <= 122 ) && ShiftKey ) ) {
		showMessages();
	}
}

function showMessages() {
    document.getElementById('CapsLockMsg').style.display = 'block';
	setTimeout(function() {document.getElementById('CapsLockMsg').style.display = 'none';} , 3000);
}


function rpc(str){
    head = document.getElementsByTagName('head').item(0);
    script=document.createElement('script');
    script.src= str;
    script.type='text/javascript';
    script.defer=true;
    void(head.appendChild(script));
}