
    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 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 = {};

// bookline trackelohoz url
    var scarab_item_id = document.location.href.replace( /:\d+/, '' );
    if( scarab_item_id.indexOf( '.hu/x' ) != -1 ) scarab_item_id = unescape( scarab_item_id.split( 'url=http%3A%2F%2F' )[ 1 ] );
    scarab_item_id = scarab_item_id.split( '?' )[ 0 ].split( '#' )[ 0 ].replace( document.location.protocol + '//', '' );
    if( scarab_item_id.indexOf( document.domain ) != -1 ) scarab_item_id = scarab_item_id.substr( scarab_item_id.indexOf( document.domain ) ).replace( /~\w+\//, '' );
//

    function trigger_share( gatype, gaevent, ctid ) {
        var url = document.location.href.split( '#' )[ 0 ].split( '?' )[ 0 ];
        _gaq.push( ['_trackSocial', gatype, gaevent, url ] );
        jQuery.ajax( {
            url: 'http://' + document.domain + '/x.php',
            data: {
                url: url,
                id: ctid
            },
            success: function() {}
        } )
    }

    function plusone( button ) {
        trigger_share( 'plusone', button.state == 'on' ? 'share' : 'unshare', button.state == 'on' ? 'plusone' : 'minusone' );
    }

    var medialepedo_video_on = false;

    function medialepedo_video( status ) {
        medialepedo_video_on = status;
    }

    function refresh_cimlap() {
        if( medialepedo_video_on ) {
            setTimeout( refresh_cimlap, 300000 ); // 300000
        }
        else document.location.reload();
    }

// puzzle fnct start
    function checkPuzzleStatus( puzzle ) {
        var misplaced = 0;
        jQuery( puzzle.target + ' .piece' ).each( function( k, i ) {
            var x = k % puzzle.pieces.x,
                y = Math.floor( k / puzzle.pieces.x );
            var piece = jQuery( this );
            var pos = getPiecePos( piece );
            if( -pos[ 0 ] != x * ( puzzle.pieces.width - 2 ) || -pos[ 1 ] != y * ( puzzle.pieces.height - 2 ) ) misplaced++;
        } );
        if( !misplaced ) jQuery( puzzle.target ).addClass( 'solved' );

    }
    function getPiecePos( obj ) {
        if( navigator.userAgent.indexOf( 'MSIE' ) !== -1 ) var pos = [ obj.css( 'backgroundPositionX' ).match( /(-|)\d+/g )[ 0 ], obj.css( 'backgroundPositionY' ).match( /(-|)\d+/g )[ 0 ] ]
        else var pos = obj.css( 'backgroundPosition' ).match( /(-|)\d+/g );
        return [ parseInt( pos[ 0 ] ), parseInt( pos[ 1 ] ) ];
    }
    function doThePuzzle( puzzle ) {
        var used = [];
        var holder = jQuery( puzzle.target );
        holder.width( puzzle.pieces.x * puzzle.pieces.width );
        for( var j = 0; j < puzzle.pieces.y; j++ ) {
            for( var i = 0; i < puzzle.pieces.x; i++ ) {
                var rnd = '';
                while( used.indexOf( rnd ) !== -1 || rnd == '' ) {
                    rnd = Math.floor( Math.random() * puzzle.pieces.x ) + '|' + Math.floor( Math.random() * puzzle.pieces.y );
                }
                used.push( rnd );
                rnd = rnd.split( '|' );
                holder.append(
                    jQuery( '<div></div>' ).addClass( 'piece' ).css( {
                        backgroundImage: "url( '" + puzzle.picture + "' )",
                        width: ( puzzle.pieces.width - 2 ) + 'px',
                        height: ( puzzle.pieces.height - 2 ) + 'px',
                        backgroundPosition: ( -rnd[ 0 ] * ( puzzle.pieces.width - 2 ) ) + 'px ' + ( -rnd[ 1 ] * ( puzzle.pieces.height - 2 ) ) + 'px'
                    } )
                );
            }
        }
        jQuery( puzzle.target + ' .piece' ).each( function( k, i ) {
            jQuery( this ).click( function( e ) {
                if( holder.hasClass( 'solved' ) ) return false;
                var selected = jQuery( puzzle.target + ' .piece.selected' ).first(),
                    piece = jQuery( this );
                if( selected.length && !piece.hasClass( 'selected' ) ) {
                    if( navigator.userAgent.indexOf( 'MSIE' ) !== -1 ) {
                        var tmp = piece.css( 'backgroundPositionX' ) + ' ' + piece.css( 'backgroundPositionY' );
                        piece.css( { backgroundPosition: selected.css( 'backgroundPositionX' ) + ' ' + selected.css( 'backgroundPositionY' ) } );
                    }
                    else {
                        var tmp = piece.css( 'backgroundPosition' );
                        piece.css( { backgroundPosition: selected.css( 'backgroundPosition' ) } );
                    }
                    selected.css( { backgroundPosition: tmp } );
                    selected.removeClass( 'selected' );
                    var pos = getPiecePos( piece );
                    piece.css( { backgroundPosition: ( pos[ 0 ] + 1 ) + 'px ' + ( pos[ 1 ] + 1 ) + 'px' } );
                    checkPuzzleStatus( puzzle );
                }
                if( !selected.length ) {
                    piece.addClass( 'selected' );
                    var pos = getPiecePos( piece );
                    piece.css( { backgroundPosition: ( pos[ 0 ] - 1 ) + 'px ' + ( pos[ 1 ] - 1 ) + 'px' } );
                }
                if( selected.length && piece.hasClass( 'selected' ) ) {
                    piece.removeClass( 'selected' );
                    var pos = getPiecePos( piece );
                    piece.css( { backgroundPosition: ( pos[ 0 ] + 1 ) + 'px ' + ( pos[ 1 ] + 1 ) + 'px' } );
                }

            } );
        } );
    }
// puzzle fnct end

// Naptar global object
var Naptar  = {
    scroller: null,
    __init: function() {
        this.scroller = {
            elements: jQuery( '#event_calendar li' ).length,
            element_width: jQuery( '#event_calendar li' ).first().width() + 4,
            pos: 0
        };
        jQuery( '#honapok' ).css( 'left', ( -NaptarStartAt * this.scroller.element_width ) + 'px' );
    },
    scroll: function( dir ) {
        jQuery( '.esemenydate' ).slideUp();
        jQuery( '.esemenyselected' ).removeClass( 'esemenyselected' );
        var ul = jQuery( '#honapok' ),
            pos = parseInt( ul.css( 'left' ) ),
            total_width = ( this.scroller.elements - 1 ) * this.scroller.element_width;
        if( dir == -1 ) {
            if( pos < 0 ) {
                ul.animate( { left: '+=' + this.scroller.element_width }, 500 );
            }
        }
        else {
            if( pos > -total_width ) {
                ul.animate( { left: '-=' + this.scroller.element_width }, 500 );
            }
        }
    }
};

    windowonload = function(e)
    {
// Navi feed ajax & menukezeles
        Navi.__init();
// Naptár
        if( jQuery( '#event_calendar' ).length ) {
            jQuery( '#event_calendar tbody a' ).each( function() {
                jQuery( this ).click( function( e ) {
                    e.preventDefault();
                    var id = '#esemeny' + jQuery( this ).attr( 'id' ).replace( 'event', '' ),
                        is_open = jQuery( id ).css( 'display' ) != 'none';
                    jQuery( '.esemenyselected' ).removeClass( 'esemenyselected' );
                    jQuery( '.esemenydate' ).slideUp();
                    if( !is_open ) {
                        jQuery( this ).addClass( 'esemenyselected' );
                        jQuery( id ).slideToggle();
                    }
                } );
            } );
            Naptar.__init();
            jQuery( '#event_calendar .left' ).each( function() {
                jQuery( this ).click( function( e ) {
                    e.preventDefault();
                    Naptar.scroll( -1 );
                } );
            } );
            jQuery( '#event_calendar .right' ).each( function() {
                jQuery( this ).click( function( e ) {
                    e.preventDefault();
                    Naptar.scroll( 1 );
                } );
            } );
        }
// custom js spec kerdoivhez
        if( document.location.href.indexOf( 'hisz-e_on_a_hitben' ) != -1 ) {
            var texts = [ 'Egy beteg álmatlanságra panaszkodik, esténként nehezen alszik el, reggelente fáradtan ébred. A teljeskörű kivizsgálás semmilyen szervi elváltozást nem mutat. Az orvos egy tablettát ír fel neki, amire a panaszok megszűnnek. Később az orvos elmondja, hogy a szer nem tartalmazott semmiféle hatóanyagot, de hasonló esetekben szerzett tapasztalata alapján gyakran beválik, ezért hatásosnak tartja és szükség esetén használja is. Elmondja azt is, hogy utólag minden esetben tájékoztatni szokta a betegeket erről, függetlenül attól, hogy működött-e a kezelés vagy nem.',
                          'Egy beteg néhány hete tartó hasi puffadásra, fájdalmas görcsökre, időnként laza székletre panaszkodik. A teljeskörű kivizsgálás semmilyen szervi elváltozást nem mutat. Az orvos egy tablettát ír fel neki, amire a panaszok megszűnnek. Később az orvos elmondja, hogy a szer nem tartalmazott semmiféle hatóanyagot, de hasonló esetekben szerzett tapasztalata alapján gyakran beválik, ezért hatásosnak tartja és szükség esetén használja is. Elmondja azt is, hogy utólag minden esetben tájékoztatni szokta a betegeket erről, függetlenül attól, hogy működött-e a kezelés vagy nem.',
                          'Egy beteg hónapok óta tartó deréktáji fájdalmakra panaszkodik. A teljeskörű kivizsgálás semmilyen szervi elváltozást nem mutat. Az orvos egy tablettát ír fel neki, amire a panaszok megszűnnek. Később az orvos elmondja, hogy a szer nem tartalmazott semmiféle hatóanyagot, de hasonló esetekben szerzett tapasztalata alapján gyakran beválik, ezért hatásosnak tartja és szükség esetén használja is. Elmondja azt is, hogy utólag minden esetben tájékoztatni szokta a betegeket erről, függetlenül attól, hogy működött-e a kezelés vagy nem.' ],
                rnd = Math.floor( Math.random() * 3 );
            jQuery( '#submit' ).hide();
            jQuery( '#kerdesek dt' ).each( function( k, i ) {
                if( k == 9 ) {
                    jQuery( this ).before(
                        jQuery( '<input />' ).attr( {
                            type: 'button',
                            value: ' Tovább '
                        } ).css( {
                            display: 'block',
                            margin: '0 auto',
                            width: '100px',
                            height: '25px'
                        } ).click( function() {
                            jQuery( '#kerdesek dt' ).each( function( k, i ) {
                                if( k > 8 ) jQuery( this ).fadeIn().next().fadeIn();
                                if( k == 9 ) jQuery( this ).prev().prev().fadeIn();
                            } );
                            document.location.href = document.location.href.split( '#' )[ 0 ] + '#story';
                            jQuery( '#submit' ).fadeIn();
                        } ),
                        jQuery( '<p></p>' ).text( texts[ rnd ] ).css( {
                            fontWeight: 'bold',
                            fontStyle: 'italic',
                            margin: '40px 0 20px',
                            backgroundColor: '#EEE',
                            padding: '10px',
                            borderRadius: '5px 5px 5px 5px',
                            display: 'none'
                        } ).attr( {
                            id: 'story'
                        } ).prepend(
                            jQuery( '<h3></h3>' ).text( 'Kérjük, figyelmesen olvassa el a következő történetet:' ),
                            jQuery( '<br />' )
                        ),
                        jQuery( '<input />' ).attr( {
                            type: 'hidden',
                            name: 'k_1832',
                            value: rnd + 1
                        } )
                    ).hide().next().hide();
                }
                else if( k > 9 ) jQuery( this ).hide().next().hide();
            } );
        }
// cimlapi meta helyettesito refresh
        if( jQuery( 'body' ).hasClass( 'cimlap' ) ) {
            setTimeout( refresh_cimlap, 1740000 ); //
        }
// mac-en mashova kell pozicionalni a hatteret a felso FB like button mellett,
// hogy ugyan ott legyen, mint ahova a likeolasok szamat rendereli majd
        if( navigator.userAgent.indexOf( 'Mac' ) != -1 ) {
            jQuery( '.fb_iframe_widget iframe' ).each( function() {
                jQuery( this ).css( 'background-position', ( jQuery( this ).parents( 'li.recommend' ).length ? '94' : '69' ) + 'px 1px' );
            } );
        }
//
// cimlap, tulelokeszlet form url formazas
        jQuery( '#tulelokeszlet_currency_submit' ).click( function( e ) {
            var form = jQuery( this ).closest( 'form' ).first(),
                params = [ jQuery( '#tulelokeszlet_currency' ).val(), jQuery( '#tulelokeszlet_amount' ).val(), jQuery( '#tulelokeszlet_transfer_type' ).val() ];
            form.attr( 'action', 'http://index.hu/x.php?id=tul_conv&url=' + escape( 'http://www.napi.hu/arfolyamok/deviza.html?i=' + params.join( '|' ) ) );
        } );
//
//share buttonok
        jQuery( '.sharing .share' ).each( function() {
            jQuery( this ).click( function( e ) {
                e.preventDefault();
                jQuery( this ).parents( '.sharing' ).first().next().fadeToggle();
            } );
        } );
        jQuery( '.sharing .close' ).each( function() {
            jQuery( this ).click( function( e ) {
                e.preventDefault();
                jQuery( this ).parents( '.sharing' ).first().prev().find( '.share' ).click();
            } );
        } );
        if( jQuery( '#sendthis_link_share' ).length ) new Control.Modal( jQuery( '#sendthis_link_share' )[ 0 ], { overlayCloseOnClick: false } );
        if( jQuery( '#sendthis_bottom_link_share' ).length ) new Control.Modal( jQuery( '#sendthis_bottom_link_share' )[ 0 ], { overlayCloseOnClick: false } );
        if( typeof FB != "undefined" ) {
            FB.Event.subscribe( 'edge.create', function( r ) {
                trigger_share( 'facebook', 'like', 'fblike' );
            } );
            FB.Event.subscribe( 'edge.remove', function( r ) {
                trigger_share( 'facebook', 'unlike', 'fbunlike' );
            } );
        }
//
// bookline trackelo
        if( typeof ScarabIndex != "undefined" ) {
            var ids = [];
            jQuery( '#booklinebox' ).find( 'li a' ).each( function() {
                var url = jQuery( this ).attr( 'href' ),
                    parts = url.match( /type=(\d+)&id=(\d+)/g ).shift().split( '&' ),
                    id = parts[ 0 ].split( '=' )[ 1 ] + '/' + parts[ 1 ].split( '=' )[ 1 ];
                if( ids.indexOf( id ) == -1 ) ids.push( id );
            } );
            ScarabIndex.renderBaseline = function() { jQuery( '#booklinebox' ).show(); };
            ScarabIndex.go( scarab_item_id, 'booklinebox_scarab', ids );
            jQuery( '#booklinebox' ).hide();
/*
            Scarab.view( scarab_item_id );
            Scarab.setMerchantId('16536C8B346C3F58');
            Scarab.go();
*/
        }
//
        SortTable.init();
        if( jQuery( '.pp_important' ).length )
        {
            var pp_cookie_name = 'pp_' + document.location.pathname.match( /(\w+\/\d{4}\/\d{2}\/\d{2}\/\w+)/gi )[ 0 ].replace( /\//gi, '' );
            var pp_cookie = false; // zart e a fontosabb reszletek doboz
            if( document.cookie.indexOf( pp_cookie_name + '=true' ) != -1 )
            {
                pp_cookie = true;
                jQuery( '.lead' ).find( 'ul' ).first().hide();
                jQuery( '.pp_important' ).toggleClass( 'closed' );
            }
            jQuery( '.pp_important' ).click( function( e )
            {
                e.preventDefault();
                jQuery( '.lead' ).find( 'ul' ).first().slideToggle( function()
                {
                    pp_cookie = document.cookie.indexOf( pp_cookie_name + '=true' ) == -1;
                    document.cookie = pp_cookie_name + '=' + ( pp_cookie ).toString() + ';';
                    jQuery( '.pp_important' ).toggleClass( 'closed' );
                } );

            } );
        }
//
// kinyithato tablazat
        jQuery( 'div.table_container .table_open' ).click( function( e ) { e.preventDefault(); jQuery( this ).parent( 'div' ).children( '.table' ).slideToggle(); jQuery( this ).blur(); } );
        jQuery( 'div.table_container .table .table_close' ).click( function( e ) { e.preventDefault(); jQuery( this ).parent( '.table' ).slideToggle(); } );
// desktop/mobil verzio valto link
        var mobile_link = document.location.href.split( '?' )[ 0 ].split( '#' )[ 0 ] + '?mobil';
        if( ( document.cookie.toString().indexOf( 'index_mobile=true' ) != -1 ) || ( window.navigator.userAgent.indexOf('Mobile') != -1 ) ) {
            jQuery( '#copyright' ).children( 'span' ).append(
                jQuery( '<span></span>' ).html( ' | ' )
            ).append(
                jQuery( '<a></a>' ).attr( 'href', mobile_link ).html( 'Mobil verzió' ).css( 'font-weight', 'bold' )
            );
        }
        if( window.navigator.userAgent.indexOf('iPad') == -1 && document.cookie.toString().indexOf( 'notification_closed=true' ) == -1 && document.cookie.toString().indexOf( 'index_mobile=true' ) != -1 && window.navigator.userAgent.indexOf('Mobile') != -1 ) {
            jQuery( 'body' ).prepend(
                jQuery( '<div></div>' ).attr( 'id', "notification" ).append(
                    jQuery( '<a></a>' ).addClass( 'msg' ).attr( 'href', mobile_link ).text( 'Tapintson a kényelmesebb mobilélményért!' )
                ).append(
                    jQuery( '<a></a>' ).addClass( 'i_close' ).attr( 'href', '#' ).click( function( e ) {
                        e.preventDefault();
                        var exdate = new Date();
                        exdate.setDate( exdate.getDate() + 3650 );
                        document.cookie = 'notification_closed=true;expires=' + exdate.toUTCString();
                        jQuery( '#notification' ).fadeOut();
                    } )
                )
            );
            if( navigator.userAgent.indexOf( 'Safari' ) != -1 ) jQuery( '#notification' ).width( jQuery( '#notification' ).width() + 20 );
        }
        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' );
                    }
                    jQuery.ajax( { url: 'http://index.hu/x.php', data: { id: 'inxokv2010db', url: 'http://index.hu' } } );
                } );
            }
        }
        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 )
                    {
                        var eredmeny = jQuery( '<div></div>' ).addClass( 'eredmeny' ).html( '&Phi; x 100 = <span>' + Highcharts.numberFormat( params[ 'final' ], 2, ',', '' ) + '</span>' );
//keplet = jQuery( '<div></div>' ).attr( 'id', 'badday_keplet' ).html( '&nbsp;' ),
                        jQuery( '#badday' ).prepend( eredmeny ).find( 'form' ).remove();
/*
                        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);
    }

    function median_webaudit() {
        var d=document,s=screen?screen.width+'x'+screen.height:"";
        var u=d.URL?new String(d.URL):"";
        var r=d.referrer?new String(d.referrer):"";
        return "@s="+s+"@u="+escape(u.substring(0,183))+"@r="+escape(r.substring(0,127));
    }
    var audit_same = Math.floor(Math.random()*100000000)+median_webaudit();
    // regi webaudit same kezeles
    //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;
    //audit_same = audit_same + median_webaudit();
    // regi webaudit same kezeles VEGE

   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 boxRotater = {
		rotate: function( ) {
				jQuery('div.box_rotate_container').each(function(){
					var rotateContainer = jQuery(this); 
					if (boxRotater[rotateContainer.attr('id')] == undefined)
						return;
					jQuery("div[id="+boxRotater[rotateContainer.attr('id')][boxRotater.array_rand(boxRotater[rotateContainer.attr('id')],1)]+"]").css('display', 'block');			
				});
			},
		array_rand : function (input) {
				if (input == undefined)
					return null;
				var rand = Math.floor((Math.random() * input.length));
				return rand;
		}
}
var Navi = {
    ids: [],
    __init: function() {
        this.loadFeed();
        jQuery( '#rovatok li[id]' ).each( function( k, i ) {
            var item = jQuery( this ),
                id = item.attr( 'id' );
            item.mouseover( Navi.over ).mouseout( Navi.out );
            if( item.hasClass( 'selected' ) ) item.prev().addClass( 'no_pipe' );
            if( id != 'cimlap_rovat' ) Navi.ids.push( id );
        } );
    },
    loadFeed: function() {
        jQuery.ajax( {
            url: getHomeLinkPath() + 'assets/static/navi_feed.html',
            success: function( r ) {
                var items = r.split( '<next>' );
                for( var i = 0; i < items.length; i++ ) {
                    jQuery( '#' + Navi.ids[ i ] + ' ul.navi_feed' ).html( items[ i ] );
                }
                setTimeout( Navi.loadFeed, 300000 );
            },
            error: function() {
                setTimeout( Navi.loadFeed, 30000 );
            }
        } );
    },
    out: function( e ) { jQuery( this ).removeClass( 'featured' ).find( 'ul.navi_feed' ).hide(); },
    over: function( e ) {
        var target = jQuery( e.target );
        if( target.attr( 'id' ) != 'featured' && !target.parents( '#featured' ).length ) jQuery( this ).removeClass( 'featured' ).find( 'ul.navi_feed' ).show();
        else jQuery( this ).addClass( 'featured' );
    }
}
/**
 * @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()
    {
        _gaq.push(['_trackEvent', 'printthis', 'nyomtathato', document.location.href.split( '?' )[ 0 ].split( '#' )[ 0 ] ]);
        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;
            jQuery( document.body ).prepend( '<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="_gaq.push([\'_trackEvent\', \'printthis\', \'nyomtatva\', \'' + document.location.href.split( '?' )[ 0 ].split( '#' )[ 0 ] + '\']); window.print(); return false;" /></form></div>' );
//           '<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()
    {
        _gaq.push(['_trackEvent', 'printthis', 'vissza', document.location.href.split( '?' )[ 0 ].split( '#' )[ 0 ]]);
        $$('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';}
    }

    function ipromo(a, hour) {
        if ( typeof hour == "undefined") hour = 24;
        b = getCookie('ipromo4');
        var d = document.getElementById('ipromo');
        if( d )
        {
            var now = new Date();
            tmp = now.getTime();
            var exp = ( tmp + (1000 * 60 * 60 * hour ));
            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 = 'ipromo4=shown; expires='+exp+';'; d.style.display = "none";  }
            if ( a == 2 ) { document.cookie = 'ipromo4=shown; expires='+exp+';'; }
        }
    }

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

    // inda promo v2
    function ipromo2_till_closed(a, hour) {
        if ( typeof hour == "undefined") hour = 24;
        b = getCookie('ipromo2closed');
        var d = document.getElementById('ipromo');
        if( d )
        {
            var now = new Date();
            tmp = now.getTime();
            var exp = ( tmp + (1000 * 60 * 60 * hour ));
            var expt = new Date(exp);
            exp = expt.toGMTString();
            if ( a == 1 ) {
                if (b != '1' )  {
                    d.style.display = "block";
                } else {
                    d.style.display = "none";
                }
            } else if ( a == 2) {
                document.cookie = 'ipromo2closed=1; 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()
{
    // rotater    
    boxRotater.rotate();      
    // UP cimlap
    if( jQuery( '#kereso_24ora' ).length )
    {
        autoComplete.bind( 'szerzo' );
        autoComplete.bind( 'cimkek' );
    }

    var up_image_holder = jQuery( '#godzilla_face' );
    if( up_image_holder.length ) {
        var up_images = document.cookie.match( /up_images=([\d,]+)/g ),
            up_img_count = 16;
        if( up_images ) up_images = up_images[ 0 ].split( /=/ )[ 1 ].split( /,/ );
        if( up_images && up_images.length < up_img_count ) {
            var up_pool = [];
            for( var i = 1; i <= up_img_count; i++ ) {
                var up_temp_id = ( i < 10 ? '0' : '' ) + i;
                if( up_images.indexOf( up_temp_id ) == -1 ) up_pool.push( up_temp_id );
            }
            var up_img_id = up_pool[ Math.floor( Math.random() * up_pool.length ) ];
            up_images.push( up_img_id );
        }
        else {
            do {
                var up_img_id = Math.floor( Math.random() * up_img_count );
                if( up_img_id < 10 ) up_img_id = '0' + up_img_id;
                else up_img_id += '';
            }
            while( up_images && up_images[ up_img_count - 1 ] != up_img_id );
            up_images = [ up_img_id ];
        }
        document.cookie = 'up_images=' + up_images.join( ',' );
        up_image_holder.append(
            jQuery( '<img />' ).attr( {
                src: 'http://index.hu/assets/images/cimlap/godzilla/godzilla_face_' + up_img_id + '.png',
                alt: '',
                border: 0
            } )
        );
    }
//
    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;
    } );

    // IE9 letűzős kampány
    if ( (window.navigator.userAgent.indexOf('Windows NT 6.1') != -1 || window.navigator.userAgent.indexOf('Windows NT 6.0') != -1 )  &&  document.cookie.toString().indexOf( 'ie9_closed=true' ) == -1 ) {
        var today = new Date();
        var day = today.getDate();
        var month = today.getMonth()+1;

        if  ( ( month==12 && ( day==22 || day==23 || day==27 || day==28 )) ||
              ( month==1 && ( day==3  || day==4  || day==10 || day==11 || day==17 || day==18 ))
            ) {
            // Csík
            var _gde_meglfqrkwo = new Image(1,1);
            _gde_meglfqrkwo.src='http://hu.hit.gemius.pl/redot.gif?l=8/tstamp='+(new Date()).getTime()+ '/id=bazqH8dD2884X7bb3164eoXDrqyROaeOpYMvQtbqyGz.e7/stparam=meglfqrkwo/fastid=1224979098645695663';
            jQuery( 'body' ).prepend(
                jQuery( '<div></div>' ).attr( 'id', 'ie9notification' ).append(
                    jQuery( '<a></a>' ).attr( 'href', 'http://hu.hit.gemius.pl/hitredir/id=bazqH8dD2884X7bb3164eoXDrqyROaeOpYMvQtbqyGz.e7/stparam=zenrinlpvj/fastid=1297036692683623599/url=' + encodeURI('http://index.hu/assets/static/ie9/') ),
                    jQuery( '<a></a>' ).attr( 'class', "close" ).attr( 'href', '#' ).click( function( e ) {
                        e.preventDefault();
                        var exdate = new Date();
                        exdate.setDate( exdate.getDate() + 40 );
                        document.cookie = 'ie9_closed=true;expires=' + exdate.toUTCString();
                        jQuery( '#ie9notification' ).fadeOut();
                    } )
                )
            );
        }

        if  ( ( month==12 && ( day==29 || day==30 )) ||
              ( month==1 && ( day==5 || day==6 || day==12 || day==13 || day==19 || day==20 || day==24 || day==25 || day==30 || day==31 ))
            ) {
            //toast
            var _gde_kjqrjpmgjs = new Image(1,1);
            _gde_kjqrjpmgjs.src='http://hu.hit.gemius.pl/redot.gif?l=8/tstamp='+(new Date()).getTime()+ '/id=bazqH8dD2884X7bb3164eoXDrqyROaeOpYMvQtbqyGz.e7/stparam=kjqrjpmgjs/fastid=1224979098645695664';
            jQuery( 'body' ).prepend(
                jQuery( '<div></div>' ).attr( 'id', 'ie9notificationtoast' ).append(
                    jQuery( '<a></a>' ).attr( 'href', 'http://hu.hit.gemius.pl/hitredir/id=bazqH8dD2884X7bb3164eoXDrqyROaeOpYMvQtbqyGz.e7/stparam=xjhinmglen/fastid=1297036692683623600/url=' + encodeURI('http://index.hu/assets/static/ie9/') ),
                    jQuery( '<a></a>' ).attr( 'class', "close" ).attr( 'href', '#' ).click( function( e ) {
                        e.preventDefault();
                        var exdate = new Date();
                        exdate.setDate( exdate.getDate() + 40 );
                        document.cookie = 'ie9_closed=true;expires=' + exdate.toUTCString();
                        jQuery( '#ie9notificationtoast' ).fadeOut();
                    } )
                )
            );
        }
    }
} );

function bind_slide_table()
{
    jQuery( '.szoveg_spec_container' ).find( 'h2' ).find( 'a' ).each( function( k, i )
    {
        var toggler = jQuery( this );
        toggler.click( function( e )
        {
            jQuery( this ).parent().next().each( function( k, i ) { jQuery( this ).slideToggle( function( e ) { jQuery( this ).prev().find( 'a' ).toggleClass( 'open' ).toggleClass( 'close' ); } ); } );
            e.preventDefault();
        } );
        if( toggler.hasClass( 'close' ) ) toggler.parent().next().slideToggle();
    } );
    jQuery( '.szoveg_spec_container' ).find( '.szoveg_close' ).find( 'a' ).each( function( k, i )
    {
        jQuery( this ).click( function( e )
        {
            jQuery( this ).parent().parent().prev().find( 'a' ).trigger( 'click' );
            e.preventDefault();
        } );
    } );
}

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() );
        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(d){d.each(["backgroundColor","borderBottomColor","borderLeftColor","borderRightColor","borderTopColor","color","outlineColor"],function(f,e){d.fx.step[e]=function(g){if(!g.colorInit){g.start=c(g.elem,e);g.end=b(g.end);g.colorInit=true}g.elem.style[e]="rgb("+[Math.max(Math.min(parseInt((g.pos*(g.end[0]-g.start[0]))+g.start[0]),255),0),Math.max(Math.min(parseInt((g.pos*(g.end[1]-g.start[1]))+g.start[1]),255),0),Math.max(Math.min(parseInt((g.pos*(g.end[2]-g.start[2]))+g.start[2]),255),0)].join(",")+")"}});function b(f){var e;if(f&&f.constructor==Array&&f.length==3){return f}if(e=/rgb\(\s*([0-9]{1,3})\s*,\s*([0-9]{1,3})\s*,\s*([0-9]{1,3})\s*\)/.exec(f)){return[parseInt(e[1]),parseInt(e[2]),parseInt(e[3])]}if(e=/rgb\(\s*([0-9]+(?:\.[0-9]+)?)\%\s*,\s*([0-9]+(?:\.[0-9]+)?)\%\s*,\s*([0-9]+(?:\.[0-9]+)?)\%\s*\)/.exec(f)){return[parseFloat(e[1])*2.55,parseFloat(e[2])*2.55,parseFloat(e[3])*2.55]}if(e=/#([a-fA-F0-9]{2})([a-fA-F0-9]{2})([a-fA-F0-9]{2})/.exec(f)){return[parseInt(e[1],16),parseInt(e[2],16),parseInt(e[3],16)]}if(e=/#([a-fA-F0-9])([a-fA-F0-9])([a-fA-F0-9])/.exec(f)){return[parseInt(e[1]+e[1],16),parseInt(e[2]+e[2],16),parseInt(e[3]+e[3],16)]}if(e=/rgba\(0, 0, 0, 0\)/.exec(f)){return a.transparent}return a[d.trim(f).toLowerCase()]}function c(g,e){var f;do{f=d.curCSS(g,e);if(f!=""&&f!="transparent"||d.nodeName(g,"body")){break}e="backgroundColor"}while(g=g.parentNode);return b(f)}var a={aqua:[0,255,255],azure:[240,255,255],beige:[245,245,220],black:[0,0,0],blue:[0,0,255],brown:[165,42,42],cyan:[0,255,255],darkblue:[0,0,139],darkcyan:[0,139,139],darkgrey:[169,169,169],darkgreen:[0,100,0],darkkhaki:[189,183,107],darkmagenta:[139,0,139],darkolivegreen:[85,107,47],darkorange:[255,140,0],darkorchid:[153,50,204],darkred:[139,0,0],darksalmon:[233,150,122],darkviolet:[148,0,211],fuchsia:[255,0,255],gold:[255,215,0],green:[0,128,0],indigo:[75,0,130],khaki:[240,230,140],lightblue:[173,216,230],lightcyan:[224,255,255],lightgreen:[144,238,144],lightgrey:[211,211,211],lightpink:[255,182,193],lightyellow:[255,255,224],lime:[0,255,0],magenta:[255,0,255],maroon:[128,0,0],navy:[0,0,128],olive:[128,128,0],orange:[255,165,0],pink:[255,192,203],purple:[128,0,128],violet:[128,0,128],red:[255,0,0],silver:[192,192,192],white:[255,255,255],yellow:[255,255,0],transparent:[255,255,255]}})(jQuery);

SortTable =
{
    bind: function()
    {
        this.dom.tables = jQuery( 'table.itabla.sortable' );
        for( var i = 0; i < this.dom.tables.length; i++ )
        {
            this.createSortLink( i );
            this.gatherData( i );
        }
    },
    cleanText: function( text )
    {
        return text.trim().toLowerCase().replace( /á/g, 'a' ).replace( /é/g, 'e' ).replace( /í/g, 'i' ).replace( /ó|ö|ő/g, 'o' ).replace( /ú|ü|ű/g, 'u' );
    },
    createSortLink: function( id )
    {
        var table = jQuery( this.dom.tables[ id ] );
        var table_head = table.children( 'thead' ).children( 'tr' );
        if( !table_head.length )
        {
            table_head = table.children( 'tbody' ).children( 'tr' ).first();
            if( !table_head.length )
            {
                table_head = table.children( 'tr' ).first();
                table_head.remove();
                table.children( 'tr' ).wrapAll( jQuery( '<tbody></tbody>' ) );
                table.prepend( jQuery( '<thead></thead>' ).append( table_head ) );
            }
            else
            {
                table_head.remove();
                table.prepend( jQuery( '<thead></thead>' ).append( table_head ) );
            }
            if( !table_head.length ) return false;
        }
        table_head.children( 'td' ).each( function( k, i )
        {
            var cell = jQuery( this ).css( { textAlign: 'right' } );
            var text = cell.html().trim().replace( /&nbsp;/gi, '' );
            cell.empty();
            if( text != '' )
            {
                cell.append(
                    jQuery( '<a></a>' ).attr( 'href', '#' ).css( { paddingLeft: '10px' } ).text( text ).click( function( e )
                    {
                        e.preventDefault();
                        var link = jQuery( this );
                        var is_sorted = link.hasClass( 'sorted' );
                        SortTable.sortBy( k, id );
                        jQuery( 'a.sorted' ).each( function( k, i ) { jQuery( this ).removeClass( 'sorted' ); } )
                        jQuery( 'a.rsorted' ).each( function( k, i ) { jQuery( this ).removeClass( 'rsorted' ); } )
                        link.addClass( ( is_sorted ? 'r' : '' ) + 'sorted' );
                    } )
                );
            }
        } );
    },
    dataTypes: [],
    dom:
    {
        tables: []
    },
    gatherData: function( id )
    {
        var table = [];
        jQuery( this.dom.tables[ id ] ).children( 'tbody' ).children( 'tr' ).each( function( k, i )
        {
            var row = [];
            var is_numeric = false;
            if( !SortTable.dataTypes[ id ] ) SortTable.dataTypes[ id ] = [];
            jQuery( this ).children( 'td' ).each( function( k, i )
            {
                var text = jQuery( this ).html().trim();
                if( !SortTable.dataTypes[ id ][ k ] ) SortTable.dataTypes[ id ][ k ] = !!( text.replace( /(\s|\.)/g, '' ).match( /^(-\d+|\d+)/gi ) != null );
                row.push( text );
                if( !SortTable.dataTypes[ id ][ k ] ) row.push( SortTable.cleanText( jQuery( this ).text() ) );
                else
                {
                    text = text.replace( /\s|\&nbsp;/g, '' ).match( /^-\d+\.\d+|\d+\.\d+|-\d+|\d+/gi );
                    row.push( text == null ? 0 : parseFloat( text[ 0 ] ) );
                }
            } );
            table.push( row );
        } );
        this.rawData.push( table );
    },
    init: function()
    {
        this.bind();
    },
    rawData: [],
    replaceTable: function( id )
    {
        var tbody = jQuery( this.dom.tables[ id ] ).children( 'tbody' );
        tbody.empty();
        for( var i = 0; i < this.rawData[ id ].length; i++ )
        {
            var tr = jQuery( '<tr></tr>' );
            for( var j = 0; j < this.rawData[ id ][ i ].length / 2; j++ )
            {
                tr.append(
                    jQuery( '<td></td>' ).attr( 'align', 'right' ).html( this.rawData[ id ][ i ][ j * 2 ] )
                );
            }
            tbody.append( tr );
        }
        jQuery( this.dom.tables[ id ] ).fadeTo( 256, 1 );
    },
    sortBy: function( column_id, table_id )
    {
        var thead = jQuery( this.dom.tables[ table_id ] ).children( 'thead' );
        if( this.sortField == column_id * 2 + 1 ) this.sortDirection = this.sortDirection == 'ASC' ? 'DESC' : 'ASC';
        else
        {
            this.sortField = column_id * 2 + 1;
            this.sortDirection = 'ASC';
        }
        jQuery( this.dom.tables[ table_id ] ).fadeTo( 256, 0.7, function()
        {
            SortTable.rawData[ table_id ].sort( SortTable.sortDirection == 'ASC' ? SortTable.__sortAsc : SortTable.__sortDesc );
            SortTable.replaceTable( table_id );
        } );
    },
    sortDirection: 'ASC',
    sortField: 0,
    __sortAsc: function( a, b )
    {
        return a[ SortTable.sortField ] < b[ SortTable.sortField ] ? -1 : ( a[ SortTable.sortField ] > b[ SortTable.sortField ] ? 1 : 0 );
    },
    __sortDesc: function( a, b )
    {
        return a[ SortTable.sortField ] > b[ SortTable.sortField ] ? -1 : ( a[ SortTable.sortField ] < b[ SortTable.sortField ] ? 1 : 0 );
    }
};

if( typeof String.prototype.trim !== 'function' ) { String.prototype.trim = function() { return this.replace( /^\s+|\s+$/g, '' ); } }

var SendThis = {
    url: document.location.href.split( '?' )[ 0 ].split( '#' )[ 0 ],
    GA_cancel: function() { _gaq.push( [ '_trackEvent', 'sendthis', 'megse', this.url ] ); },
    GA_submit: function() {
        var to = jQuery( '#sendthis_to' ).val(),
            targets = to == '' ? 0 : to.split( ',' ).length;
        _gaq.push( [ '_trackEvent', 'sendthis', 'elkuldve', this.url, targets ] );
    }
}



var ____prototype_ae_IE9JumpList = ____prototype_ae_IE9JumpList || {};
(function( jumplist ) {
	if ( !navigator.userAgent.toLowerCase().match(/msie (9|10)(\.?[0-9]*)*/) ) {
		return;
	}

	var options = {

		// Basic site information
		siteName: 'Index', // Site Name
		applicationName: 'Index', // Site Name
		startURL: 'http://index.hu', // Homepage URL
		shortcutIcon: 'http://ie9pinning.blob.core.windows.net/files/JumpList/634594322757753282/Main-favicon.ico', // Main Site Icon
		tooltip: '',

		// Dynamic jumplist tasks & notifications
		rssFeedURL: 'http://index.hu/24ora/rss/?stat=true',
		categoryTitle: 'Legolvasottabb az Indexen', // Task group name
		defaultTaskIcon: 'http://ie9pinning.blob.core.windows.net/files/JumpList/634594322757753282/GenericTask-favicon.ico', // Generic task icon
		notifications: true,  // Taskbar notifications

		navButtonColor: false,
		latestFeedItemDate: 0,
		pollInterval: 30000,

		// Jumplist tasks { name: Task Label, action: Task URL, icon: Task Icon }
		staticTasks: [{ name: 'TV műsor',  action: 'http://index.hu/kultur/musor/tv?utm_source=tab&utm_medium=ie9&utm_campaign=ie9_letuzes', icon: 'http://ie9pinning.blob.core.windows.net/files/JumpList/634594322757753282/Task4-favicon.ico', target: 'tab' },{ name: 'Fotó-videó',  action: 'http://index.hu/#medialepedo?utm_source=tab&utm_medium=ie9&utm_campaign=ie9_letuzes', icon: 'http://ie9pinning.blob.core.windows.net/files/JumpList/634594322757753282/Task1-favicon.ico', target: 'tab' },{ name: 'Időjárás',  action: 'http://index.hu/idojaras?utm_source=tab&utm_medium=ie9&utm_campaign=ie9_letuzes', icon: 'http://ie9pinning.blob.core.windows.net/files/JumpList/634594322757753282/Task3-favicon.ico', target: 'tab' },{ name: 'Sportgéza',  action: 'http://sportgeza.hu?utm_source=tab&utm_medium=ie9&utm_campaign=ie9_letuzes', icon: 'http://ie9pinning.blob.core.windows.net/files/JumpList/634594322757753282/Task2-favicon.ico', target: 'tab' },{ name: 'Index címlap',  action: 'http://index.hu?utm_source=tab&utm_medium=ie9&utm_campaign=ie9_letuzes', icon: 'http://ie9pinning.blob.core.windows.net/files/JumpList/634594322757753282/Task0-favicon.ico', target: 'tab' }],

		// Drag and drop site pinning bar
		prompt: false, // Add a site pinning bar on top of my site pages
		barSiteName: 'Index.hu' // Site name as it should appear on the pinning bar
	};

	var lib = {
		dom: {
			meta: function(name, content) {
				var meta = document.createElement('meta');
				meta.setAttribute('name', name);
				meta.setAttribute('content', content);
				return meta;
			},
			link: function(rel, href) {
				var link = document.createElement('link');
				link.setAttribute('rel', rel);
				link.setAttribute('href', href);
				return link;
			},
			div: function() {
				return document.createElement('div');
			}
		},
		net: {
			getJSONP: function( URL ) {
				var script = document.createElement('script');
				script.type = 'text/javascript';
				script.src = URL + ( URL.indexOf('?') != -1 ? '&' : '?' ) + Date.now();
				var head = document.getElementsByTagName('head')[0];
				head.insertBefore(script, head.firstChild);
			}
		}
	};

	jumplist.parseRSSFeed = function parseRSSFeed( news ) {
		try {
			if ( window.external.msIsSiteMode() ) {
				window.external.msSiteModeClearJumpList();
				window.external.msSiteModeCreateJumpList( options.categoryTitle );

				try {
					// RSS feeds
                    if ( news.rss && news.rss.channel && news.rss.channel.item ) {
					    for ( var items = news.rss.channel.item.slice(0, 10), numItems = items.length, i = numItems-1, task, pubDate, newItems = 0, taskTitle = ''; i >= 0; i-- ) {
						    task = items[i];
						    pubDate = Date.parse( task.pubDate );
						    taskTitle = task.title ? ( typeof task.title == 'string' ? task.title : task.title['#cdata-section'] || '' ) : '';
						    window.external.msSiteModeAddJumpListItem( taskTitle, task.link, options.defaultTaskIcon );

						    if ( pubDate > options.latestFeedItemDate ) {
							    newItems++;
							    options.latestFeedItemDate = pubDate;
						    }
					    }
                    } else if ( news.feed && news.feed.entry ) { // Atom feeds
					    for ( var items = news.feed.entry.slice(0, 10), numItems = items.length, i = numItems-1, task, pubDate, newItems = 0, taskTitle = '', link = {}; i >= 0; i-- ) {
						    task = items[i];
						    pubDate = Date.parse( task.published );
						    taskTitle = task.title ? ( typeof task.title == 'string' ? task.title : (task.title['#cdata-section'] ? task.title['#cdata-section'] : task.title['#text'] || '')) : '';

                            if ( task.link ) {
                                if ( typeof task.link == 'string') {
                                    link['@href'] = task.link || '#';
                                } else if ( Object.prototype.toString.call( task.link ) === '[object Array]') {
                                    link = task.link[0];
                                } else {
                                    link = task.link;
                                }
                            }

						    window.external.msSiteModeAddJumpListItem( taskTitle, link['@href'] || '#', options.defaultTaskIcon );

						    if ( pubDate > options.latestFeedItemDate ) {
							    newItems++;
							    options.latestFeedItemDate = pubDate;
						    }
                        }
                    }

					if ( options.notifications && newItems ) {
						window.external.msSiteModeSetIconOverlay('http://buildmypinnedsite.com/icons/overlays/star-notice.ico', numItems + ' unread items');
					}
				} catch ( ex ) {
				}

				window.external.msSiteModeShowJumpList();
			} else {
			}
		} catch ( ex ) {
		}

		window.setTimeout( ____prototype_ae_IE9JumpList.poll, options.pollInterval );
	}

	// Init code
	document.addEventListener('DOMContentLoaded', function() {

		try {
			document.getElementsByTagName('body')[0].onfocus = function() {
				window.external.msSiteModeClearIconOverlay();
			};
		} catch(err) {
		}

		var head = document.getElementsByTagName('head');

		if ( !head ) {
			return;
		}

		head = head[0];

		var links = document.getElementsByTagName('link'), remove = [];

		for ( var i = 0, rel; i < links.length; i++ ) {
			rel = links[i].getAttribute('rel');
			if ( !rel ) {
				continue;
			}
			rel = rel.toLowerCase().replace(/^\s+|\s+$/g, '').replace(/\s+/g, ' ');
			if ( rel == 'icon' || rel == 'shortcut icon' ) {
				remove.push( links[i] );
			}
		}

		for ( i = 0; i < remove.length; i++ ) {
			head.removeChild( remove[i] );
		}

		if ( options.shortcutIcon ) {
			head.appendChild( lib.dom.link('shortcut icon', options.shortcutIcon) );
		}

		head.appendChild( lib.dom.meta('application-name', options.applicationName) );
		head.appendChild( lib.dom.meta('msapplication-tooltip', options.tooltip) );

		if ( options.navButtonColor ) {
			head.appendChild( lib.dom.meta('msapplication-navbutton-color', options.navButtonColor) );
		}

		if ( options.startURL ) {
			head.appendChild( lib.dom.meta('msapplication-starturl', options.startURL) );
		}

		for ( var i = 0, task; i < options.staticTasks.length; i++ ) {
			task = options.staticTasks[i];
			head.appendChild( lib.dom.meta('msapplication-task', 'name=' + task.name + ';action-uri=' + task.action + ';icon-uri=' + task.icon + ';window-type=' + task.target ) );
		}
		if ( options.prompt && !window.external.msIsSiteMode() && sessionStorage.getItem('hideIE9SitePinningBar') != '1' ) {
			var bar = lib.dom.div();
			var barHTML = '<div style="border: 1px solid #E1E1E1; padding: 5px 9px 2px 9px; background: #fff url(http://buildmypinnedsite.com/PinImages/Bar/bar-background.png) repeat-x scroll 0 100%;"><table cellspacing="0" cellpadding="0" style="width: 100%; border: 0 none; border-collapse: collapse;"><tbody><tr><td><div style="background: transparent url(' + options.shortcutIcon.replace(/\.ico$/, ".png") + ') no-repeat scroll 0 3px; background-size: 20px 20px; width: 260px; padding-left: 26px; min-height: 30px; font-weight: bold; font-size:14px;">Experience ' + (options.barSiteName || options.siteName) + '  as a Pinned Site</div></td><td><div style="display: inline-block;padding-right: 40px; position: relative;text-align: right;"><strong style="font-weight: bold; font-size: 18px;">Drag this icon to your taskbar <img src="http://buildmypinnedsite.com/PinImages/Bar/arrow-icon.png" /></strong><div style="color:#797c85; font-size: 12px;">or, <a href="#" onclick="window.external.msAddSiteMode(); return false" style="color: #6CABBA; text-decoration: underline;">click here</a> to add this site to your start menu </div><div style="position: absolute; right:-120px; top: -13px; width: 164px; height: 143px; background: transparent url(http://buildmypinnedsite.com/PinImages/Bar/drag-icon-placeholder.png) no-repeat scroll 0 0;"><img class="msPinSite" style="position: absolute; top:17px; left:16px;cursor: move; width: 32px; height: 32px;" src="' + options.shortcutIcon.replace(/\.ico$/, ".png") + '" /></div></div></td><td><div style="position: relative; float: right; width: 80px; min-height: 30px; padding-left: 23px; padding-right: 30px; background: transparent url(http://buildmypinnedsite.com/PinImages/Bar/info-icon.png) no-repeat scroll 0 6px;"><a style="font-size: 12px; color: #6CABBA; text-decoration: underline;" href="http://www.beautyoftheweb.com/#/productguide/clean/seamless-with-windows-7" target="_blank">Learn about Site Pinning</a><div onclick="document.getElementById(\'___ie9sitepinning__bar_container\').style.display=\'none\';window.sessionStorage.setItem(\'hideIE9SitePinningBar\', \'1\')" style="background: transparent url(http://buildmypinnedsite.com/PinImages/Bar/close-button.png) no-repeat scroll 0 0;position: absolute;top: 0; right: 0;display: block; width: 18px; height: 18px; cursor: pointer; float: right;"></div></div></td></tbody></table></div>';
			bar.setAttribute('style', "position: absolute; top: 0; left: 20px; width: 95%; margin:0; padding:0; border: 0 none; border-bottom:1px solid #707070; color: #1c1f26; background: transparent none no-repeat scroll 0 0; font-family: 'Segoe UI', Arial, tahoma, sans-serif; line-height: 18px; box-shadow: 0 1px 5px rgba(140,140,140,0.7);");
			bar.id = '___ie9sitepinning__bar_container';
			bar.innerHTML = barHTML;
			document.getElementsByTagName('body')[0].appendChild( bar );
		}

		jumplist.poll = function() {
			lib.net.getJSONP( options.rssFeedURL, jumplist.parseRSSFeed );
		};

		window.setTimeout( jumplist.poll, 3 );
	});
})( ____prototype_ae_IE9JumpList );
