



// popup ablak   #  #  #  #  #  #  #  #  #  #  #  #  #  #  #  #  #  #  #  #  #  #  #  #  #  #  #  #  #  #  #  #  #  #  #  #  #  #  #  #  #  #  #  #  #  #  #  #  #  #
function popwindow(wid, hei, file)
{
	xpos = (window.getWidth()/2) - (wid/2);
	ypos = (window.getHeight()/2) - (hei/2) - 30;

	specs = "toolbar=0";// + bars;
	specs+= ", width=" + wid;
	specs+= ", height=" + hei;
	specs+= ", left=" + xpos;
	specs+= ", top=" + ypos;
	specs+= ", status=0";// + status;
	specs+= ", scrollbars=0";// + bars;
	specs+= ", resizable=0";// + resiz;
	specs+= ", location=no, menubar=0, directories=0 ";

	window.open(file, "_blank", specs);
}
// END










// altalanos popup dialog (1.2) #  #  #  #  #  #  #  #  #  #  #  #  #  #  #  #  #  #  #  #  #  #  #  #  #  #  #  #  #  #  #  #  #  #  #  #  #  #  #  #  #  #  #  #  #
var PopDialog = new Class
({
	topclose: true,

	Implements: Options,
	options: {
		wid: 402,
		hei: 248,
		useCover: true,
		closeOnCover: false,
		effect: {
			type: 'none', /*fade, drop */
			time: 350
		}
	},



	//
	initialize: function(options)
	{
		this.setOptions(options);

		// dialog elem
		this.dialog = new Element('div', {'class':'popDialog', 'id':'popDialog'})

		// fejlec
		headArea = new Element('div', {'class':'topbar'}).inject(this.dialog);

		// title
		this.headTitle = new Element('span', {'id':'popDialog_title','html':'&#160;'}).inject(headArea);

		// fejlec gomb
		headCloseBtn = new Element('a', {'href':'#', 'id':'popDialog_close_button'}).inject(headArea);
		headCloseBtn.addEvent('click', function(e)
		{
			e.stop();
			this.hide();
		}.bind(this));

		// sep
		new Element('div', {'class':'clear'}).inject(this.dialog);

		// tartalom terulet
		this.contentArea = new Element('span', {'id':'popDialog_content_area'}).inject(this.dialog);
		//this.contentArea = new Element('div', {'styles':{'overflow':'auto'}, 'id':'popDialog_content_area'}).inject(this.dialog);
	},



	// kirakas
	show: function(content, title)
	{
		// ha kell akkor cover is (bezarasra mindketto zarodik)
		if (this.options.useCover)
		{
			// cover
			this.cover = new Element('div', {'id':'fullCover', 'styles':{'width':window.getSize().x,'height':window.getScrollSize().y}});
			if (this.options.closeOnCover)
				this.cover.addEvent('click', function(){this.hide()}.bind(this));
			this.cover.inject($(document.body));
//alert('a');
			// selectek elrejtese ie6 alatt
			if (Browser.Engine.trident4)
			{
				this.selects = document.getElements('select');
				this.selects.each
				(
					function(s)
					{
						s.setStyle('visibility', 'hidden');
					}
				)
			}
		}

		// meret
		this.dialog.setStyle('width', this.options.wid);
		this.dialog.setStyle('height', this.options.hei);

		// kozepre x az ablakhoz
		//var xpos = (window.getSize().x/2)-this.options.wid/2;
		// sitespecifikus: most a contenthez tesszuk
		var xpos = ($('site').getSize().x/2) - ((this.options.wid+2)/2) + 10;
		this.dialog.setStyle('left', xpos);

		// kozepre y az ablakhoz
		ypos = window.getScroll().y + ( (window.getSize().y/2)-this.options.hei/2 );
		this.dialog.setStyle('top', ypos);

		// tartalom es title bele (ha jott tartalom)
		if ( $chk(content) || $chk(title) )
			this.update(content, title);

		// kirakas
		switch (this.options.effect.type)
		{
			// fade effekt
			case 'fade':
			{
				// eloszor nemlatszik
				this.dialog.setStyle('opacity', 0);
				// effektet gyartunk neki
				var dFX = new Fx.Tween(this.dialog, {duration: this.options.effect.time});
				// betesszuk a DOMmba
				this.dialog.inject($(document.body));
				// fade-in
				dFX.start('opacity', 0, 1);
				break;
			}
			// drop effekt
			case 'drop':
			{
				// effektet gyartunk neki
				var dFX = new Fx.Tween(this.dialog, {duration: this.options.effect.time});
				// eloszor nemlatszik
				this.dialog.setStyle('height', 21);
				// betesszuk a DOMmba
				this.dialog.inject($(document.body));
				// fade-in
				dFX.start('height', 1, this.options.hei);
				break;
			}
			// sima
			default:
				this.dialog.inject($(document.body));
		}

		// tartalmi terulet magassag fix
//		chei = this.options.hei-headArea.getSize().y;//headArea.getSize().y;
//		this.contentArea.setStyle('height', chei);
	},
	// END show



	// tartalom valtoztatas
	update: function(content, title)
	{
		// title
		if ($chk(title))
			this.headTitle.set('html', title);

		// tartalom
		if ($chk(content))
			this.contentArea.set('html', content);
	},
	// END show



	// eltuntetes
	hide: function()
	{
		// dialog nemkell
		this.dialog.dispose();

		// cover nemkell
		if (this.cover)
			this.cover.dispose();

		// selectek visszarakasa ie6 alatt
		if (Browser.Engine.trident4)
		{
			this.selects.each
			(
				function(s)
				{
					s.setStyle('visibility', 'visible');
				}
			)
		}
	}
	// END hide

});
// END altalanos popup dialog










// magassag fix megsem kell 
/*
window.addEvent('domready', function()
{
	// a foot a legalso elem, ennek pozicioja szamit
	var footBottom = $('siteFoot').getCoordinates().bottom;

	// ablak alja
	var windowBottom = window.getScrollSize().y;

	// ha nem log ki (az alja nem nagyobb a window aljanal)
	if (footBottom<windowBottom)
	{
		var contentHei = $('siteContent').getSize().y;

		// a siteContent meretet noveljuk annyiva, amennyi a kulonbseg a foot alja es a window alja kozott
		contentHei+= (windowBottom-footBottom);
		$('siteContent').setStyle('height', contentHei);
	}

});
*/









/*flash insert*/
function InsertFlash(data, width, height, transparent, base)
{
	n_width = Number(width);
	n_height = Number(height);
	if(n_width > 0 && n_height > 0)
	{
		var swf = BuiltFlash(data, n_width, n_height, transparent, base);
		document.write(swf);
	}
	return;
}
function BuiltFlash(data, width, height, transparent, base)
{
	var swf = '<object'+
				' type="application/x-shockwave-flash" data="'+data+
				'" width="'+width+
				'" height="'+height+
				'">\n';
	swf += '<param name="movie" value="'+data+'" />\n';	
	if(transparent==true)
		swf += '<param name="wmode" value="transparent" />\n';
	if(base != '')
		swf += '<param name="base" value="'+base+'">\n';		
		swf += '<embed src="'+data+'" pluginspage="http://www.macromedia.com/go/getflashplayer';
	if(base != '')
		swf += '" base="'+base;              
	swf += '" width="'+width+
				'" height="'+height+
				'" type="application/x-shockwave-flash">'+
				'</embed>\n';
	swf += '</object>\n';

				
	return swf;
}
