var tt_POPFRAME, tt_DRAGPOPUP;
tt_POPFRAME={
////////////////////////////////
obj_PDCid:"tt_POPFRAMECONTENTDIV",
obj_PDCHEADid:"tt_POPFRAMEHEADID",
font_family: "Arial, Helvetica, sans-serif",
cim_background_color:"#f93",
border:"2px solid #f93",

flashToHide:false,
///////////////////////////////

selboxes:[],
flashes:[],

obj_PDC:"undefined",

ua:navigator.userAgent.toLowerCase(),
isDOM:false,
isIE:false,
isIEWin:false,
ieVers:0,
isOpera:false,

msg:[],

init:function()
{
	if(document.getElementById)
	{
		this.isDOM=true;
		this.isOpera=/opera|OPERA|Opera/.test(this.ua);
		if(document.all && !this.isOpera)
		{
			this.isIE=true;
			this.isIEWin=this.isIE && /win/.test(this.ua);
			this.ieVers=parseFloat(navigator.appVersion.split("MSIE")[1]);
		}
		if(this.o(this.obj_PDCid))
		{
			this.rejt();
		}
		return true;
	}
	else
	{
		alert('Az Ön böngészője nagyon elavult.\nHasználjon modernebb böngészőt!\npl. Internet Explorer 8+, Firefox 3+, Opera 10+\n\nYour browser is too old.\nUse modern browser!\nLike:Explorer 8+, Firefox 3+, Opera 10+...');
		return false;
	}
},

mutat: function (f,kw,kh,lang)
{
	var scrS,w,t,h,cnt,full_kw,full_kh,kleft,ktop;

	kw=parseInt(kw,10);
	kh=parseInt(kh,10);

	switch (lang)
	{
		case "m":
			this.msg.bezar="Bezár";
			this.msg.alt_tit="Az ablak bezárásához kattintson a képre";
			this.msg.aniOn="Az animáció bekapcsolása";
			this.msg.aniOff="Az animáció kikapcsolása";
			break;
		case "a":
			this.msg.bezar="Close";
			this.msg.alt_tit="Click on the image to close this window";
			this.msg.aniOn="Switch the animation on";
			this.msg.aniOff="Switch the animation off";
			break;
		case "d":
			this.msg.bezar="Schliessen";
			this.msg.alt_tit="Klicken Sie auf das Bild dieses Fenster zu schliessen ";
			this.msg.aniOn="Die Animation einschalten";
			this.msg.aniOff="Die Animation ausschalten";
			break;			
		default:
			this.msg.bezar="Bezár";
			this.msg.alt_tit="Az ablak bezárásához kattintson a képre";
			this.msg.aniOn="Az animáció bekapcsolása";
			this.msg.aniOff="Az animáció kikapcsolása";
	}
	
	this.init();

	if(!this.isDOM)
	{
		return;
	}
	
	if(this.flashToHide)
	{
		this.hideFlash();
	}
	
	this.hideSelectbox();

	this.createPDC();
	
	scrS=this.getScreenSizes();

	w=scrS.w;
	h=scrS.h;
	t=scrS.t;

	cnt="<table id='tt_POPFRAME_cntTable' cellspacing='0' cellpadding='0' border='0' style='table-layout:fixed; width:"+(kw)+"px; background-color:#fff; color:#000; font-family:"+this.font_family+";";
	if(this.isIEWin)
	{
		cnt+="filter:alpha(opacity=100);";
	}
	else
	{
		cnt+="opacity:1;";
	}	
	cnt+="'>";
	
	cnt+="<tr id='"+this.obj_PDCHEADid+"'>";
	
	cnt+="<td align='right' style='padding:1px 1px 2px 0; cursor: move; background-color:"+this.cim_background_color+"'>";
		
	cnt+="<a href='javascript:void(0)' onclick='tt_POPFRAME.rejt(); return false' style='text-decoration:none;' title='"+this.msg.bezar+"'><img src='img/popdivclose.png' width='20' height='20' border='0' alt='"+this.msg.bezar+"' title='"+this.msg.bezar+"' /></a>";
	
	
	cnt+="</td></tr>";
	
	cnt+="<tr><td><iframe id='popdivElement' name='popdivElement' src='"+f+"' width='"+kw+"' height='"+kh+"'  marginwidth='0' marginheight='0' frameborder='0' align='middle' scrolling='auto' style='padding:0'></iframe></td></tr></table>";
	
/////////////////////////////////////////////

	this.obj_PDC.innerHTML=cnt;
	
	if(!this.isIE)
	{
		this.o(this.obj_PDCHEADid).onmousedown=function(){
		tt_POPFRAME.obj_PDC.style.opacity=0.80;
		};
		this.o(this.obj_PDCHEADid).onmouseup=function(){
		tt_POPFRAME.obj_PDC.style.opacity=1;
		};
	}
	else
	{
		this.o(this.obj_PDCHEADid).onmousedown=function(){
		tt_POPFRAME.obj_PDC.style.filter = 'alpha(opacity=80)';
		};
		this.o(this.obj_PDCHEADid).onmouseup=function(){
		tt_POPFRAME.obj_PDC.style.filter = 'alpha(opacity=100)';
		};
	}
	
	this.obj_PDC.style.visibility="visible";

	full_kw=this.o('tt_POPFRAME_cntTable').scrollWidth;
	full_kh=this.o('tt_POPFRAME_cntTable').scrollHeight;

	this.obj_PDC.style.width=parseInt(full_kw,10)+'px';
	this.obj_PDC.style.height=parseInt(full_kh,10)+'px';
	
	kleft=( w/2 - (full_kw/2) )+'px';
	ktop = (t+( h/2 - (full_kh/2) ));
	ktop = ktop>=10 ? (ktop+'px') : "10px";

	//pozicionálás, méretezés:
	this.obj_PDC.style.left=kleft;
	this.obj_PDC.style.top=ktop;
		
	this.obj_PDC.style.visibility="visible";

	tt_DRAGPOPUP.objID=this.obj_PDCid;
	tt_DRAGPOPUP.objToDragID=this.obj_PDCHEADid;

	document.onmousedown=tt_DRAGPOPUP.selectmouse;
	document.onmouseup=tt_DRAGPOPUP.upmouse;
},

rejt:function() {
	this.obj_PDC.parentNode.removeChild(this.obj_PDC);
	if(this.flashToHide)
	{	
		this.showFlash();
		this.flashes.length=0;
	}
	this.showSelectbox();
	this.selboxes.length = 0;
	if (this.isIEWin)
	{
		window.attachEvent("onunload", tt_POPFRAME.cleanupIELeaks);
	}
},

getBodyElement: function()
{
	var b;
        if(document.getElementsByTagName("body"))
        {
		b=document.getElementsByTagName("body")[0] || document.getElementsByTagName("body").item(0);
        }
        else if(window.content.document.getElementsByTagName("body"))
        {
		b=window.content.document.getElementsByTagName("body")[0];
	}
	else if(document.childNodes[1])
	{
		b=document.childNodes[1];
	}
	else
	{
		b=document.body;
	}
	return b;
},

createPDC: function()
{
	var ujContDiv,bodi,firstEl;
	
	bodi=this.getBodyElement();

	ujContDiv=document.createElement('div');
	ujContDiv.id=this.obj_PDCid;
	ujContDiv.style.textAlign='center';
	ujContDiv.style.backgroundColor='#fff'; 
	ujContDiv.style.position='absolute';
	ujContDiv.style.width=0;
	ujContDiv.style.height=0;
	ujContDiv.style.top=0;
	ujContDiv.style.left=0;
	ujContDiv.style.display='block';
	ujContDiv.style.visibility='hidden';
	ujContDiv.style.opacity=1;
	ujContDiv.style.filter= 'alpha(opacity=100)';
	ujContDiv.style.zIndex='9999'; 
	ujContDiv.style.border=this.border; //2px solid #e8c666
	
	firstEl=bodi.childNodes[0];
	bodi.insertBefore(ujContDiv,firstEl);
	this.obj_PDC=this.o(this.obj_PDCid);
},

o: function(id)
{
	return document.getElementById(id);
},

hideFlash: function()
{
	var et,etl,e,ft,ftl,i,pt,ptl,p;

	//###### önálló EMBED OBJECT nélkül:
	et= document.getElementsByTagName("embed");
	etl=et.length;
	for (e=0; e<etl; e++)
	{
		if(et[e].parentNode.style.display!=='none'&&et[e].parentNode.tagName.toLowerCase()!=="object")
		{
			if(this.getFlashExt(this.gal(et[e],'src')) )
			{
				et[e].style.display='none';
				this.flashes.push(et[e]);
			}
			else if(this.gal(et[e],'type')==="application/x-shockwave-flash")
			{
				et[e].style.display='none';
				this.flashes.push(et[e]);
			}
		}
	}
	
	//###### OBJECT param-el és embeddel vagy anélkül:	
	ft=document.getElementsByTagName("object");
	ftl=ft.length;
	for (i=0; i<ftl; i++)
	{
		if (ft[i].style.display!=='none' )
		{
			if(this.gal(ft[i],'classid')==='clsid:d27cdb6e-ae6d-11cf-96b8-444553540000')
			{
				ft[i].style.display='none';
				this.flashes.push(ft[i]);
			}
			else if( this.getFlashExt(this.gal(ft[i],'src')) )
			{
				ft[i].style.display='none';
				this.flashes.push(ft[i]);
			}
			else if( this.getFlashExt(this.gal(ft[i],'data')) )
			{
				ft[i].style.display='none';
				this.flashes.push(ft[i]);
			}			
			else if(this.gal(ft[i],'type')==="application/x-shockwave-flash")
			{
				ft[i].style.display='none';
				this.flashes.push(ft[i]);
			}
			else
			{
				pt=ft[i].getElementsByTagName("param");
				ptl=pt.length;
				for(p=0; p<ptl; p++)
				{
					if( this.gal(pt[p],'name')==="movie" && this.getFlashExt(this.gal(pt[p],'value')) )
					{
						ft[i].style.display='none'; 
						this.flashes.push(ft[i]);
					}
					else if( this.gal(pt[p],'name')==="src" && this.getFlashExt(this.gal(pt[p],'value')) )
					{
						ft[i].style.display='none'; 
						this.flashes.push(ft[i]);
					}				
					else if( this.gal(pt[p],'name')==="data" && this.getFlashExt(this.gal(pt[p],'value')) )
					{
						ft[i].style.display='none'; 
						this.flashes.push(ft[i]);
					}
				}
			}
		}	
	}
},


gal: function (elem,attr)
{
	try
	{
		if(elem.getAttribute(attr)!==null||elem.getAttribute(attr)!=="undefined")
		{
			return elem.getAttribute(attr).toLowerCase();
		}
		else
		{
			return eval("elem."+attr).toLowerCase();
		}
	}
	catch (e)
	{
		return null;
	}
},

getFlashExt: function(f)
{
	var fe,d;
	if(!f)
	{
		return false;
	}
	fe ="";
	d = f.replace(/^\s|\s$/g, "");
	if (d.match(/\.(swf|SWF)/) )
	{
		fe = RegExp.$1;
	}
	return fe;
},

showFlash: function()
{
	var l,i;
	l=this.flashes.length;
	for(i=0; i<l;i++)
	{
		this.flashes[i].style.display="";
	}
},

hideSelectbox: function()
{
	var i,selects,sl;

	//IE6/IE5/IE4:
	if(this.isIE && this.ieVers<7)
	{
		selects = document.getElementsByTagName('select');
		sl=selects.length;
		for(i=0;i<sl;i++)
		{
			if(selects[i].style.display!=="none")
			{
				selects[i].style.display="none";
				this.selboxes.push(selects[i]);
			}
		}		
	}
},

showSelectbox: function()
{
	var i,sl;
	if(this.isIE && this.ieVers<7)
	{
		sl=this.selboxes.length;
		for(i=0;i<sl;i++)
		{
			this.selboxes[i].style.display="block";
		}		
	}
},

getScrollerWidth: function ()
{
    var scr = null;
    var inn = null;
    var wNoScroll = 0;
    var wScroll = 0;
    scr = document.createElement('div');
    scr.style.position = 'absolute';
    scr.style.top = '-1000px';
    scr.style.left = '-1000px';
    scr.style.width = '100px';
    scr.style.height = '50px';
    scr.style.overflow = 'hidden';
    inn = document.createElement('div');
    inn.style.width = '100%';
    inn.style.height = '200px';
    scr.appendChild(inn);
    document.body.appendChild(scr);
    wNoScroll = inn.offsetWidth;
    scr.style.overflow = 'auto';
    wScroll = inn.offsetWidth;
    document.body.removeChild(document.body.lastChild);
    return (wNoScroll - wScroll);
},

getScreenSizes:function()
{
	var scrollw=30,w=800,h=600,t=0;

	if( typeof( window.parent.innerWidth ) === 'number' )
	{
		//Non-IE
		w = window.parent.innerWidth;
		h = window.parent.innerHeight;
	}
	else if( parent.document.documentElement && ( parent.document.documentElement.clientWidth || parent.document.documentElement.clientHeight ) )
	{
		//IE 6+ in 'standards compliant mode'
		w = parent.document.documentElement.clientWidth;
		h = parent.document.documentElement.clientHeight;
	}
	else if( parent.document.body && ( parent.document.body.clientWidth || parent.document.body.clientHeight ) )
	{
		//IE 4 compatible
		w = parent.document.body.clientWidth;
		h = parent.document.body.clientHeight;
	}

	scrollw= parseInt(this.getScrollerWidth(),10);
	if((w-scrollw)<w)
	{
		w=(w-scrollw);
	}

	if( typeof( window.pageYOffset ) === 'number' )
	{
		//Netscape compliant
		t = window.parent.pageYOffset;
	}
	else if( parent.document.body && parent.document.body.scrollTop )
	{
		//DOM compliant
		t = parent.document.body.scrollTop;
	}
	else if( parent.document.documentElement && parent.document.documentElement.scrollTop )
	{
		//IE6 standards compliant mode
		t = parent.document.documentElement.scrollTop;
	}
	return {w:w,h:h,t:t};
},

cleanupIELeaks: function()
{
	var _o,_l,i,x;
	_o = document.getElementsByTagName("object");
	_l = _o.length;
	for (i = 0; i < _l; i++) {
		_o[i].style.display = "none";
		for (x in _o[i])
		{
			if (typeof _o[i][x] === "function")
			{
				_o[i][x] = null;
			}
		}
	}
}

};//end class


//////////////////////////////////////////////////////////////////
tt_DRAGPOPUP={
///////////
objID: "",
objToDragID: "",
///////////

isdrag: false,
x: "",
y: "",
tx: "",
ty: "",
dobj: "",

movemouse: function(e)
{
	if(this.isdrag)
	{
		if(document.getElementById && !document.all)
		{
			this.dobj.style.left = (this.tx + e.clientX - this.x)+"px";
			this.dobj.style.top  = (this.ty + e.clientY - this.y)+"px";
		}
		else
		{
			this.dobj.style.left = (this.tx + event.clientX - this.x)+"px";
			this.dobj.style.top  = (this.ty + event.clientY - this.y)+"px";
		}
		return false;
	}
	else
	{
		return true;
	}
},

selectmouse: function(e)
{
	var fobj;
	if(document.getElementById && !document.all)
	{
		fobj=e.target;
	}
	else
	{
		fobj=event.srcElement;
	}

	var topelement ="HTML";

	while (fobj.tagName !== topelement && fobj.id !== tt_DRAGPOPUP.objToDragID)
	{
		if(document.getElementById)
		{
			fobj =fobj.parentNode;
		}
		else
		{
			fobj=parentElement;
		}
	}

	if (fobj.id===tt_DRAGPOPUP.objToDragID)
	{
		this.isdrag = true;
		this.dobj = document.getElementById(tt_DRAGPOPUP.objID);
		this.tx = parseInt(this.dobj.style.left,10);
		this.ty = parseInt(this.dobj.style.top,10);

		if(document.getElementById && !document.all)
		{
			this.x =e.clientX;
			this.y =e.clientY;
		}
		else
		{
			this.x =event.clientX;
			this.y =event.clientY;
		}
		document.onmousemove=tt_DRAGPOPUP.movemouse;
		return false;
	}
	else
	{
		return true;
	}
},

upmouse: function()
{
	this.isdrag=false;
}

};