
    var indexadengineui = Math.round( Math.random() * 10000000 );
    var same = indexadengineui;
    var adshost = 'sher';
    try {
        document.domain = 'sportgeza.hu';
    } catch (e) {}

    var homelink_path = null;

    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 getHomeLinkPath()
    {
        if( !homelink_path )
        {
            homelink_path = $('homelink').href
        }
        return homelink_path;
    }

    function fix( a ) { a.href = a.href.replace( /NEMSPA_M./g, "" ); return true; }
    function show_more_eredmeny(anchor)
    {
        var eredmeny_tovabbi = $(anchor).up('tbody').previous('.tabella_more');
        var td = $(anchor).up('td');
        if (eredmeny_tovabbi.getStyle('display') == 'none') {
            td.setAttribute('class', 'showless');
            anchor.innerHTML = 'Az első három';
            eredmeny_tovabbi.toggle();
        } else {
            td.setAttribute('class', 'showmore');
            anchor.innerHTML = 'Az összes eredmény';
            eredmeny_tovabbi.toggle();
        }
    }

    function szavazas_kuld(szavazo_form)
    {
       var selected_radio   = getSelectedRadio(szavazo_form.szavazat);
       var szavazo_szavazat = szavazo_form.szavazat[selected_radio].value;
       if (!szavazo_szavazat) {alert('Kérem előbb szavazzon!'); return false;}
       new Ajax.Updater('kinyerma_szavazogep', szavazo_form.action, {
          parameters: { op: 'szavazas', meccsid : szavazo_form.meccsid.value, szavazat : szavazo_szavazat}
       });
    }

    function getSelectedRadio(buttonGroup)
    {
        if (buttonGroup[0]) {
          for (var i=0; i<buttonGroup.length; i++) {
              if (buttonGroup[i].checked) {
                        return i
                    }
                }
            } else {
                    if (buttonGroup.checked) { return 0; } // if the one button is checked, return zero
            }
            return -1;
    }

    function overdiv(flag)
    {
        document.getElementById('csoportok').style.display = flag=='1' ? 'none' : 'block';
    }

    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 toggle_listtable( id )
    {
        if( typeof $( 'eredmeny_item_' + id ).open == 'undefined' || $( 'eredmeny_item_' + id ).open == false ) $( 'eredmeny_item_' + id ).open = true;
        else $( 'eredmeny_item_' + id ).open = false;
        if( $( 'eredmeny_item_' + id ).open )
        {
            $( 'eredmeny_item_' + id ).hide();
            if( $( 'eredmeny_item_' + id ).innerHTML == '' ) new Ajax.Request( tortenelem_url + 'futball/eredmenyek/meccs/' + id, { parameters: { plain: 1, noauth: 1 }, onSuccess: function( data ) { $( 'eredmeny_item_' + id ).update( data.responseText ); Effect.toggle( 'eredmeny_item_' + id, 'blind' ); } } );
            else Effect.toggle( 'eredmeny_item_' + id, 'blind' );
        }
        else Effect.toggle( 'eredmeny_item_' + id, 'blind' );
    }

    function vbmap_highlight()
    {
        var id = jQuery( this ).attr( 'id' );
        id = id.indexOf( 'a' ) != -1 ? id.replace( 'a', 'b' ) : id.replace( 'b', 'a' );
        jQuery( '#' + id ).toggleClass( 'selected' );
    }

    function tabella_ajax_binder()
    {
        jQuery( '.csoportselect td' ).each( function( k, i )
        {
            if( !jQuery( i ).children( 'a' ).hasClass( 'selected' ) )
            {
                jQuery( i ).click( function( e )
                {
                    e.preventDefault();
                    jQuery( '#right_tabella' ).fadeTo( 400, 0.4 );
                    jQuery.ajax(
                    {
                        type: 'POST',
                        url: document.location.href.split( '/vb' )[ 0 ] + '/vb/',
                        data: { op: 'ajax_tabella', csoport: jQuery( this ).children( 'a' ).attr( 'title' ).substr( 0, 1 ) },
                        success: function( r )
                        {
                            jQuery( '#right_tabella' ).html( r );
                            tabella_ajax_binder();
                            jQuery( '#right_tabella' ).fadeTo( 400, 1 );
                        },
                        dataType: 'text'
                    } );
                    return false;
                } );
            }
        } );
    }

    function tabella_szeles_ajax_binder()
    {
        jQuery( '#csoportmenu' ).children( 'li' ).each( function( k, i )
        {
            if( !jQuery( i ).children( 'a' ).hasClass( 'selected' ) )
            {
                jQuery( i ).children( 'a' ).click( function( e )
                {
                    e.preventDefault();
                    jQuery( '#content' ).fadeTo( 400, 0.4 );
                    jQuery( '.tabella.csoportok.eredmeny_tabella' ).css( 'opacity', '0.4' );
                    jQuery.ajax(
                    {
                        type: 'POST',
                        url: document.location.href.split( '/vb' )[ 0 ] + '/vb/',
                        data: { op: 'ajax_szeles_tabella', csoport: jQuery( this ).html() },
                        success: function( r )
                        {
                            jQuery( '.meccstabla_container' ).html( r );
                            jQuery( '#content' ).fadeTo( 400, 1 );
                            jQuery( '#pagecontent' ).children( 'h1' ).html( '<a href="' + document.location.href.split( '/vb' )[ 0 ] + '/vb/eredmenyek/">Összes eredmény</a> <span class="seppa">|</span> Csoportmeccsek' );
                            tabella_szeles_ajax_binder();
                            bind_vod();
                            meccs_sliders();
                        },
                        dataType: 'text'
                    } );
                    return false;
                } );
            }
        } );
    }

    jQuery( document ).ready( function()
    {

        if( jQuery( '#kereso_24ora' ).length )
        {
            autoComplete.bind( 'szerzo' );
            autoComplete.bind( 'cimkek' );
        }
        tabella_ajax_binder();
        tabella_szeles_ajax_binder();
        jQuery( '#menetrend_slider' ).click( function( e )
        {
            jQuery( '#offlist' ).slideToggle();
            jQuery( this ).html( jQuery( this ).html() == 'Összes meccs' ? 'Lista bezárása' : 'Összes meccs' );
            e.preventDefault();
            return false;
        } );
        jQuery( '#vbmap' ).children( '.cname' ).each( function( k, i ) { if( !jQuery( i ).hasClass( 'selected' ) ) jQuery( i ).mouseover( vbmap_highlight ).mouseout( vbmap_highlight ); } );
        jQuery( '#vbmap' ).children( '.cbullet' ).each( function( k, i ) { if( !jQuery( i ).hasClass( 'selected' ) ) jQuery( i ).mouseover( vbmap_highlight ).mouseout( vbmap_highlight ); } );
    } );

// 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' );
    }

    windowonload = function() {
// 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' );
            } );
        }
//
//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' );
            } );
        }
        if( typeof twttr != "undefined" ) twttr.events.bind( 'tweet', function( event ) { trigger_share( 'twitter', 'tweet', 'tweet' ); } );
//
// bookline trackelo
        if( typeof Scarab != "undefined" ) {
            Scarab.view( scarab_item_id );
            Scarab.setMerchantId('16536C8B346C3F58');
            Scarab.go();
        }
//
        if( ( document.cookie.toString().indexOf( 'index_mobile=true' ) != -1 ) || ( window.navigator.userAgent.indexOf('Mobile') != -1 ) )
        {
            jQuery( '#footer_base' ).append(
                jQuery( '<li></li>' ).append(
                    jQuery( '<a></a>' ).attr( 'href', document.location.href.split( '?' )[ 0 ].split( '#' )[ 0 ] + '?mobil' ).html( 'Mobil verzió' ).css( 'font-weight', 'bold' )
                )
            );
        }
        if ( $('sendthis_link') != null ) {
            if ($('sendthis_link')) new Control.Modal( $('sendthis_link'), { overlayCloseOnClick: false } );
            if ($('sendthis_link_bottom')) new Control.Modal( $('sendthis_link_bottom'), { overlayCloseOnClick: false } );
        }
        $$( 'form.vote_monster_form' ).each( function( element )
        {
            Event.observe( element, 'submit', function( event )
            {
                event.stop();
                var selected = null;
                var parameters = 'op=postmini&IS_AJAX_REQUEST=true&method=castvote&noauth=1' + '&mininame=' + element.id.substring( 5 );
                this.getInputs( 'radio', 'option' ).each( function( elem ) { if( elem.getValue() != null ) selected = elem } );
                if( selected != null ) parameters = parameters + '&option=' + selected.value;
                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 = data.responseText;
                    }
                } );
            } );
        } );
        $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>') } );
        });
        $$('A').each( function( i ) { i.href = i.href.replace( /NEMSPA_M./g, "" ); } )
        printify();
        if ( typeof Calendar != 'undefined' )
        {
            if ( $('datum_trigger_c') ) {
                IndexCalendarSetup( $('datum'), $('datum_trigger_c'), function( cal ) { $('datum').form.submit(); }  );
            }
            if ( $('datum_trigger_d') ) {
                IndexCalendarSetup( $('datum_d'), $('datum_trigger_d'), function( cal ) { $('datum_d').form.submit(); }  );
            }
            if ( $('tol_trigger_c') ) {
                IndexCalendarSetup( $('tol'), $('tol_trigger_c')  );
            }
            if ( $('ig_trigger_c') ) {
                IndexCalendarSetup( $('ig'), $('ig_trigger_c')  );
            }

        }
    }

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

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

    function printify()
    {
        if ( $('szoveg') )
        {
            //$('print_orig').checked = false;
            links = $('cikk_pager') ? $$( '#szoveg .oldal A' ) : $('szoveg').getElementsByTagName( 'A' );
            if ( links.length > 0 ) { cikklinks = '<h3 class="print_linkshead">A cikkben hivatkozott linkek:</h3><ul class="print_hivatkozasok">'; }
            cikklis = '';
            j = 0;
            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 );
            }
            szerzok = $('szerzo') ? $('szerzo').getElementsByTagName( 'A' ) : new Array();
            for( i = 0; i < szerzok.length; i++ )
            {
                re = /\?(.*)/g;
                href = szerzok[i].href.replace( 'mailto:', '' ).replace( 'NEMSPA_M', '' ).replace( re, '' );
                szerzok[i].innerHTML = szerzok[i].innerHTML + '<span class="print_szerzo"> - ' + href + '</span>';
            }
            kapcsolodo = $$('#related UL LI A');
            for( i = 0; i < kapcsolodo.length; i++ )
            {
                re = /^(.*?)=http/
                href = unescape( kapcsolodo[i].href.replace( re, 'http' ) );
                kapcsolodo[i].innerHTML = kapcsolodo[i].innerHTML + '<span class="print_anchor"> - ' + href + '</span>';
            }
        }
    }

    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='http://sportgeza.hu/assets/css/printcontrols.css';
                printcontrols_stylesheet.media = 'screen';
                document.getElementsByTagName("head")[0].appendChild( printcontrols_stylesheet );
            }
            //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>' +'<div id="print_ad" style="float: right; margin: 10px 20px 0 0; width: 350px; height: 53px;"><a href="http://sher.index.hu/rd?lc=12349&ad=127288&ui=206802090&li=&tg="><img src="http://sher.index.hu/ad?lc=12349" border="0" title="HirdetĂ©s" alt="HirdetĂ©s" /></a></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>' );
            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 = '15px auto';
        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 auto';
        preview_stylesheet.disabled = true;
        printcontrols_stylesheet.disabled = true;
        if ( $('print_links_container') ) { $('print_links_container').style.display = 'none'; }
        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 showTabella(csoport)
    {
       document.getElementById("tabellaA").style.display = "none";
       document.getElementById("tabellaB").style.display = "none";
       document.getElementById("tabellaC").style.display = "none";
       document.getElementById("tabellaD").style.display = "none";
       document.getElementById("tabella" + csoport).style.display = "block";
       return false;
    }

    function showlinks( meccsid )
    {
        for( i = 0; i < 4; i++ ) {
            e_meccsek = $('e_meccsek_' + i).getElementsByTagName('TR');
            for( j = 0; j < e_meccsek.length; j++ ) {

                if ( e_meccsek[j].id != '' ) e_meccsek[j].style.display = 'none';
            }
            if ( meccsid ) { $( 'm' + meccsid ).style.display = ''; }
        }
    }

    function sh( o )
    {
        o.style.display = o.style.display == 'none' ? '' : 'none';
    }

    function eb2008_select_cikk_box( o )
    {
        $$( '#features .cimlapbox' ).each( function( c ) { c.removeClassName( 'aktiv' ); } )
        $$( '#hirmenu LI A' ).each( function( c ) { c.removeClassName( 'aktiv' ); } )
        $( o.id.replace( '_toggler', '' ) ).addClassName( 'aktiv' );
        o.addClassName( 'aktiv' );
    }

    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();
        }
    }
// VB 2010 menetrend

function meccs_sliders()
{
    var all = jQuery( '.meccslista' ).length - jQuery( '.meccslista.off' ).length;
    var cnt = 0;
    jQuery( '.meccslista' ).each( function( k, i )
    {
        var obj = jQuery( i );
        if( !obj.hasClass( 'off' ) )
        {
            obj.click( function()
            {
                var target = jQuery( this );
                target.toggleClass( 'selected' ).next().slideToggle();
                target.attr( 'title', ( target.attr( 'title' ) == 'Kattintson a kinyitáshoz!' ? 'Kattintson a bezáráshoz!' : 'Kattintson a kinyitáshoz!' ) );
            } );
            cnt += 1;
            if( document.location.href.indexOf( '/eredmenyek' ) != -1 && !k ) obj.trigger( 'click' );
        }
    } );
}
jQuery( document ).ready( function()
{
    meccs_sliders();
/*
    if ( jQuery( '#csoportmenu' ) )
    {
        var url_parts = window.location.href.split('2010/vb/');
        if ( url_parts.length > 1 && !url_parts[1].split('/')[1] )
        {
            jQuery( '#csoportmenu li a' ).each( function( k, e )
            {
                var a = jQuery(e);
                a.click(function(event){
                    jQuery( '#csoportmenu li a' ).each( function( k, e )
                    {
                        jQuery(e).removeClass('selected');
                        jQuery( '#tabella_' + e.id.split('_')[1] ).attr('style',"display: none;");

                    });
                    jQuery( '#tabella_' + this.id.split('_')[1] ).attr('style',"display: '';");
                    jQuery(this).addClass('selected');
                    event.preventDefault();
                    return false;
                });
            });
        }
    }
*/
} );


// VB modal video player

function bind_vod()
{
    jQuery( '.modal_opener' ).each( function( k, i )
    {
        jQuery( i ).click( function( e )
        {
            if( !jQuery( this ).parents( '.vod_kep' ).length )
            {
                var link = this;
                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( link ).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', document.location.href.split( '/vb/' )[ 0 ] + '/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: 'POST',
                        url: document.location.href.split( '/vb' )[ 0 ] + '/vb/',
                        data:
                        {
                            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( this ).attr( 'title' ) );
                bind();
            }
            e.preventDefault();
            return false;
        } );
    } );
}
jQuery( document ).ready( function()
{
    jQuery( document.body ).append( jQuery( '<div id="modal_target"></div>' ) );
    if( document.location.href.indexOf( '/vb/videok' ) != -1 && document.location.href.split( 'vb/videok/' ).length > 1 )
    {
      var hash = document.location.href.split( 'vb/videok/' )[ 1 ].split( '/' )[ 0 ].split( '?' )[ 0 ].split( '#' )[ 0 ];
    }
    if( hash != '' )
    {
        jQuery( '.modal_opener' ).each( function( k, i )
        {
            if( jQuery( i ).attr( 'id' ).indexOf( hash ) != -1 ) setTimeout( "jQuery( '#" + jQuery( i ).attr( 'id' ) + "' ).trigger( 'click' )", 300 );
        } );
    }
    bind_vod();
} );

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;

function scroll( 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( "scroll( '" + 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; scroll( 'replay_wrapper' ); } ).mouseup( function() { stop_scroll(); } );
    jQuery( '#replay_scroller_down' ).click( function() { return false; } ).mousedown( function() { stop_scroll(); scroll_step = scroll_big_step; scroll( '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', document.location.href.split( '/vb/' )[ 0 ] + '/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><a href="/futball/2010/vb/videok/">Videók</a></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>' +
             '  <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>';

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

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 EredmenyRefresh = {
    base_url: '',
    esemeny_id: 0,
    interval: 30000,
    last_update: 0,
    checkEredmeny: function() {
        setTimeout( function() {
            var d = new Date(),
                p = {};
            p[ 't' + d.getTime() ] = true;
            jQuery.ajax( {
                url: EredmenyRefresh.base_url + EredmenyRefresh.type + '_' + EredmenyRefresh.esemeny_id + '_time.cache',
                data: p,
                success: function( r ) {
                    if( r != EredmenyRefresh.last_update ) {
                        EredmenyRefresh.last_update = r;
                        EredmenyRefresh.updateEredmeny();
                    }
                    EredmenyRefresh.checkEredmeny();
                },
                error: function( r ) {
                    if( r.status != 404 ) EredmenyRefresh.checkEredmeny();
                }
            } );
        }, this.interval );
    },
    init: function( id, time, type ) {
        this.base_url = document.location.href.match( /http:\/\/(.*).hu\/(~\w+\/|)/g )[ 0 ] + 'assets/static/eredmenyek/';
        this.esemeny_id = id;
        this.last_update = time;
        this.type = type;
        this.checkEredmeny();
    },
    updateEredmeny: function() {
        var d = new Date(),
            p = {};
        p[ 't' + d.getTime() ] = true;
        jQuery.ajax( {
            data: p,
            url: this.base_url + this.type + '_' + this.esemeny_id + '_eredmeny.cache',
            success: function( r ) {
                jQuery( '.eredmenyek_cikk_bottom' ).fadeOut( function() { jQuery( this ).empty().html( r ).fadeIn(); } );
            }
        } );
    }
};

