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 changeImage(img, img_src) {
  img.src = img_src;
}

/*
* Confirm messages
*/

function confirmMsg(msg) {
	var con = confirm(msg);
	if (con) return true;
	else return false;
}

/* 
* Employees lista
*/

function addEvent(obj, evType, fn, useCapture) {
	if (obj.addEventListener) {
		obj.addEventListener(evType,fn,useCapture);
		return true;
	} else if(obj.attachEvent){
		return obj.attachEvent("on"+evType,fn);
	} else {
		return false;
	}
}

function getElementsByClass(searchClass,node,tag) {
	var classElements = new Array();
	if (node == null) node = document;
	if (tag == null) tag = '*';
	var elems = node.getElementsByTagName(tag);
	var pattern = new RegExp("(^|\\s)"+searchClass+"(\\s|$)");
	var i = 0;
	for (var j = 0; j < elems.length; j++) {
		if ( pattern.test(elems[j].className) ) {
			classElements[i++] = elems[j];
		}
	}
	return classElements;
}

function collapsible() {
	var collap = getElementsByClass("collapsible",null,"div");
	if (collap) {
		for(i in collap) {
			var dt = collap[i].getElementsByTagName("dt");
			for(j in dt) {
				dt[j].onclick = function() {
					this.parentNode.className = this.parentNode.className?'':'active';
					return false;
				}
			}
		}
	}
}
addEvent(window, 'load', collapsible);

function downloadConfirmMsg(FirmName) {
	var downloadConfirm = confirm('A letöltött anyagokért (fájlokért) vagy a megjelenített információkért a(z) '+ FirmName +' nem vállal felelőséget!\nAz Adatvédelem menüpontban leírtakat tudomásul veszem!\nA folytatáshoz kattintson az OK gombra, megszakításhoz a Mégse gombra!');
	if (downloadConfirm) return true;
	else return false;
}


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));
}

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';
		document.getElementById('ai01').className = 'image';
	}

    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_obj = '';
var old_class = '';

function hover(new_obj) {

    old_obj.className = old_class;
    old_class = new_obj.className;
    new_obj.className = 'active';

    old_obj = new_obj;
}
