

    function printfire()
    {
        if (document.createEvent)
        {
            printfire.args = arguments;
            var ev = document.createEvent("Events");
            ev.initEvent("printfire", false, true);
            dispatchEvent(ev);
        }
    }


    if ( document.location.href.indexOf( 'totalcar.hu' ) > -1 ) { document.domain = 'totalcar.hu'; }
    else
    {
        if ( document.location.href.indexOf( 'nepitelet.hu' ) > -1 ) { document.domain = 'nepitelet.hu'; }
        if ( document.location.href.indexOf( 'karotta.hu' ) > -1 ) {}
        else if ( document.location.href.indexOf( 'forum.index.hu' ) <= -1 ) { document.domain = 'index.hu'; }
    }

    var indexadengineui = Math.round( Math.random() * 10000000 );
    var same = indexadengineui;
    var adshost = 'rehs';

    function fix( a ) { a.href = a.href.replace( /NEMSPA_M./g, "" ); return true; }

    function stat( a, b )
    {
        if ( b ) { window.status = a.href.replace( /NEMSPA_M./g, "" ); }
        else { window.status = ""; }
    }

    function Is()
    {
        //browser leválogatás
        agent = navigator.userAgent.toLowerCase();
        this.agent = navigator.userAgent.toLowerCase();
        this.major = parseInt(navigator.appVersion);
        this.minor = parseFloat(navigator.appVersion);
        this.ns = ( ( agent.indexOf( 'mozilla' ) != -1 ) && ( ( agent.indexOf( 'spoofer' ) == -1 ) && ( agent.indexOf( 'compatible' ) == -1 ) ) );
        this.ns4 = ( this.ns && ( this.major <= 4 ) && ( this.minor < 5 ) );
        this.ns6 = ( this.ns && ( this.major >= 5 ) );
        this.opera = ( agent.indexOf( 'opera' ) != -1 );
        this.opera6 = ( this.major >= 6 );
        this.ie = ( agent.indexOf( "msie" ) != -1 );
        this.ie4 = ( this.ie && ( this.major == 4 ) && ( agent.indexOf( "msie 5.0" ) == -1 ) );
        this.ie5 = ( this.ie && ( this.major == 4 ) && ( agent.indexOf( "msie 5" ) != -1 ) );
        this.ie6 = ( this.ie && ( this.major == 4 ) && ( agent.indexOf( "msie 6" ) != -1 ) );
        this.ie7 = ( this.ie && ( this.major == 4 ) && ( agent.indexOf( "msie 7" ) != -1 ) );
        this.iframe = ( this.ie || this.ns6 || this.opera6 );
        this.popup = ( this.ie || this.ns6 || this.opera6 );
        this.layer = ( this.ie || this.ns6 );
        obj = null
        //try { obj = new ActiveXObject("microsoft.XMLHTTP"); } catch(e) {}
        //this.notie = ( obj == null );
        this.notie = !this.ie
    }

    var is = new Is();

    function getCookie(NameOfCookie)
    {
        if (document.cookie.length > 0)
        {
            begin = document.cookie.indexOf( NameOfCookie + "=" );
            if (begin != -1)
            {
                begin += NameOfCookie.length + 1;
                end = document.cookie.indexOf( ";", begin);
                if ( end == -1 ) { end = document.cookie.length; }
                return document.cookie.substring( begin, end );
            } else { return null; }
        }
    }

    function setCookie( NameOfCookie, expiredays )
    {
        var value = getCookie( NameOfCookie );
        if (!value) { value = 0;}
        if ( parseInt(value) <= maxMegjelenes )
        {
            value = parseInt( value ) + 1;
            var ExpireDate = new Date ();
            ExpireDate.setTime( ExpireDate.getTime() + ( expiredays * 24 * 3600 * 1000 ) );
            document.cookie = NameOfCookie + "=" + escape( value ) + ";path=/" + ( ( expiredays == null ) ? "" : "; expires=" + ExpireDate.toGMTString() );
        }
        return value;
    }

    function incCookie( NameOfCookie, expirehours )
    {
        var ExpireDate = new Date ();
        var value = getCookie( NameOfCookie );
        if (!value) { value = 1; } else { value = parseInt( value ) + 1; }
        ExpireDate.setTime( ExpireDate.getTime() + ( expirehours * 3600 * 1000 ) );
        document.cookie = NameOfCookie + "=" + escape( value ) + ( ( expirehours == null ) ? "" : "; expires=" + ExpireDate.toGMTString() );
        return value;
    }

    function webaudit( ucm, uct, where )
    {
        document.write( '<img class="pixel" src="http://audit.median.hu/cgi-bin/track.cgi?uc=' + ucm + '&amp;dc=' + ( ( where == 'top' ) ? 1 : 2 ) + '&amp;ui=' + audit_same + '" alt="" />' );
        if ( uct )
        {
            var params = new Array();
            params.push( 'uc='+ uct );
            params.push( 'sd='+ screen.width +'x'+ screen.height );
            if ( screen.colorDepth != 'undefined' ) { params.push( 'cd='+ screen.colorDepth ); }
            var referrer = encodeURIComponent ? encodeURIComponent( document.referrer ) : escape( document.referrer );
            if ( referrer != '' ) { params.push( 'rp='+ referrer ); }
            params.push( 'ui='+ same );
            document.write( '<img class="pixel" src="http://pixel.' + document.domain + '/12g?' + params.join( '&amp;' ) + '" alt="" />' );
        }
    }

    function adocean( name, margin_top, margin_bottom )
    {
        document.write( '<div style="margin-top: ' + margin_top + 'px; margin-bottom: ' + margin_bottom + 'px;" id="' + name + '_container">' );
        document.write( '<div id="' + name + '"></div><script type="text/javascript">ado.slave(\'' + name + '\', {myMaster: \'' + bannerCode + '\' });</script>' );
        document.write( '</div>' );
    }

    function placeadocean( name, margin_top, margin_bottom )
    {
        document.write( '<div style="margin-top: ' + margin_top + 'px; margin-bottom: ' + margin_bottom + 'px;" id="' + name + '_container">' );
        document.write( '<div id="' + name + '"></div><script type="text/javascript">ado.placement( { id: \'' + name + '\', server: \'indexhu.adocean.pl\' });</script>' );
        document.write( '</div>' );
    }

    function banner( ade_lc, bhely_id, width, height, margin_top, margin_bottom, co )
    {
        if ( co == undefined ) { co = 1; }
        document.write( '<div style="margin-top: ' + margin_top + 'px; margin-bottom: ' + margin_bottom + 'px;">' );
        if ( is.iframe )
        {
            document.write( '<iframe name="indexadengineframe' + same + '" src="http://' + adshost + '.' + document.domain + '/ad?lc=' + ade_lc + '&amp;ui=' + indexadengineui + '&amp;co=' + co + '&amp;cn=1&amp;do=' + document.domain + '&amp;ho=' + width + '&amp;ve=' + height + '" width="' + width + '" vspace="0" hspace="0" marginheight="0" marginwidth="0" height="' + height + '" frameborder="0" scrolling="no"></iframe>' );
        } else {
            document.write( '<a target="_top" href="http://' + adshost + '.index.hu/rd?lc=' + ade_lc + '&ui=' + indexadengineui + '"><img src="http://' + adshost + '.index.hu/ad?lc=' + ade_lc + '&amp;ui=' + indexadengineui + '" border="0" height="' + height + '" width="' + width + '"></a>' );
        }
        document.write( '</div>' );
    }

    function gallery( o )
    {
        window.open( o.href + '&currpic=' + o.childNodes[0].src, 'TotalCarKepek', 'scrollbars=no,resizable=yes,menu=no,width=900,height=700' );
        return false;
    }

    function gallerynu( o )
    {
		kepu = o.childNodes[0].src;
		var kep = kepu.split("/");
        window.open( o.href + '?currpic=' + kep[kep.length-1], 'TotalCarKepek', 'scrollbars=no,resizable=yes,menu=no,width=900,height=700' );
        return false;
    }


    function huge( o )
    {
        window.open( o.href + '&currpic=' + o.childNodes[0].src, 'TotalCarKepek', 'scrollbars=no,resizable=no,menu=no,width=1024,height=768' );
        return false;
    }

    function select_redirect( o )
    {
        if ( o.value != '' ) { document.location.href = o.value; }
    }

    suckerfish4prez = function()
    {
        text_node = document.getElementById("text");
        if ( text_node != null )
        {
            var sfEls = text_node.getElementsByTagName("a");
            for (var i=0; i<sfEls.length; i++)
            {
                sfEls[i].onmouseover=function() { this.className+=" hover"; }
                sfEls[i].onmouseout=function() { this.className=this.className.replace(new RegExp(" hover\\b"), ""); }
            }
        }
    }

    if (window.attachEvent) window.attachEvent("onload", suckerfish4prez);

    function getXMLHTTP()
    {
        ver = navigator.appVersion;
        app = navigator.appName;
        isNS = Boolean(navigator.productSub)
        isIE = (ver.indexOf("MSIE 5") != -1 || ver.indexOf("MSIE 6") != -1) ? 1 : 0;
        obj = null;

        try { obj = new ActiveXObject("microsoft.XMLHTTP"); }
        catch(e) { try { obj = new XMLHttpRequest(); } catch(e) {} }

        return obj;
    }

    function load( destid, url, host )
    {
        xmlhttp = new xmlRequest();
        xmlhttp.getURL( url, destid, host );
    }

    function xmlRequest()
    {
        if ( !this.http ) { this.http = getXMLHTTP(); this.xmlhttp = 1; }
        if ( !this.http )
        {
            this.http = document.createElement( 'iframe' );
            this.http.style.width = 0;
            this.http.style.height = 0;
            this.http.style.visibility = 'hidden';
            document.getElementsByTagName( "body" ).item( 0 ).appendChild( this.http );
            this.xmlhttp = 0;
        }

        this.getURL = function getURL( url, destid, host )
        {
            this.destid = destid;
            this.prepare( url, host );
            this.send();
        }

        this.prepare = function prepare( url, host )
        {
            this.url = url;
            if ( this.xmlhttp )
            {
                var myRequest = this;
                this.url = 'http://' + ( host ) + this.url;
                this.http.open( "GET", this.url, true );
                this.http.onreadystatechange = function ()
                {
                    if (myRequest.http.readyState === 4)
                    {
                        document.getElementById( myRequest.destid ).innerHTML = myRequest.http.responseText;
                    }
                }
            }
            else { this.http.setAttribute( 'name', this.destid ); }
        }

        this.send = function send()
        {
            if ( this.xmlhttp ) { this.http.send( '' ); }
            else { this.http.src = this.url + '&destid=' + this.destid; this.http.style.display = 'none'; }
        }
    }

    function receive( destid, data )
    {
        document.getElementById( destid ).innerHTML = data;
    }



    if (window.attachEvent) window.attachEvent("onload", suckerfish4prez);

    var theTop;
    var sticky;
    var bannerheight = 50;

    function movesticky()
    {
        if ( window.pageYOffset != undefined ) { scrollpos = window.pageYOffset; }
        else if ( document.compatMode == 'BackCompat' ) { scrollpos = document.body.scrollTop; }
        else { scrollpos = document.documentElement.scrollTop; }
        if ( sticky.style.position == "absolute" )
        {
            topa = ( window.innerHeight ? window.innerHeight : document.documentElement.clientHeight ) - bannerheight + scrollpos;
            if ( window.innerHeight && window.innerWidth < 970 ) { topa = topa - 16; }
            sticky.style.top = topa  + 'px';
        }
        else
        {
            topa = ( (window.innerHeight) ? window.innerHeight : document.documentElement.clientHeight ) - bannerheight;
            if ( window.innerHeight && window.innerWidth < 970 ) { topa = topa - 16; }
            sticky.style.top = topa + 'px';
        }
        temp = setTimeout('movesticky()', 0);
    }

    function flashbanner( ade_lc, id, width, height, ver )
    {
        if ( getFlashVersion() >= ver )
        {
            document.getElementById( id ).innerHTML = '';
            banner( ade_lc, 0, width, height, 0, 0 );
        }
    }

    function getFlashVersion() {
        var flashversion = 0;
        if (navigator.plugins && navigator.mimeTypes.length) {
            var x = navigator.plugins["Shockwave Flash"];
            if(x && x.description) {
                var y = x.description;
                   flashversion = y.charAt(y.indexOf('.')-1);
            }
        } else {
            result = false;
            for(var i = 15; i >= 3 && result != true; i--){
                   execScript('on error resume next: result = IsObject(CreateObject("ShockwaveFlash.ShockwaveFlash.'+i+'"))','VBScript');
                   flashversion = i;
               }
        }
        return flashversion;
    }

    function popup( popname, lc, maxmegj, expirehours )
    {
        if ( expirehours == undefined ) { expirehours = 24; }
        if ( ( is.popup ) && ( incCookie( popname, expirehours ) <= maxmegj ) )
        {
            document.write('<iframe name="indexadengineframe" src="http://' + adshost + '.index.hu/ad?lc=' + lc + '&amp;ui=' + indexadengineui + '&amp;co=1" width="1" vspace="0" hspace="0" marginheight="0" marginwidth="0" height="1" frameborder="0" scrolling="no"></iframe>');
        }
    }

    function popunder( popname, lc, maxmegj, expirehours )
    {
        if ( expirehours == undefined ) { expirehours = 24; }
        if ( ( is.popup ) && ( incCookie( popname, expirehours ) <= maxmegj ) )
        {
            if (!window.name) { window.name = "pupuplaunchwindow"; }
            windowname = window.name;
            document.write('<iframe name="indexadengineframe" src="http://' + adshost + '.index.hu/ad?lc=' + lc + '&amp;ui=' + indexadengineui + '&amp;co=1" width="1" vspace="0" hspace="0" marginheight="0" marginwidth="0" height="1" frameborder="0" scrolling="no"></iframe>');
            setTimeout( "focus(windowname)", 800 );
        }
    }

    function layer( layername, lc, maxmegj, expirehours )
    {
        if ( expirehours == undefined ) { expirehours = 24; }
        if ( ( is.layer ) && ( incCookie( layername, expirehours ) <= maxmegj ) )
        {
            document.write( '<scr' + 'ipt type="text/javascript" src="http://' + adshost + '.index.hu/get?lc=' + lc + '&dl=1&dt=co"></scr' + 'ipt>' );
        }
    }

    function display_layer( layers )
    {
        var shown = 0;
        for( i = 0; i < layers.length; i++ )
        {
            layer = layers[ i ]; swf_url = layer[0]; click_url = layer[1]; swf_width = layer[2]; swf_height = layer[3]; swf_length = layer[4]; swf_top = layer[5]; swf_left = layer[6]; swf_zindex = layer[7]; swf_id = layer[8]; maxmegj = layer[9]; expirehours = layer[10]; required_flash_version = layer[11]; transparent = layer[12]; custom = layer[13];
            if ( !shown )
            {
                if ( expirehours == undefined ) { expirehours = 24; }
                if ( maxmegj == undefined ) { maxmegj = 1; }
                if ( ( is.layer && ( !transparent || is.ie ) ) && ( incCookie( swf_id, expirehours ) <= maxmegj ) )
                {
                    if ( !isNaN( swf_url ) && !custom ) { swf_url = 'http://' + adshost + '.' + document.domain + '/get?ad=' + swf_url + '&dl=1&dt=swf&di=1'; }
                    if ( !isNaN( click_url ) ) { click_url = 'http://' + adshost + '.' + document.domain + '/rd?ad=' + click_url; }
                    if ( required_flash_version == undefined ) { required_flash_version = 5; }
                    if ( getFlashVersion() >= required_flash_version )
                    {
                        document.write( '<div id="' + swf_id + '_container" style="position: absolute; left: ' + swf_left + 'px; top:' + swf_top + 'px; z-index: ' + swf_zindex + '">' );
                        if ( custom )
                        {
                            document.write( '<script type="text/javascript" src="' + 'http://' + adshost + '.' + document.domain + '/get?ad=' + swf_url + '&dl=1&dt=co&di=1' + '"></script>');
                        }
                        else
                        {
                            jel = ( ( swf_url.indexOf( '?' ) != -1 ) ? '&' : '?' );
                            document.write( '<script type="text/javascript">function ' + swf_id + '_DoCommand( command, args ) { real_DoCommand( command, "' + swf_id + '", "' + click_url + '" ); }</script>');
                            document.write( '<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=4,0,0,0" width="' + swf_width + '" height="' + swf_height + '" id="' + swf_id + '">' );
                            document.write( '<param name="movie" value="' + swf_url + jel + 'clickTag=' + escape( click_url ) + '" />' );
                            document.write( '<param name="quality" value="autohigh" />' );
                            document.write( '<param name="wmode" value="transparent" />' );
                            document.write( '<param name="swLiveConnect" value="true" />' );
                            document.write( '<embed swLiveConnect="true" src="' + swf_url + jel + 'clickTag=' + escape( click_url ) + '" quality="autohigh" width="' + swf_width + '" height="' + swf_height + '" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash" name="' + swf_id + '">' );
                            document.write( '</embed>' );
                            document.write( '</object>');
                        }
                        document.write( '</div>');
                        setTimeout( "onLayerFinishedPlaying( '" + swf_id + "' )", swf_length * 1000 );
                        shown = 1;
                    }
                }
            }
        }
    }

    function sh( o )
    {
        o.style.display = o.style.display == 'none' ? '' : 'none';
    }


    var menuTimeout = 0;

    function onLayerFinishedPlaying( swf_id ) { document.getElementById( swf_id   + '_container' ).style.display = 'none'; }
    function real_DoCommand( command, id, click_url )
    {
        switch ( command )
        {
            case 'hide' : document.getElementById( id + '_container' ).style.visibility = 'hidden'; break;
            case 'click' : window.open( click_url ); break;
        }
    }

    function display_menu( elementname, aktiva )
    {
        tcmenu_ul = document.getElementById("tcmenu");
        almenu_div = document.getElementById("almenu");
        if ( aktiva != null || aktiva == 'cimlap' )
        {
          document.getElementById( 'ma'+ elementname ).className = '';
          document.getElementById( 'am'+ elementname ).style.display = 'none';
          if ( aktiva != 'cimlap' )
          {	if(document.getElementById( 'am'+ elementname ).style != undefined){
            	document.getElementById( 'am'+ aktiva ).style.display = 'block';
          	}
            document.getElementById( 'ma'+ aktiva ).className = 'active';
          }
        }
        else
        {
          if ( menuTimeout )
          {
            clearTimeout( menuTimeout );
          }
        }

        if ( ( tcmenu_ul != null && aktiva == null ) || ( tcmenu_ul != null && aktiva == '' ) )
        {
            var menu_items = tcmenu_ul.getElementsByTagName("a");
            var almenu_items = almenu_div.getElementsByTagName("a");
            for (var i=0; i<menu_items.length; i++)
            {
              if ( elementname != menu_items[i].name )
              {
                document.getElementById( 'ma'+ menu_items[i].name ).className = '';
                document.getElementById( 'am'+ menu_items[i].name ).style.display = 'none';
              }
              else
              {
                document.getElementById( 'am'+ menu_items[i].name ).style.display = 'block';
                document.getElementById( 'ma'+ menu_items[i].name ).className = 'active';
              }
            }
        }
    }

    function confirmDelete( delUrl ) {
      if (confirm("Biztos törlöd?")) {
        window.open( delUrl,'KepekDel', 'scrollbars=yes,resizable=yes,menu=no,width=640,height=480');
        setTimeout('window.location.reload()',1000);
      }
      else
      {
      return false;
      }
    }

    function diplayActiveControl( url, w, h )
    {
        document.write( '<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=4,0,0,0" width="' + w + '" height="' + h + '" id="multilink">' );
        document.write( '<param name="movie" value="' + url + '">' );
        document.write( '<param name="quality" value="autohigh">' );
        document.write( '<embed src="' + url + '" quality="autohigh" width="' + w + '" height="' + h + '" type="application/x-shockwave-flash" pluginspace="http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash" name="multilink">' );
        document.write( '</embed>' );
        document.write( '</object>' );
    }

	WEBAUDIT=function() {

	  this.WACID=null;
	  this.WACIDName="WACID";


	  this.getCookie=function(name)  {
	    var nameEQ = name + "=";
	    var ca = document.cookie.split(';');
	    for(var i=0;i < ca.length;i++)
	    {
	            var c = ca[i];
	            while (c.charAt(0)==' ') c = c.substring(1,c.length);
	            if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length,c.length);
	    }
	    return null;
	  }

	  this.setCookie=function(name,value,topDomain) {
	    var date = new Date(2020,12,31,23,59,59);
	    var expires = "; expires="+date.toGMTString();
	    document.cookie = name+"="+value+expires+"; path=/; domain=" + topDomain;
	  }

	  this.generateID=function(splitter) {
	    var sp=(splitter) ? splitter : 'A';
	    var now=new Date();
	    return Date.parse(now.toGMTString()) + sp + Math.floor(Math.random()*1000000000);
	  }

	  this.getTopDomain=function(fullDomain) {
	    var darabok=fullDomain.split('.');
	    return darabok[(darabok.length-2)] + '.' + darabok[(darabok.length-1)];
	  }

	  this.getDomain=function(url) {
	    var urlDarabok=url.split('/');
	    return urlDarabok[2];
	  }

	  this.WACID=this.getCookie(this.WACIDName);
	}

    var wa=new WEBAUDIT();
    var felbontas = "";
    var audit_same =  Math.floor(Math.random()*1000000);
    var wa_url = "@u=";
    var wa_referrer = "@r=";

    if(wa.WACID==null)
    {
      wa.WACID=wa.generateID('A');
      wa.setCookie(wa.WACIDName,wa.WACID,wa.getTopDomain(wa.getDomain(document.URL)));
    }

    audit_same = audit_same + "@c=" + wa.WACID;
    if(screen) felbontas='@s='+screen.width+'x'+screen.height;
    if(document.referrer) wa_referrer=wa_referrer+document.referrer;
    if(document.URL) wa_url=wa_url+document.URL;
    audit_same = audit_same + felbontas + wa_url + wa_referrer;

/**
 * @author Ryan Johnson <ryan@livepipe.net>
 * @copyright 2007 LivePipe LLC
 * @package Control.Modal
 * @license MIT
 * @url http://livepipe.net/projects/control_modal/
 * @version 1.2.11
 */

if(typeof(Class) != "undefined"){ // van-e prototype
if(typeof(Control) == "undefined")
	Control = {};
  Control.Modal = Class.create();
  Object.extend(Control.Modal,{
	loaded: false,
	responders: $A([]),
	overlay: false,
	container: false,
	current: false,
	ie: false,
	targetRegexp: /#(.+)$/,
	imgRegexp: /\.(jpe?g|gif|png|tiff?)$/,
	overlayStyles: {
		position: 'absolute',
		top: 0,
		left: 0,
		zIndex: 9998
	},
	load: function(){
		if(!Control.Modal.loaded){
			Control.Modal.loaded = true;
			Control.Modal.ie = (navigator.appName == 'Microsoft Internet Explorer');
			Control.Modal.overlay = $(document.createElement('div'));
			Control.Modal.overlay.id = 'modal_overlay';
			Object.extend(Control.Modal.overlay.style,Control.Modal.overlayStyles);
			Control.Modal.overlay.hide();
			Control.Modal.container = $(document.createElement('div'));
			Control.Modal.container.id = 'modal_container';
			Control.Modal.container.hide();
			document.getElementsByTagName('body')[0].appendChild(Control.Modal.overlay);
			document.getElementsByTagName('body')[0].appendChild(Control.Modal.container);
		}
	},
	open: function(contents,options){
		m = new Control.Modal(false,$H({contents:contents}).merge(options));
		m.open();
		return m;
	},
	close: function(){
		if(Control.Modal.current)
			Control.Modal.current.close();
	},
	attachEvents: function(){
		Event.observe(window,'load',Control.Modal.load);
		Event.observe(window,'unload',Event.unloadCache,false);
	},
	center: function(){
		element = this.container;
		if(!element._centered){
			this.container.setStyle({
				position: 'absolute'
			});
			this.container._centered = true;
		}
		dimensions = Control.Modal.container.getDimensions();
		Position.prepare();
		offset_left = (Position.deltaX + Math.floor((Control.Modal.getWindowWidth() - dimensions.width) / 2));
		offset_top = (Position.deltaY + Math.floor((Control.Modal.getWindowHeight() - dimensions.height) / 2));
		modal_dimensions = Control.Modal.container.getDimensions();
		Control.Modal.container.setStyle({
			top: ((modal_dimensions.height <= Control.Modal.getWindowHeight()) ? ((offset_top != null && offset_top > 0) ? offset_top : '0') + 'px' : 0),
			left: ((modal_dimensions.width <= Control.Modal.getWindowWidth()) ? ((offset_left != null && offset_left > 0) ? offset_left : '0') + 'px' : 0)
		});
	},
	getWindowWidth: function(){
		return (self.innerWidth || document.documentElement.clientWidth || document.body.clientWidth || 0);
	},
	getWindowHeight: function(){
		return (self.innerHeight || document.documentElement.clientHeight || document.body.clientHeight || 0);
	},
	getDocumentWidth: function(){
		return Math.max(document.body.scrollWidth,Control.Modal.getWindowWidth());
	},
	getDocumentHeight: function(){
		return Math.max(document.body.scrollHeight,Control.Modal.getWindowHeight());
	},
	onKeyDown: function(event){
		if(event.keyCode == Event.KEY_ESC)
			Control.Modal.close();
	},
	addResponder: function(responder){
		Control.Modal.responders.push(responder);
	},
	removeResponder: function(responder){
		Control.Modal.responders = Control.Modal.responders.without(responder);
	},
	//from Scriptaculous
	setOpacity: function(element,value){
		element= $(element);
		if(value == 1){
			Element.setStyle(element,{
				opacity: (/Gecko/.test(navigator.userAgent) && !/Konqueror|Safari|KHTML/.test(navigator.userAgent)) ? 0.999999 : null
			});
		if(/MSIE/.test(navigator.userAgent))
			Element.setStyle(element,{
				filter: Element.getStyle(element,'filter').replace(/alpha\([^\)]*\)/gi,'')
			});
		}else{
			if(value < 0.00001) value = 0;
			Element.setStyle(element, {opacity: value});
			if(/MSIE/.test(navigator.userAgent))
				Element.setStyle(element,{
					filter: Element.getStyle(element,'filter').replace(/alpha\([^\)]*\)/gi,'') + 'alpha(opacity='+value*100+')'
				});
		}
	}
});
Object.extend(Control.Modal.prototype,{
	mode: '',
	html: false,
	href: '',
	element: false,
	src: false,
	imageLoaded: false,
	initialize: function(element,options){
		this.element = $(element);
		this.options = $H({
			beforeOpen: Prototype.emptyFunction,
			afterOpen: Prototype.emptyFunction,
			beforeClose: Prototype.emptyFunction,
			afterClose: Prototype.emptyFunction,
			beforeLoad: Prototype.emptyFunction,
			onLoad: Prototype.emptyFunction,
			onFailure: Prototype.emptyFunction,
			onException: Prototype.emptyFunction,
			afterLoad: Prototype.emptyFunction,
			beforeImageLoad: Prototype.emptyFunction,
			afterImageLoad: Prototype.emptyFunction,
			contents: false,
			image: false,
			imageTemplate: new Template('<img src="#{src}" id="#{id}"/>'),
			imageAutoDisplay: true,
			imageCloseOnClick: true,
			hover: false,
			iframe: false,
			iframeTemplate: new Template('<iframe src="#{href}" width="100%" height="100%" frameborder="0" id="#{id}"></iframe>'),
			evalScripts: true, //for Ajax, define here instead of in requestOptions
			requestOptions: {}, //for Ajax.Request
			overlayDisplay: true,
			overlayClassName: '',
			overlayCloseOnClick: true,
			containerClassName: '',
			opacity: 0.3,
			zIndex: 9998,
			width: null,
			height: null,
			offsetLeft: 0, //for use with 'relative'
			offsetTop: 0, //for use with 'relative'
			position: 'absolute' //'absolute' or 'relative'
		});
		if(options)
			for(o in options)
				this.options[o] = options[o];
		target_match = false;
		image_match = false;
		if(this.element){
			target_match = Control.Modal.targetRegexp.exec(this.element.href);
			image_match = Control.Modal.imgRegexp.exec(this.element.href);
		}
		if(this.options.contents){
			this.mode = 'contents';
		}else if(this.options.image || image_match){
			this.mode = 'image';
			this.src = this.element.href;
		}else if(target_match){
			this.mode = 'named';
			x = $(target_match[1]);
			this.html = x.innerHTML;
			x.remove();
			this.href = target_match[1];
		}else{
			this.mode = (this.options.iframe) ? 'iframe' : 'ajax';
			this.href = this.element.href;
		}
		if(this.element){
			if(this.options.hover){
				this.element.observe('mouseover',this.open.bind(this));
				this.element.observe('mouseout',this.close.bind(this));
			}else{
				this.element.onclick = function(){
					this.open();
					return false;
				}.bindAsEventListener(this);
			}
		}
		targets = Control.Modal.targetRegexp.exec(window.location);
		this.position = function(){
			Control.Modal.overlay.setStyle({
				height: Control.Modal.getDocumentHeight() + 'px',
				width: Control.Modal.getDocumentWidth() + 'px'
			});
			if(this.options.position == 'absolute')
				Control.Modal.center();
			else{
				yx = Position.cumulativeOffset(this.element);
				Control.Modal.container.setStyle({
					position: 'absolute',
					top: yx[1] + this.options.offsetTop,
					left: yx[0] + this.options.offsetLeft
				});
			}
		}.bind(this);
		if(this.mode == 'image'){
			this.afterImageLoad = function(){
				if(this.options.imageAutoDisplay && !window.opera)
					$('modal_image').show();
				this.position();
				this.notifyResponders('afterImageLoad');
			}.bind(this);
		}
		if(this.mode == 'named' && targets && targets[1] && targets[1] == this.href)
			this.open();
	},
	open: function(){
		if(!this.options.hover)
			Event.observe($(document.getElementsByTagName('body')[0]),'keydown',Control.Modal.onKeyDown);
		Control.Modal.current = this;
		if(this.notifyResponders('beforeOpen') === false)
			return;
		if(!this.options.hover){
			Control.Modal.overlay.setStyle({
				zIndex: this.options.zIndex
			});
			Control.Modal.setOpacity(Control.Modal.overlay,this.options.opacity);
		}
		Control.Modal.container.setStyle({
			zIndex: this.options.zIndex + 1,
			width: (this.options.width ? this.options.width + 'px' : ''),
			height: (this.options.height ? this.options.height + 'px' : '')
		});
		if(Control.Modal.ie && !this.options.hover){
			$A(document.getElementsByTagName('select')).each(function(select){
				select.style.visibility = 'hidden';
			});
		}
		Control.Modal.overlay.addClassName(this.options.overlayClassName);
		Control.Modal.container.addClassName(this.options.containerClassName);
		switch(this.mode){
			case 'image':
				this.imageLoaded = false;
				this.notifyResponders('beforeImageLoad');
				this.update(this.options.imageTemplate.evaluate({src: this.src, id: 'modal_image'}));
				this.position();
				if(this.options.imageAutoDisplay && !window.opera)
					$('modal_image').hide();
				if(this.options.imageCloseOnClick)
					$('modal_image').observe('click',Control.Modal.close);
				$('modal_image').observe('load',this.afterImageLoad);
				$('modal_image').observe('readystatechange',this.afterImageLoad);
				break;
			case 'ajax':
				this.notifyResponders('beforeLoad');
				options = $H({
					method: 'get',
					onSuccess: function(request){
						this.notifyResponders('onLoad',request);
						this.update(request.responseText);
						if(this.options.evalScripts)
							request.responseText.evalScripts();
						this.notifyResponders('afterLoad',request);
					}.bind(this),
					onFailure: this.options.onFailure,
					onException: this.options.onException
				});
				if(this.options.requestOptions)
					for(o in this.options.requestOptions)
						options[o] = this.options.requestOptions[o];
				new Ajax.Request(this.href + '?plain=1&nocom=1',options);
				break;
			case 'iframe':
				this.update(this.options.iframeTemplate.evaluate({href: this.href, id: 'modal_iframe'}));
				this.position();
				break;
			case 'contents':
				this.update((typeof(this.options.contents) == 'function' ? this.options.contents.bind(this)() : this.options.contents));
				break;
			case 'named':
				this.update(this.html);
				break;
		}
		if(!this.options.hover){
			if(this.options.overlayCloseOnClick && this.options.overlayDisplay)
				Control.Modal.overlay.observe('click',Control.Modal.close);
			if(this.options.overlayDisplay)
				Control.Modal.overlay.show();
		}
		this.options.afterOpen();
	},
	update: function(html){
		Control.Modal.container.update(html);
		this.position();
		Control.Modal.container.show();
		if(this.options.position == 'absolute'){
			Event.stopObserving(window,'resize',this.position,false);
			Event.stopObserving(window,'scroll',this.position,false);
			Event.observe(window,'resize',this.position,false);
			Event.observe(window,'scroll',this.position,false);
		}
	},
	close: function(){
		response = this.notifyResponders('beforeClose');
		if(response == false && response != null)
			return;
		if(this.mode == 'image'){
			if(this.options.imageCloseOnClick)
				$('modal_image').stopObserving('click',Control.Modal.close);
			$('modal_image').stopObserving('load',this.afterImageLoad);
			$('modal_image').stopObserving('readystatechange',this.afterImageLoad);
		}
		if(Control.Modal.ie && !this.options.hover){
			$A(document.getElementsByTagName('select')).each(function(select){
				select.style.visibility = 'visible';
			});
		}
		if(!this.options.hover)
			Event.stopObserving(window,'keyup',Control.Modal.onKeyDown);
		Control.Modal.current = false;
		Control.Modal.overlay.removeClassName(this.options.overlayClassName);
		Control.Modal.container.removeClassName(this.options.containerClassName);
		Event.stopObserving(window,'resize',this.position,false);
		Event.stopObserving(window,'scroll',this.position,false);
		if(!this.options.hover){
			if(this.options.overlayCloseOnClick && this.options.overlayDisplay)
				Control.Modal.overlay.stopObserving('click',Control.Modal.close);
			if(this.options.overlayDisplay)
				Control.Modal.overlay.hide();
		}
		Control.Modal.container.update('');
		Control.Modal.container.hide();
		this.notifyResponders('afterClose');
	},
	notifyResponders: function(event_name,argument){
		Control.Modal.responders.each(function(responder){
			if(responder[event_name])
				responder[event_name](argument);
		});
		response = this.options[event_name](argument);
		return response;
	}
});
Control.Modal.attachEvents();
} // van-e prototype

  if(typeof(Class) != "undefined")
  { // van-e prototype

    window.onload = function initsticky()
    {
        /*if ( $('szotar_popup') != null ) {
            new Control.Modal( $('szotar_popup'), { overlayCloseOnClick: false,
            	iframe: true,
            	iframeTemplate: new Template('<iframe src="#{href}" scrolling="no" width="100%" height="100%" frameborder="0" id="#{id}"></iframe>') } );
        }*/

		document.getElementsByClassName('modal').each(function(link){
	    	new Control.Modal( link, { overlayCloseOnClick: true,
    	    	iframe: true,
        	iframeTemplate: new Template('<iframe src="#{href}" scrolling="no" width="100%" height="100%" frameborder="0" id="#{id}"></iframe>') } );
    		});

    		document.getElementsByClassName('modpopup').each(
    		function(link){
    		var mw=600;
		var mh=500;
		if(link.id != undefined){
		    s = link.id.split('_');
		    if(s[0] != null) mw = s[0];
		    if(s[1] != null) mh = s[1];
		}
        	new Control.Modal( link, { overlayCloseOnClick: true,
            	iframe: true,
            	width: mw,
            	height: mh,
            	iframeTemplate: new Template('<iframe src="#{href}" scrolling="no" width="100%" height="100%" frameborder="0" id="#{id}"></iframe>') } );
    		});

        sticky = document.getElementById('sticky');
        if ( sticky != null )
        {
            topa = ( (window.innerHeight) ? window.innerHeight : document.documentElement.clientHeight ) - bannerheight;
            if ( window.innerHeight && window.innerWidth < 970 ) { topa = topa - 16; }
            sticky.style.top = topa  + 'px';
            sticky.style.display = '';
            temp = setTimeout('movesticky()', 10);
        }


    }
  }

function openFull( vurl )
{
    var url = "http://mf.index.hu/player_ng.swf?file=" + vurl + "&mode=big";
    var fs = window.open( url , "FullScreenVideo", "toolbar=no,width=" + screen.availWidth  + ",height=" + screen.availHeight + ",status=no,resizable=yes,fullscreen=yes,scrollbars=no");
    fs.focus();
}

function openFull169( vurl )
{
    var url = "http://mf.index.hu/player_ng_169.swf?file=" + vurl + "&mode=big";
    var fs = window.open( url , "FullScreenVideo", "toolbar=no,width=" + screen.availWidth  + ",height=" + screen.availHeight + ",status=no,resizable=yes,fullscreen=yes,scrollbars=no");
    fs.focus();
}

function textbanner( ade_lc, bhely_id, width, height, margin_top, margin_bottom, co )
{
    document.write( '<scr'+'ipt type="text/javascript" src="http://' + adshost + '.' + document.domain + '/get?dt=co&lc=' + ade_lc + '&ui=' + indexadengineui + '&co=1&cn=1&do&dl=1"></scr'+'ipt>' );
}
