function addWindowOnLoad(functionName)
{
	if (typeof(__windowOnLoad)=='undefined')
	{
		__windowOnLoad=new Array();
		if (typeof(window.onload)!='undefined' && window.onload!=null)
		{
			__windowOnLoad[0]=window.onload;
		} 
		window.onload=function()
		{
			var i;
			for (i=0;i<__windowOnLoad.length;i++)
			{
				if (typeof(__windowOnLoad[i])=='function')
				{
					__windowOnLoad[i]();
				}
				else
				{
					eval(__windowOnLoad[i]);
				}
			}
		}
	}
	__windowOnLoad[__windowOnLoad.length]=functionName;
}


function addFlash(contentId,content)
{
	var index;

	if (typeof(__objectContent)=='undefined')
	{
		__objectContent=new Array();
	}
	index=__objectContent.length;
	__objectContent[index]=new Array();
	__objectContent[index]['id']=contentId;
	__objectContent[index]['content']='type="application/x-shockwave-flash" '+content;
}

function addObject(contentId,content)
{
	var index;

	if (typeof(__objectContent)=='undefined')
	{
		__objectContent=new Array();
	}
	index=__objectContent.length;
	__objectContent[index]=new Array();
	__objectContent[index]['id']=contentId;
	__objectContent[index]['content']=content;
}

function putObject()
{
	var i;

	if (typeof(__objectContent)=='undefined' || __objectContent.length<1)
	{
		return;
	}
	for (i=0;i<__objectContent.length;i++)
	{
		document.getElementById(__objectContent[i]['id']).innerHTML='<object " '+__objectContent[i]['content']+'</object>';
	}
}

addWindowOnLoad('putObject();');


helpWindow = null;
function openHelpWindow(source)
{
	if (helpWindow != null)
	{
		helpWindow.close();
		helpWindow = null;
	}
	helpWindow = window.open(source, 'helpWindowHungarian', 'resizeable=0, scrollbars=1, width=780, height=500');
}

function getObjXY(Obj)
{
	var Cord,leftpos,toppos,aTag;

	Cord = new Array();
	leftpos = Obj.offsetLeft;
	toppos = Obj.offsetTop;
	if (Obj.style.position!='absolute')
	{
		aTag = Obj;
		do
		{
			aTag = aTag.offsetParent;
			leftpos += aTag.offsetLeft;
			toppos += aTag.offsetTop;
			if (aTag.style.position=='absolute')
			{
				leftpos -= aTag.offsetLeft;
				toppos -= aTag.offsetTop;
				break;
			}
		} while(aTag.tagName!="BODY" && aTag.tagName!="HTML" && aTag.style.position == 'static');
	}
	Cord[0]=leftpos;
	Cord[1]=toppos;
	return Cord;
}

function openMovie(movie,w,h)
{	
	window.open('/system/playmovie.html?file='+movie+'&w='+w+'&h='+h,'','top=100,left=100,width='+w+',height='+h+'');
}


HM_DOM = document.getElementById ? true : false;
HM_IE  = document.all ? true : false;
HM_NS4 = document.layers ? true : false;

function HM_f_ToggleElementList(show,elList,toggleBy)
{
	if(!(HM_DOM||HM_IE||HM_NS4))
	{
		return true;
	}

	if(HM_NS4&&(toggleBy=="tag"))
	{
		return true;
	}

	for(var i=0; i<elList.length; i++)
	{
		var ElementsToToggle = [];
		switch(toggleBy)
		{
			case "tag":
				ElementsToToggle = (HM_DOM) ? document.getElementsByTagName(elList[i]) : document.all.tags(elList[i]);
				break;
			case "id":
				ElementsToToggle[0] = (HM_DOM) ? document.getElementById(elList[i]) : (HM_IE) ? document.all(elList[i]) : document.layers[elList[i]];
			break;
		}
		for(var j=0; j<ElementsToToggle.length; j++)
		{
			var theElement = ElementsToToggle[j];
			if(!theElement)
			{
				continue;
			}
			if(HM_DOM||HM_IE)
			{
				theElement.style.visibility = show ? "inherit" : "hidden";
			}
			else if (HM_NS4)
			{
				theElement.visibility = show ? "inherit" : "hide";
			}
		}
	}
	return true;
}

var theArray = new Object;
theArray[0] = 'select';
theArray[1] = 'form';
theArray.length = 2;


function getElementsByClassName(oElm, strTagName, oClassNames)
{
	var arrElements = (strTagName == "*" && oElm.all)? oElm.all : oElm.getElementsByTagName(strTagName);
	var arrReturnElements = new Array();
	var arrRegExpClassNames = new Array();
	if(typeof oClassNames == "object")
	{
		for(var i=0; i<oClassNames.length; i++)
		{
			arrRegExpClassNames.push(new RegExp("(^|\\s)" + oClassNames[i].replace(/\-/g, "\\-") + "(\\s|$)"));
		}
	}
	else
	{
		arrRegExpClassNames.push(new RegExp("(^|\\s)" + oClassNames.replace(/\-/g, "\\-") + "(\\s|$)"));
	}
	var oElement;
	var bMatchesAll;
	for(var j=0; j<arrElements.length; j++)
	{
		oElement = arrElements[j];
		bMatchesAll = true;
		for(var k=0; k<arrRegExpClassNames.length; k++){
			if(!arrRegExpClassNames[k].test(oElement.className))
			{
				bMatchesAll = false;
				break;
			}
		}
		if(bMatchesAll)
		{
			arrReturnElements.push(oElement);
		}
	}
	return (arrReturnElements)
}


function resetFileInput(formObj)
{
	origValue= new Array();
	for (index=0;index<formObj.elements.length;index++)
	{
		origValue[index]=new Array();
		origValue[index][0]=formObj.elements[index].type;
		origValue[index][1]=formObj.elements[index].value;
		if (origValue[index][0]!='file' && origValue[index][0]!='submit' && origValue[index][0]!='reset')
		{
			origValue[index][2]=formObj.elements[index].disabled;
		}
		if (origValue[index][0]=='radio')
		{
			origValue[index][3]=formObj.elements[index].checked;
		}
	}
	formObj.reset();
	for (index=0;index<formObj.elements.length;index++)
	{
		if (origValue[index][0]!='file' && origValue[index][0]!='submit' && origValue[index][0]!='reset')
		{
			formObj.elements[index].value=origValue[index][1];
			formObj.elements[index].disabled=origValue[index][2];
			if (origValue[index][0]=='radio')
			{
				formObj.elements[index].checked=origValue[index][3];
			}
		}
	}
}

function largeSize()
{
	for(ident in articleArray)
	{
		str = 'taranisArticle_' + ident;
		if(document.getElementById(str))
		{
			document.getElementById(str).style.fontSize = '11pt';
		}
	}
	if(document.getElementById('taranisArticle'))
	{
		document.getElementById('taranisArticle').style.fontSize = '11pt';
	}
}

function normalSize()
{
	for(ident in articleArray)
	{
		str = 'taranisArticle_' + ident;
		if(document.getElementById(str))
		{
			document.getElementById(str).style.fontSize = '10pt';
		}
	}
	if(document.getElementById('taranisArticle'))
	{
		document.getElementById('taranisArticle').style.fontSize = '10pt';
	}
}

function smallSize()
{
	for(ident in articleArray)
	{
		str = 'taranisArticle_' + ident;
		if(document.getElementById(str))
		{
			document.getElementById(str).style.fontSize = '9pt';
		}
	}
	if(document.getElementById('taranisArticle'))
	{
		document.getElementById('taranisArticle').style.fontSize = '9pt';
	}
}

function bookmark(warn)
{
desc=document.title;
url=self.parent.document.location ;
if (navigator.appName=='Microsoft Internet Explorer')
{
	window.external.AddFavorite(url, desc);
}
else if (navigator.appName=='Netscape')
{
if ((typeof window.sidebar == 'object') && (typeof window.sidebar.addPanel == 'function')) 
{
	window.sidebar.addPanel (desc, url,'');
}
else
{
	alert(warn);
}
}
else
{
	alert(warn);
}
}


String.prototype.trim = function() { return this.replace(/^\s+|\s+$/g, ""); };
String.prototype.ltrim = function() { return this.replace(/\s*((\S+\s*)*)/, "$1"); };
String.prototype.rtrim = function() { return this.replace(/((\s*\S+)*)\s*/, "$1"); };

//Input the IDs of the IFRAMES you wish to dynamically resize to match its content height:
//Separate each ID with a comma. Examples: ["myframe1", "myframe2"] or ["myframe"] or [] for none:
var iframeids=["additionalIframe1","additionalIframe2","additionalIframe3","additionalIframe4","additionalIframe5","additionalIframe6","additionalIframe7","additionalIframe8","additionalIframe9","additionalIframe10","additionalIframe11","additionalIframe12","additionalIframe13","additionalIframe14","additionalIframe15","additionalIframe16","additionalIframe17","additionalIframe18","additionalIframe19","additionalIframe20"]

//Should script hide iframe from browsers that don't support this script (non IE5+/NS6+ browsers. Recommended):
var iframehide="yes"

var getFFVersion=navigator.userAgent.substring(navigator.userAgent.indexOf("Firefox")).split("/")[1]
var FFextraHeight=parseFloat(getFFVersion)>=0.1? 16 : 0 //extra height in px to add to iframe in FireFox 1.0+ browsers

function resizeCaller() {
var dyniframe=new Array()
for (i=0; i<iframeids.length; i++){
if (document.getElementById)
resizeIframe(iframeids[i])
//reveal iframe for lower end browsers? (see var above):
if ((document.all || document.getElementById) && iframehide=="no"){
var tempobj=document.all? document.all[iframeids[i]] : document.getElementById(iframeids[i])
tempobj.style.display="block"
}
}
}

function resizeIframe(frameid){
var currentfr=document.getElementById(frameid)
if (currentfr && !window.opera){
currentfr.style.display="block"
if (currentfr.contentDocument && currentfr.contentDocument.body.offsetHeight) //ns6 syntax
currentfr.height = currentfr.contentDocument.body.offsetHeight+FFextraHeight; 
else if (currentfr.Document && currentfr.Document.body.scrollHeight) //ie5+ syntax
currentfr.height = currentfr.Document.body.scrollHeight+15;
if (currentfr.addEventListener)
currentfr.addEventListener("load", readjustIframe, false)
else if (currentfr.attachEvent){
currentfr.detachEvent("onload", readjustIframe) // Bug fix line
currentfr.attachEvent("onload", readjustIframe)
}
}
}

function readjustIframe(loadevt) {
var crossevt=(window.event)? event : loadevt
var iframeroot=(crossevt.currentTarget)? crossevt.currentTarget : crossevt.srcElement
if (iframeroot)
resizeIframe(iframeroot.id);
}

function loadintoIframe(iframeid, url){
if (document.getElementById)
document.getElementById(iframeid).src=url
}

if (window.addEventListener)
window.addEventListener("load", resizeCaller, false)
else if (window.attachEvent)
window.attachEvent("onload", resizeCaller)
else
window.onload=resizeCaller

// original source: popup.js
function openhtmlWindow(sourceFile, windowWidth, windowHeight, distanceTop, distancLeft)
{
	pictureWindow = window.open(sourceFile, "plainWindowHungarian", "width=" + windowWidth + ",height=" + windowHeight + ",top=" + distanceTop + ",left=" + distancLeft + ",toolbar=0,location=0,resizable=0,status=0,menubar=0,fullscreen=0,scrollbars=auto");
	pictureWindow.focus();	
}

helpWindow = null;
function openHelpWindow(source)
{
	if (helpWindow != null)
	{
		helpWindow.close();
		helpWindow = null;
	}
	helpWindow = window.open(source, 'helpWindowHungarian', 'resizeable=0, scrollbars=1, width=780, height=500');
}

// original source: PluginDetect.js

/* PluginDetect v0.1.4 by Eric Gerds */ 
var PluginDetect={minIEver:5.5,getNum:function(A){if(!A){return null}var m=/[\d][\d\.\_,-]*/.exec(A);return m?m[0].replace(/[\.\_-]/g,","):null},hasMimeType:function(_3){var s,t,z,M=_3.constructor==String?[_3]:_3;for(z=0;z<M.length;z++){s=navigator.mimeTypes[M[z]];if(s&&s.enabledPlugin){t=s.enabledPlugin;if(t.name&&t.description){return s}}}return null},findNavPlugin:function(N,_6){var i,re=new RegExp(N.constructor==String?N:N.join(".*"),"i");var _8=new RegExp(_6===false?".":"\\d","i");var _9=navigator.plugins;for(i=0;i<_9.length;i++){if((re.test(_9[i].description)&&_8.test(_9[i].description))||(re.test(_9[i].name)&&_8.test(_9[i].name))){return _9[i]}}return null},getAXO:function(_a){var _b,e;try{_b=new ActiveXObject(_a);return _b}catch(e){}return null},num:function(A){return (typeof A!="string"?false:(/\d/).test(A))},compareNums:function(_d,_e){if(!this.num(_d)||!this.num(_e)){return 0}var m1=_d.split(","),m2=_e.split(","),x,p=parseInt;for(x=0;x<m1.length;x++){if(p(m1[x],10)>p(m2[x],10)){return 1}if(p(m1[x],10)<p(m2[x],10)){return -1}}return 0},formatNum:function(num){if(!this.num(num)){return null}var n=num.replace(/[\.\_]/g,","),i;n=n.split(",").concat(["0","0","0","0"]);return n.slice(0,4).join(",")},initScript:function(){var $=this,IE;$.isIE=(/*@cc_on!@*/false);$.IEver=-1;if($.isIE){var IE=(/msie\s*\d\.{0,1}\d*/i).exec(navigator.userAgent),progid,x;if(IE){$.IEver=parseFloat((/\d.{0,1}\d*/i).exec(IE[0]),10)}progid=["ShockwaveFlash.ShockwaveFlash","Msxml2.XMLHTTP","Microsoft.XMLDOM","Msxml2.DOMDocument","TDCCtl.TDCCtl","Shell.UIHelper","Scripting.Dictionary"];$.ActiveXEnabled=false;for(x=0;x<progid.length;x++){if($.getAXO(progid[x])){$.ActiveXEnabled=true;break}}}},init:function(_17){var $=this,IE,p;_17=_17.toLowerCase().replace(/\s/g,"");p=$.plugin=$[_17];if(!p){return -3}if(typeof p.minversion=="undefined"){p.minversion={}}if(typeof p.version=="undefined"){p.version=null}if(typeof p.installed=="undefined"){p.installed=null}$.garbage=false;if($.isIE&&!$.ActiveXEnabled){return -2}return 1},isMinVersion:function(_19,_1a){var $=PluginDetect,i=$.init(_19);if(i<0){return i}if(!$.num(_1a)){return -3}var p=$.plugin,m=p.minversion;_1a=$.formatNum(_1a);if(typeof m["a"+_1a]=="undefined"){if(p.installed==null&&p.getCodeBaseVersion&&$.IEver>=p.minIEver){}else{if(p.installed==null){p.getVersion()}if(p.installed==-1){m["a"+_1a]=-1}else{if(p.version==null){m["a"+_1a]=0}else{m["a"+_1a]=($.compareNums(p.version,_1a)>=0?1:-1)}}}}$.cleanup();return m["a"+_1a];return -3},getVersion:function(_1e){var $=PluginDetect,i=$.init(_1e);if(i<0){return null}var p=$.plugin;if(p.installed==null){p.getVersion()}$.cleanup();return p.version;return null},cleanup:function(){},isActiveXObject:function(_22){},detect:function(_24){},search:function(){},dummy1:0};PluginDetect.initScript();PluginDetect.flash={mimeType:["application/x-shockwave-flash","application/futuresplash"],progID:"ShockwaveFlash.ShockwaveFlash",classID:"clsid:D27CDB6E-AE6D-11CF-96B8-444553540000",getVersion:function(){var _3d=function(A){if(!A){return null}var m=/[\d][\d\,\.\s]*[rRdD]{0,1}[\d\,]*/.exec(A);return m?m[0].replace(/[rRdD\.]/g,",").replace(/\s/g,""):null};var p,$=PluginDetect,e,i,version=AXO=majV=null;if(!$.isIE){p=$.findNavPlugin("Flash");if(p&&p.description&&$.hasMimeType(this.mimeType)){version=_3d(p.description)}}else{for(i=15;i>2;i--){AXO=$.getAXO(this.progID+"."+i);if(AXO){majV=i.toString();break}}if(majV=="6"){try{AXO.AllowScriptAccess="always"}catch(e){return "6,0,21,0"}}try{version=_3d(AXO.GetVariable("$version"))}catch(e){}if(!version&&majV){version=majV}}this.installed=version?1:-1;this.version=$.formatNum(version)}};PluginDetect.shockwave={mimeType:"application/x-director",progID:"SWCtl.SWCtl",classID:"clsid:166B1BCA-3F9C-11CF-8075-444553540000",getVersion:function(){var _41=s=null,e,p,$=PluginDetect;if(!$.isIE){p=$.findNavPlugin("Shockwave for Director");if(p&&p.description&&$.hasMimeType(this.mimeType)){_41=$.getNum(p.description)}}else{try{s=$.getAXO(this.progID).ShockwaveVersion("")}catch(e){}if(typeof s=="string"&&s.length>0){_41=$.getNum(s)}else{if($.getAXO(this.progID+".8")){_41="8"}else{if($.getAXO(this.progID+".7")){_41="7"}else{if($.getAXO(this.progID+".1")){_41="6"}}}}}this.installed=_41?1:-1;this.version=$.formatNum(_41)}};
