
    var indexadengineui = Math.round( Math.random() * 10000000 );
    var same = indexadengineui;
    var adshost = 'rehs';
    var refresh_period = 600000;

    var scrolltimer = 0;

    var homelink_path = null;
    var indafoto_pic = 0;
    var indafoto_speed = 4;

    function getHomeLinkPath()
    {
        if( !homelink_path )
        {
            homelink_path = $('homelink').href
        }
        return homelink_path;
    }

    function scroll( p, o, dir )
    {
        var tmp = Math.max( -document.getElementById( o ).scrollHeight + document.getElementById( p ).clientHeight, Math.min( ( parseInt( document.getElementById( o ).style.top ) + ( 2 * dir ) ), 0 ) );
        if ( isNaN( tmp ) ) { tmp = 0; }          
        document.getElementById( o ).style.top =  tmp + 'px';
        what = ( dir > 0 ? 'scrollUp( \'' + p + '\', \'' + o + '\' )' : 'scrollDown( \'' + p + '\', \'' + o + '\' )' );
        scrolltimer = setTimeout( what, 10 );
        return false;
    }

    function scroll_v( p, o, dir )
    {
        if( indafoto_pic == 0 )
        {
            for( i in document.getElementById( 'ml_kep_container_ul' ).childNodes )
            {
                if( document.getElementById( 'ml_kep_container_ul' ).childNodes[ i ].tagName == "LI" ) indafoto_pic += ( document.getElementById( 'ml_kep_container_ul' ).childNodes[ i ].clientWidth + 10 );
            }
            indafoto_pic = indafoto_pic > 0 ? indafoto_pic - 9 : indafoto_pic;
        }
        var tmp = Math.max( document.getElementById( p ).clientWidth - indafoto_pic, Math.min( ( parseInt( document.getElementById( o ).style.left ) + ( indafoto_speed * dir ) ), 0 ) );
        if ( isNaN( tmp ) ) { tmp = 0; }
        document.getElementById( o ).style.left = tmp + 'px';
        if( tmp < 0 && $( 'ml_kep_navi_prev' ).style.display == 'none' ) $( 'ml_kep_navi_prev' ).appear( { duration: 0.7 } );
        if( tmp == 0 && $( 'ml_kep_navi_prev' ).style.display != 'none' ) $( 'ml_kep_navi_prev' ).fade( { duration: 0.7 } );
        if( tmp == document.getElementById( p ).clientWidth - indafoto_pic && $( 'ml_kep_navi_next' ).style.display != 'none' ) $( 'ml_kep_navi_next' ).fade( { duration: 0.7 } );
        if( tmp > document.getElementById( p ).clientWidth - indafoto_pic && $( 'ml_kep_navi_next' ).style.display == 'none' ) $( 'ml_kep_navi_next' ).appear( { duration: 0.7 } );
        what = ( dir > 0 ? 'scroll_left( \'' + p + '\', \'' + o + '\' )' : 'scroll_right( \'' + p + '\', \'' + o + '\' )' );
        scrolltimer = setTimeout( what, 5 );
        return false;
    }

    function scrollUp( p, o ) { return scroll( p, o, 1 ); }
    function scrollDown( p, o ) { return scroll( p, o, -1 ); }

    function scroll_left( p, o ) { return scroll_v( p, o, 1 ); }
    function scroll_right( p, o ) { return scroll_v( p, o, -1 ); }

    function clearScroll() { window.clearTimeout( scrolltimer ); }


    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, "" ); a.href = a.href.replace( /NEMSPA_M./g, "" ); return true; }
        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 );
    }

    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 createCookie(name,value,days) {
            if (days) {
                var date = new Date();
                date.setTime(date.getTime()-(days*24*60*60*1000));
                var expires = "; expires="+date.toGMTString();
            }
            else var expires = "";
            document.cookie = name+"="+value+expires+"; path=/";
        }

        function readCookie(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;
        }

        function eraseCookie(name) {
            createCookie(name,"",-1);
        }

    function webaudit( ucm, uct, where, name, auditid )
    {
        document.write( '<img' + ( ( auditid != undefined ) ? ' id="' + auditid + '"' : '' ) + ' 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 class="adocean" 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 textadocean( 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; }
        if ( is.iframe )
        {
            rnd = "uniq" + Math.round( Math.random() * 10000000 );
            document.write( '<div style="margin-top: ' + margin_top + 'px; margin-bottom: ' + margin_bottom + 'px;" id="' + rnd + '">' );
            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>' );
            document.write( '<scr'+'ipt type="text/javascript">cont = document.getElementById( "' + rnd + '" ).parentNode.parentNode; if ( cont.id == "microsite" ) { cont.style.width = "' + width + 'px"; cont.style.marginLeft = "' + ( 220 - width / 2 ) + 'px"; }</scr'+'ipt>' );
            document.write( '</div>' );
        } else {
            document.write( '<div style="margin-top: ' + margin_top + 'px; margin-bottom: ' + margin_bottom + 'px;">' );
            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 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>' );
    }

    function teszt_banner( ade_lc, bhely_id, width, height, margin_top, margin_bottom, co )
    {
        if ( co == undefined ) { co = 1; }
        if ( is.iframe )
        {
            rnd = "uniq" + Math.round( Math.random() * 10000000 );
            document.write( '<div style="margin-top: ' + margin_top + 'px; margin-bottom: ' + margin_bottom + 'px;" id="' + rnd + '">' );
            document.write( '<iframe name="indexadengineframe' + same + '" src="http://sher3.index.hu/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>' );
            document.write( '<scr'+'ipt type="text/javascript">cont = document.getElementById( "' + rnd + '" ).parentNode.parentNode; if ( cont.id == "microsite" ) { cont.style.width = "' + width + 'px"; cont.style.marginLeft = "' + ( 220 - width / 2 ) + 'px"; }</scr'+'ipt>' );
            document.write( '</div>' );
        } else {
            document.write( '<div style="margin-top: ' + margin_top + 'px; margin-bottom: ' + margin_bottom + 'px;">' );
            document.write( '<a target="_top" href="http://sher3.index.hu/rd?lc=' + ade_lc + '&ui=' + indexadengineui + '"><img src="http://sher3.index.hu/ad?lc=' + ade_lc + '&amp;ui=' + indexadengineui + '" border="0" height="' + height + '" width="' + width + '"></a>' );
            document.write( '</div>' );
        }
    }


    function eu_open( nick )
    {
        var num = Math.round( Math.random() * 100000000000 );
        window.open( 'http://index.hu/res/eu/lexikon/list_out.php?ff=look&amp;key=' + nick, 'gyaloglo' + num, 'resizable=no,status=no,width=530,height=400,top=10,left=10,scrollbars=yes' );
    }

    function gallery( o )
    {
        window.open( o.href + '&currpic=' + o.childNodes[0].src, 'IndexKepek', 'scrollbars=no,resizable=no,menu=no,width=610,height=560' );
        return false;
    }

    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 onLayerFinishedPlaying( swf_id ) { document.getElementById( swf_id   + '_container' ).style.display = 'none'; }
    function openwindow( click_url ) { window.open( click_url ); }
    function real_DoCommand( command, id, click_url )
    {
        switch ( command )
        {
            case 'hide' : document.getElementById( id + '_container' ).style.visibility = 'hidden'; break;
            case 'click' : openwindow( click_url ); break;
        }
    }

    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 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 gyaloglo_open( nick )
    {
        var num = Math.round( Math.random() * 100000000000 );
        window.open( 'http://index.hu/x?gyal=http%3A//chat.gyaloglo.hu/php/gochat_cgyh.php%3Fusername=' + nick, 'gyaloglo'+num, 'resizable=no,status=no,width=602,height=560,top=10,left=10,scrollbars=no' );
        return false;
    }

    var theTop = 255;
    var sticky;
    var refreshTimeout;
    var vb2010meccsek_html = {};
    
    windowonload = function(e)
    {
        var szupravezeto = Ext.get( 'db_cs_container' );
        if( szupravezeto )
        {
            buttons = szupravezeto.query( 'li' );
            for( i = 0; i < buttons.length; i++ )
            {
                Ext.fly( buttons[ i ] ).on( 'click', function( e, i )
                {
                    e.stopEvent();
                    var li = Ext.fly( i ).parent( 'li' );
                    if( !li.hasClass( 'active' ) )
                    {
                        Ext.fly( szupravezeto.query( '.active' )[ 0 ] ).removeClass( 'active' );
                        li.addClass( 'active' );
                        Ext.fly( szupravezeto.query( '.show' )[ 0 ] ).removeClass( 'show' );
                        Ext.get( Ext.fly( i ).parent( 'a' ).dom.id.replace( 'sw', 'tr' ) ).addClass( 'show' );
                    }
                } );
            }
        }
        if( $( 'badday' ) )
        {
            $$( '#badday input[type=text]' ).each( function( element )
            {
                element.observe( 'keypress', function( event )
                {
                    if( typeof event.charCode == 'undefined' && typeof event.keyCode != 'undefined' ) event.charCode = event.keyCode;
                    if( element.getAttribute( 'id' ) == 'bankszamla_osszeg' && element.getValue().length > 3 && ( "0123456789" ).indexOf( String.fromCharCode( event.charCode ) ) != -1 ) event.stop();
                    else
                    {
                        if( ( "0123456789" ).indexOf( String.fromCharCode( event.charCode ) ) == -1 && event.charCode != 0 && event.charCode != 8 && event.charCode != 9 && event.charCode != 13 && event.charCode != 27 ) event.stop();
                    }
                } );
            } );
            $$( '#badday input[type=submit]' ).each( function( element )
            {
                element.observe( 'click', function( event )
                {
                    event.stop();
                    var params = new Object();
                    params.plain = 1;
                    var all_ok = true;
                    $$( '#badday input[type=text]' ).each( function( element )
                    {
                        params[ 'formula_' + $( element ).id ] = parseFloat( $( element ).value );
                        if( $( element ).id != 'bankszamla_osszeg' && $( element ).id != 'hianyzo_fogak' && ( $( element ).value.length == 0 || $( element ).value == 0 || $( element ).value == '0' ) ) all_ok = false;
                    } );
                    params.final = ( ( ( params[ 'formula_lakas_alapterulete' ] / params[ 'formula_lakok_szama' ] + params[ 'formula_bankszamla_osszeg' ] ) * ( Math.ceil( Math.log( params[ 'formula_internet_savszelesseg' ] ) * Math.LOG10E ) + 1 ) ) / ( ( params[ 'formula_testsuly' ] + params[ 'formula_eletkor' ] ) * ( params[ 'formula_hianyzo_fogak' ] + 2 * Math.PI ) ) ) * 100;
                    if( all_ok )
                    {
                        new Ajax.Request( document.location.href,
                        {
                            parameters: params,
                            onSuccess: function( data )
                            {
                                $( 'content' ).innerHTML = data.responseText;
                            }
                        } );
                    }
                    else
                    {
                        window.alert( 'Minden mezőt ki kell tölteni!' );
                    }
                } );
            } );

        }
        if( $('idojaras_select') )
        {
            $('idojaras_select').observe( 'change' , function( event ) { idojaras_select( event ) } );
            $('idojaras_select').observe( 'keyup' , function( event ) { idojaras_select( event ) } );
function idojaras_select( event )
{
    if( $( event.target ).value != '' )
    {
        parts = $( event.target ).value.split( '|' );
        href = 'http://index.hu/x?ido=/idojaras/' + parts[ 0 ] + '/';
        $( 'idojaras' ).removeClassName( $( 'idojaras' ).className.split( ' ' )[ 1 ] ).addClassName( parts[ 4 ] ).title = parts[ 5 ];
        options = $$( '#idojaras_select option' );
        for( i = 0; ln = options.length, i < ln; i++ ) if( options[ i ].value == $( event.target ).value ) $( 'idojaras_varos' ).innerHTML = '<a href="' + href + '">' + options[ i ].innerHTML + '</a>';
        $( 'idojaras_homerseklet' ).innerHTML = '<span class="min">' + parts[ 2 ] + '°C</span><span class="slash"> / </span><span class="max">' + parts[ 3 ] + '°C</span><span class="now">most <span>' + parts[ 1 ] + '°C</span></span>';
        $( 'idojaras_reszletes' ).href = href;
        createCookie( 'selectedcity', parts[ 0 ], 365 );
    }
}
        }
        if( $('medialepedo')  ) { 
            $( 'ml_kep_navi_prev' ).hide();
            $( 'ml_kep_navi_prev' ).onmousedown = function() { indafoto_speed = 8; };
            $( 'ml_kep_navi_prev' ).onmouseup = function() { indafoto_speed = 4; $( 'ml_kep_navi_prev' ).blur(); };
            $( 'ml_kep_navi_next' ).onmousedown = function() { indafoto_speed = 8; };
            $( 'ml_kep_navi_next' ).onmouseup = function() { indafoto_speed = 4; $( 'ml_kep_navi_next' ).blur(); };
        }
        
        if( document.getElementById( 'ml_kep_container_ul' ) )
        {
            if( indafoto_pic == 0 )
            {
                for( i in document.getElementById( 'ml_kep_container_ul' ).childNodes )
                {
                    if( document.getElementById( 'ml_kep_container_ul' ).childNodes[ i ].tagName == "LI" ) indafoto_pic += ( document.getElementById( 'ml_kep_container_ul' ).childNodes[ i ].clientWidth + 10 );
                }
            }
            indafoto_pic = indafoto_pic > 0 ? indafoto_pic - 9 : indafoto_pic;
            document.getElementById( 'ml_kep_container_ul' ).style.width = indafoto_pic + 'px';
        }
        showad;
        printify();
        if ( typeof Calendar != 'undefined' )
        {
            IndexCalendarSetup( $('tol'), $('tol_trigger_c') );
            IndexCalendarSetup( $('ig'), $('ig_trigger_c') );
            IndexCalendarSetup( $('datum'), $('datum_trigger_c'), function( cal ) { $('datum').form.submit(); }  );
            IndexCalendarSetup( $('date1'), $('date1_trigger_c') );
            IndexCalendarSetup( $('date'), $('date_trigger_c') );
        }

        if ( $('bessenyei') ) {
            $('bessenyei').style.display = 'block';
            setTimeout("removebp()",12000);
        }

        if ( $('indabox') ) {
            indalinks = $$('#indabox UL LI>A');
            for(  i = 0; i < indalinks.length; i++ )
            {
                indalinks[i].onmouseover = function() {
                    dobozok = $$('#indabox .szoveg');
                    for(  j = 0; j < indalinks.length; j++ ) { dobozok[j].style.display = ( this.parentNode == dobozok[j].parentNode ? 'block' : 'none' ); }
                    lik = $$('#indabox LI');
                    for(  j = 0; j < lik.length; j++ )
                    {
                        if ( ( this.parentNode == lik[j] ) && !lik[j].hasClassName( 'selected' ) ) { lik[j].addClassName( 'selected' ); }
                        if ( this.parentNode != lik[j] ) { lik[j].removeClassName( 'selected' ); }
                    }
                }
            }
        }
        if ( $('kepekprev') ) {
            $('kepeknext').onclick = function()
            {
                lista = $$('#vizual .kepek UL LI')
                for( i = 0; i < lista.length; i++ ) { if ( lista[i].hasClassName( 'selected' ) ) { j = i; } }
                lista[ j ].removeClassName( 'selected' )
                lista[ ( j < lista.length - 1 ) ? j + 1 : 0 ].addClassName( 'selected' );
                return false;
            }
            $('videoknext').onclick = function()
            {
                lista = $$('#vizual .videok UL LI')
                for( i = 0; i < lista.length; i++ ) { if ( lista[i].hasClassName( 'selected' ) ) { j = i; } }
                lista[ j ].removeClassName( 'selected' )
                lista[ ( j < lista.length - 1 ) ? j + 1 : 0 ].addClassName( 'selected' );
                return false;
            }
            $('kepekprev').onclick = function()
            {
                lista = $$('#vizual .kepek UL LI')
                for( i = 0; i < lista.length; i++ ) { if ( lista[i].hasClassName( 'selected' ) ) { j = i; } }
                lista[ j ].removeClassName( 'selected' )
                lista[ ( j > 0 ) ? j - 1 : lista.length - 1 ].addClassName( 'selected' );
                return false;
            }
            $('videokprev').onclick = function()
            {
                lista = $$('#vizual .videok UL LI')
                for( i = 0; i < lista.length; i++ ) { if ( lista[i].hasClassName( 'selected' ) ) { j = i; } }
                lista[ j ].removeClassName( 'selected' )
                lista[ ( j > 0 ) ? j - 1 : lista.length - 1 ].addClassName( 'selected' );
                return false;
            }
        }
        $$( 'form.vote_monster_form' ).each( function( element )
        {
            Event.observe( element, 'submit', function( event )
            {
                event.stop();
                var selected = null;
                var noauth = '&noauth=1';
                if( this.getInputs( 'hidden', 'noauth' ).length == 0 ) { noauth = ''; }
                var parameters = 'op=postmini&IS_AJAX_REQUEST=true&method=castvote' + noauth + '&mininame=' + element.id.substring( 5 );
                if( this.getInputs( 'hidden', 'multi' )[ 0 ].getValue() == "1" )
                {
                    selected = new Array();
                    this.getInputs( 'checkbox', 'option' ).each( function( elem ) { if( elem.getValue() != null ) selected[ selected.length ] = elem.value } );
                    if( !selected.length ) return false;
                    parameters = parameters + '&multi=1&option=' + selected.join( '|' );
                }
                else
                {
                    this.getInputs( 'radio', 'option' ).each( function( elem ) { if( elem.getValue() != null ) selected = elem } );
                    if( selected != null ) parameters = parameters + '&option=' + selected.value;
                    else return false;
                }
                new Ajax.Request( this.action,
                {
                    parameters: parameters,
                    onSuccess: function( data )
                    {
                        var swap_text = '';
                        if( element.hasClassName( 'monster_hidden_form' ) ) swap_text = 'Köszönjük, hogy szavazott!';
                        else swap_text = data.responseText;
                        $( element.id.substring( 5 ) ).innerHTML = swap_text;
                    }
                } );
            } );
        } );
        $$( 'form.idojaras_form' ).each( function( element ) { element.getElements()[ 0 ].observe( 'change', function( event ) { if( this.getValue() != '0' ) document.location.href = 'http://index.hu/idojaras/' + this.getValue() + '/'; } ); } );
        if ( $('pager_top') )
        {
            page_init();
            //init_pagerlinks();
            //switch_page();
        }
        if ( $('cikklistak') != null )
        {
            $('friss').onclick = function()
            {
                if ( !this.hasClassName( 'selected' ) ) {
                    this.addClassName( 'selected' )
                    $('nepszeru').removeClassName( 'selected' );
                    this.next().style.display = 'block';
                    $('nepszeru').next().hide();
                }
                return false;
            }
            $('nepszeru').onclick = function()
            {
                if ( !this.hasClassName( 'selected' ) ) {
                    this.addClassName( 'selected' )
                    $('friss').removeClassName( 'selected' );
                    this.next().style.display = 'block';
                    $('friss').next().hide();
                }
                return false;
            }
	    //*
            if( $('videok') != null ) $('videok').onclick = function()
            {
                if ( !this.hasClassName( 'selected' ) ) {
                    this.addClassName( 'selected' )
                    $('kepek').removeClassName( 'selected' );
                    this.next().style.display = 'block';
                    $('kepek').next().hide();
                }
                return false;
            }
            if( $('kepek') != null ) $('kepek').onclick = function()
            {
                if ( !this.hasClassName( 'selected' ) ) {
                    this.addClassName( 'selected' )
                    $('videok').removeClassName( 'selected' );
                    this.next().style.display = 'block';
                    $('videok').next().hide();
                }
                return false;
            }
	    //*/
        }
        if ( $('sendthis_link') != null ) {
            new Control.Modal( $('sendthis_link'), { overlayCloseOnClick: false } );
            new Control.Modal( $('sendthis_link_bottom'), { overlayCloseOnClick: false } );
        }
        $A(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>') } );
            });

            $A(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 ) temp = setTimeout('movesticky()', 10);
        $$( 'iframe.fixme' ).each(function(e){e.src = e.src});
    }

    function init_pagerlinks()
    {
        linkek = $('cikkpager_pages').getElementsByTagName( 'A' )
        for( i = 0; i < linkek.length; i++ ) { linkek[ i ].href = linkek[ i ].href.replace( '!', '#' ); }
        linkek = $('cikkpager_pages_bottom').getElementsByTagName( 'A' )
        for( i = 0; i < linkek.length; i++ ) { linkek[ i ].href = linkek[ i ].href.replace( '!', '#' ); }
        $('cikkpager_next_anchor').href = $('cikkpager_next_anchor').href.replace( '!', '#' );
        $('cikkpager_prev_anchor').href = $('cikkpager_prev_anchor').href.replace( '!', '#' );
        $('cikkpager_next_anchor_bottom').href = $('cikkpager_next_anchor_bottom').href.replace( '!', '#' );
        $('cikkpager_prev_anchor_bottom').href = $('cikkpager_prev_anchor_bottom').href.replace( '!', '#' );
    }

    function switch_page()
    {
        current = window.location.hash.replace( '#', '' );
    if ( current && $( 'oldal_' + current ) )
        {
            oldalak = $$( '#szoveg .oldal' ).each( function( s ) { s.removeClassName( 'aktiv' ); } );
            $( 'oldal_' + current ).addClassName( 'aktiv' );
            $('kopf').style.display = $( 'oldal_' + current ).hasClassName( 'elso' ) ? 'block' : 'none';
            $('cikkpager_prev').style.display = $( 'oldal_' + current ).hasClassName( 'elso' ) ? 'none' : 'block';
            $('cikkpager_next').style.display = $( 'oldal_' + current ).hasClassName( 'utolso' ) ? 'none' : 'block';
            $('cikkpager_prev_bottom').style.display = $( 'oldal_' + current ).hasClassName( 'elso' ) ? 'none' : 'block';
            $('cikkpager_next_bottom').style.display = $( 'oldal_' + current ).hasClassName( 'utolso' ) ? 'none' : 'block';
            linkek = $('cikkpager_pages').getElementsByTagName( 'A' );
            for( i = 0; i < linkek.length; i++ )
            {
//        linkek[i].removeClassName( 'selected' );
                if ( linkek[i].href == window.location.href )
                {
                    if ( i > 0 ) { $('cikkpager_prev_anchor').href = linkek[ i - 1 ].href; }
                    if ( i < linkek.length - 1 ) { $('cikkpager_next_anchor').href = linkek[ i + 1 ].href; }
//            linkek[i].addClassName( 'selected' );
                }
            }
            linkek = $('cikkpager_pages_bottom').getElementsByTagName( 'A' );
            for( i = 0; i < linkek.length; i++ )
            {
//        linkek[i].removeClassName( 'selected' );
                if ( linkek[i].href == window.location.href )
                {
                    if ( i > 0 ) { $('cikkpager_prev_anchor_bottom').href = linkek[ i - 1 ].href; }
                    if ( i < linkek.length - 1 ) { $('cikkpager_next_anchor_bottom').href = linkek[ i + 1 ].href; }
//            linkek[i].addClassName( 'selected' );
                }
            }
        }
        window.setTimeout( switch_page, 1000 );
    }

    var CURRENT_PAGE = 1;
    var PAGES = 0;
    function page_init()
    {
        PAGES = $$('DIV.oldal').length;
        $$( 'A.onestep.next1' ).each(function(i){ i.onclick = function(){ return page_next(1); }});
        $$( 'A.onestep.prev1' ).each(function(i){ i.onclick = function(){ return page_next(-1); }});
        $$( 'DIV.tobboldalas_cikk DIV.pages A' ).each(function(i){
                if ( $(i).hasClassName('actual') ) { CURRENT_PAGE = parseInt(i.className.split(' ')[0].split('_')[1]); }
                i.onclick = function(){ var cn = $(i).hasClassName('actual') ? i.className.split(' ')[0] : i.className; return page_switch(parseInt(cn.split('_')[1])); }
        });
        if ( window.location.hash && parseInt( window.location.hash.substring(1) ) ) { page_switch( window.location.hash.substring(1) ); }
    }
    function page_switch(page)
    {
        var old = [];
        var t;
        if ( !PAGES ) { PAGES = $$('DIV.oldal').length; }
        page = parseInt(page);
        if ( CURRENT_PAGE ) {
            var t = $('cikk_oldal_' + CURRENT_PAGE);
            if ( t ) { if ( t.hasClassName('aktiv') ) { t.removeClassName('aktiv'); } }
            old = $$('a.oldal_' + CURRENT_PAGE);
        }
        $(old).each( function(i){ $(i).removeClassName('actual') });
        $$('a.oldal_' + page).each( function(i){ $(i).addClassName('actual') });
        t = $('cikk_oldal_' + page);
        if ( t ) {
            CURRENT_PAGE = page;
            if ( !t.hasClassName('aktiv') ) { t.addClassName( 'aktiv' ); }
            $$( 'A.onestep.next1' ).each(function(i){ i.style.visibility = CURRENT_PAGE == PAGES ? 'hidden' : 'visible'; });
            $$( 'A.onestep.prev1' ).each(function(i){ i.style.visibility = CURRENT_PAGE == 1 ? 'hidden' : 'visible'; });
            //window.location.href = '#szoveg';
            window.location.hash = page;
            window.scrollTo(0, $('szoveg').offsetTop);
        }
        return false;
    }

    function page_next(dir)
    {
        dir = parseInt(dir);
        if ( !PAGES ) { PAGES = $$('DIV.oldal').length; }
        var page = CURRENT_PAGE + dir;
        return PAGES >= ( page ) && ( page > 0 ) ? page_switch( page ) : false;
    }

    function printify()
    {
        if ( $('szoveg') )
        {
            try {
            //$('print_orig').checked = false;
            var links = $('pager_top') ? $$( '#szoveg .oldal A' ) : $('szoveg').getElementsByTagName( 'A' );
            if ( links && links.length > 0 ) { cikklinks = '<h3 class="print_linkshead">A cikkben hivatkozott linkek:</h3><ul class="print_hivatkozasok">'; }
            var cikklis = '';
            j = 0;
            if ( links ) for( i = 0; i < links.length; i++ )
            {
                if ( ( links[i].parentNode.nodeName == 'P' || links[i].parentNode.id == 'szoveg' ) && links[i].name != 'more' )
                {
                    links[i].innerHTML = links[i].innerHTML + '<span class="print_anchor"> [' + ( j + 1 ) + ']</span>';
                    cikklis += '<li>[' + ( j + 1 ) + '] ' + links[i].href + '</li>';
                    j++;
                }
            }
            if ( cikklis != '' )
            {
                cikklinks += cikklis + '</ul>';
                var newD = document.createElement( 'DIV' );
                newD.id = 'print_links_container';
                newD.innerHTML = cikklinks;
                var ocikk_bottom = $('cikk_bottom');
                if ( ocikk_bottom ) ocikk_bottom.parentNode.insertBefore( newD, ocikk_bottom );
            }
            var szerzok_linkek = $('szerzo') ? $('szerzo').getElementsByTagName( 'A' ) : new Array();
            for( i = 0; i < szerzok_linkek.length; i++ )
            {
                var re = /\?(.*)/g;
                var href = szerzok_linkek[i].href.replace( 'mailto:', '' ).replace( 'NEMSPA_M', '' ).replace( re, '' );
                szerzok_linkek[i].innerHTML = szerzok[i].innerHTML + '<span class="print_szerzo"> - ' + href + '</span>';
            }
            var kapcsolodo_linkek = $$('#kapcsolodo A');
            if ( kapcsolodo_linkek ) for( i = 0; i < kapcsolodo_linkek.length; i++ )
            {
                var re = /^(.*?)=http/;
                var href = unescape( kapcsolodo_linkek[i].href.replace( re, 'http' ) );
                kapcsolodo_linkek[i].innerHTML = kapcsolodo_linkek[i].innerHTML + '<span class="print_anchor"> - ' + href + '</span>';
            }
        } catch (e) {
            //alert(e.description);
        }
        }
    }

    function movesticky()
    {
          if ( window.pageYOffset != undefined ) { scrollpos = window.pageYOffset; }
        else if ( document.compatMode == 'BackCompat' ) { scrollpos = document.body.scrollTop; }
        else { scrollpos = document.documentElement.scrollTop; }
        if ( scrollpos > theTop ) { topa = ( sticky.style.position == "absolute" ) ? scrollpos : 0; }
        else { topa = ( sticky.style.position == "absolute" ) ? theTop : theTop - scrollpos; }
        sticky.style.top = topa + 'px';
        temp = setTimeout('movesticky()', 0);
    }

    function val06map_DoFSCommand(command, args) {}
    function getFlashMovieObject(movieName)
    {
        if (window.document[movieName])
        {
            return window.document[movieName];
        }

        if (navigator.appName.indexOf("Microsoft Internet")==-1)
        {
            if (document.embeds && document.embeds[movieName])
            {
                return document.embeds[movieName];
            }
        }
        else
        {
            return document.getElementById(movieName);
        }
        return document.getElementById( movieName );
    }

    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;

   function numbersonly(myfield, e, dec)
   {
     var key;
     var keychar;

     if (window.event) { key = window.event.keyCode; }
     else if (e) { key = e.which; }
     else { return true; }
     keychar = String.fromCharCode(key);

     // vezerlo karakterek
     if ((key==null) || (key==0) || (key==8) || (key==9) || (key==13) || (key==27) ) { return true; }

     // szamok
     else if ((("0123456789").indexOf(keychar) > -1)) { return true; }
     else if ( keychar == "." ) { return true; }
     else { return false; }
   }

   function number_format(a, b, c, d) {
      a = Math.round(a * Math.pow(10, b)) / Math.pow(10, b);
      e = a + '';
      f = e.split('.');
      if (!f[0]) {
        f[0] = '0';
      }
      if (!f[1]) {
        f[1] = '';
      }
      if (f[1].length < b) {
      g = f[1];
      for (i=f[1].length + 1; i <= b; i++) {
      g += '0';
      }
        f[1] = g;
      }
      if(d != '' && f[0].length > 3) {
        h = f[0];
        f[0] = '';
        for(j = 3; j < h.length; j+=3) {
          i = h.slice(h.length - j, h.length - j + 3);
          f[0] = d + i +  f[0] + '';
        }
        j = h.substr(0, (h.length % 3 == 0) ? 3 : (h.length % 3));
        f[0] = j + f[0];
     }
     c = (b <= 0) ? '' : c;
     return f[0] + c + f[1];
}

    var dohover = true;
    var feedopened = false;
    var feedtimeout = 0;
    var closetimeout = new Array();
    var feedsloaded = false;
    initHover = function()
    {
        navRoot = $('rovatok');
        if(!navRoot.childNodes)return;
        for( i = 0; i < navRoot.childNodes.length; i++ )
        {
            node = navRoot.childNodes[ i ];
            if ( node.nodeName == "LI" )
            {
                if ( node.id != 'cimlap_rovat' )
                {
                    node.innerHTML += '<ul class="navi_feed" style="display: none;"><li></li></ul>';
                    prev = node.previousSibling.nodeName == 'LI' ? node.previousSibling : node.previousSibling.previousSibling;
                    if ( node.className == 'selected' )
                    {
                        prev.style.backgroundImage = prev.id == 'cimlap_rovat' ? 'none' : 'url(' + getHomeLinkPath() + 'assets/images/navi_arrow.gif)';
                    }
                }
                node.onmouseover = function()
                {
                    if ( dohover )
                    {
                        window.clearTimeout( closetimeout[ this.id ] );
                        if ( this.id == 'cimlap_rovat' )
                        {
                            this.style.backgroundImage = 'url(' + getHomeLinkPath() + 'assets/images/navi_bg_noarrow_hi.gif)';
                            feedtimeout = window.setTimeout( 'feedopened = true', feedopened ? 10 : 400 );

                        }
                        else
                        {
                            prev = this.previousSibling.nodeName == 'LI' ? this.previousSibling : this.previousSibling.previousSibling;
                            if ( prev && prev.className != 'selected' )
                            {
                                prev.style.backgroundImage = prev.id == 'cimlap_rovat' ? 'none' : 'url(' + getHomeLinkPath() + 'assets/images/navi_arrow.gif)';
                            }
                            this.style.backgroundImage = 'url(' + getHomeLinkPath() + 'assets/images/navi_bg_hi.gif)';
                            feedtimeout = window.setTimeout( 'openfeed( \'' + this.id + '\' )', feedopened ? 10 : 400 );
                        }
                        for( i = 0; i < this.childNodes.length && this.childNodes[ i ].nodeName != 'A'; i++ ) {}
                        if ( i < this.childNodes.length )
                        {
                            this.childNodes[ i ].style.backgroundImage = 'url(' + getHomeLinkPath() + 'assets/images/navi_bg_left_hi.gif)';
                            this.childNodes[ i ].style.color = 'white';
                        }
                    }
                }
                node.onmouseout = function()
                {
                    if ( dohover )
                    {
                        window.clearTimeout( feedtimeout );
                        closetimeout[ this.id ] = window.setTimeout( 'closefeed( \'' + this.id + '\' )', 5 );
                        next = null;
                        if ( this.nextSibling != null )
                        {
                            next = this.nextSibling.nodeName == 'LI' ? this.nextSibling : this.nextSibling.nextSibling;
                        }
                        if ( this.id == 'cimlap_rovat' )
                        {
                            this.style.backgroundImage = this.className == 'selected' ? 'url(' + getHomeLinkPath() + 'assets/images/navi_bg_noarrow.gif)' : next.className == 'selected' ? 'none' : 'url(' + getHomeLinkPath() + 'assets/images/navi_pipe.gif)';
                        }
                        else
                        {
                            prev = this.previousSibling.nodeName == 'LI' ? this.previousSibling : this.previousSibling.previousSibling;
                            if ( prev.className != 'selected' )
                            {
                                prev.style.backgroundImage = prev.id == 'cimlap_rovat' ? 'url(' + getHomeLinkPath() + 'assets/images/navi_pipe.gif)' : 'url(' + getHomeLinkPath() + 'assets/images/navi_arrow_pipe.gif)';
                            }
                            if ( this.className == 'selected' )
                            {
                                this.style.backgroundImage =  'url(' + getHomeLinkPath() + 'assets/images/navi_bg.gif)';
                                prev.style.backgroundImage = prev.id == 'cimlap_rovat' ? 'none' : 'url(' + getHomeLinkPath() + 'assets/images/navi_arrow.gif)';
                            }
                            else
                            {
                                if ( this.id == 'navi_video' )
                                {
                                    this.style.backgroundImage = 'url(' + getHomeLinkPath() + 'assets/images/navi_arrow.gif)';
                                }
                                else
                                {
                                    this.style.backgroundImage = next.className == 'selected' ? 'url(' + getHomeLinkPath() + 'assets/images/navi_arrow.gif)' : 'url(' + getHomeLinkPath() + 'assets/images/navi_arrow_pipe.gif)';
                                }
                            }
                        }
                        for( i = 0; i < this.childNodes.length && this.childNodes[ i ].nodeName != 'A'; i++ ) {}
                        if ( i < this.childNodes.length )
                        {
                            this.childNodes[ i ].style.backgroundImage = this.className == 'selected' ? 'url(' + getHomeLinkPath() + 'assets/images/navi_bg_left.gif)' : 'none';
                            this.childNodes[ i ].style.color = this.className == 'selected' ? 'white' : 'black';
                        }
                    }
                }
            }
        }
        ofeatured = $('featured');
        if ( ofeatured != null )
        {
            $('featured').onmouseover = function() { dohover = false; }
            $('featured').onmouseout = function() { dohover = true; }
        }
    }

    function openfeed( tab )
    {
        tab = $( tab );
        if ( !feedsloaded )
        {
            feedsloaded = true;
            new Ajax.Request( getHomeLinkPath() + 'assets/static/navi_feed.html',
                {
                    method: 'get',
                    onSuccess: function( transport )
                    {
                        var response = transport.responseText || "";
                        arr = response.split( '<next>' );
                        orovatok = $('rovatok');
                        k = 0;
                        for( i = 1; i < orovatok.childNodes.length; i++ )
                        {
                            node = orovatok.childNodes[ i ];
                            if ( node.nodeName == "LI" )
                            {
                                for( j = 0; j < node.childNodes.length && node.childNodes[ j ].className != 'navi_feed'; j++ ) {}
                                if ( j < node.childNodes.length )
                                {
                                    node.childNodes[ j ].innerHTML = arr[ k ];
                                    k++;
                                }
                            }
                        }
                        window.setTimeout( 'feedsloaded = false', 5 * 60 * 1000 );
                    }
                }
            );
        }

        for( i = 0; i < tab.childNodes.length && tab.childNodes[ i ].className != 'navi_feed'; i++ ) {}
        if ( i < tab.childNodes.length )
        {
            feed = tab.childNodes[ i ];
            feed.style.display = 'block';
        }
        feedopened = true;
    }

    function closefeed( tab )
    {
        tab = $( tab );
        for( i = 0; i < tab.childNodes.length && tab.childNodes[ i ].className != 'navi_feed'; i++ ) {}
        if ( i < tab.childNodes.length )
        {
            feed = tab.childNodes[ i ];
            feed.style.display = 'none';
        }
        feedopened = false;
    }


/**
 * @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"){
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 = {
            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';
            if( this.element != null ) 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 = {
                    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',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){
        $A(Control.Modal.responders).each(function(responder){
            if(responder[event_name])
                responder[event_name](argument);
        });
        if (this.options[event_name]) {
            response = this.options[event_name](argument);
            return response;
        }
        return null;
    }
});
Control.Modal.attachEvents();
Event.observe(window,'load',windowonload);
} // van-e prototype


    function removebp() {
        $('bessenyei').style.display = 'none';
    }

    var preview_stylesheet = false;
    var preview_stylesheet_helper;
    var oldbodypadding;
    var oldbodymargin;

    function set_print_css()
    {
        if ( !preview_stylesheet )
        {
            if( document.createStyleSheet ){
                    printcontrols_stylesheet = document.createStyleSheet( getHomeLinkPath() + 'assets/css/printcontrols.css' );
                    preview_stylesheet = document.createStyleSheet( getHomeLinkPath() + 'assets/css/printpreview.css' );
            } else {

                    preview_stylesheet = document.createElement('link');
                    preview_stylesheet.rel='stylesheet';
                    preview_stylesheet.type = 'text/css';
                    preview_stylesheet.href= getHomeLinkPath() + 'assets/css/printpreview.css';
                    preview_stylesheet.media = 'screen';
                    document.getElementsByTagName("head")[0].appendChild( preview_stylesheet );

                    printcontrols_stylesheet = document.createElement('link');
                    printcontrols_stylesheet.rel='stylesheet';
                    printcontrols_stylesheet.type = 'text/css';
                    printcontrols_stylesheet.href=getHomeLinkPath() + 'assets/css/printcontrols.css';
                    printcontrols_stylesheet.media = 'screen';
                    document.getElementsByTagName("head")[0].appendChild( printcontrols_stylesheet );
            }
            //document.getElementById("internetado_head").style.display = "none";
            //document.body.innerHTML = '<div id="printcontrols"><a href="#" class="back" onclick="reset_print_page(); return false;">Vissza</a><form action="" method="post" name="print"><input type="checkbox" class="checkbox" id="print_pictures" onclick="if ( this.checked ) { $$(\'#szoveg .kep\').each( function(e) { e.style.display = \'inline\' } ); } else { $$(\'#szoveg .kep\').each( function(e) { e.style.display = \'none\' } ); }"/>&nbsp;a képeket is szeretném<input type="checkbox" checked="checked" id="print_anchors" class="checkbox masodik" onclick="if ( $(\'print_links_container\') ) { $(\'print_links_container\').style.display = this.checked ? \'block\' : \'none\'; if ( this.checked ) { $$(\'#szoveg .print_anchor\').each( function(e) { e.style.display = \'inline\' } ); } else { $$(\'#szoveg .print_anchor\').each( function(e) { e.style.display = \'none\' } ); } }" />&nbsp;a cikkben hivatkozott linkeket is nyomtassa<!-- input type="checkbox" checked class="checkbox masodik" id="print_orig" onchange="if ( this.checked ) { unset_print_css(); } else { set_print_css(); }"/>&nbsp;Eredeti oldal --><input type="submit" id="nyomtat" value=" Nyomtatás " onclick="window.print(); return false;" /></form></div>'+ document.body.innerHTML;
            document.body.innerHTML = '<div id="printcontrols"><a href="#" class="back" onclick="reset_print_page(); return false;">Vissza</a><form action="" method="post" name="print"><input type="checkbox" class="checkbox" id="print_pictures" onclick="if ( this.checked ) { $$(\'#szoveg .kep\').each( function(e) { e.style.display = \'inline\' } ); } else { $$(\'#szoveg .kep\').each( function(e) { e.style.display = \'none\' } ); }"/>&nbsp;a képeket is szeretném' + ( $$('.charts').length > 0 ? '<input type="checkbox" class="checkbox masodik" id="print_charts" onclick="if ( this.checked ) { $$(\'.charts\').each( function(e) { e.style.display = \'block\' } ); } else { $$(\'.charts\').each( function(e) { e.style.display = \'none\' } ); }"/>&nbsp;a grafikonokat is szeretném' : '' ) + '<input type="checkbox" checked="checked" id="print_anchors" class="checkbox masodik" onclick="if ( $(\'print_links_container\') ) { $(\'print_links_container\').style.display = this.checked ? \'block\' : \'none\'; if ( this.checked ) { $$(\'#szoveg .print_anchor\').each( function(e) { e.style.display = \'inline\' } ); } else { $$(\'#szoveg .print_anchor\').each( function(e) { e.style.display = \'none\' } ); } }" />&nbsp;a cikkben hivatkozott linkeket is nyomtassa ' + ( $('comment_list_container') ? '<input type="checkbox" class="checkbox masodik" id="print_comments" onchange="$(\'comment_list_container\').toggle()"/>&nbsp;a kommenteket is szeretném' : '' ) + '&nbsp;<input type="submit" id="nyomtat" value=" Nyomtatás " onclick="window.print(); return false;" /></form></div>'+ document.body.innerHTML;
//           '<div id="print_ad" style="float: right; margin: 10px 20px 0 0; width: 350px; height: 53px;"><a href="http://rehs.index.hu/rd?lc=12349&ad=127288&ui=206802090&li=&tg="><img src="http://rehs.index.hu/ad?lc=12349" border="0" title="Hirdetés" alt="Hirdetés" /></a></div>';
            Ext.each( Ext.query( '.miniapp.charts' ), function( element )
            {
                eval( 'draw_' + element.id + '();' );
            } );
        }
        else
        {
            preview_stylesheet.disabled = false;
            printcontrols_stylesheet.disabled = false;
        }
        $$('HEAD LINK').each( function(e) { if ( e.media == 'print' ) { e.disabled = false; } } );
        $$('.print_szerzo').each( function(e) { e.style.display = 'inline'; } );
//        if ( $('print_ad') ) { $('print_ad').style.display = 'block'; }

        if ( $('print_anchors').checked )
        {
            if ( $('print_links_container') ) { $('print_links_container').style.display = 'block'; }
            $$('.print_anchor').each( function(e) { e.style.display = 'inline'; } );
        }
        else
        {
            if ( $('print_links_container') ) { $('print_links_container').style.display = 'none'; }
            $$('.print_anchor').each( function(e) { e.style.display = 'none'; } );
        }
        if ( $('print_pictures').checked ) { $$('#szoveg .kep').each( function(e) { e.style.display = 'block'; } ); }
        else { $$('#szoveg .kep').each( function(e) { e.style.display = 'none'; } ); }

        if ($( 'print_comments' ) && $('comment_list_container')) {
            if ( !$('print_comments').checked ) { $('comment_list_container').style.display = 'none'; }
        }
        if ($( 'microsite_microsite' ) ) $('microsite_microsite').style.display = 'none';
        document.body.scrollTo( 0 );
    }

    function unset_print_css()
    {
        $$('HEAD LINK').each( function(e) { if ( e.media == 'print' ) { e.disabled = true; } } );
        document.body.style.margin = '0 0pt 10px 20px';
        preview_stylesheet.disabled = true;
    }

    function reset_print_page()
    {
        $$('HEAD LINK').each( function(e) { if ( e.media == 'print' ) { e.disabled = false; } } );
        document.body.style.margin = '15px 0pt 10px 20px';
        preview_stylesheet.disabled = true;
        printcontrols_stylesheet.disabled = true;
        if ( $('print_links_container') ) { $('print_links_container').style.display = 'none'; }
        //document.getElementById("internetado_head").style.display = "block";
        if ( $('print_ad') ) { $('print_ad').style.display = 'none'; }
        $$('.print_szerzo').each( function(e) { e.style.display = 'none'; } );
        $$('.print_anchor').each( function(e) { e.style.display = 'none'; } );
        $$('#szoveg .kep').each( function(e) { e.style.display = 'block'; } );
        $$('.charts').each( function(e) { e.style.display = 'block'; } );
        if ($( 'microsite_microsite' ) ) $('microsite_microsite').style.display = 'block';
        if ($('comment_list_container')) {
             $('comment_list_container').style.display = 'block';
        }
    }

    // tenisz kozv timer
    function GetCurrentTime() {
        var my_current_timestamp;
        my_current_timestamp = new Date();
        return my_current_timestamp.getTime();
    }

    function dotime( datetime )
    {
        akttime = GetCurrentTime();
        var starttime = new Date();
        starttime.setTime(Date.parse(datetime));
        if ( akttime > starttime ) {
        esec = (akttime - starttime) / 1000;    //compute elapsed time
        eora = parseInt(esec / 3600) ;
        mperc = esec % 3600 ;
        eperc = parseInt( mperc / 60 );
        msec  = parseInt( mperc % 60 );
        var timestr;
        timestr = eora+"'"+eperc+"\"";
        var timer = document.getElementById('timer');
        if (document.getElementById) { timer.innerHTML = timestr; }
        }
   }
  // tenisz kozv timer vege

  //cimlap programdoboz
            function programkeres(targetform){
                if('/kultur/musor/tv/' == targetform.programtipus.value && ('all' == targetform.from.value || targetform.from.selectedIndex==0 )){targetform.from.selectedIndex=1;}
                targetform.action=targetform.programtipus.value;
                targetform.submit();
            }
    //cimlap programdoboz vege

    //cimlap idojarasdoboz

    function changeCityBox(i){
        if(i>0){
            citydata=(cbx[i-1]).split(';');
            st = "doboz " + citydata[2];
            document.getElementById('idojaras').className = st;
            inner = "";
            inner+='<span class="idojaras"><span class="min">'+citydata[3]+'°C</span> / <span class="max">'+citydata[4]+'°C</span></span>';
            inner+='<span class="varos" id><a href="/x?ido=/politika/bulvar/idojaras/" onclick="submitidojaras();return false">'+citydata[1]+'</a></span>';

            document.getElementById('idojaras').innerHTML=inner;
            createCookie('selectedcity', citydata[0], 365);
        }

    }


    function submitidojaras(){
        o=document.getElementById('idojaras_select')
        y=o.options.length;
        if(o.options.selectedIndex>0){document.getElementById('selectedcity').value = o[o.options.selectedIndex].value;}
        document.idojaras_form.submit();
    }
    //cimlap idojarasdoboz vege

    // Tippmax
    function showtp(id) {
    var d = document.getElementById(id);
        for (var i = 1; i<=10; i++) {
            if (document.getElementById('tmpic'+i)) {document.getElementById('tmpic'+i).style.display='none';}
        }
    if (d) {d.style.display='block';}
    }
    // HP bubble adhoz
    function showad(id) {
    var d = document.getElementById(id);
        for (var i = 1; i<=10; i++) {
            if (document.getElementById('adbubble'+i)) {document.getElementById('adbubble'+i).style.display='none';}
        }
    if (d) {d.style.display='block';}
    }

    // inda promo
    function ipromo(a) {
        b = getCookie('ipromo');
        var d = document.getElementById('ipromo');
        if( d )
        {
            var now = new Date();
            tmp = now.getTime();
            var exp = ( tmp + (1000 * 60 * 60 * 24 ));
            var expt = new Date(exp);
            exp = expt.toGMTString();
            if (b != 'shown' )  {    d.style.display = "block"; } else { d.style.display = "none"; }
            if ( a == 1 ) { document.cookie = 'ipromo=shown; expires='+exp+';'; d.style.display = "none";  }
        }
    }

    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 moderateComment( id )
    {
        var moderate = $( 'ban_' + id + '_moderate' ).options[$( 'ban_' + id + '_moderate' ).selectedIndex].value;
        var block    = $( 'ban_' + id + '_block' ).options[$( 'ban_' + id + '_block' ).selectedIndex].value;
        if( moderate || block )
        {
            var win = window.open(
                munkaUrl + 'moderateComment?id=' + id + '&moderate=' + moderate + '&days=' + block,
                'commentadmin',
                'location=1,status=1,scrollbars=1,height=600,width=600'
            );

            if( moderate == 1 )
            {
                $( 'c' + id ).parentNode.removeChild( $( 'c' + id ) );
            }
            else
            {
                $( 'ban_' + id ).style.display = 'none';
                $( 'openban_' + id ).show();
            }
        }
        else
        {
            $( 'ban_' + id ).hide();
            $( 'openban_' + id ).show();
        }
    }

    // Workaround for https://bugzilla.mozilla.org/show_bug.cgi?id=388714
    // FF iframe bug
    var checkIframes = function() {
        for (i=0; i<window.frames.length; i++)
        {
            try
            {
                if (window.frames[i].document.location.href != window.frames[i].frameElement.src && !(window.frames[i].document.location.href == document.location.href && window.frames[i].frameElement.src == 'about:blank'))
                {
                    window.frames[i].frameElement.src = window.frames[i].frameElement.src;
                }
            }
            catch(e) {}
        }
    };
    var userAgent = navigator.userAgent.toLowerCase();
    if (userAgent)
    {
        var browserFirefox = /mozilla/.test( userAgent ) && !/(compatible|webkit)/.test( userAgent );
        if (browserFirefox)
        {
            // Ez kell atirni ugy hogy unloadra lefusson a checkIframes()
            //$(document).ready(checkIframes);
        }
    }
    function sportfolio(aktiv){
    	//alert(aktiv);
    	$('arfolyam').className = aktiv == 'arfolyam' ? 'tab selected' : 'tab';
    	$('arfolyam_div').style.display = aktiv == 'arfolyam' ? 'block' : 'none';
    	$('sport').className = aktiv == 'sport' ? 'tab selected' : 'tab';
    	$('sport_div').style.display = aktiv == 'sport' ? 'block' : 'none';
    	$('musor').className = aktiv == 'musor' ? 'tab selected' : 'tab';
    	$('musor_div').style.display = aktiv == 'musor' ? 'block' : 'none';
    	}

    function turnoff_refresh() { window.clearTimeout( refreshTimeout ) }

/* VB modal video player INNEN */

function bind_vod()
{
    jQuery( '.modal_opener' ).each( function( k, i )
    {
        jQuery( i ).click( function( e )
        {
            if( runalready && navigator.appVersion.indexOf( 'MSIE' ) != -1 ) jQuery( '#modal_target' ).show();
            jQuery( '#modal_target' ).html( __html ).fadeIn( 400, function()
            {
                runalready = true;
                var date = new Date();
                var hash = jQuery( e.target ).parent( 'a' ).attr( 'id' ).split( 'hash' );
                var mode = hash[ 0 ] == '' ? 'cikk' : hash[ 0 ];
                hash = hash[ 1 ];
                var so = new SWFObject("http://files.indavideo.hu/player/iVodPlayer.swf?b=" + date.getTime(), "ivplayer", "660", "410", "10", "#000", true);
                so.addParam("flashvars", "vID=" + hash + "&amp;onsite=1&amp;autostart=1");
                so.addParam("allowfullscreen", "true");
                so.addParam("allowScriptAccess", "always");
                so.addParam("quality", "best");
                so.addParam("wmode", "opaque");
                so.addParam("salign", "t");
                so.write("modal_player");
                jQuery( '#modal_ad_container iframe' ).attr( 'src', 'http://sportgeza.hu/futball/2010/vb/elo/banner/0/' + mode + '/?noauth=1' );
                var top = document.body.scrollTop;
                if( navigator.userAgent.indexOf( 'Firefox' ) != -1 || navigator.userAgent.indexOf( 'Opera' ) != -1 ) top = window.pageYOffset;
                else if( navigator.userAgent.indexOf( 'MSIE' ) != -1 ) top = document.documentElement.scrollTop;
                jQuery( '#sg_vod_modal' ).css( 'padding-top', top );
                jQuery( '#vod_list' ).css( 'height', jQuery( '#sg_vod_modal' ).height() + 'px' );
                jQuery.ajax(
                {
                    type: 'GET',
                    url: 'http://index.hu/assets/static/proxy.php',
                    data:
                    {
                        __proxy_url: 'http://sportgeza.hu/futball/2010/vb/',
                        op: 'vod_list',
                        noauth: '1'
                    },
                    success: function( r )
                    {
                        jQuery( '#vod_list_ul' ).html( r );
                        jQuery( '#replay_scroller' ).css( 'height', '627px' );
                        bind_inner();
                    },
                    dataType: 'text'
                } );
            } );
            jQuery( '#modal_target' ).css( 'height', jQuery( document ).height() + 'px' );
            jQuery( '#modal_top span' ).html( jQuery( e.target ).parent( 'a' ).attr( 'title' ) );
            bind();
            return false;
        } )
    } );
}

jQuery( document ).ready( function()
{
    jQuery( document.body ).append( jQuery( '<div id="modal_target"></div>' ) );
    var hash_param = document.location.href.split( '#' );
    if( typeof hash_param[ 1 ] != 'undefined' && hash_param[ 1 ] == 'up2date' ) setTimeout( 'document.location.reload();', refresh_period );
    bind_vod();
    bind_slide_table();
    hci_max = jQuery( '#hci_toplist' ).height() - jQuery( '#hci_toplist_ul' ).height();
    jQuery( '#hci_toplist' ).mousewheel( function( e, d )
    {
        var ret = true;
        var current = parseInt( jQuery( '#hci_toplist_ul' ).css( 'top' ) );
        var detail = 30;
        if( typeof d != 'undefined' ) detail *= d;
        var calc = current + detail;
        if( calc > 0 ) calc = 0;
        else if( calc < hci_max ) calc = hci_max;
        else ret = false;
        jQuery( '#hci_toplist_ul' ).css( 'top', calc + 'px' );
        if( !ret ) e.preventDefault();
        return ret;
    } );
} );

function bind_slide_table()
{
    jQuery( '.szoveg_spec_container' ).children( 'h2' ).children( 'a' ).each( function( k, i )
    {
        jQuery( this ).click( function( e )
        {
            var link = this;
            jQuery( this ).parents( '.szoveg_spec_container' ).children( '.szoveg_spec' ).each( function( k, i )
            {
                jQuery( this ).slideToggle( function( e )
                { 
                    if( jQuery( link ).hasClass( 'open' ) ) jQuery( link ).removeClass( 'open' ).addClass( 'close' );
                    else jQuery( link ).removeClass( 'close' ).addClass( 'open' );
                } );
            } );
            e.preventDefault();
            return false;
        } );
    } );
    jQuery( '.szoveg_spec_container' ).children( '.szoveg_spec' ).children( '.szoveg_close' ).children( 'a' ).each( function( k, i )
    {
        jQuery( this ).click( function( e )
        {
            var link = jQuery( this ).parents( '.szoveg_spec_container' ).children( 'h2' ).children( 'a' )[ 0 ];
            jQuery( jQuery( this ).parents( '.szoveg_spec_container' ).children( '.szoveg_spec' )[ 0 ] ).slideToggle( function()
            {
                if( jQuery( link ).hasClass( 'open' ) ) jQuery( link ).removeClass( 'open' ).addClass( 'close' );
                else jQuery( link ).removeClass( 'close' ).addClass( 'open' );
            } );
            e.preventDefault();
            return false;
        } );
    } );
    
}

var runalready = false;

var scroll_timeout = 0;
var scroll_interval = 30;
var scroll_step = 4;
var scrollers = {};
var default_scroll_step = scroll_step;
var scroll_big_step = 7;
var hci_max;

function vodscroll( target, direction )
{
    if( typeof direction == 'undefined' ) direction = 'up';
    var obj = jQuery( '#' + target );
    if( typeof scrollers[ target ] == 'undefined' ) scrollers[ target ] = 0;
    var type = target.split( '_' )[0];
    var max = -( jQuery( '#' + type + '_wrapper' ).height() - jQuery( '#' + type + '_scroller' ).height() );
    var val = -scroll_step;
    if( direction == 'down' ) val = scroll_step;
    scrollers[ target ] -= val;
    if( scrollers[ target ] > 0 ) scrollers[ target ] = 0;
    if( scrollers[ target ] < max ) scrollers[ target ] = max;
    if( jQuery( '#' + type + '_scroller' ).height() < jQuery( '#' + target ).height() )
    {
        obj.css( 'top', scrollers[ target ] + 'px' );
        if( scrollers[ target ] < 0 && scrollers[ target ] > max )
        {
            scroll_timeout = setTimeout( "vodscroll( '" + target + "', '" + direction + "')", scroll_interval );
        }
    }
    else if( scrollers[ target ] )
    {
        scrollers[ target ] = 0;
        obj.css( 'top', scrollers[ target ] + 'px' );
    }
}
function stop_scroll() { clearTimeout( scroll_timeout );  scroll_step = default_scroll_step; }

function bind_inner()
{
    jQuery( '#replay_scroller_up' ).click( function() { return false; } ).mousedown( function() { stop_scroll(); scroll_step = scroll_big_step; vodscroll( 'replay_wrapper' ); } ).mouseup( function() { stop_scroll(); } );
    jQuery( '#replay_scroller_down' ).click( function() { return false; } ).mousedown( function() { stop_scroll(); scroll_step = scroll_big_step; vodscroll( 'replay_wrapper', 'down' ); } ).mouseup( function() { stop_scroll(); } );
    jQuery( '#replay_scroller' ).mousewheel( function( e, d )
    {
        var ret = false;
        var _target = jQuery( this ).attr( 'id' ).split( '_' )[ 0 ];
        var target = _target + '_wrapper';
        if( typeof scrollers[ target ] == 'undefined' ) scrollers[ target ] = 0;
        var detail = e.detail ? e.detail : 10 * -d;
        scrollers[ target ] -= ( detail * scroll_step * 2 );
        var max = -( jQuery( '#' + target ).height() - jQuery( this ).height() );
        console.log( scrollers[ target ], max );
        if( scrollers[ target ] > 0 )
        {
            scrollers[ target ] = 0;
            ret = true;
        }
        if( scrollers[ target ] < max )
        {
            scrollers[ target ] = max;
            ret = true;
        }
        if( jQuery( '#' + _target + '_scroller' ).height() < jQuery( '#' + target ).height() ) jQuery( this ).children().css( 'top', scrollers[ target ] );
        else if( scrollers[ target ] )
        {
            scrollers[ target ] = 0;
            jQuery( this ).children().css( 'top', scrollers[ target ] );
        }
        return ret;
    } );
    window.onscroll = function()
    {
        var top = document.body.scrollTop;
        if( navigator.userAgent.indexOf( 'Firefox' ) != -1 || navigator.userAgent.indexOf( 'Opera' ) != -1 ) top = window.pageYOffset;
        else if( navigator.userAgent.indexOf( 'MSIE' ) != -1 ) top = document.documentElement.scrollTop;
        jQuery( '#sg_vod_modal' ).css( 'padding-top', top );
    };
    jQuery( '#vod_list a.modal_opener' ).each( function( k, i )
    {
        jQuery( i ).click( function( e )
        {
            e.preventDefault();
            var date = new Date();
            var hash = jQuery( e.target ).parent( 'a' ).attr( 'id' ).split( 'hash' );
            var mode = hash[ 0 ] == '' ? 'cikk' : hash[ 0 ];
            hash = hash[ 1 ];
            jQuery( '#modal_player' ).html( '' );
            var so = new SWFObject("http://files.indavideo.hu/player/iVodPlayer.swf?b=" + date.getTime(), "ivplayer", "660", "410", "10", "#000", true);
            so.addParam("flashvars", "vID=" + hash + "&amp;onsite=1&amp;autostart=1");
            so.addParam("allowfullscreen", "true");
            so.addParam("allowScriptAccess", "always");
            so.addParam("quality", "best");
            so.addParam("wmode", "opaque");
            so.addParam("salign", "t");
            so.write("modal_player");
            jQuery( '#modal_ad_container iframe' ).attr( 'src', 'http://sportgeza.hu/futball/2010/vb/elo/banner/0/' + mode + '/' );
            jQuery( '#modal_top span' ).html( jQuery( e.target ).parent( 'a' ).attr( 'title' ) );
            return false;
        } );
    } );
}

function bind()
{
    jQuery( document ).keypress( function( e )
    {
        var key = e.charCode;
        if( !key ) key = e.keyCode;
        if( key == 27 ) jQuery( '#modal_top a' ).trigger( 'click' );
    } );
    jQuery( '#modal_target' ).click( function( e )
    {
        var target_id = jQuery( e.target ).attr( 'id' );
        if( target_id == 'sg_vod_modal' || target_id == 'modal_target' ) jQuery( '#modal_top a' ).trigger( 'click' );
    } );
    jQuery( '#modal_top a' ).click( function( e )
    {
        jQuery( '#modal_target' ).unbind( 'click' ).html( '' ).fadeOut();
        if( navigator.appVersion.indexOf( 'MSIE' ) != -1 ) jQuery( '#modal_target' ).hide();
        jQuery( '#modal_top a' ).unbind( 'click' );
        jQuery( document ).unbind( 'keypress' );
        window.onscroll = function() {};
    } );
}

var __html = '<div id="sg_vod_modal">' +
             '  <div id="vod_list">' +
             '      <h4>Legfrissebb videók</h4>' +
             '      <div class="sctrl"><a href="#" id="replay_scroller_up" class="btnscup"></a></div>' +
             '      <div id="replay_scroller" class="scroller">' +
             '          <div id="replay_wrapper" class="scroll_wrap">' +
             '              <ul id="vod_list_ul"></ul>' +
             '          </div>' +
             '      </div>' +
             '      <div class="sctrl down"><a href="#" id="replay_scroller_down" class="btnscdown"></a></div>' +
             '  </div>' +
             '<script type="text/javascript"><!--//--><![CDATA[//><!--' +
	         'webaudit( \'12755759947826\', \'\', \'top\', \'Vb-stat VOD\' ); //--><!]]>' +
	         '</script><div id="modal_top"><span></span><a href="#" onclick="return false;">vissza az oldalra</a></div>' +
             '  <div id="modal_player"></div>' +
             '  <div id="modal_ad_txt"></div>' +
             '  <div id="modal_ad_container"><iframe frameborder="0" scrolling="no"></iframe></div>' +
             '</div>';

/* VB modal video player EDDIG */
(function(c){var a=["DOMMouseScroll","mousewheel"];c.event.special.mousewheel={setup:function(){if(this.addEventListener){for(var d=a.length;d;){this.addEventListener(a[--d],b,false)}}else{this.onmousewheel=b}},teardown:function(){if(this.removeEventListener){for(var d=a.length;d;){this.removeEventListener(a[--d],b,false)}}else{this.onmousewheel=null}}};c.fn.extend({mousewheel:function(d){return d?this.bind("mousewheel",d):this.trigger("mousewheel")},unmousewheel:function(d){return this.unbind("mousewheel",d)}});function b(f){var d=[].slice.call(arguments,1),g=0,e=true;f=c.event.fix(f||window.event);f.type="mousewheel";if(f.wheelDelta){g=f.wheelDelta/120}if(f.detail){g=-f.detail/3}d.unshift(f,g);return c.event.handle.apply(this,d)}})(jQuery);
