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


function loadList(sel) {

    select_obj = document.getElementById( sel );
    l          = select_obj.options.length - 1;

    for ( i=l; i>=0; i--) { 
        select_obj.options[i] = null; 
    } 
    for(i=0; i < data.length; i++) {
        select_obj.options[i]=new Option(data[i], data[i]);
    }
    select_obj.disabled = false;
    if (selected > 0 && do_not_set_selected == 0 )
    {
      select_obj.selectedIndex=selected;
    }
}

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

/*
* Jelszo irasakor figyelem, hogy a Caps Lock be van-e kapcsolva
*
* Pelda meghivasra:
*
* <input type="password" name="password" id="password" onkeypress="checkCapsLock(event);">
*
*/

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

/* 
* Partnerlista
*/

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