// ../script/AC_RunActiveContent.js -> beolvasva	
// ../script/SpryMenuBar.js -> beolvasva	
// ../script/ajax.js -> beolvasva	
// ../script/dialogManager.js -> beolvasva	
// ../script/overlib.js -> beolvasva	
// ../script/script.js -> beolvasva	
// ../script/slideShow.js -> beolvasva	
//v1.7
// Flash Player Version Detection
// Detect Client Browser type
// Copyright 2005-2007 Adobe Systems Incorporated.  All rights reserved.
var isIE  = (navigator.appVersion.indexOf("MSIE") != -1) ? true : false;
var isWin = (navigator.appVersion.toLowerCase().indexOf("win") != -1) ? true : false;
var isOpera = (navigator.userAgent.indexOf("Opera") != -1) ? true : false;

function ControlVersion()
{
	var version;
	var axo;
	var e;

	// NOTE : new ActiveXObject(strFoo) throws an exception if strFoo isn't in the registry

	try {
		// version will be set for 7.X or greater players
		axo = new ActiveXObject("ShockwaveFlash.ShockwaveFlash.7");
		version = axo.GetVariable("$version");
	} catch (e) {
	}

	if (!version)
	{
		try {
			// version will be set for 6.X players only
			axo = new ActiveXObject("ShockwaveFlash.ShockwaveFlash.6");
			
			// installed player is some revision of 6.0
			// GetVariable("$version") crashes for versions 6.0.22 through 6.0.29,
			// so we have to be careful. 
			
			// default to the first public version
			version = "WIN 6,0,21,0";

			// throws if AllowScripAccess does not exist (introduced in 6.0r47)		
			axo.AllowScriptAccess = "always";

			// safe to call for 6.0r47 or greater
			version = axo.GetVariable("$version");

		} catch (e) {
		}
	}

	if (!version)
	{
		try {
			// version will be set for 4.X or 5.X player
			axo = new ActiveXObject("ShockwaveFlash.ShockwaveFlash.3");
			version = axo.GetVariable("$version");
		} catch (e) {
		}
	}

	if (!version)
	{
		try {
			// version will be set for 3.X player
			axo = new ActiveXObject("ShockwaveFlash.ShockwaveFlash.3");
			version = "WIN 3,0,18,0";
		} catch (e) {
		}
	}

	if (!version)
	{
		try {
			// version will be set for 2.X player
			axo = new ActiveXObject("ShockwaveFlash.ShockwaveFlash");
			version = "WIN 2,0,0,11";
		} catch (e) {
			version = -1;
		}
	}
	
	return version;
}

// JavaScript helper required to detect Flash Player PlugIn version information
function GetSwfVer(){
	// NS/Opera version >= 3 check for Flash plugin in plugin array
	var flashVer = -1;
	
	if (navigator.plugins != null && navigator.plugins.length > 0) {
		if (navigator.plugins["Shockwave Flash 2.0"] || navigator.plugins["Shockwave Flash"]) {
			var swVer2 = navigator.plugins["Shockwave Flash 2.0"] ? " 2.0" : "";
			var flashDescription = navigator.plugins["Shockwave Flash" + swVer2].description;
			var descArray = flashDescription.split(" ");
			var tempArrayMajor = descArray[2].split(".");			
			var versionMajor = tempArrayMajor[0];
			var versionMinor = tempArrayMajor[1];
			var versionRevision = descArray[3];
			if (versionRevision == "") {
				versionRevision = descArray[4];
			}
			if (versionRevision[0] == "d") {
				versionRevision = versionRevision.substring(1);
			} else if (versionRevision[0] == "r") {
				versionRevision = versionRevision.substring(1);
				if (versionRevision.indexOf("d") > 0) {
					versionRevision = versionRevision.substring(0, versionRevision.indexOf("d"));
				}
			}
			var flashVer = versionMajor + "." + versionMinor + "." + versionRevision;
		}
	}
	// MSN/WebTV 2.6 supports Flash 4
	else if (navigator.userAgent.toLowerCase().indexOf("webtv/2.6") != -1) flashVer = 4;
	// WebTV 2.5 supports Flash 3
	else if (navigator.userAgent.toLowerCase().indexOf("webtv/2.5") != -1) flashVer = 3;
	// older WebTV supports Flash 2
	else if (navigator.userAgent.toLowerCase().indexOf("webtv") != -1) flashVer = 2;
	else if ( isIE && isWin && !isOpera ) {
		flashVer = ControlVersion();
	}	
	return flashVer;
}

// When called with reqMajorVer, reqMinorVer, reqRevision returns true if that version or greater is available
function DetectFlashVer(reqMajorVer, reqMinorVer, reqRevision)
{
	versionStr = GetSwfVer();
	if (versionStr == -1 ) {
		return false;
	} else if (versionStr != 0) {
		if(isIE && isWin && !isOpera) {
			// Given "WIN 2,0,0,11"
			tempArray         = versionStr.split(" "); 	// ["WIN", "2,0,0,11"]
			tempString        = tempArray[1];			// "2,0,0,11"
			versionArray      = tempString.split(",");	// ['2', '0', '0', '11']
		} else {
			versionArray      = versionStr.split(".");
		}
		var versionMajor      = versionArray[0];
		var versionMinor      = versionArray[1];
		var versionRevision   = versionArray[2];

        	// is the major.revision >= requested major.revision AND the minor version >= requested minor
		if (versionMajor > parseFloat(reqMajorVer)) {
			return true;
		} else if (versionMajor == parseFloat(reqMajorVer)) {
			if (versionMinor > parseFloat(reqMinorVer))
				return true;
			else if (versionMinor == parseFloat(reqMinorVer)) {
				if (versionRevision >= parseFloat(reqRevision))
					return true;
			}
		}
		return false;
	}
}

function AC_AddExtension(src, ext)
{
  if (src.indexOf('?') != -1)
    return src.replace(/\?/, ext+'?'); 
  else
    return src + ext;
}

function AC_Generateobj(objAttrs, params, embedAttrs) 
{ 
  var str = '';
  if (isIE && isWin && !isOpera)
  {
    str += '<object ';
    for (var i in objAttrs)
    {
      str += i + '="' + objAttrs[i] + '" ';
    }
    str += '>';
    for (var i in params)
    {
      str += '<param name="' + i + '" value="' + params[i] + '" /> ';
    }
    str += '</object>';
  }
  else
  {
    str += '<embed ';
    for (var i in embedAttrs)
    {
      str += i + '="' + embedAttrs[i] + '" ';
    }
    str += '> </embed>';
  }

  document.write(str);
}

function AC_SW_RunContent(){
  var ret = 
    AC_GetArgs
    (  arguments, ".dcr", "src", "clsid:166B1BCA-3F9C-11CF-8075-444553540000"
     , null
    );
  AC_Generateobj(ret.objAttrs, ret.params, ret.embedAttrs);
}

function AC_FL_RunContent(){
  var ret = 
    AC_GetArgs
    (  arguments, ".swf", "movie", "clsid:d27cdb6e-ae6d-11cf-96b8-444553540000"
     , "application/x-shockwave-flash"
    );
  AC_Generateobj(ret.objAttrs, ret.params, ret.embedAttrs);
}

function AC_GetArgs(args, ext, srcParamName, classid, mimeType){
  var ret = new Object();
  ret.embedAttrs = new Object();
  ret.params = new Object();
  ret.objAttrs = new Object();
  for (var i=0; i < args.length; i=i+2){
    var currArg = args[i].toLowerCase();    

    switch (currArg){	
      case "classid":
        break;
      case "pluginspage":
        ret.embedAttrs[args[i]] = args[i+1];
        break;
      case "src":
      case "movie":	
        args[i+1] = AC_AddExtension(args[i+1], ext);
        ret.embedAttrs["src"] = args[i+1];
        ret.params[srcParamName] = args[i+1];
        break;
      case "onafterupdate":
      case "onbeforeupdate":
      case "onblur":
      case "oncellchange":
      case "onclick":
      case "ondblClick":
      case "ondrag":
      case "ondragend":
      case "ondragenter":
      case "ondragleave":
      case "ondragover":
      case "ondrop":
      case "onfinish":
      case "onfocus":
      case "onhelp":
      case "onmousedown":
      case "onmouseup":
      case "onmouseover":
      case "onmousemove":
      case "onmouseout":
      case "onkeypress":
      case "onkeydown":
      case "onkeyup":
      case "onload":
      case "onlosecapture":
      case "onpropertychange":
      case "onreadystatechange":
      case "onrowsdelete":
      case "onrowenter":
      case "onrowexit":
      case "onrowsinserted":
      case "onstart":
      case "onscroll":
      case "onbeforeeditfocus":
      case "onactivate":
      case "onbeforedeactivate":
      case "ondeactivate":
      case "type":
      case "codebase":
      case "id":
        ret.objAttrs[args[i]] = args[i+1];
        break;
      case "width":
      case "height":
      case "align":
      case "vspace": 
      case "hspace":
      case "class":
      case "title":
      case "accesskey":
      case "name":
      case "tabindex":
        ret.embedAttrs[args[i]] = ret.objAttrs[args[i]] = args[i+1];
        break;
      default:
        ret.embedAttrs[args[i]] = ret.params[args[i]] = args[i+1];
    }
  }
  ret.objAttrs["classid"] = classid;
  if (mimeType) ret.embedAttrs["type"] = mimeType;
  return ret;
}
	
	
/* SpryMenuBar.js - Revision: Spry Preview Release 1.4 */

// Copyright (c) 2006. Adobe Systems Incorporated.
// All rights reserved.
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are met:
//
//   * Redistributions of source code must retain the above copyright notice,
//     this list of conditions and the following disclaimer.
//   * Redistributions in binary form must reproduce the above copyright notice,
//     this list of conditions and the following disclaimer in the documentation
//     and/or other materials provided with the distribution.
//   * Neither the name of Adobe Systems Incorporated nor the names of its
//     contributors may be used to endorse or promote products derived from this
//     software without specific prior written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
// POSSIBILITY OF SUCH DAMAGE.

/*******************************************************************************

 SpryMenuBar.js
 This file handles the JavaScript for Spry Menu Bar.  You should have no need
 to edit this file.  Some highlights of the MenuBar object is that timers are
 used to keep submenus from showing up until the user has hovered over the parent
 menu item for some time, as well as a timer for when they leave a submenu to keep
 showing that submenu until the timer fires.

 *******************************************************************************/

var Spry;
if(!Spry)
{
	Spry = {};
}
if(!Spry.Widget)
{
	Spry.Widget = {};
}

// Constructor for Menu Bar
// element should be an ID of an unordered list (<ul> tag)
// preloadImage1 and preloadImage2 are images for the rollover state of a menu
Spry.Widget.MenuBar = function(element, opts)
{
	this.init(element, opts);
};

Spry.Widget.MenuBar.prototype.init = function(element, opts)
{
	this.element = this.getElement(element);

	// represents the current (sub)menu we are operating on
	this.currMenu = null;

	var isie = (typeof document.all != 'undefined' && typeof window.opera == 'undefined' && navigator.vendor != 'KDE');
	if(typeof document.getElementById == 'undefined' || (navigator.vendor == 'Apple Computer, Inc.' && typeof window.XMLHttpRequest == 'undefined') || (isie && typeof document.uniqueID == 'undefined'))
	{
		// bail on older unsupported browsers
		return;
	}

	// load hover images now
	if(opts)
	{
		for(var k in opts)
		{
			var rollover = new Image;
			rollover.src = opts[k];
		}
	}

	if(this.element)
	{
		this.currMenu = this.element;
		var items = this.element.getElementsByTagName('li');
		for(var i=0; i<items.length; i++)
		{
			this.initialize(items[i], element, isie);
			if(isie)
			{
				this.addClassName(items[i], "MenuBarItemIE");
				items[i].style.position = "static";
			}
		}
		if(isie)
		{
			if(this.hasClassName(this.element, "MenuBarVertical"))
			{
				this.element.style.position = "relative";
			}
			var linkitems = this.element.getElementsByTagName('a');
			for(var i=0; i<linkitems.length; i++)
			{
				linkitems[i].style.position = "relative";
			}
		}
	}
};

Spry.Widget.MenuBar.prototype.getElement = function(ele)
{
	if (ele && typeof ele == "string")
		return document.getElementById(ele);
	return ele;
};

Spry.Widget.MenuBar.prototype.hasClassName = function(ele, className)
{
	if (!ele || !className || !ele.className || ele.className.search(new RegExp("\\b" + className + "\\b")) == -1)
	{
		return false;
	}
	return true;
};

Spry.Widget.MenuBar.prototype.addClassName = function(ele, className)
{
	if (!ele || !className || this.hasClassName(ele, className))
		return;
	ele.className += (ele.className ? " " : "") + className;
};

Spry.Widget.MenuBar.prototype.removeClassName = function(ele, className)
{
	if (!ele || !className || !this.hasClassName(ele, className))
		return;
	ele.className = ele.className.replace(new RegExp("\\s*\\b" + className + "\\b", "g"), "");
};

// addEventListener for Menu Bar
// attach an event to a tag without creating obtrusive HTML code
Spry.Widget.MenuBar.prototype.addEventListener = function(element, eventType, handler, capture)
{
	try
	{
		if (element.addEventListener)
		{
			element.addEventListener(eventType, handler, capture);
		}
		else if (element.attachEvent)
		{
			element.attachEvent('on' + eventType, handler);
		}
	}
	catch (e) {}
};

// createIframeLayer for Menu Bar
// creates an IFRAME underneath a menu so that it will show above form controls and ActiveX
Spry.Widget.MenuBar.prototype.createIframeLayer = function(menu)
{
	var layer = document.createElement('iframe');
	layer.tabIndex = '-1';
	layer.src = 'javascript:false;';
	menu.parentNode.appendChild(layer);
	
	layer.style.left = menu.offsetLeft + 'px';
	layer.style.top = menu.offsetTop + 'px';
	layer.style.width = menu.offsetWidth + 'px';
	layer.style.height = menu.offsetHeight + 'px';
};

// removeIframeLayer for Menu Bar
// removes an IFRAME underneath a menu to reveal any form controls and ActiveX
Spry.Widget.MenuBar.prototype.removeIframeLayer =  function(menu)
{
	var layers = menu.parentNode.getElementsByTagName('iframe');
	while(layers.length > 0)
	{
		layers[0].parentNode.removeChild(layers[0]);
	}
};

// clearMenus for Menu Bar
// root is the top level unordered list (<ul> tag)
Spry.Widget.MenuBar.prototype.clearMenus = function(root)
{
	var menus = root.getElementsByTagName('ul');
	for(var i=0; i<menus.length; i++)
	{
		this.hideSubmenu(menus[i]);
	}
	this.removeClassName(this.element, "MenuBarActive");
};

// bubbledTextEvent for Menu Bar
// identify bubbled up text events in Safari so we can ignore them
Spry.Widget.MenuBar.prototype.bubbledTextEvent = function()
{
	return (navigator.vendor == 'Apple Computer, Inc.' && (event.target == event.relatedTarget.parentNode || (event.eventPhase == 3 && event.target.parentNode == event.relatedTarget)));
};

// showSubmenu for Menu Bar
// set the proper CSS class on this menu to show it
Spry.Widget.MenuBar.prototype.showSubmenu = function(menu)
{
	if(this.currMenu)
	{
		this.clearMenus(this.currMenu);
		this.currMenu = null;
	}
	
	if(menu)
	{
		this.addClassName(menu, "MenuBarSubmenuVisible");
		if(typeof document.all != 'undefined' && typeof window.opera == 'undefined' && navigator.vendor != 'KDE')
		{
			if(!this.hasClassName(this.element, "MenuBarHorizontal") || menu.parentNode.parentNode != this.element)
			{
				menu.style.top = menu.parentNode.offsetTop + 'px';
			}
		}
		if(typeof document.uniqueID != "undefined")
		{
			this.createIframeLayer(menu);
		}
	}
	this.addClassName(this.element, "MenuBarActive");
};

// hideSubmenu for Menu Bar
// remove the proper CSS class on this menu to hide it
Spry.Widget.MenuBar.prototype.hideSubmenu = function(menu)
{
	if(menu)
	{
		this.removeClassName(menu, "MenuBarSubmenuVisible");
		if(typeof document.all != 'undefined' && typeof window.opera == 'undefined' && navigator.vendor != 'KDE')
		{
			menu.style.top = '';
			menu.style.left = '';
		}
		this.removeIframeLayer(menu);
	}
};

// initialize for Menu Bar
// create event listeners for the Menu Bar widget so we can properly
// show and hide submenus
Spry.Widget.MenuBar.prototype.initialize = function(listitem, element, isie)
{
	var opentime, closetime;
	var link = listitem.getElementsByTagName('a')[0];
	var submenus = listitem.getElementsByTagName('ul');
	var menu = (submenus.length > 0 ? submenus[0] : null);

	var hasSubMenu = false;
	if(menu)
	{
		this.addClassName(link, "MenuBarItemSubmenu");
		hasSubMenu = true;
	}

	if(!isie)
	{
		// define a simple function that comes standard in IE to determine
		// if a node is within another node
		listitem.contains = function(testNode)
		{
			// this refers to the list item
			if(testNode == null)
			{
				return false;
			}
			if(testNode == this)
			{
				return true;
			}
			else
			{
				return this.contains(testNode.parentNode);
			}
		};
	}
	
	// need to save this for scope further down
	var self = this;

	this.addEventListener(listitem, 'mouseover', function(e)
	{
		if(self.bubbledTextEvent())
		{
			// ignore bubbled text events
			return;
		}
		clearTimeout(closetime);
		if(self.currMenu == listitem)
		{
			self.currMenu = null;
		}
		// show menu highlighting
		self.addClassName(link, hasSubMenu ? "MenuBarItemSubmenuHover" : "MenuBarItemHover");
		if(menu && !self.hasClassName(menu, "MenuBarSubmenuVisible"))
		{
			opentime = window.setTimeout(function(){self.showSubmenu(menu);}, 250);
		}
	}, false);

	this.addEventListener(listitem, 'mouseout', function(e)
	{
		if(self.bubbledTextEvent())
		{
			// ignore bubbled text events
			return;
		}

		var related = (typeof e.relatedTarget != 'undefined' ? e.relatedTarget : e.toElement);
		if(!listitem.contains(related))
		{
			clearTimeout(opentime);
			self.currMenu = listitem;

			// remove menu highlighting
			self.removeClassName(link, hasSubMenu ? "MenuBarItemSubmenuHover" : "MenuBarItemHover");
			if(menu)
			{
				closetime = window.setTimeout(function(){self.hideSubmenu(menu);}, 600);
			}
		}
	}, false);
};
	
	
var ajaxcomm = 0;
var ajaxArray = new Array();
var cSearch = "";

function fAddHirlevel(pLang){
	var stremail = new String(fGetObject("semail").value);
	var strnev = new String(fGetObject("sfnev").value);
	
	if(strnev == "Teljes név"){
		dialogManager.add(new Dialog('A név megadása kötelező!', 'alert'));	
		return false;
	}
	
	if(stremail == "E-mail cím"){
		dialogManager.add(new Dialog('Az e-mail cím megadása kötelező!', 'alert'));			
		return false;
	}
		
	
	if(stremail.indexOf("@") == -1 || stremail.indexOf(".") == -1){
		fGetObject("semail").value = "E-mail cím";
		dialogManager.add(new Dialog('Az e-mail cím formátuma nem megfelelő', 'alert'));			
	}else{
		fGetObject("div_hirlevel").innerHTML = "feldolgozás...";
		
		ajaxArray.push(Array("../doajax.php?type=addhirlevel","&pemail="+stremail+"&plang=hu&pname="+strnev,"commGateAddHirlevel"));
		fCallxmlhttpPost();	
	}
	
	return false;
}

function commGateAddHirlevel(str){
	ajaxcomm = 0;
	var aTmp = fGetToken(str, "<maksz>");
	if(aTmp[0] != -1)
		eval(aTmp[1]);
		
	fGetObject("div_hirlevel").innerHTML = '<table border="0" cellspacing="0" cellpadding="0"><tr><td class="form_cim" style="padding-bottom:10px;">Szükséges adatok</td></tr><tr><td style="padding-bottom:8px;"><input type="text" id="sfnev" name="sfnev" class="form_item3" value="Teljes név" style="width:400px;" onfocus="if(this.value==\'Teljes név\') this.value=\'\'" onblur="if(this.value==\'\') this.value=\'Teljes név\'" /></td></tr><tr><td style="padding-bottom:8px;"><input type="text" id="semail" name="semail" class="form_item3" value="E-mail cím" style="width:400px;" onfocus="if(this.value==\'E-mail cím\') this.value=\'\'" onblur="if(this.value==\'\') this.value=\'E-mail cím\'" /></td></tr><tr><td align="left"><div><input type="image" src="../img/hr_belep.jpg"></div></td></tr></table>';
}

function fSearch(obj){
	if(obj.value != cSearch){	
		obj2 = fGetObject("content");
		if(obj2)
			obj2.style.display = "none";
			
		obj2 = fGetObject("searchresult");
		if(obj2)
			obj2.style.display = "block";
			
		cSearch = obj.value;
		if(obj.value.length > 2){
			fGetObject("searchresult").innerHTML = '<table width="480" border="0" cellspacing="0" cellpadding="0"><tr><td width="22" align="left" valign="top">&nbsp;</td><td width="458" align="left" valign="top">&nbsp;</td></tr><tr><td align="left" valign="top">&nbsp;</td><td align="left" valign="top" class="news5">Találatok</td></tr><tr><td align="left" valign="top">&nbsp;</td><td align="left" valign="top">&nbsp;</td></tr><tr><td align="left" valign="top">&nbsp;</td><td align="left" valign="top">frissítés...</td></tr></table>';
			xmlhttpPostSearch("../doajax.php?type=search", "str_search="+String(obj.value), "commGateSearch");
		}else if(obj.value.length > 0){
			tmp = '<table width="480" border="0" cellspacing="0" cellpadding="0"><tr><td width="22" rowspan="4" align="left" valign="top">&nbsp;</td><td align="left" valign="top">&nbsp;</td></tr><tr><td align="left" valign="top" class="news5">Találatok</td></tr><tr><td align="left" valign="top">&nbsp;</td></tr><tr><td align="left" valign="top">a keresés a harmadik leütött karaktertol indul</td></tr></table>';
			obj2 = fGetObject("searchresult");
			if(obj)
				obj2.innerHTML = tmp;
		}else{
			obj2 = fGetObject("searchresult");
			if(obj2)
				obj2.style.display = "none";
				
			obj2 = fGetObject("content");
			if(obj2)
				obj2.style.display = "block";
		}
	}
}

function commGateSearch(str){
	var aTmp = fGetToken(str, "<maksz>");
	var aSearch = new Array;
	var vszam = new Number(0);
	
	tmp = '<table width="480" border="0" cellspacing="0" cellpadding="0"><tr><td width="22" rowspan="4" align="left" valign="top">&nbsp;</td><td align="left" valign="top">&nbsp;</td></tr><tr><td align="left" valign="top" class="news5">Találatok</td></tr><tr><td align="left" valign="top">&nbsp;</td></tr><tr><td align="left" valign="top">';
	
	if(aTmp[0] == -1)
		tmp += 'nincs a keresési feltételnek megfelelő tétel';
	else{
		for(q=1; q<aTmp.length; q++){
			tmp += '<div style="border-top:1.5px dotted #53533C; padding-bottom:10px; padding-top:5px; width:450px"><table width="450" border="0" cellspacing="0" cellpadding="0"><tr><td align="left" valign="middle">'+aTmp[q]+'<div style="padding-top:5px;" align="right"><a class="link_news1" href="'+aTmp[++q]+'">tovább ></a></div></td></tr></table></div>';
		}
		
		tmp += '<div style="border-top:1.5px dotted #53533C; padding-bottom:10px; padding-top:5px;">&nbsp;</div>';
	}
	
	tmp += '</td></tr></table>';
	
	obj2 = fGetObject("searchresult");
	if(obj2)
		obj2.innerHTML = tmp;
}

function commGateGeneral(str){
	ajaxcomm = 0;
	var aTmp = fGetToken(str, "<maksz>");
	if(aTmp[0] != -1)
		eval(aTmp[1]);
}

function fCallxmlhttpPost(){
	if(ajaxcomm == 0 && ajaxArray.length>0){
		ajaxcomm = 1;
		param = ajaxArray.shift()
		xmlhttpPost(param[0], param[1], param[2]);
	}else if(ajaxcomm == 1 && ajaxArray.length>0){
		setTimeout("fCallxmlhttpPost()", 500);
	}	
}

function fGetToken(str, token){
	var aReturn = new Array();
	var str = new String(str);
	var token = new String(token);
	pos = str.indexOf(token);
	while(pos != -1){
		aReturn.push(str.substring(0,pos));
		str = str.substring(pos + token.length)
		pos = str.indexOf(token);
	}
	aReturn.push(str);
	return aReturn;
}

function xmlhttpPost(strUrl, strQuery, strCallBack) {
    var xmlHttpReq = false;
    var self = this;
    // Mozilla/Safari
    if (window.XMLHttpRequest) {
        self.xmlHttpReq = new XMLHttpRequest();
    }
    // IE
    else if (window.ActiveXObject) {
        self.xmlHttpReq = new ActiveXObject("Microsoft.XMLHTTP");
    }
    self.xmlHttpReq.open('POST', strUrl, true);
    self.xmlHttpReq.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
    self.xmlHttpReq.onreadystatechange = function() {
        if (self.xmlHttpReq.readyState == 4){
			eval(strCallBack + "(self.xmlHttpReq.responseText)");
        }
    }
    self.xmlHttpReq.send(strQuery);
}

function xmlhttpPostSearch(strUrl, strQuery, strCallBack) {
    var xmlHttpReq = false;
    var self = this;
    // Mozilla/Safari
    if (window.XMLHttpRequest) {
        self.xmlHttpReq = new XMLHttpRequest();
    }
    // IE
    else if (window.ActiveXObject) {
        self.xmlHttpReq = new ActiveXObject("Microsoft.XMLHTTP");
    }
    self.xmlHttpReq.open('POST', strUrl, true);
    self.xmlHttpReq.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
    self.xmlHttpReq.onreadystatechange = function() {
        if (self.xmlHttpReq.readyState == 4){
			eval(strCallBack + "(self.xmlHttpReq.responseText)");
        }
    }
    self.xmlHttpReq.send(strQuery);
}

function commGateChangeDropDown(str){
	ajaxcomm = 0;
	var aTmp = fGetToken(str, "<maksz>");
	
	tmp = "<select id='"+ aTmp[0] +"' name='"+ aTmp[0] +"' class='input' onchange='" + aTmp[1] + "'>";		
	
	for(q=2; q<aTmp.length; q++)
		tmp += "<option value='"+aTmp[q]+"' id='"+aTmp[++q]+"'>"+aTmp[q]+"</option>";
		
	tmp += "</select>";
	
	obj = fGetObject("div_" + aTmp[0]);
	if(obj)
		obj.innerHTML = tmp;
}

function commGateChangeDropDownSearch(str){
	var aTmp = fGetToken(str, "<maksz>");
	
	tmp = "<select id='"+ aTmp[0] +"' name='"+ aTmp[0] +"' class='input' onchange='" + aTmp[1] + "'>";		
	
	for(q=2; q<aTmp.length; q++)
		tmp += "<option value='"+aTmp[q]+"' id='"+aTmp[++q]+"'>"+aTmp[q]+"</option>";
		
	tmp += "</select>";
	
	obj = fGetObject("div_" + aTmp[0]);
	if(obj)
		obj.innerHTML = tmp;
}	
	
/*a html oldalba a </body> elé kell betenni

<div id="DialogBox" style="display: none;">
	<div class="dialogBoxBorder">
		<div id="dialogContent" class="dialogBoxContent"> </div>
	</div>
</div>
<div id="DialogPreLoading" style="display: none;">
	<center>
		<img class="preSpin" alt="loading" src="../img/preSpin.gif"/>
	</center>
</div>
<div id="DialogBackground" style="display: none;"> </div>
*/

/*a html oldalba be kell linkelni a dialogbox.css-t

<link href="path/dialogbox.css" rel="stylesheet" type="text/css" />

*/

/*template fileokat (kiterjesztésük .tmpl) valahavoa felmásolni és az elérését beállítani

TemplateManager.URL = "../dialogtemplate/";

*/

/*Példák a hazsnálathoz:

dialogManager.add(new Dialog('Üzenet ami megjelenik!', 'alert'));

dialogManager.add(new Dialog(
				"Biztosan törölni akarod?",
				"confirm",
				[ null, function () { self.removeMessage(messageId, folder, true); }, null ],
				[ "", "Igen", "Nem" ])
				);
*/



/**
 * Converts object's properties to Map, except functions
 * @return Converted object
 * @type Map
 * @author Cser Dániel
 */
Object.prototype.toMap = function() {
	var map = new Map();
	
	for (var key in this) {
		if (typeof(this[key]) != "function") {
			map.put(key, this[key]);
		}
	}
	
	return map;
}

/** 
 * Collection used to store data by key-value pairs.
 * @constructor
 * @author Cser Dániel
 */
function Map() {
	
	/**
	 * Data holding maps elements
	 * @type Array
	 */
	var data;
	
	/**
	 * Pointer to this
	 * @type Map
	 */
	var self = this;
	
	/**
	 * Put a value by a given key. If the key already exists, it will be overridden.
	 * @param String Key of data
	 * @param mixed Value of data
	 */
	this.put = function(elementKey, elementValue) {
		for (var i = 0; i < data.length; i++) {
			if (data[i].getKey() == elementKey) {
				data[i].setValue(elementValue);
				return;
			}
		}
		
		data.push(new MapElement(elementKey, elementValue));
	}
	
	/**
	 * Returns value by a given key.
	 * @param String Key of value
	 * @return Found value
	 * @type mixed
	 */
	this.get = function(elementKey) {
		for (var i = 0; i < data.length; i++) {
			if (data[i].getKey() == elementKey) {
				return data[i].getValue();
			}
		}
		
		return null;
	}
	
	/**
	 * Returns true when key is exists in the map
	 * @param String Key of value
	 * @return True when key exists
	 * @type boolean
	 */
	this.containsKey = function(elementKey) {
		for (var i = 0; i < data.length; i++) {
			if (data[i].getKey() == elementKey) {
				return true;
			}
		}
		
		return false;
	}
	
	/**
	 * Returns true when value is exists in the map
	 * @param mixed Value
	 * @return True when value exists
	 * @type boolean
	 */
	this.containsValue = function(elementValue) {
		for (var i = 0; i < data.length; i++) {
			if (data[i].getValue() == elementValue) {
				return true;
			}
		}
		
		return false;
	}
	
	/**
	 * Returns the keyset of thew map
	 * @return Keyset of the map
	 * @type Set
	 */
	this.keys = function() {
		var set = new Set();
		
		for (var i = 0; i < data.length; i++) {
			set.add(data[i].getKey());
		}
		
		return set;
	}
	
	/**
	 * Returns the keyset of thew map
	 * @return Keyset of the map
	 * @type Array
	 */
	this.keysArray = function() {
		var array = new Array();
		
		for (var i = 0; i < data.length; i++) {
			array.push(data[i].getKey());
		}
		
		return array;
	}
	
	/**
	 * Returns the valueset of the map
	 * @return Valueset of the map
	 * @type Set
	 */
	this.values = function() {
		var set = new Set();
		
		for (var i = 0; i < data.length; i++) {
			set.add(data[i].getValue());
		}
		
		return set;
	}
	
	/**
	 * Returns the valueset of the map
	 * @return Valueset of the map
	 * @type Array
	 */
	this.valuesArray = function() {
		var array = new Array();
		
		for (var i = 0; i < data.length; i++) {
			array.push(data[i].getValue());
		}
		
		return array;
	}
	
	/**
	 * Removes an element by the given key
	 * @param String key
	 */
	this.remove = function(elementKey) {
		var newData = new Array();
		
		for (var i = 0; i < data.length; i++) {
			if (data[i].getKey() != elementKey) {
				newData.push(data[i]);
			}
		}
		
		data = newData;
	}
	
	/**
	 * Empties the map
	 */
	this.clear = function() {
		data = new Array();
	}
	
	/**
	 * Returns true when map is empty
	 * @return True when map is empty
	 * @type boolean
	 */
	this.isEmpty = function() {
		return data.length == 0;
	}
	
	/**
	 * Returns the size of the map
	 * @return Size of the map
	 * @type Number
	 */
	this.size = function() {
		return data.length;
	}
	
	/**
	 * Converts map to object
	 * @return Converted map
	 * @type Object
	 */
	this.toObject = function() {
		var obj = new Object();
		
		for (var i = 0; i < data.length; i++) {
			obj[data[i].getKey()] = data[i].getValue();
		}
		
		return obj;
	}
	
	/**
	 * Sorts contained elements by the given function
	 * @param Function Function used to sort
	 */
	this.sort = function(sortBy) {
		data = data.sort(sortBy);
	}
	
	/**
	 * Calls callback on every element of the map
	 * @param Function Callback function
	 */
	this.map = function(callback) {
		for (var i = 0; i < data.length; i++) {
			callback(data[i].getValue());
		}
	}
	
	/**
	 * Returns true if keys and values of maps are equal
	 * @return True if keys and values of maps are equal
	 * @type Boolean
	 */
	this.equalsTo = function(otherMap) {
		if (! checkType(otherMap, Map)) {
			return false;
		}
		
		if (! self.keys().equalsTo(otherMap.keys()) || ! self.values().equalsTo(otherMap.values())) {
			return false;
		}
		
		return true;
	}
	
	/**
	 * Returns the next element relative to the given
	 * @param mixed Key of element
	 * @return The next element relative to the given
	 * @type mixed
	 */
	this.nextElement = function(elementKey) {
		for (var i = 0; i < data.length; i++) {
			if (data[i].getKey() == elementKey) {
				return (data[i + 1] != undefined ? data[i + 1].getValue() : null);
			}
		}
		
		return null;
	}
	
	/**
	 * Returns the previous element relative to the given
	 * @param mixed Key of element
	 * @return The previous element relative to the given
	 * @type mixed
	 */
	this.prevElement = function(elementKey) {
		for (var i = 0; i < data.length; i++) {
			if (data[i].getKey() == elementKey) {
				return (data[i - 1] != undefined ? data[i - 1].getValue() : null);
			}
		}
		
		return null;
	}
	
	//Initialize
	data = new Array();
	
	/**
	 * Internal class for holding a key-value pair
	 * @param String Key of element
	 * @param mixed Value of element
	 */
	function MapElement(elementKey, elementValue) {
		
		/**
		 * Key of element
		 * @type String
		 */
		var key = elementKey;
		
		/**
		 * Value of element
		 * @type mixed
		 */
		var value = elementValue;
		
		/**
		 * Return the key of element
		 * @return Key of element
		 * @type String
		 */
		this.getKey = function() {
			return key;
		}
		
		/**
		 * Returns the value of element
		 * @return Value of element
		 * @type mixed
		 */
		this.getValue = function() {
			return value;
		}
		
		/**
		 * Set the new value of element
		 * @param mixed New value
		 */
		this.setValue = function(elementValue) {
			value = elementValue;
		}
		
	}
	
}

/**
 * Prototype.js style getElementById
 * @param String Id of DOM object
 * @return Found DOM object
 * @type Object
 */
function $(id) {
	return document.getElementById(id);
}

/**
 * Check if the variable is not null and is defined
 * @param mixed Variable to check
 * @return True if it's OK
 * @type Boolean
 */
function check(variable) {
	return (variable != null && variable != undefined);
}

/**
 * Check if the variable is not null and is defined and is instanceof type
 * @param mixed Variable to check
 * @return True if it's OK
 * @type Boolean
 */
function checkType(variable, type) {
	return (variable != null && variable != undefined && variable instanceof type);
}


/**
 * Returns a file content by a given URL
 * @param String URL of file
 * @throws When URL is null
 * @throws When XMLHttpRequest object cannot be created.
 * @return File content
 * @type String
 */
function getStringByUrl(url){
	if (! check(url) || url.length == 0)
		alert("getStringByUrl(): Invalid parameters.");
		
	var randomSeed = Math.floor(Math.random() * (10001));
	
	var xmlHttpReq = false;
    var self = this;
    // Mozilla/Safari
    if (window.XMLHttpRequest) {
        self.xmlHttpReq = new XMLHttpRequest();
    }
    // IE
    else if (window.ActiveXObject) {
        self.xmlHttpReq = new ActiveXObject("Microsoft.XMLHTTP");
    }
	
	self.xmlHttpReq.open('GET', url + "?random=" + randomSeed, false);
	self.xmlHttpReq.send(null);
	
	if (self.xmlHttpReq.status != 200) {
		//TODO: Log error
		return;
	}

	return self.xmlHttpReq.responseText;
}


/**
 * Represents an element in the dialog queue
 * @param String Message
 * @param String Type
 * @param Array Callbacks
 * @param Array Captions
 * @author Cser Dániel
 */
function Dialog(dialogMessage, dialogType, dialogCallbacks, dialogCaptions) {
	
	/**
	 * Message
	 * @type String
	 */
	var message;
	
	/**
	 * Type
	 * @type Number
	 */
	var type;
	
	/**
	 * Callbacks
	 * @type Array
	 */
	var callbacks;
	
	/**
	 * Captions
	 * @type Array
	 */
	var captions;
	
	/**
	 * OK constant for captions and callbacks
	 * @type Number
	 */
	Dialog.OK = 0;
	
	/**
	 * YES constant for captions and callbacks
	 * @type Number
	 */
	Dialog.YES = 1;
	
	/**
	 * NO constant for captions and callbacks
	 * @type Number
	 */
	Dialog.NO = 2;
	
	/**
	 * Returns message
	 * @return Message
	 * @type String
	 */
	this.getMessage = function() {
		return message;
	}
	
	/**
	 * Sets message
	 * @param String Message
	 */
	this.setMessage = function(dialogMessage) {
		if (! dialogMessage) {
			//TODO: Log error
			return;
		}
		
		message = String(dialogMessage);
	}
	
	/**
	 * Returns type
	 * @return Type
	 * @type Number
	 */
	this.getType = function() {
		return type;
	}
	
	/**
	 * Sets type
	 * @param Number Type
	 */
	this.setType = function(dialogType) {
		if (! dialogType) {
			//TODO: Log error
			return;
		}
		
		type = Number(dialogType);
	}
	
	/**
	 * Returns the requested callback
	 * @param Number Which callback
	 * @return Requested callback
	 * @type String
	 */
	this.getCallback = function(callbackType) {
		//az összes callback állítása esetén ez nem tömb, ezért ezzel csak az x karaktert adja vissza,
		//mivel String tömbként kezeli, így ezt vizsgálni és kezelni kell
		//return callbacks[Number(callbackType)];
		if( callbacks instanceof Array )
			return callbacks[Number(callbackType)];	
		else
			return callbacks;
	}
	
	/**
	 * Sets the given callback
	 * @param Number Which callback
	 * @param Function Callback function
	 */
	this.setCallback = function(callbackType, dialogCallback) {
		if (! callbackType || ! dialogCallback) {
			//TODO: Log error
			return;
		}
		
		callbacks[Number(callbackType)] = dialogCallback;
	}
	
	/**
	 * Sets all callbacks
	 * @param Array Callback array
	 */
	this.setCallbacks = function(dialogCallbacks) {
		if (! dialogCallbacks || ! dialogCallbacks instanceof Array) {
			//TODO: Log error
			return;
		}
		
		callbacks = dialogCallbacks;
	}
	
	/**
	 * Returns the requested caption
	 * @param Number Which caption
	 * @return Requested caption
	 * @type String
	 */
	this.getCaption = function(captionType) {
		return captions[Number(captionType)];
	}
	
	/**
	 * Sets the given caption
	 * @param Number Which caption
	 * @param String Caption
	 */
	this.setCaption = function(captionType, dialogCaption) {
		if (! captionType || ! dialogCaption) {
			//TODO: Log error
			return;
		}
		
		captions[Number(captionType)] = String(dialogCaption);
	}
	
	/**
	 * Sets all captions
	 * @param Array Captions array
	 */
	this.setCaptions = function(dialogCaptions) {
		if (! dialogCaptions || ! dialogCaptions instanceof Array) {
			//TODO: Log error
			return;
		}
		
		captions = dialogCaptions;
	}
	
	//Initialize
	message = dialogMessage || "";
	type = dialogType || "";
	callbacks = dialogCallbacks || [null, null, null];
	captions = dialogCaptions || ["Ok", "Igen", "Nem"];
	
}

/**
 * Default parser used to parse template
 * @constructor
 * @author Cser Dániel
 */
var DefaultParser = {
	
	/**
	 * Object containing statements
	 * @type Object
	 */
	statements: {
		"if":      { delta: 1,  prefix: "if (", suffix: ") {\n", minParams: 1 },
		
		"elseif":  { delta: 0,  prefix: "} else if (", suffix: ") {\n" },
		
		"else":    { delta: 0,  prefix: "} else {\n" },
		
		"/if":     { delta: -1, prefix: "}\n" },
		
		"for":     {
			delta: 1,
			
			prefix: function(parameters) {
				if (parameters[1] != "in") {
					throw new TemplateParseError("Error parsing template " + name + ", loop with bad parameters: " + parameters.join(" ") + ".");
				}
				
				return [
					"if (typeof(_FORS) == \"undefined\" || ! _FORS.length) {\n  var _FORS = [];\n}\n",
					"_FORS.push(0);\n",
					"if (typeof(" + parameters[2] + ") != \"undefined\" && " + parameters[2] + " instanceof Array) {\n",
					"  var " + parameters[0] + "Array = " + parameters[2] + ";\n",
					"  for (var " + parameters[0] + "Iterator = 0; " + parameters[0] + "Iterator < " + parameters[0] + "Array.length; " + parameters[0] + "Iterator++) {\n",
					"    var " + parameters[0] + " = " + parameters[0] + "Array[" + parameters[0] + "Iterator];\n",
					"    _FORS[_FORS.length - 1]++;\n"].join("");
			},
			
			minParams: 3
		},
		
		"forelse": { delta: 0,  prefix: "  }\n}\n if (_FORS[_FORS.length - 1] == 0) {\n  if (true) {\n" },
		
		"/for":    { delta: -1, prefix: "  }\n}\n" },
		
		"eat":     { delta: 1, prefix: "/*\n" },
		
		"/eat":    { delta: -1, prefix: "*/\n" },
		
		"include": {
			delta: 0,
			
			prefix: function(parameters) {
				var templateName = parameters.shift();
				var templateWith = parameters.shift();
				
				if (templateWith != "with") {
					throw new TemplateParseError("Error parsing template " + name + ", include with bad parameters: " + parameters.join(" ") + ".");
				}
				
				return "_OUT.push(templateManager.getTemplate(" + templateName + ").process({ " + parameters.join(" ") + " }));\n";
			},
			
			minParams: 3 }
	},
	
	/**
	 * Object containing modifiers
	 * @type Object
	 */
	modifiers: {
		//Eats the whole string
		"eat":        function(s) { return ""; },
		
		//Upper-cases string
		"upperCase":  function(s) { return String(s).toUpperCase(); },
		
		//Lower-cases string
		"lowerCase":  function(s) { return String(s).toLowerCase(); },
		
		//Return first param if that is not a nullstring, second param else
		"default":    function(s1, s2) { return String(s1).length > 0 ? s1 : s2; },
		
		//Upper-cases first characters of every word
		"capitalize": function(s) {
			var words = String(s).split(" ");
			var capitalized = [];
			
			for (var i = 0; i < words.length; i++) {
				capitalized.push(this["ucFirst"](words[i]));
			}
			
			return capitalized.join(" ");
		},
		
		//Upper-cases first character
		"ucFirst":    function(s) {
			var oldStr = String(s);
			var newStr = String(oldStr[0]).toUpperCase();
			
			for (var i = 1; i < oldStr.length; i++) {
				newStr += oldStr[i];
			}
			
			return newStr;
		},
		
		//Lower-cases first character
		"lcFirst":    function(s) {
			var oldStr = String(s);
			var newStr = String(oldStr[0]).toLowerCase();
			
			for (var i = 0; i < oldStr.length; i++) {
				newStr += oldStr[i];
			}
			
			return newStr;
		},
		
		//Trims whitespaces form the beginning and end of the string
		"trim":       function(s) { return String(s).replace(/^\s+|\s+$/, ''); }
	}
	
}



/**
 * Represents a parsed template
 * @constructor
 * @author Cser Dániel
 */
function Template(templateName, tmpl, templateParser) {
	
	/**
	 * Template source
	 * @type String
	 */
	var source;
	
	/**
	 * Parsed string
	 * @type String
	 */
	var template;
	
	/**
	 * Name of template
	 * @type String
	 */
	var name;
	
	/**
	 * Template parser object
	 * @type Object
	 */
	var parser;
	
	/**
	 * Temp variable to check the number of start/end tags
	 * @type Number
	 */
	var delta;
	
	/**
	 * Parses the whole template and return the parsed and eval'd code
	 * @param String Template to parse
	 * @throws TemplateParseError on template parsing errors
	 * @return Parsed template
	 * @type String
	 */
	function parse(tmpl) {
		tmpl = new String(tmpl);
		
		tmpl = tmpl.replace(/\t/g, "    "); //convert \t to four spaces
		tmpl = tmpl.replace(/\r\n/g, "\n"); //convert windows line delimiters to unix style
		tmpl = tmpl.replace(/\r/g, "\n"); //convert macosx line delimiters to unix style
		
		var actualPos = -1;
		var parsed = ["function evalTmpl(_OUT, _CONTEXT, _MODIFIERS) { with (_CONTEXT) {\n"];
		
		while (actualPos + 1 < tmpl.length) {
			var statementStart = tmpl.indexOf("{", actualPos);
			
			if (statementStart < 0) {
				break;
			}
			
			var statementEnd = tmpl.indexOf("}", statementStart + 1);
			
			if (statementEnd < 0) {
				break;
			}
			
			if (tmpl.charAt(statementStart - 1) == "$") { //expression which will be shown
				parseText(parsed, tmpl.substring(actualPos, statementStart - 1));
				parseExpression(parsed, tmpl.substring(statementStart + 1, statementEnd));
			} else { //statement
				parseText(parsed, tmpl.substring(actualPos, statementStart));
				parseStatement(parsed, tmpl.substring(statementStart + 1, statementEnd));
			}
			
			actualPos = statementEnd + 1;
		}
		
		if (delta != 0) {
			throw new TemplateParseError("Error parsing template " + name + ", tag start/end tags number are not the same.");
		}
		
		//last piece of text
		parseText(parsed, tmpl.substring(actualPos, tmpl.length));
		
		parsed.push("} }");
		
		eval(parsed.join(""));
		
		return evalTmpl;
	}
	
	/**
	 * Parses the text
	 * @param Array Array to push results
	 * @param String Text to parse
	 */
	function parseText(out, text) {
		if (! text && text.length == 0) {
			return "";
		}
		
		var nlPrefix = 0; //index to first non-newline in prefix.
	    var nlSuffix = text.length - 1; //index to first non-space/tab in suffix.
	    
	    while (nlPrefix < text.length && text.charAt(nlPrefix) == "\n") {
	    	nlPrefix++;
	    }
	    
	    while (nlSuffix >= 0 && (text.charAt(nlSuffix) == " " || text.charAt(nlSuffix) == "\t")) {
	    	nlSuffix--;
	    }
	    
	    if (nlSuffix < nlPrefix) {
	    	nlSuffix = nlPrefix;
	    }
	    
	    var lines = text.substring(nlPrefix, nlSuffix + 1).split("\n");
	    
	    for (var i = 0; i < lines.length; i++) {
			out.push("_OUT.push(\"" + lines[i].replace(/"/g, "\\\"") + "\");\n");
			
			if (i < lines.length - 1) {
	            out.push('_OUT.push("\\n");\n');
	        }
		}
	}
	
	/**
	 * Parses the expressions
	 * @param Array Array to push results
	 * @param String Expression to parse
	 * @throws TemplateParseError on template parsing errors
	 */
	function parseExpression(out, expression) {
		if (! expression && expression.length == 0) {
			return "";
		}
		
		var modifiers = expression.split("|");
		expression = modifiers.shift();
		
		var expr = expression;
		var parts;
		var modifier;
		
		for (var i = 0; i < modifiers.length; i++) {
			parts = modifiers[i].split(":");
			modifier = parts.shift();
			
			if (parser.modifiers[modifier] == null) {
				throw new TemplateParseError("Error parsing template " + name + ", no such modifier: " + modifier + ".");
			}
			
			expr = "_MODIFIERS[\"" + modifier + "\"](" + expr + (parts.length > 0 ? ", " + parts[0].replace(/"/g, "\"") : "") + ")";
		}
		
		out.push("_OUT.push(" + expr + ");\n");
	}
	
	/**
	 * Parses the statements
	 * @param Array Array to push results
	 * @param String Statements to parse
	 * @throws TemplateParseError on template parsing errors
	 */
	function parseStatement(out, stmt) {
		if (! stmt && stmt.length == 0) {
			return;
		}
		
		parameters = stmt.split(" ");
		statement = parameters.shift();
		
		statement = parser.statements[statement];
		
		if (statement == null) {
			parseText(out, stmt);
		}
		
		delta += statement.delta;
		
		if (delta < 0) {
			throw new TemplateParseError("Error parsing template " + name + ", fewer start tags then end tags.");
		}
		
		if (statement.minParams != null && statement.minParams > parameters.length) {
			throw new TemplateParseError("Error parsing template " + name + ", too few parameters.");
		}
		
		if (typeof(statement.prefix) == "function") {
			out.push(statement.prefix(parameters));
		} else {
			out.push(statement.prefix);
		}
		
		if (statement.suffix != null) {
			out.push(parameters.join(" "));
			out.push(statement.suffix);
		}
	}
	
	/**
	 * Processes the template with the given context
	 * @param Object Context of template
	 * @throws TemplateProcessError template on processing errors
	 * @return Ready-to-use template
	 * @type String
	 */
	this.process = function(context) {
		if (! context || ! template) {
			return "";
		}
		
		var processed = [];
		
		try {
			template(processed, context, parser.modifiers);
		} catch(e) {
			throw new TemplateProcessError(e.message, e.fileName, e.lineNumber, e.stack);
		}
		
		return processed.join("");
	}
	
	/**
	 * Returns HTML source
	 * @return HTML source
	 * @type String
	 */
	this.getSource = function() {
		return source;
	}
	
	//Initialize
	if (! tmpl || ! templateName || tmpl.length == 0 || templateName.length == 0) {
		return null;
	}
	
	if (templateParser != null) {
		parser = templateParser;
	} else {
		parser = DefaultParser;
	}
	
	name = templateName;
	delta = 0;
	source = new String(tmpl);
	template = parse(tmpl);
	
}
/**
 * Loads and caches templates.
 * @constructor
 * @author Cser Dániel
 */
function TemplateManager() {
	
	/**
	 * Base dir of templates.
	 * Set in config.js
	 * @type String
	 */
	TemplateManager.URL = "../dialogtemplate/";
	
	/**
	 * Map to store templates
	 * @type Map
	 */
	var templates;
	
	/**
	 * Corrects the name of template
	 */
	function correctName(templateName) {
		return String(templateName).toLowerCase();
	}
	
	/**
	 * Returns the template and loads it when necessary
	 * @param String Name of template
	 * @throws On parsing errors
	 * @return Template
	 * @type Template
	 */
	function get(templateName) {
		templateName = correctName(templateName);
		if (! templates.containsKey(templateName)) {
			if (! check(TemplateManager.URL)) {
				//TODO: Log error
				return null;
			}
			
			var templateUrl = TemplateManager.URL + templateName.replace(/_/g, "/") + ".tmpl";
			
			try {
				var templateData = getStringByUrl(templateUrl);
			} catch (e) {
				alert("TemplateHandler.get(): Couldn't read file " + templateUrl + ".");
				//throw new TemplateParseError("TemplateHandler.get(): Couldn't read file " + templateUrl + ".");
			}
			templates.put(templateName, new Template(templateName, templateData));
		}
		return templates.get(templateName);
	}
	
	/**
	 * Returns the given template
	 * @param String Name of template
	 * @throws On parsing errors
	 * @return Template
	 * @type Template
	 */
	this.getTemplate = function(templateName) {
		return get(templateName);
	}
	
	/**
	 * Processes the given template with the given context, then puts it into the given DOM object
	 * @param String Name of template
	 * @param Object Template context
	 * @param String Id of DOM object to put the template
	 * @throws On parsing errors
	 */
	this.processTemplate = function(templateName, templateData, domId) {
		$(domId).innerHTML = get(templateName).process(templateData);
	}
	
	//Initialize
	templates = new Map();
	
}
/**
 * Represents a template parsing error.
 * @constructor
 * @author Cser Dániel
 */
function TemplateParseError(message, fileName, lineNumber, stack) {
	
	/**
	 * Message of error
	 * @type String
	 */
	this.message = message;
	
	/**
	 * Name of the file where the error occured
	 * @type String
	 */
	this.fileName = fileName;
	
	/**
	 * Number of line where the error occured
	 * @type String
	 */
	this.lineNumber = lineNumber;
	
	/**
	 * Stact trace of error
	 * @type Object
	 */
	this.stack = stack;
	
	/**
	 * Name of error
	 * @type String
	 */
	this.name = "TemplateParseError";
	
}
/**
 * Represents a template processing error.
 * @constructor
 * @author Cser Dániel
 */
function TemplateProcessError(message, fileName, lineNumber, stack) {
	
	/**
	 * Message of error
	 * @type String
	 */
	this.message = message;
	
	/**
	 * Name of the file where the error occured
	 * @type String
	 */
	this.fileName = fileName;
	
	/**
	 * Number of line where the error occured
	 * @type String
	 */
	this.lineNumber = lineNumber;
	
	/**
	 * Stact trace of error
	 * @type Object
	 */
	this.stack = stack;
	
	/**
	 * Name of error
	 * @type String
	 */
	this.name = "TemplateProcessError";
	
}




/**
 * Dialog window manager class.
 * @constructor
 * @author Cser Dániel
 */
function DialogManager() {
	
	/**
	 * DialogBox width size
	 * @type integer
	 */
	var width = 310;
	
	/**
	 * DialogBox height size
	 * @type integer
	 */
	var height = 180;

	/**
	 * Array of disabled selects
	 * @type Array
	 */
	var disabledSelects;
	
	/**
	 * Queue array
	 * @type Array
	 */
	var queue;
	
	/**
	 * Running state
	 * @type Boolean
	 */
	var running;
	
	/**
	 * Adds a new task
	 * @param Dialog Dialog to add
	 */
	this.add = function(dialog) {
		//when this is a progress or there's no progress in the queue
		queue.push(dialog);
		//return when already displaying or there's nothing to display
		if (running) {
			return;
		}
		
		//start showing
		this.running = true;
	    
	    //disable active selects
		var allSelects = document.getElementsByTagName("select");
		for (i = 0; i < allSelects.length; i++) {
    		if (allSelects[i].disabled == false) {
    			disabledSelects[i] = allSelects[i];
    			disabledSelects[i].disabled = true;
    		}
			allSelects[i].style.visibility = 'hidden';
    	}
	    
	    //hider div
	    var pageSize = getPageSize();
	    setOpacity( $("DialogBackground"), 0.9 );
	    $("DialogBackground").style.height = pageSize.pageHeight+'px';
	    $("DialogBackground").style.display = "block";
	    
	    //dialog box
	    getWindow( height, width );
	    
	    //start showing
	    show();
	}
	
	/**
	 * Shows a task
	 */
	function show() {
		try {
			window.scrollBy(0, 0);
		    templateManager.processTemplate(queue[0].getType(), { dialog: queue[0] }, "dialogContent");
		} catch(e) {
			//TODO: Log error
		}
	}
	
	/**
	 * One task ended
	 * @param Number Result code
	 */
	this.done = function(result) {		
		
		if (queue.length == 0 || result == null || result == undefined) {
			//TODO: Log error
			return;
		}
		
		var fn = queue[0].getCallback(result);
		if (typeof(fn) == "function") {
			try {
				fn();
			} catch(e) {
				//TODO: Log error
			}
		}
	    //remove first element
	    queue.shift();
	    //when this was the last one in queue
	    if (queue.length == 0) {
	    	running = false;
	    	
			//hide dialog and bakground
			$("DialogBackground").style.display = "none";
			$("DialogBox").style.display = "none";
			$("dialogContent").innerHTML = "";
			//enable all disabled selects and clear the array holding them
	    	for (var i = 0; i < disabledSelects.length; i++) {
		    	disabledSelects[i].disabled = false;
				disabledSelects[i].style.visibility = 'visible';
	    	}
	    	
	    	disabledSelects = new Array();
			
		    return;
	    }
	    show();
	}
	
	/**
	 *
	 */
	this.showBackground = function() {
		var pageSize = getPageSize();
	    setOpacity( $("DialogBackground"), 0.3 );
	    $("DialogBackground").style.height = pageSize.pageHeight + 'px';
	    $("DialogBackground").style.display = "block";
		return;
	}
	
	/**
	 *
	 */
	this.hideBackground = function() {
		$("DialogBackground").style.display = "none";
		return;
	}
	
	/**
	* set DialogBackground style
	* @param htmlObject 
	* @param opacity value
	*/
	function setOpacity(element, value) {
	    if (typeof element == 'string')
		element= $(element);
	    if (value == 1) {
		element.style.opacity = (/Gecko/.test(navigator.userAgent) && !/Konqueror|Safari|KHTML/.test(navigator.userAgent)) ? 0.999999 : 1.0 ;
		if(/MSIE/.test(navigator.userAgent) && !window.opera)
		    element.style.filter = element.style.filter.replace(/alpha\([^\)]*\)/gi,'');
	    } else {
		if(value < 0.00001) value = 0;
		    element.style.opacity = value;
		if(/MSIE/.test(navigator.userAgent) && !window.opera)
		    element.style.filter = element.style.filter.replace(/alpha\([^\)]*\)/gi,'') + 'alpha(opacity='+value*100+')';
	    }
	    return element;
	}
	
	
	/**
	* set DialogBox style and position
	* @param box height
	* @param box width
	*/
	function getWindow(height, width) {
	    var DialogBox = $("DialogBox");
	    var pageSize = getPageSize();
	    var pos = realOffset(document.body);
	    
	    DialogBox.style.top = (pageSize.windowHeight/2 - height/2 + pos[1])+'px';
	    DialogBox.style.left = (pageSize.windowWidth/2 - width/2 + pos[0])+'px';
	    
	    DialogBox.style.display = "block";
	}
	
	/**
	* set DialogBox real position
	* @return top, left size
	* @type Array
	*/
	function realOffset(element) {
	    var valueT = 0, valueL = 0;
	    do {
		valueT += element.scrollTop  || 0;
		valueL += element.scrollLeft || 0;
		element = element.parentNode;
	    } while (element);
	    return [valueL, valueT];
	}
	
	
	/**
	* get page, widow, scroll height and width size 
	* @return size data
	* @type object
	*/
	function getPageSize() {
	    var xScroll, yScroll;
            if (window.innerHeight && window.scrollMaxY) {
		xScroll = document.body.scrollWidth;
		yScroll = window.innerHeight + window.scrollMaxY;
	    } else if (document.body.scrollHeight > document.body.offsetHeight) {
		xScroll = document.body.scrollWidth;
		yScroll = document.body.scrollHeight;
	    } else {
		xScroll = document.body.offsetWidth;
		yScroll = document.body.offsetHeight;
	    }
	    
	    var windowWidth, windowHeight;
	    if (self.innerHeight) {
		windowWidth = self.innerWidth;
		windowHeight = self.innerHeight;
	    } else if (document.documentElement && document.documentElement.clientHeight) {
		windowWidth = document.documentElement.clientWidth;
		windowHeight = document.documentElement.clientHeight;
	    } else if (document.body) {
		windowWidth = document.body.clientWidth;
		windowHeight = document.body.clientHeight;
	    }
	    
	    if(yScroll < windowHeight) {
		pageHeight = windowHeight;
	    } else {
		pageHeight = yScroll;
	    }
            if(xScroll < windowWidth) {
	        pageWidth = windowWidth;
	    } else {
		pageWidth = xScroll;
	    }
	    return {
		'pageWidth':pageWidth,
		'pageHeight':pageHeight,
		'windowWidth':windowWidth,
		'windowHeight':windowHeight,
		'yScroll':yScroll,
		'xScroll':xScroll
	    }
	}
	
	//Initialize
	disabledSelects = new Array();
	queue = new Array();
	running = false;
	
}

templateManager = new TemplateManager();
dialogManager = new DialogManager();	
	
var olLoaded = 0;var pmStart = 10000000; var pmUpper = 10001000; var pmCount = pmStart+1;  var pms = new Array(); var olInfo = new Info('4.00', 1);
var FREPLACE = 0; var FBEFORE = 1; var FAFTER = 2; var FALTERNATE = 3;
var olHideForm=0;  // parameter for hiding SELECT and ActiveX elements in IE5.5+ 
registerCommands('donothing,inarray,caparray,sticky,background,noclose,caption,left,right,center,offsetx,offsety,fgcolor,bgcolor,textcolor,capcolor,closecolor,width,border,cellpad,status,autostatus,autostatuscap,height,closetext,snapx,snapy,fixx,fixy,relx,rely,fgbackground,bgbackground,padx,pady,fullhtml,above,below,capicon,textfont,captionfont,closefont,textsize,captionsize,closesize,timeout,function,delay,hauto,vauto,closeclick,wrap,followmouse,mouseoff,closetitle,cssoff,cssclass,fgclass,bgclass,textfontclass,captionfontclass,closefontclass');

if (typeof ol_fgcolor=='undefined') var ol_fgcolor="#ffffff";
if (typeof ol_bgcolor=='undefined') var ol_bgcolor="#81197f";
if (typeof ol_textcolor=='undefined') var ol_textcolor="#666666";
if (typeof ol_capcolor=='undefined') var ol_capcolor="#000000";
if (typeof ol_closecolor=='undefined') var ol_closecolor="#ffffff";
if (typeof ol_textfont=='undefined') var ol_textfont="Verdana, Arial, Helvetica, sans-serif";
if (typeof ol_captionfont=='undefined') var ol_captionfont="Verdana, Arial, Helvetica, sans-serif";
if (typeof ol_closefont=='undefined') var ol_closefont="Verdana, Arial, Helvetica, sans-serif";
if (typeof ol_textsize=='undefined') var ol_textsize="1";
if (typeof ol_captionsize=='undefined') var ol_captionsize="1";
if (typeof ol_closesize=='undefined') var ol_closesize="1";
if (typeof ol_width=='undefined') var ol_width="230";
if (typeof ol_border=='undefined') var ol_border="1";
if (typeof ol_cellpad=='undefined') var ol_cellpad=5;
if (typeof ol_offsetx=='undefined') var ol_offsetx=10;
if (typeof ol_offsety=='undefined') var ol_offsety=-70;
if (typeof ol_text=='undefined') var ol_text="Default Text";
if (typeof ol_cap=='undefined') var ol_cap="";
if (typeof ol_sticky=='undefined') var ol_sticky=0;
if (typeof ol_background=='undefined') var ol_background="";
if (typeof ol_close=='undefined') var ol_close="Close";
if (typeof ol_hpos=='undefined') var ol_hpos=RIGHT;
if (typeof ol_status=='undefined') var ol_status="";
if (typeof ol_autostatus=='undefined') var ol_autostatus=0;
if (typeof ol_height=='undefined') var ol_height=-1;
if (typeof ol_snapx=='undefined') var ol_snapx=0;
if (typeof ol_snapy=='undefined') var ol_snapy=0;
if (typeof ol_fixx=='undefined') var ol_fixx=-1;
if (typeof ol_fixy=='undefined') var ol_fixy=-1;
if (typeof ol_relx=='undefined') var ol_relx=null;
if (typeof ol_rely=='undefined') var ol_rely=null;
if (typeof ol_fgbackground=='undefined') var ol_fgbackground="";
if (typeof ol_bgbackground=='undefined') var ol_bgbackground="";
if (typeof ol_padxl=='undefined') var ol_padxl=1;
if (typeof ol_padxr=='undefined') var ol_padxr=1;
if (typeof ol_padyt=='undefined') var ol_padyt=1;
if (typeof ol_padyb=='undefined') var ol_padyb=1;
if (typeof ol_fullhtml=='undefined') var ol_fullhtml=0;
if (typeof ol_vpos=='undefined') var ol_vpos=BELOW;
if (typeof ol_aboveheight=='undefined') var ol_aboveheight=0;
if (typeof ol_capicon=='undefined') var ol_capicon="";
if (typeof ol_frame=='undefined') var ol_frame=self;
if (typeof ol_timeout=='undefined') var ol_timeout=0;
if (typeof ol_function=='undefined') var ol_function=null;
if (typeof ol_delay=='undefined') var ol_delay=0;
if (typeof ol_hauto=='undefined') var ol_hauto=0;
if (typeof ol_vauto=='undefined') var ol_vauto=0;
if (typeof ol_closeclick=='undefined') var ol_closeclick=0;
if (typeof ol_wrap=='undefined') var ol_wrap=0;
if (typeof ol_followmouse=='undefined') var ol_followmouse=1;
if (typeof ol_mouseoff=='undefined') var ol_mouseoff=0;
if (typeof ol_closetitle=='undefined') var ol_closetitle='Close';
if (typeof ol_css=='undefined') var ol_css=CSSOFF;
if (typeof ol_fgclass=='undefined') var ol_fgclass="";
if (typeof ol_bgclass=='undefined') var ol_bgclass="";
if (typeof ol_textfontclass=='undefined') var ol_textfontclass="";
if (typeof ol_captionfontclass=='undefined') var ol_captionfontclass="";
if (typeof ol_closefontclass=='undefined') var ol_closefontclass="";

////////
// ARRAY CONFIGURATION
////////

// You can use these arrays to store popup text here instead of in the html.
if (typeof ol_texts=='undefined') var ol_texts = new Array("Text 0", "Text 1");
if (typeof ol_caps=='undefined') var ol_caps = new Array("Caption 0", "Caption 1");

////////
// END OF CONFIGURATION
// Don't change anything below this line, all configuration is above.
////////





////////
// INIT
////////
// Runtime variables init. Don't change for config!
var o3_text="";
var o3_cap="";
var o3_sticky=0;
var o3_background="";
var o3_close="Close";
var o3_hpos=RIGHT;
var o3_offsetx=2;
var o3_offsety=2;
var o3_fgcolor="";
var o3_bgcolor="";
var o3_textcolor="";
var o3_capcolor="";
var o3_closecolor="";
var o3_width=100;
var o3_border=1;
var o3_cellpad=2;
var o3_status="";
var o3_autostatus=0;
var o3_height=-1;
var o3_snapx=0;
var o3_snapy=0;
var o3_fixx=-1;
var o3_fixy=-1;
var o3_relx=null;
var o3_rely=null;
var o3_fgbackground="";
var o3_bgbackground="";
var o3_padxl=0;
var o3_padxr=0;
var o3_padyt=0;
var o3_padyb=0;
var o3_fullhtml=0;
var o3_vpos=BELOW;
var o3_aboveheight=0;
var o3_capicon="";
var o3_textfont="Verdana,Arial,Helvetica";
var o3_captionfont="Verdana,Arial,Helvetica";
var o3_closefont="Verdana,Arial,Helvetica";
var o3_textsize="1";
var o3_captionsize="1";
var o3_closesize="1";
var o3_frame=self;
var o3_timeout=0;
var o3_timerid=0;
var o3_allowmove=0;
var o3_function=null; 
var o3_delay=0;
var o3_delayid=0;
var o3_hauto=0;
var o3_vauto=0;
var o3_closeclick=0;
var o3_wrap=0;
var o3_followmouse=1;
var o3_mouseoff=0;
var o3_closetitle='';
var o3_css=CSSOFF;
var o3_fgclass="";
var o3_bgclass="";
var o3_textfontclass="";
var o3_captionfontclass="";
var o3_closefontclass="";

// Display state variables
var o3_x = 0;
var o3_y = 0;
var o3_showingsticky = 0;
var o3_removecounter = 0;

// Our layer
var over = null;
var fnRef, hoveringSwitch = false;

// Decide browser version
var isMac = (navigator.userAgent.indexOf("Mac") != -1);
var olOp = (navigator.userAgent.toLowerCase().indexOf('opera 7.') > -1);
var olNs4 = (navigator.appName=='Netscape' && parseInt(navigator.appVersion) == 4);
var olNs6 = (document.getElementById) ? true : false;
var olIe4 = (document.all) ? true : false;
var olIe5 = false; 
var olIe55 = false; // Added additional variable to identify IE5.5+
var docRoot = 'document.body';

// Resize fix for NS4.x to keep track of layer
if (olNs4) {
	var oW = window.innerWidth;
	var oH = window.innerHeight;
	window.onresize = function() { if (oW != window.innerWidth || oH != window.innerHeight) location.reload(); }
}

// Microsoft Stupidity Check(tm).
if (olIe4) {
	var versNum=parseFloat(navigator.userAgent.match(/MSIE (\d\.\d+)\.*/i)[1]);
	if (versNum >= 5){
		olIe5=true;
		olIe55=(versNum>=5.5&&!olOp) ? true : false;
		if (olNs6) olNs6=false;
	}
	if (olNs6) olIe4 = false;
}

// Check for compatability mode.
if (document.compatMode && document.compatMode == 'CSS1Compat') {
	docRoot= ((olIe4 && !olOp) ? 'document.documentElement' : docRoot);
}

// Add window onload handlers to indicate when all modules have been loaded
// For Netscape 6+ and Mozilla, uses addEventListener method on the window object
// For IE it uses the attachEvent method of the window object and for Netscape 4.x
// it sets the window.onload handler to the OLonload_handler function
if(window.addEventListener) window.addEventListener("load",OLonLoad_handler,true);
else if (window.attachEvent) window.attachEvent("onload",OLonLoad_handler);
else window.onload=OLonLoad_handler;

// Capture events, alt. diffuses the overlib function.
var olCheckMouseCapture = true;
if ((olNs4 || olNs6 || olIe4)) {
	olMouseCapture();
} else {
	overlib = no_overlib;
	nd = no_overlib;
	ver3fix = true;
}


////////
// PUBLIC FUNCTIONS
////////

// overlib(arg0,...,argN)
// Loads parameters into global runtime variables.
function overlib() {
	if (!olLoaded || isExclusive(overlib.arguments)) return true;
	if (olCheckMouseCapture) olMouseCapture();
	if (over) cClick();

	// Load defaults to runtime.
	o3_text=ol_text;
	o3_cap=ol_cap;
	o3_sticky=ol_sticky;
	o3_background=ol_background;
	o3_close=ol_close;
	o3_hpos=ol_hpos;
	o3_offsetx=ol_offsetx;
	o3_offsety=ol_offsety;
	o3_fgcolor=ol_fgcolor;
	o3_bgcolor=ol_bgcolor;
	o3_textcolor=ol_textcolor;
	o3_capcolor=ol_capcolor;
	o3_closecolor=ol_closecolor;
	o3_width=ol_width;
	o3_border=ol_border;
	o3_cellpad=ol_cellpad;
	o3_status=ol_status;
	o3_autostatus=ol_autostatus;
	o3_height=ol_height;
	o3_snapx=ol_snapx;
	o3_snapy=ol_snapy;
	o3_fixx=ol_fixx;
	o3_fixy=ol_fixy;
	o3_relx=ol_relx;
	o3_rely=ol_rely;
	o3_fgbackground=ol_fgbackground;
	o3_bgbackground=ol_bgbackground;
	o3_padxl=ol_padxl;
	o3_padxr=ol_padxr;
	o3_padyt=ol_padyt;
	o3_padyb=ol_padyb;
	o3_fullhtml=ol_fullhtml;
	o3_vpos=ol_vpos;
	o3_aboveheight=ol_aboveheight;
	o3_capicon=ol_capicon;
	o3_textfont=ol_textfont;
	o3_captionfont=ol_captionfont;
	o3_closefont=ol_closefont;
	o3_textsize=ol_textsize;
	o3_captionsize=ol_captionsize;
	o3_closesize=ol_closesize;
	o3_timeout=ol_timeout;
	o3_function=ol_function;
	o3_delay=ol_delay;
	o3_hauto=ol_hauto;
	o3_vauto=ol_vauto;
	o3_closeclick=ol_closeclick;
	o3_wrap=ol_wrap;	
	o3_followmouse=ol_followmouse;
	o3_mouseoff=ol_mouseoff;
	o3_closetitle=ol_closetitle;
	o3_css=ol_css;
	o3_fgclass=ol_fgclass;
	o3_bgclass=ol_bgclass;
	o3_textfontclass=ol_textfontclass;
	o3_captionfontclass=ol_captionfontclass;
	o3_closefontclass=ol_closefontclass;
	
	setRunTimeVariables();
	
	fnRef = '';
	
	// Special for frame support, over must be reset...
	o3_frame = ol_frame;
	
	if (olNs4) {
		over = o3_frame.document.layers['overDiv'];
	} else if (document.all) {
		over = o3_frame.document.all['overDiv'];
	} else if (document.getElementById) {
		over = o3_frame.document.getElementById("overDiv");
	}

	parseTokens('o3_', overlib.arguments);
	if (!postParseChecks()) return false;

	if (o3_delay == 0) {
		return runHook("olMain", FREPLACE);
 	} else {
		o3_delayid = setTimeout("runHook('olMain', FREPLACE)", o3_delay);
		return false;
	}
}

// Clears popups if appropriate
function nd(time) {
	if (olLoaded && !isExclusive()) {
		if (time && !o3_delay) {
			if (o3_timerid > 0) clearTimeout(o3_timerid);
			
			o3_timerid = setTimeout("cClick()",(o3_timeout = time));
		}
		if (o3_removecounter >= 1) { o3_showingsticky = 0 };
		
		if (o3_showingsticky == 0) {
			o3_allowmove = 0;
			if (over != null && o3_timerid == 0) runHook("hideObject", FREPLACE, over);
		} else {
			o3_removecounter++;
		}
	}
	
	return true;
}

// The Close onMouseOver function for stickies
function cClick() {
	if (olLoaded) {
		runHook("hideObject", FREPLACE, over);
		o3_showingsticky = 0;	
	}	
	return false;
}

// Method for setting page specific defaults.
function overlib_pagedefaults() {
	parseTokens('ol_', overlib_pagedefaults.arguments);
}


////////
// OVERLIB MAIN FUNCTION
////////

// This function decides what it is we want to display and how we want it done.
function olMain() {
	var layerhtml, styleType;
 	runHook("olMain", FBEFORE);
 	
	if (o3_background!="" || o3_fullhtml) {
		// Use background instead of box.
		layerhtml = runHook('ol_content_background', FALTERNATE, o3_css, o3_text, o3_background, o3_fullhtml);
	} else {
		// They want a popup box.
		styleType = (pms[o3_css-1-pmStart] == "cssoff" || pms[o3_css-1-pmStart] == "cssclass");

		// Prepare popup background
		if (o3_fgbackground != "") o3_fgbackground = "background=\""+o3_fgbackground+"\"";
		if (o3_bgbackground != "") o3_bgbackground = (styleType ? "background=\""+o3_bgbackground+"\"" : o3_bgbackground);

		// Prepare popup colors
		if (o3_fgcolor != "") o3_fgcolor = (styleType ? "bgcolor=\""+o3_fgcolor+"\"" : o3_fgcolor);
		if (o3_bgcolor != "") o3_bgcolor = (styleType ? "bgcolor=\""+o3_bgcolor+"\"" : o3_bgcolor);

		// Prepare popup height
		if (o3_height > 0) o3_height = (styleType ? "height=\""+o3_height+"\"" : o3_height);
		else o3_height = "";

		// Decide which kinda box.
		if (o3_cap=="") {
			// Plain
			layerhtml = runHook('ol_content_simple', FALTERNATE, o3_css, o3_text);
		} else {
			// With caption
			if (o3_sticky) {
				// Show close text
				layerhtml = runHook('ol_content_caption', FALTERNATE, o3_css, o3_text, o3_cap, o3_close);
			} else {
				// No close text
				layerhtml = runHook('ol_content_caption', FALTERNATE, o3_css, o3_text, o3_cap, "");
			}
		}
	}	

	// We want it to stick!
	if (o3_sticky) {
		if (o3_timerid > 0) {
			clearTimeout(o3_timerid);
			o3_timerid = 0;
		}
		o3_showingsticky = 1;
		o3_removecounter = 0;
	}

	// Created a separate routine to generate the popup to make it easier
	// to implement a plugin capability
	if (!runHook("createPopup", FREPLACE, layerhtml)) return false;

	// Prepare status bar
	if (o3_autostatus > 0) {
		o3_status = o3_text;
		if (o3_autostatus > 1) o3_status = o3_cap;
	}

	// When placing the layer the first time, even stickies may be moved.
	o3_allowmove = 0;

	// Initiate a timer for timeout
	if (o3_timeout > 0) {          
		if (o3_timerid > 0) clearTimeout(o3_timerid);
		o3_timerid = setTimeout("cClick()", o3_timeout);
	}

	// Show layer
	runHook("disp", FREPLACE, o3_status);
	runHook("olMain", FAFTER);

	if (o3_status != '') {
		return true;
	} else {
		return;
	}
}

////////
// LAYER GENERATION FUNCTIONS
////////
// These functions just handle popup content with tags that should adhere to the W3C standards specification.

// Makes simple table without caption
function ol_content_simple(text) {
	txt='<table width="'+o3_width+ '" border="0" cellpadding="'+o3_border+'" cellspacing="0" '+(o3_bgclass ? 'class="'+o3_bgclass+'"' : o3_bgcolor+' '+o3_height)+'><tr><td><table width="100%" border="0" cellpadding="' + o3_cellpad + '" cellspacing="0" '+(o3_fgclass ? 'class="'+o3_fgclass+'"' : o3_fgcolor+' '+o3_fgbackground+' '+o3_height)+'><tr><td valign="TOP"'+(o3_textfontclass ? ' class="'+o3_textfontclass+'">' : '>')+(o3_textfontclass ? '' : wrapStr(0,o3_textsize,'text'))+text+(o3_textfontclass ? '' : wrapStr(1,o3_textsize))+'</td></tr></table></td></tr></table>';

	set_background("");
	return txt;
}

// Makes table with caption and optional close link
function ol_content_caption(text,title,close) {
	var nameId;
	closing="";
	closeevent="onmouseover";
	if (o3_closeclick==1) closeevent= (o3_closetitle ? "title='" + o3_closetitle +"'" : "") + " onclick";
	if (o3_capicon!="") {
		nameId=' hspace=\"5\"'+' align=\"middle\" alt=\"\"';
		if (typeof o3_dragimg!='undefined'&&o3_dragimg) nameId=' hspace=\"5\"'+' name=\"'+o3_dragimg+'\" id=\"'+o3_dragimg+'\" align=\"middle\" alt=\"Drag Enabled\" title=\"Drag Enabled\"';
		o3_capicon='<img src=\"'+o3_capicon+'\"'+nameId+' />';
	}

	if (close != "") closing='<td '+(o3_closefontclass ? 'class="'+o3_closefontclass : 'align="RIGHT')+'"><a href="javascript:return '+fnRef+'cClick();" '+closeevent+'="return '+fnRef+'cClick();">'+(o3_closefontclass ? '' : wrapStr(0,o3_closesize,'close'))+close+(o3_closefontclass ? '' : wrapStr(1,o3_closesize,'close'))+'</a></td>';
	txt='<table width="'+o3_width+ '" border="0" cellpadding="'+o3_border+'" cellspacing="0" '+(o3_bgclass ? 'class="'+o3_bgclass+'"' : o3_bgcolor+' '+o3_bgbackground+' '+o3_height)+'><tr><td><table width="100%" border="0" cellpadding="0" cellspacing="0"><tr><td'+(o3_captionfontclass ? ' class="'+o3_captionfontclass+'">' : '>')+(o3_captionfontclass ? '' : '<b>'+wrapStr(0,o3_captionsize,'caption'))+o3_capicon+title+(o3_captionfontclass ? '' : wrapStr(1,o3_captionsize)+'</b>')+'</td>'+closing+'</tr></table><table width="100%" border="0" cellpadding="' + o3_cellpad + '" cellspacing="0" '+(o3_fgclass ? 'class="'+o3_fgclass+'"' : o3_fgcolor+' '+o3_fgbackground+' '+o3_height)+'><tr><td valign="TOP"'+(o3_textfontclass ? ' class="'+o3_textfontclass+'">' :'>')+(o3_textfontclass ? '' : wrapStr(0,o3_textsize,'text'))+text+(o3_textfontclass ? '' : wrapStr(1,o3_textsize)) + '</td></tr></table></td></tr></table>';

	set_background("");
	return txt;
}

// Sets the background picture,padding and lots more. :)
function ol_content_background(text,picture,hasfullhtml) {
	if (hasfullhtml) {
		txt=text;
	} else {
		txt='<table width="'+o3_width+'" border="0" cellpadding="0" cellspacing="0" height="'+o3_height+'"><tr><td colspan="3" height="'+o3_padyt+'"></td></tr><tr><td width="'+o3_padxl+'"></td><td valign="TOP" width="'+(o3_width-o3_padxl-o3_padxr)+'">'+wrapStr(0,o3_textsize,'text')+text+wrapStr(1,o3_textsize)+'</td><td width="'+o3_padxr+'"></td></tr><tr><td colspan="3" height="'+o3_padyb+'"></td></tr></table>';
	}

	set_background(picture);
	return txt;
}

// Loads a picture into the div.
function set_background(pic) {
	if (pic == "") {
		if (olNs4) {
			over.background.src = null; 
		} else if (over.style) {
			over.style.backgroundImage = "none";
		}
	} else {
		if (olNs4) {
			over.background.src = pic;
		} else if (over.style) {
			over.style.backgroundImage = "url("+pic+")";
		}
	}
}

////////
// HANDLING FUNCTIONS
////////

// Displays the popup
function disp(statustext) {
	runHook("disp", FBEFORE);
	
	if (o3_allowmove == 0) {
		runHook("placeLayer", FREPLACE);
		runHook("showObject", FREPLACE, over);
		o3_allowmove = (o3_sticky || o3_followmouse==0) ? 0 : 1;
	}
	
	runHook("disp", FAFTER);

	if (statustext != "") self.status = statustext;
}

// Creates the actual popup structure
function createPopup(lyrContent){
	runHook("createPopup", FBEFORE);
	
	if (o3_wrap && !(olNs4 || olOp)) {
		if (olIe4) {
			over.style.pixelWidth = 0;
		} else if (olNs6) {
			repositionTo(over, 0, -over.offsetHeight);
		}
	}

	layerWrite(lyrContent);
	
	// Have to set o3_width for placeLayer() routine if o3_wrap is turned on
	if (o3_wrap) o3_width=(olNs4 ? over.clip.width : over.offsetWidth);
	
	runHook("createPopup", FAFTER, lyrContent);

	return true;
}

// Decides where we want the popup.
function placeLayer() {
	var placeX, placeY, widthFix = 0;
	
	// HORIZONTAL PLACEMENT
	if (eval('o3_frame.'+docRoot) && eval("typeof o3_frame."+docRoot+".clientWidth=='number'") && eval('o3_frame.'+docRoot+'.clientWidth')) {
		iwidth = eval('o3_frame.'+docRoot+'.clientWidth');
	} else if (typeof(o3_frame.innerWidth) == 'number') {
		widthFix = Math.ceil(1.2*(o3_frame.outerWidth - o3_frame.innerWidth));
		iwidth = o3_frame.innerWidth;
	}

	// Horizontal scroll offset
	winoffset=(olIe4) ? eval('o3_frame.'+docRoot+'.scrollLeft') : o3_frame.pageXOffset;
	var parsedWidth = parseInt(o3_width);

	if (o3_fixx > -1 || o3_relx != null) {
		// Fixed position
		placeX=(o3_relx != null ? ( o3_relx < 0 ? winoffset +o3_relx+ iwidth - parsedWidth - widthFix : winoffset+o3_relx) : o3_fixx);
	} else {  
		// If HAUTO, decide what to use.
		if (o3_hauto == 1) {
			if ((o3_x - winoffset) > (iwidth / 2)) {
				o3_hpos = LEFT;
			} else {
				o3_hpos = RIGHT;
			}
		}  		

		// From mouse
		if (o3_hpos == CENTER) { // Center
			placeX = o3_x+o3_offsetx-(parsedWidth/2);

			if (placeX < winoffset) placeX = winoffset;
		}

		if (o3_hpos == RIGHT) { // Right
			placeX = o3_x+o3_offsetx;

			if ((placeX+parsedWidth) > (winoffset+iwidth - widthFix)) {
				placeX = iwidth+winoffset - parsedWidth - widthFix;
				if (placeX < 0) placeX = 0;
			}
		}
		if (o3_hpos == LEFT) { // Left
			placeX = o3_x-o3_offsetx-parsedWidth;
			if (placeX < winoffset) placeX = winoffset;
		}  	

		// Snapping!
		if (o3_snapx > 1) {
			var snapping = placeX % o3_snapx;

			if (o3_hpos == LEFT) {
				placeX = placeX - (o3_snapx+snapping);
			} else {
				// CENTER and RIGHT
				placeX = placeX+(o3_snapx - snapping);
			}

			if (placeX < winoffset) placeX = winoffset;
		}
	}	

	// VERTICAL PLACEMENT
	if (eval('o3_frame.'+docRoot) && eval("typeof o3_frame."+docRoot+".clientHeight=='number'") && eval('o3_frame.'+docRoot+'.clientHeight')) {
		iheight = eval('o3_frame.'+docRoot+'.clientHeight');
	} else if (typeof(o3_frame.innerHeight)=='number') {
		iheight = o3_frame.innerHeight;
	}

	// Vertical scroll offset
	scrolloffset=(olIe4) ? eval('o3_frame.'+docRoot+'.scrollTop') : o3_frame.pageYOffset;
	var parsedHeight=(o3_aboveheight ? parseInt(o3_aboveheight) : (olNs4 ? over.clip.height : over.offsetHeight));

	if (o3_fixy > -1 || o3_rely != null) {
		// Fixed position
		placeY=(o3_rely != null ? (o3_rely < 0 ? scrolloffset+o3_rely+iheight - parsedHeight : scrolloffset+o3_rely) : o3_fixy);
	} else {
		// If VAUTO, decide what to use.
		if (o3_vauto == 1) {  
			if ((o3_y - scrolloffset) > (iheight/2)) {
				o3_vpos = ABOVE;
			} else {
				o3_vpos = BELOW;
			}
		}

		// From mouse
		if (o3_vpos == ABOVE) {
			if (o3_aboveheight == 0) o3_aboveheight = parsedHeight; 

			placeY = o3_y - (o3_aboveheight+o3_offsety);
			if (placeY < scrolloffset) placeY = scrolloffset;
		} else {
			// BELOW
			placeY = o3_y+o3_offsety;
		} 

		// Snapping!
		if (o3_snapy > 1) {
			var snapping = placeY % o3_snapy;  			

			if (o3_aboveheight > 0 && o3_vpos == ABOVE) {
				placeY = placeY - (o3_snapy+snapping);
			} else {
				placeY = placeY+(o3_snapy - snapping);
			} 			

			if (placeY < scrolloffset) placeY = scrolloffset;
		}
	}

	// Actually move the object.
	repositionTo(over, placeX, placeY);
}

// Moves the layer
function olMouseMove(e) {
	var e = (e) ? e : event;

	if (e.pageX) {
		o3_x = e.pageX;
		o3_y = e.pageY;
	} else if (e.clientX) {
		o3_x = eval('e.clientX+o3_frame.'+docRoot+'.scrollLeft');
		o3_y = eval('e.clientY+o3_frame.'+docRoot+'.scrollTop');
	}
	
	if (o3_allowmove == 1) runHook("placeLayer", FREPLACE);

	// MouseOut handler
	if (hoveringSwitch && !olNs4 && runHook("cursorOff", FREPLACE)) {
		cClick();
		hoveringSwitch = !hoveringSwitch;
	}
}

// Fake function for 3.0 users.
function no_overlib() { return ver3fix; }

// Capture the mouse and chain other scripts.
function olMouseCapture() {
	capExtent = document;
	var fN, mseHandler = olMouseMove;
	var re = /function[ ]+(\w+)\(/;
	
	if (document.onmousemove || (!olIe4 && window.onmousemove)) {
		if (window.onmousemove) capExtent = window;
		fN = capExtent.onmousemove.toString().match(re);

		if (fN[1] == 'anonymous' || fN[1] == 'olMouseMove') {
			olCheckMouseCapture = false;
			return;
		}
		var str = fN[1]+'(e); ' + 'olMouseMove(e); ';
		mseHandler = new Function('e', str);
	}

	capExtent.onmousemove = mseHandler;
	if (olNs4) capExtent.captureEvents(Event.MOUSEMOVE);
}


////////
// PARSING FUNCTIONS
////////

// Does the actual command parsing.
function parseTokens(pf, ar) {
	// What the next argument is expected to be.
	var v, mode=-1, par = (pf != 'ol_');	
	var fnMark = (par && !ar.length ? 1 : 0);

	for (i = 0; i < ar.length; i++) {
		if (mode < 0) {
			// Arg is maintext,unless its a number between pmStart and pmUpper
			// then its a command.
			if (typeof ar[i] == 'number' && ar[i] > pmStart && ar[i] < pmUpper) {
				fnMark = (par ? 1 : 0);
				i--;   // backup one so that the next block can parse it
			} else {
				switch(pf) {
					case 'ol_':
						ol_text = ar[i].toString();
						break;
					default:
						o3_text=ar[i].toString();  
				}
			}
			mode = 0;
		} else {
			// Note: NS4 doesn't like switch cases with vars.
			if (ar[i] >= pmCount || ar[i]==DONOTHING) { continue; }
			if (ar[i]==INARRAY) { fnMark = 0; eval(pf+'text=ol_texts['+ar[++i]+'].toString()'); continue; }
			if (ar[i]==CAPARRAY) { eval(pf+'cap=ol_caps['+ar[++i]+'].toString()'); continue; }
			if (ar[i]==STICKY) { if (pf!='ol_') eval(pf+'sticky=1'); continue; }
			if (ar[i]==BACKGROUND) { eval(pf+'background="'+ar[++i]+'"'); continue; }
			if (ar[i]==NOCLOSE) { if (pf!='ol_') opt_NOCLOSE(); continue; }
			if (ar[i]==CAPTION) { eval(pf+"cap='"+escSglQuote(ar[++i])+"'"); continue; }
			if (ar[i]==CENTER || ar[i]==LEFT || ar[i]==RIGHT) { eval(pf+'hpos='+ar[i]); continue; }
			if (ar[i]==OFFSETX) { eval(pf+'offsetx='+ar[++i]); continue; }
			if (ar[i]==OFFSETY) { eval(pf+'offsety='+ar[++i]); continue; }
			if (ar[i]==FGCOLOR) { eval(pf+'fgcolor="'+ar[++i]+'"'); continue; }
			if (ar[i]==BGCOLOR) { eval(pf+'bgcolor="'+ar[++i]+'"'); continue; }
			if (ar[i]==TEXTCOLOR) { eval(pf+'textcolor="'+ar[++i]+'"'); continue; }
			if (ar[i]==CAPCOLOR) { eval(pf+'capcolor="'+ar[++i]+'"'); continue; }
			if (ar[i]==CLOSECOLOR) { eval(pf+'closecolor="'+ar[++i]+'"'); continue; }
			if (ar[i]==WIDTH) { eval(pf+'width='+ar[++i]); continue; }
			if (ar[i]==BORDER) { eval(pf+'border='+ar[++i]); continue; }
			if (ar[i]==CELLPAD) { i=opt_MULTIPLEARGS(++i,ar,(pf+'cellpad')); continue; }
			if (ar[i]==STATUS) { eval(pf+"status='"+escSglQuote(ar[++i])+"'"); continue; }
			if (ar[i]==AUTOSTATUS) { eval(pf +'autostatus=('+pf+'autostatus == 1) ? 0 : 1'); continue; }
			if (ar[i]==AUTOSTATUSCAP) { eval(pf +'autostatus=('+pf+'autostatus == 2) ? 0 : 2'); continue; }
			if (ar[i]==HEIGHT) { eval(pf+'height='+pf+'aboveheight='+ar[++i]); continue; } // Same param again.
			if (ar[i]==CLOSETEXT) { eval(pf+"close='"+escSglQuote(ar[++i])+"'"); continue; }
			if (ar[i]==SNAPX) { eval(pf+'snapx='+ar[++i]); continue; }
			if (ar[i]==SNAPY) { eval(pf+'snapy='+ar[++i]); continue; }
			if (ar[i]==FIXX) { eval(pf+'fixx='+ar[++i]); continue; }
			if (ar[i]==FIXY) { eval(pf+'fixy='+ar[++i]); continue; }
			if (ar[i]==RELX) { eval(pf+'relx='+ar[++i]); continue; }
			if (ar[i]==RELY) { eval(pf+'rely='+ar[++i]); continue; }
			if (ar[i]==FGBACKGROUND) { eval(pf+'fgbackground="'+ar[++i]+'"'); continue; }
			if (ar[i]==BGBACKGROUND) { eval(pf+'bgbackground="'+ar[++i]+'"'); continue; }
			if (ar[i]==PADX) { eval(pf+'padxl='+ar[++i]); eval(pf+'padxr='+ar[++i]); continue; }
			if (ar[i]==PADY) { eval(pf+'padyt='+ar[++i]); eval(pf+'padyb='+ar[++i]); continue; }
			if (ar[i]==FULLHTML) { if (pf!='ol_') eval(pf+'fullhtml=1'); continue; }
			if (ar[i]==BELOW || ar[i]==ABOVE) { eval(pf+'vpos='+ar[i]); continue; }
			if (ar[i]==CAPICON) { eval(pf+'capicon="'+ar[++i]+'"'); continue; }
			if (ar[i]==TEXTFONT) { eval(pf+"textfont='"+escSglQuote(ar[++i])+"'"); continue; }
			if (ar[i]==CAPTIONFONT) { eval(pf+"captionfont='"+escSglQuote(ar[++i])+"'"); continue; }
			if (ar[i]==CLOSEFONT) { eval(pf+"closefont='"+escSglQuote(ar[++i])+"'"); continue; }
			if (ar[i]==TEXTSIZE) { eval(pf+'textsize="'+ar[++i]+'"'); continue; }
			if (ar[i]==CAPTIONSIZE) { eval(pf+'captionsize="'+ar[++i]+'"'); continue; }
			if (ar[i]==CLOSESIZE) { eval(pf+'closesize="'+ar[++i]+'"'); continue; }
			if (ar[i]==TIMEOUT) { eval(pf+'timeout='+ar[++i]); continue; }
			if (ar[i]==FUNCTION) { if (pf=='ol_') { if (typeof ar[i+1]!='number') { v=ar[++i]; ol_function=(typeof v=='function' ? v : null); }} else {fnMark = 0; v = null; if (typeof ar[i+1]!='number') v = ar[++i];  opt_FUNCTION(v); } continue; }
			if (ar[i]==DELAY) { eval(pf+'delay='+ar[++i]); continue; }
			if (ar[i]==HAUTO) { eval(pf+'hauto=('+pf+'hauto == 0) ? 1 : 0'); continue; }
			if (ar[i]==VAUTO) { eval(pf+'vauto=('+pf+'vauto == 0) ? 1 : 0'); continue; }
			if (ar[i]==CLOSECLICK) { eval(pf +'closeclick=('+pf+'closeclick == 0) ? 1 : 0'); continue; }
			if (ar[i]==WRAP) { eval(pf +'wrap=('+pf+'wrap == 0) ? 1 : 0'); continue; }
			if (ar[i]==FOLLOWMOUSE) { eval(pf +'followmouse=('+pf+'followmouse == 1) ? 0 : 1'); continue; }
			if (ar[i]==MOUSEOFF) { eval(pf +'mouseoff=('+pf+'mouseoff == 0) ? 1 : 0'); continue; }
			if (ar[i]==CLOSETITLE) { eval(pf+"closetitle='"+escSglQuote(ar[++i])+"'"); continue; }
			if (ar[i]==CSSOFF||ar[i]==CSSCLASS) { eval(pf+'css='+ar[i]); continue; }
			if (ar[i]==FGCLASS) { eval(pf+'fgclass="'+ar[++i]+'"'); continue; }
			if (ar[i]==BGCLASS) { eval(pf+'bgclass="'+ar[++i]+'"'); continue; }
			if (ar[i]==TEXTFONTCLASS) { eval(pf+'textfontclass="'+ar[++i]+'"'); continue; }
			if (ar[i]==CAPTIONFONTCLASS) { eval(pf+'captionfontclass="'+ar[++i]+'"'); continue; }
			if (ar[i]==CLOSEFONTCLASS) { eval(pf+'closefontclass="'+ar[++i]+'"'); continue; }
			i = parseCmdLine(pf, i, ar);
		}
	}

	if (fnMark && o3_function) o3_text = o3_function();
	
	if ((pf == 'o3_') && o3_wrap) {
		o3_width = 0;
		
		if (olOp || (olIe4 && isMac)) {
			var tReg=/<.*\n*>/ig;
			if (!tReg.test(o3_text)) o3_text = o3_text.replace(/[ ]+/g, '&nbsp;');
			if (!tReg.test(o3_cap))o3_cap = o3_cap.replace(/[ ]+/g, '&nbsp;');
		}
	}
	if ((pf == 'o3_') && o3_sticky) {
		if (!o3_close && (o3_frame != ol_frame)) o3_close = ol_close;
		if (o3_mouseoff && (o3_frame == ol_frame)) opt_NOCLOSE(' ');
	}
}


////////
// LAYER FUNCTIONS
////////

// Writes to a layer
function layerWrite(txt) {
	txt += "\n";
	if (olNs4) {
		var lyr = o3_frame.document.overDiv.document
		lyr.write(txt)
		lyr.close()
	} else if (typeof over.innerHTML != 'undefined') {
		if (olIe5 && isMac) over.innerHTML = '';
		over.innerHTML = txt;
	} else {
		range = o3_frame.document.createRange();
		range.setStartAfter(over);
		domfrag = range.createContextualFragment(txt);
		
		while (over.hasChildNodes()) {
			over.removeChild(over.lastChild);
		}
		
		over.appendChild(domfrag);
	}
}

// Make an object visible
function showObject(obj) {
	runHook("showObject", FBEFORE);

	var theObj=(olNs4 ? obj : obj.style);
	theObj.visibility = 'visible';

	runHook("showObject", FAFTER);
}

// Hides an object
function hideObject(obj) {
	runHook("hideObject", FBEFORE);

	var theObj=(olNs4 ? obj : obj.style);
	theObj.visibility = 'hidden';

	if (o3_timerid > 0) clearTimeout(o3_timerid);
	if (o3_delayid > 0) clearTimeout(o3_delayid);

	o3_timerid = 0;
	o3_delayid = 0;
	self.status = "";

	if (over.onmouseout || over.onmouseover) {
		if (olNs4) over.releaseEvents(Event.MOUSEOUT || Event.MOUSEOVER);
		over.onmouseout = over.onmouseover = null;
	}

	runHook("hideObject", FAFTER);
}

// Move a layer
function repositionTo(obj, xL, yL) {
	var theObj=(olNs4 ? obj : obj.style);
	theObj.left = xL + (!olNs4 ? 'px' : 0);
	theObj.top = yL + (!olNs4 ? 'px' : 0);
}

// Check position of cursor relative to overDiv DIVision; mouseOut function
function cursorOff() {
	var left = parseInt(over.style.left);
	var top = parseInt(over.style.top);
	var right = left+over.offsetWidth;
	var bottom = top+ over.offsetHeight;

	if (o3_x < left || o3_x > right || o3_y < top || o3_y > bottom) return true;

	return false;
}


////////
// COMMAND FUNCTIONS
////////

// Calls callme or the default function.
function opt_FUNCTION(callme) {
	o3_text = (callme ? (typeof callme=='string' ? (/.+\(.*\)/.test(callme) ? eval(callme) : callme) : callme()) : (o3_function ? o3_function() : 'No Function'));

	return 0;
}

// Handle hovering
function opt_NOCLOSE(unused) {
	if (!unused) o3_close = "";

	if (olNs4) {
		over.captureEvents(Event.MOUSEOUT || Event.MOUSEOVER);
		over.onmouseover = function () { if (o3_timerid > 0) { clearTimeout(o3_timerid); o3_timerid = 0; } }
		over.onmouseout = cClick;
	} else {
		over.onmouseover = function () {hoveringSwitch = true; if (o3_timerid > 0) { clearTimeout(o3_timerid); o3_timerid =0; } }
	}

	return 0;
}

// Function to scan command line arguments for multiples
function opt_MULTIPLEARGS(i, args, parameter) {
  var k = i, l, re, pV, str = '';

  for(k=i; k<args.length; k++) {
		str += args[k] + ',';
		if(typeof args[k] == 'number'&&args[k]>pmStart) break;
	}
  if(k >= args.length) l = str.length-1;
  else {
    re = eval('/,' + args[k] + '/');
    l = str.search(re);
  }

	k--;  // reduce by one so the for loop this is in works correctly
	str = str.substring(0, l);
	pV = (olNs4&&/cellpad/i.test(parameter)) ? str.split(',')[0] : str;
	eval(parameter + '="' + pV + '"');

	return k;
}

// Remove &nbsp; in texts when done.
function nbspCleanup() {
	if (o3_wrap && (olOp || (olIe4 && isMac))) {
		o3_text = o3_text.replace(/\&nbsp;/g, ' ');
		o3_cap = o3_cap.replace(/\&nbsp;/g, ' ');
	}
}

// Escape embedded single quotes in text strings
function escSglQuote(str) {
  return str.toString().replace(/'/g,"\\'");
}

// Onload handler for window onload event
function OLonLoad_handler(e) {
	if (!olLoaded) olLoaded=1;  // indicates that all modules have loaded now

	// remove the OLonload_handler for Ns6+, Mozilla based browsers, and IE
	if (window.removeEventListener) window.removeEventListener("load",OLonLoad_handler,true);
	else if (window.detachEvent) window.detachEvent("onload",OLonLoad_handler);
	
	// Route the event to the normal handler in Nx4.x
	if (olNs4) routeEvent(e);
}

// Wraps strings in Layer Generation Functions with the correct tags
//    endWrap true(if end tag) or false if start tag
//    fontSizeStr - font size string such as '1' or '10px'
//    whichString is being wrapped -- 'text', 'caption', or 'close'
function wrapStr(endWrap,fontSizeStr,whichString) {
	var fontStr, fontColor, isClose=((whichString=='close') ? 1 : 0), hasDims=/[%\-a-z]+$/.test(fontSizeStr);
	fontSizeStr = (olNs4) ? (!hasDims ? fontSizeStr : '1') : fontSizeStr;
	if (endWrap) return (hasDims&&!olNs4) ? (isClose ? '</span>' : '</div>') : '</font>';
	else {
		fontStr='o3_'+whichString+'font';
		fontColor='o3_'+((whichString=='caption')? 'cap' : whichString)+'color';
		return (hasDims&&!olNs4) ? (isClose ? '<span style="font-family: '+quoteMultiNameFonts(eval(fontStr))+'; color: '+eval(fontColor)+'; font-size: '+fontSizeStr+';">' : '<div style="font-family: '+quoteMultiNameFonts(eval(fontStr))+'; color: '+eval(fontColor)+'; font-size: '+fontSizeStr+';">') : '<font face="'+eval(fontStr)+'" color="'+eval(fontColor)+'" size="'+(parseInt(fontSizeStr)>7 ? '7' : fontSizeStr)+'">';
	}
}

// Quotes Multi word font names; needed for CSS Standards adherence in font-family
function quoteMultiNameFonts(theFont) {
	var v, pM=theFont.split(',');
	for (var i=0; i<pM.length; i++) {
		v=pM[i];
		v=v.replace(/^\s+/,'').replace(/\s+$/,'');
		if(/\s/.test(v) && !/['"]/.test(v)) {
			v="\'"+v+"\'";
			pM[i]=v;
		}
	}
	return pM.join();
}

// dummy function which will be overridden 
function isExclusive(args) {
	return false;
}
////////
//  PLUGIN ACTIVATION FUNCTIONS
////////

// Runs plugin functions to set runtime variables.
function setRunTimeVariables(){
	if (typeof runTime != 'undefined' && runTime.length) {
		for (var k = 0; k < runTime.length; k++) {
			runTime[k]();
		}
	}
}

// Runs plugin functions to parse commands.
function parseCmdLine(pf, i, args) {
	if (typeof cmdLine != 'undefined' && cmdLine.length) { 
		for (var k = 0; k < cmdLine.length; k++) { 
			var j = cmdLine[k](pf, i, args);
			if (j >- 1) {
				i = j;
				break;
			}
		}
	}

	return i;
}

// Runs plugin functions to do things after parse.
function postParseChecks(){
	if (typeof postParse != 'undefined' && postParse.length) {
		for (var k = 0; k < postParse.length; k++) {
			if (postParse[k]()) continue;
			return false;  // end now since have an error
		}
	}
	return true;
}


////////
//  PLUGIN REGISTRATION FUNCTIONS
////////

// Registers commands and creates constants.
function registerCommands(cmdStr) {
	if (typeof cmdStr!='string') return;

	var pM = cmdStr.split(',');
	pms = pms.concat(pM);

	for (var i = 0; i< pM.length; i++) {
		eval(pM[i].toUpperCase()+'='+pmCount++);
	}
}

// Register a function to hook at a certain point.
function registerHook(fnHookTo, fnRef, hookType, optPm) {
	var hookPt, last = typeof optPm;
	
	if (fnHookTo == 'plgIn'||fnHookTo == 'postParse') return;
	if (typeof hookPts == 'undefined') hookPts = new Array();
	if (typeof hookPts[fnHookTo] == 'undefined') hookPts[fnHookTo] = new FunctionReference();

	hookPt = hookPts[fnHookTo];

	if (hookType != null) {
		if (hookType == FREPLACE) {
			hookPt.ovload = fnRef;  // replace normal overlib routine
			if (fnHookTo.indexOf('ol_content_') > -1) hookPt.alt[pms[CSSOFF-1-pmStart]]=fnRef; 

		} else if (hookType == FBEFORE || hookType == FAFTER) {
			var hookPt=(hookType == 1 ? hookPt.before : hookPt.after);

			if (typeof fnRef == 'object') {
				hookPt = hookPt.concat(fnRef);
			} else {
				hookPt[hookPt.length++] = fnRef;
			}

			if (optPm) hookPt = reOrder(hookPt, fnRef, optPm);

		} else if (hookType == FALTERNATE) {
			if (last=='number') hookPt.alt[pms[optPm-1-pmStart]] = fnRef;
		}

		return;
	}
}

// Register a function that will set runtime variables.
function registerRunTimeFunction(fn) {
	if (isFunction(fn)) {
		if (typeof runTime == 'undefined') runTime = new Array();
		if (typeof fn == 'object') {
			runTime = runTime.concat(fn);
		} else {
			runTime[runTime.length++] = fn;
		}
	}
}

// Register a function that will handle command parsing.
function registerCmdLineFunction(fn){
	if (isFunction(fn)) {
		if (typeof cmdLine == 'undefined') cmdLine = new Array();
		if (typeof fn == 'object') {
			cmdLine = cmdLine.concat(fn);
		} else {
			cmdLine[cmdLine.length++] = fn;
		}
	}
}

// Register a function that does things after command parsing. 
function registerPostParseFunction(fn){
	if (isFunction(fn)) {
		if (typeof postParse == 'undefined') postParse = new Array();
		if (typeof fn == 'object') {
			postParse = postParse.concat(fn);
		} else {
			postParse[postParse.length++] = fn;
		}
	}
}

////////
//  PLUGIN REGISTRATION FUNCTIONS
////////

// Runs any hooks registered.
function runHook(fnHookTo, hookType) {
	var l = hookPts[fnHookTo], optPm, arS, ar = runHook.arguments;

	if (hookType == FREPLACE) {
		arS = argToString(ar, 2);

		if (typeof l == 'undefined' || !(l = l.ovload)) return eval(fnHookTo+'('+arS+')');
		else return eval('l('+arS+')');

	} else if (hookType == FBEFORE || hookType == FAFTER) {
		if (typeof l == 'undefined') return;
		l=(hookType == 1 ? l.before : l.after);

		if (!l.length) return;

		arS = argToString(ar, 2);
		for (var k = 0; k < l.length; k++) eval('l[k]('+arS+')'); 

	} else if (hookType == FALTERNATE) {
		optPm = ar[2];
		arS = argToString(ar, 3);

		if (typeof l == 'undefined' || (l = l.alt[pms[optPm-1-pmStart]]) == 'undefined') {
			return eval(fnHookTo+'('+arS+')');
		} else {
			return eval('l('+arS+')');
		}
	}
}

////////
//  UTILITY FUNCTIONS
////////

// Checks if something is a function.
function isFunction(fnRef) {
	var rtn = true;

	if (typeof fnRef == 'object') {
		for (var i = 0; i < fnRef.length; i++) {
			if (typeof fnRef[i]=='function') continue;
			rtn = false;
			break;
		}
	} else if (typeof fnRef != 'function') {
		rtn = false;
	}
	
	return rtn;
}

// Converts an array into an argument string for use in eval.
function argToString(array, strtInd, argName) {
	var jS = strtInd, aS = '', ar = array;
	argName=(argName ? argName : 'ar');
	
	if (ar.length > jS) {
		for (var k = jS; k < ar.length; k++) aS += argName+'['+k+'], ';
		aS = aS.substring(0, aS.length-2);
	}
	
	return aS;
}

// Places a hook in the correct position in a hook point.
function reOrder(hookPt, fnRef, order) {
	if (!order || typeof order == 'undefined' || typeof order == 'number') return;
	
	var newPt = new Array(), match;

	if (typeof order=='function') {
		if (typeof fnRef=='object') {
			newPt = newPt.concat(fnRef);
		} else {
			newPt[newPt.length++]=fnRef;
		}
		
		for (var i = 0; i < hookPt.length; i++) {
			match = false;
			if (typeof fnRef == 'function' && hookPt[i] == fnRef) {
				continue;
			} else {
				for(var j = 0; j < fnRef.length; j++) if (hookPt[i] == fnRef[j]) {
					match = true;
					break;
				}
			}
			if (!match) newPt[newPt.length++] = hookPt[i];
		}

		newPt[newPt.length++] = order;

	} else if (typeof order == 'object') {
		if (typeof fnRef == 'object') {
			newPt = newPt.concat(fnRef);
		} else {
			newPt[newPt.length++] = fnRef;
		}
		
		for (var j = 0; j < hookPt.length; j++) {
			match = false;
			if (typeof fnRef == 'function' && hookPt[j] == fnRef) {
				continue;
			} else {
				for (var i = 0; i < fnRef.length; i++) if (hookPt[j] == fnRef[i]) {
					match = true;
					break;
				}
			}
			if (!match) newPt[newPt.length++]=hookPt[j];
		}

		for (i = 0; i < newPt.length; i++) hookPt[i] = newPt[i];
		newPt.length = 0;
		
		for (var j = 0; j < hookPt.length; j++) {
			match = false;
			for (var i = 0; i < order.length; i++) {
				if (hookPt[j] == order[i]) {
					match = true;
					break;
				}
			}
			if (!match) newPt[newPt.length++] = hookPt[j];
		}
		newPt = newPt.concat(order);
	}

	for(i = 0; i < newPt.length; i++) hookPt[i] = newPt[i];

	return hookPt;
}

////////
// OBJECT CONSTRUCTORS
////////

// Object for handling hooks.
function FunctionReference() {
	this.ovload = null;
	this.before = new Array();
	this.after = new Array();
	this.alt = new Array();
}

// Object for simple access to the overLIB version used.
// Examples: simpleversion:351 major:3 minor:5 revision:1
function Info(version, prerelease) {
	this.version = version;
	this.prerelease = prerelease;

	this.simpleversion = parseInt(this.version*100);
	this.major = parseInt(this.simpleversion / 100);
	this.minor = parseInt(this.simpleversion / 10) - this.major * 10;
	this.revision = parseInt(this.simpleversion) - this.major * 100 - this.minor * 10;
}



////////
// STANDARD REGISTRATIONS
////////
registerHook("ol_content_simple", ol_content_simple, FALTERNATE, CSSOFF);
registerHook("ol_content_caption", ol_content_caption, FALTERNATE, CSSOFF);
registerHook("ol_content_background", ol_content_background, FALTERNATE, CSSOFF);
registerHook("ol_content_simple", ol_content_simple, FALTERNATE, CSSCLASS);
registerHook("ol_content_caption", ol_content_caption, FALTERNATE, CSSCLASS);
registerHook("ol_content_background", ol_content_background, FALTERNATE, CSSCLASS);
registerHook("hideObject", nbspCleanup, FAFTER);	
	
var NS4 = (document.layers)? 1 : 0;
var IE4 = (document.all)? 1 : 0;
var W3C = (document.getElementById)? 1 : 0;
var hrIsSelect = 0;

function fCheckHirlevel(){
	var strnev = new String(fGetObject("uname").value);
	var stremail = new String(fGetObject("uemail").value);	
	
	if(strnev == ""){
		alert('A név megadása kötelező!');	
		return false;
	}
	
	if(stremail == ""){
		alert('Az e-mail cím megadása kötelező!');	
		return false;
	}
		
	
	if(stremail.indexOf("@") == -1 || stremail.indexOf(".") == -1){
		fGetObject("uemail").value = "";
		alert('Az e-mail cím formátuma nem megfelelő');
		return false;
	}
	
	return true;
}

function fFileBrowse(obj, ext){
	var tmp = new String(obj.value);
	tmp = tmp.substr(tmp.length-4, 4);
	if(tmp.toLowerCase() != ext){
		obj.value = "";
		dialogManager.add(new Dialog('Csak '+ext+' file-t lehet feltölteni!', 'alert'));
	}
}

function fGetObject(obj_name){
	if(W3C)
		return document.getElementById(obj_name);
	else if(NS4)
		return document.layers[obj_name];
	else
		return window.opener.document.all[obj_name];
}

function fIsNum(tmp){
	var szam = new String(tmp);
	var jok = new String("0123456789");
	for(k=0; k<szam.length; k++){
		if(jok.indexOf(szam.charAt(k)) == -1)
			return false;
	}
	return true;
}

function fIsNum2(tmp){
	var szam = new String(tmp);
	var jok = new String("0123456789.");
	var ispoint = false;
	for(k=0; k<szam.length; k++){
		if(szam.charAt(k) == "." && ispoint)
			return false;
		else if(szam.charAt(k) == ".")
			ispoint = true;
			
		if(jok.indexOf(szam.charAt(k)) == -1)
			return false;
	}
	return true;
}

function fIsNum3(obj){
	var szam = new String(obj.value);
	while(szam.indexOf(",") != -1)
		szam = szam.replace(",", ".");
		
	while(szam.indexOf(" ") != -1)
		szam = szam.replace(" ", "");
	obj.value = szam;
	
	var jok = new String("0123456789.");
	var ispoint = false;
	for(k=0; k<szam.length; k++){
		if(szam.charAt(k) == "." && ispoint){
			obj.value = "";
			return false;			
		}else if(szam.charAt(k) == ".")
			ispoint = true;
			
		if(jok.indexOf(szam.charAt(k)) == -1){
			obj.value = "";
			return false;
		}
	}
	return true;
}

function fIsTime(obj){
	var time = new String(obj.value);	
	while(time.indexOf(",") != -1)
		time = time.replace(",", ":");
		
	while(time.indexOf(".") != -1)
		time = time.replace(".", ":");
		
	while(time.indexOf(" ") != -1)
		time = time.replace(" ", ":");
		
	tmp = time.indexOf(":");
	if(tmp == 1){
		time = "0" + time;
	}	
	
	obj.value = time;
		
	if(time.length != 5){
		alert("Az idő formátuma nem megfelelő, helyesen: 16:30");
		return false;
	}	
	
	
	var hour = new String(time.substr(0,2));
	var minute = new String(time.substr(3,2));

	if(!fIsNum(hour)){
		alert("Az óra csak szám lehet!");
		return false;
	}
	
	if(!fIsNum(minute)){
		alert("A perc csak szám lehet!");
		return false;
	}
	
	if(hour<0 || hour>23){
		alert("Az óra 01-23 lehet!");
		return false;
	}
	
	if(!fIsNum(minute)){
		alert("A perc csak szám lehet");
		return false;
	}
	
	if(minute<0 || minute>59){
		alert("A perc 00-59 lehet!");
		return false;
	}
	
	return true;
}

function fIsDate(obj){
	var date = new String(obj.value);	
	while(date.indexOf(",") != -1)
		date = date.replace(",", "-");
		
	while(date.indexOf(".") != -1)
		date = date.replace(".", "-");
		
	while(date.indexOf(" ") != -1)
		date = date.replace(" ", "-");
		
	obj.value = date;
		
	if(date.length != 10){
		alert("A dátum formátuma nem megfelelő: 1999-09-09");
		return false;
	}	
	
	var year = new String(date.substr(0,4));
	var month = new String(date.substr(5,2));
	var day = new String(date.substr(8,2));

	if(!fIsNum(year)){
		alert("Az év csak szám lehet");
		return false;
	}
	
	if(!fIsNum(month)){
		alert("A hónap csak szám lehet");
		return false;
	}
	
	if(month<1 || month>12){
		alert("A hónap 01-12 lehet!");
		return false;
	}
	
	if(!fIsNum(day)){
		alert("A nap csak szám lehet");
		return false;
	}
	
	if(day<1 || day>31){
		alert("A nap 01-31 lehet!");
		return false;
	}
	
	return true;
}

String.prototype.trim = function () {
    return this.replace(/^\s*/, "").replace(/\s*$/, "");
}

String.prototype.replaceAll = function (str1, str2) {
	str = this;
	pos = str.indexOf(str1);
    while(pos != -1){
		str = str.replace(str1, str2);
		pos = str.indexOf(str1,pos+str2.length-str1.length);
	}
	return str;
}

Number.prototype.valuta = function () {
	var str = new String(this);
	
    str = str.replaceAll(".", ",");
	
	if(str.indexOf(".")>-1)
		tmp = false;
	else
		tmp = true;
	w=0;
	for(q=str.length-1; q>=0; q--){
		if(tmp)
			w++;
		
		if(str.charAt(q) == ",")
			tmp = true;
			
		if(w%3==0 && w>0)
			str = str.substr(0,q)+"&nbsp;"+str.substr(q);
	}
	return str;
}	
	
/***********************************************

* Ultimate Fade-In Slideshow (v1.51): © Dynamic Drive (http://www.dynamicdrive.com)

* This notice MUST stay intact for legal use

* Visit http://www.dynamicdrive.com/ for this script and 100s more.

***********************************************/

 

var fadebgcolor="white"



////NO need to edit beyond here/////////////

 

var fadearray=new Array() //array to cache fadeshow instances

var fadeclear=new Array() //array to cache corresponding clearinterval pointers

 

var dom=(document.getElementById) //modern dom browsers

var iebrowser=document.all

 

function fadeshow(theimages, fadewidth, fadeheight, borderwidth, delay, pause, displayorder){

this.pausecheck=pause

this.mouseovercheck=0

this.delay=delay

this.degree=10 //initial opacity degree (10%)

this.curimageindex=0

this.nextimageindex=1

fadearray[fadearray.length]=this

this.slideshowid=fadearray.length-1

this.canvasbase="canvas"+this.slideshowid

this.curcanvas=this.canvasbase+"_0"

if (typeof displayorder!="undefined")

theimages.sort(function() {return 0.5 - Math.random();}) //thanks to Mike (aka Mwinter) :)

this.theimages=theimages

this.imageborder=parseInt(borderwidth)

this.postimages=new Array() //preload images

for (p=0;p<theimages.length;p++){

this.postimages[p]=new Image()

this.postimages[p].src=theimages[p][0]

}

 

var fadewidth=fadewidth+this.imageborder*2

var fadeheight=fadeheight+this.imageborder*2

 

if (iebrowser&&dom||dom) //if IE5+ or modern browsers (ie: Firefox)

document.write('<div id="master'+this.slideshowid+'" style="position:relative;width:'+fadewidth+'px;height:'+fadeheight+'px;overflow:hidden;"><div id="'+this.canvasbase+'_0" style="position:absolute;width:'+fadewidth+'px;height:'+fadeheight+'px;top:0;left:0;filter:progid:DXImageTransform.Microsoft.alpha(opacity=10);opacity:0.1;-moz-opacity:0.1;-khtml-opacity:0.1;background-color:'+fadebgcolor+'"></div><div id="'+this.canvasbase+'_1" style="position:absolute;width:'+fadewidth+'px;height:'+fadeheight+'px;top:0;left:0;filter:progid:DXImageTransform.Microsoft.alpha(opacity=10);opacity:0.1;-moz-opacity:0.1;-khtml-opacity:0.1;background-color:'+fadebgcolor+'"></div></div>')

else

document.write('<div><img name="defaultslide'+this.slideshowid+'" src="'+this.postimages[0].src+'"></div>')

 

if (iebrowser&&dom||dom) //if IE5+ or modern browsers such as Firefox

this.startit()

else{

this.curimageindex++

setInterval("fadearray["+this.slideshowid+"].rotateimage()", this.delay)

}

}



function fadepic(obj){

if (obj.degree<100){

obj.degree+=10

if (obj.tempobj.filters&&obj.tempobj.filters[0]){

if (typeof obj.tempobj.filters[0].opacity=="number") //if IE6+

obj.tempobj.filters[0].opacity=obj.degree

else //else if IE5.5-

obj.tempobj.style.filter="alpha(opacity="+obj.degree+")"

}

else if (obj.tempobj.style.MozOpacity)

obj.tempobj.style.MozOpacity=obj.degree/101

else if (obj.tempobj.style.KhtmlOpacity)

obj.tempobj.style.KhtmlOpacity=obj.degree/100

else if (obj.tempobj.style.opacity&&!obj.tempobj.filters)

obj.tempobj.style.opacity=obj.degree/101

}

else{

clearInterval(fadeclear[obj.slideshowid])

obj.nextcanvas=(obj.curcanvas==obj.canvasbase+"_0")? obj.canvasbase+"_0" : obj.canvasbase+"_1"

obj.tempobj=iebrowser? iebrowser[obj.nextcanvas] : document.getElementById(obj.nextcanvas)

obj.populateslide(obj.tempobj, obj.nextimageindex)

obj.nextimageindex=(obj.nextimageindex<obj.postimages.length-1)? obj.nextimageindex+1 : 0

setTimeout("fadearray["+obj.slideshowid+"].rotateimage()", obj.delay)

}

}

 

fadeshow.prototype.populateslide=function(picobj, picindex){

var slideHTML=""

if (this.theimages[picindex][1]!="") //if associated link exists for image

slideHTML='<a href="'+this.theimages[picindex][1]+'" target="'+this.theimages[picindex][2]+'">'

slideHTML+='<img src="'+this.postimages[picindex].src+'" border="'+this.imageborder+'px">'

if (this.theimages[picindex][1]!="") //if associated link exists for image

slideHTML+='</a>'

picobj.innerHTML=slideHTML

}

 

 

fadeshow.prototype.rotateimage=function(){

if (this.pausecheck==1) //if pause onMouseover enabled, cache object

var cacheobj=this

if (this.mouseovercheck==1)

setTimeout(function(){cacheobj.rotateimage()}, 100)

else if (iebrowser&&dom||dom){

this.resetit()

var crossobj=this.tempobj=iebrowser? iebrowser[this.curcanvas] : document.getElementById(this.curcanvas)

crossobj.style.zIndex++

if(crossobj.style.zIndex>18)
	crossobj.style.zIndex=2;

fadeclear[this.slideshowid]=setInterval("fadepic(fadearray["+this.slideshowid+"])",50)

this.curcanvas=(this.curcanvas==this.canvasbase+"_0")? this.canvasbase+"_1" : this.canvasbase+"_0"

}

else{

var ns4imgobj=document.images['defaultslide'+this.slideshowid]

ns4imgobj.src=this.postimages[this.curimageindex].src

}

this.curimageindex=(this.curimageindex<this.postimages.length-1)? this.curimageindex+1 : 0

}

 

fadeshow.prototype.resetit=function(){

this.degree=10

var crossobj=iebrowser? iebrowser[this.curcanvas] : document.getElementById(this.curcanvas)

if (crossobj.filters&&crossobj.filters[0]){

if (typeof crossobj.filters[0].opacity=="number") //if IE6+

crossobj.filters(0).opacity=this.degree

else //else if IE5.5-

crossobj.style.filter="alpha(opacity="+this.degree+")"

}

else if (crossobj.style.MozOpacity)

crossobj.style.MozOpacity=this.degree/101

else if (crossobj.style.KhtmlOpacity)

crossobj.style.KhtmlOpacity=this.degree/100

else if (crossobj.style.opacity&&!crossobj.filters)

crossobj.style.opacity=this.degree/101

}

 

 

fadeshow.prototype.startit=function(){

var crossobj=iebrowser? iebrowser[this.curcanvas] : document.getElementById(this.curcanvas)

this.populateslide(crossobj, this.curimageindex)

if (this.pausecheck==1){ //IF SLIDESHOW SHOULD PAUSE ONMOUSEOVER

var cacheobj=this

var crossobjcontainer=iebrowser? iebrowser["master"+this.slideshowid] : document.getElementById("master"+this.slideshowid)

crossobjcontainer.onmouseover=function(){cacheobj.mouseovercheck=1}

crossobjcontainer.onmouseout=function(){cacheobj.mouseovercheck=0}

}

this.rotateimage()

}	
	

