function fw3k_thumb_gallery( p_arr_entiteti, p_thumb_variation, p_thumbs_per_page, p_url_target, p_id_suff, p_app_rewrite_base, p_use_additional_overlay, p_use_hover_thumb )
{
    if(p_arr_entiteti.length == 0) return false;

    var SLIKA_ID = 0;
    var ENTITET_OPIS = 1;
    var URL = 2;

    this._arr_entiteti = p_arr_entiteti;

    this._current_page = 1;
    this._current_index = 0;

    this._total_pages = 1;
    this._thumbs_per_page = p_thumbs_per_page;

    this._id_suff = p_id_suff;

    this._url_target = p_url_target;
    this._thumb_variation = p_thumb_variation;

    this._fade_inout = true;

    this._app_rewrite_base = p_app_rewrite_base;

    this._use_additional_overlay = p_use_additional_overlay;

    this._use_hover_thumb = p_use_hover_thumb;
    
    this._init = function()
    {
        this._total_pages = Math.ceil( this._arr_entiteti.length / this._thumbs_per_page);
        this.show_thumbs();

        this.show( 0 );
    }

    this.show_thumbs = function()
    {
        var _obj_instance = this;
        var _thumb_variation = this._thumb_variation;
        var _id_suff = this._id_suff;

        var _app_rewrite_base = this._app_rewrite_base;

        for ( index = 0; index < this._thumbs_per_page; index++ ){

            var _current_abs_index = this._get_absolute_index( index, this );

            if( _current_abs_index <= this._arr_entiteti.length -1 ){

                var thumb_el = document.getElementById( 'galerija_thumb_' + (index + 1) + '_' + _id_suff );

                $('#galerija_thumb_' + (index + 1) + '_' + _id_suff).hide();

                var _index = parseInt( thumb_el.id.substr( 'galerija_thumb_'.length, thumb_el.id.length - 'galerija_thumb_'.length - _id_suff.length - 1 ) );
                var _abs_index = parseInt( _obj_instance._get_absolute_index( ( _index - 1 ), _obj_instance ) );
                var arr_entitet = _obj_instance._arr_entiteti[ _abs_index ];

                $('#galerija_spinner_' + (_index ) + '_' + _id_suff).show();                

                if( typeof( arr_entitet ) != 'undefined' ){
                    
                    var _url = arr_entitet[ URL ];

                    var _slika_id = arr_entitet[ SLIKA_ID ];
                    var _opis = arr_entitet[ ENTITET_OPIS ];

                    var _galerija_thumb_id = '#galerija_thumb_' + _index + '_' + _id_suff;
                    var _galerija_caption_id = '#galerija_caption_' + _index + '_' + _id_suff;

                    
                    _html_slika = '<a href="' + _url +'"><img src="' + _app_rewrite_base + 'fw3k/util_scripts/get_slika_varijacija.php?slika_id=' + _slika_id + '&amp;var_suff=' + _thumb_variation + '" onload="javascript:obj_gallery_' + _id_suff + '.hide_spinner(' + _index + ')" border="0" />';

                    if (this._use_additional_overlay) {
                        _html_slika += '<span class="photogallery_name_container"><div class="photogallery_overlay"></div><h4>' + _opis + '</h4></span>';
                    }
                    _html_slika += '</a>';
                    _html_caption = '<a href="' + _url +'">' + _opis + '</a>';

                    $( _galerija_thumb_id ).html( _html_slika );
                    $( _galerija_caption_id ).html( _html_caption );

                    
                    if (this._use_hover_thumb /*&& !($.browser.msie && $.browser.version=='6.0')*/) {
                    	this.set_img_hover(_galerija_thumb_id, _slika_id);
                    }

                    if( $.browser.opera ){
                        _obj_instance.hide_spinner(_index);
                    }
                }
            } else {
                // prikazi prazan thumb
                $( '#galerija_thumb_' + (index + 1) + '_' + this._id_suff ).html( '&nbsp;' );
                $( '#galerija_caption_' + (index + 1) + '_' + this._id_suff ).html( '&nbsp' );
            }
        }

    }

    this.set_img_hover = function (parent, slika_id)
    {
    	var _app_rewrite_base = this._app_rewrite_base;
    	
    	var parent_cont = $(parent);

    	var img_src = _app_rewrite_base + 'fw3k/util_scripts/get_slika_varijacija.php?slika_id=' + slika_id + '&var_suff=';
    	
    	var preload_img = new Image();
    	preload_img.src = img_src + '190x125';
    	
    	var a    = parent_cont.find('a');
    	var img  = a.find('img');
    	var span = a.find('span.photogallery_name_container');

    	var _img;
    	a.hover(function() {
    		img.css({
    			width: '190px',
    			height: '125px'
			}).attr('src', img_src +  '190x125');
    		parent_cont.css({'z-index': '1000'});
    		a.css({
    			position: 'absolute',
    			'z-index': '1000',
    			top: '-40px',
    			left: '-55px',
    			width: '190px',
    			height: '125px',
    			display: 'block'
    		});
    		a.addClass('frame');
    		span.css('display', 'block');
    	}, function() {
    		a.removeClass('frame');
    		img.css({
				width: '83px',
				height: '54px'
			});
    		img.attr('src', img_src  + '83x54');
    		span.css('display', 'none');
    		parent_cont.css({'z-index': '50'});
    		a.css({
    			position: 'relative',
    			'z-index': '50',
				top: '0',
    			left: '0',
    			width: '83px',
    			height: '54px'
    		});
		});
    }

    this.show = function( p_index )
    {
        // evenutalno promijeni klasu trenutno aktivnog thumba
    }

    this.next = function()
    {
        if( this._get_absolute_index( this._current_index ) < (this._arr_entiteti.length - 1) ){
            this._current_index ++;

            // ako prelazimo na slijedecu stranicu
            if( this._current_index > this._thumbs_per_page - 1 ){
                this._current_index = 0;
                this._current_page++;

                this.show_thumbs();
            }

            this.show( this._current_index );
        }
    }

    this.hide_spinner = function( p_index )
    {
        //alert( 'pozvan' );
        var _galerija_thumb_id = '#galerija_thumb_' + p_index + '_' + this._id_suff;
        $( _galerija_thumb_id ).show();
        $( '#galerija_spinner_' + (p_index ) + '_' + this._id_suff ).hide();
    }

    this.prev = function()
    {
        if( this._get_absolute_index( this._current_index ) > 0 ){
            this._current_index --;

            // ako prelazimo na prethodnu stranicu
            if( this._current_index < 0){
                this._current_index = this._thumbs_per_page - 1;
                this._current_page--;

                this.show_thumbs();
            }

            this.show( this._current_index );
        }
    }

    this.next_page = function()
    {
        if( this._current_page < this._total_pages ){
            this._current_page ++;
            this._current_index = 0;

            this.show_thumbs();
            //this.show( this._current_index );
        }
    }

    this.prev_page = function()
    {
        if( this._current_page > 1 ){
            this._current_page --;
            this._current_index = this._thumbs_per_page - 1;

            this.show_thumbs();
            //this.show( this._current_index );
        }
    }

    // index je zero based
    this._get_absolute_index = function( p_index, p_obj_instance )
    {
        return (p_obj_instance._current_page - 1) * p_obj_instance._thumbs_per_page + p_index;
    }

    if( typeof( this._app_rewrite_base ) == 'undefined' ){
        this._app_rewrite_base = '';
    }

    if( typeof( this._use_additional_overlay ) == 'undefined' ){
        this._use_additional_overlay = true;
    }

    if( typeof( this._use_hover_thumb ) == 'undefined' ){
        this._use_hover_thumb = false;
    }

    this._init();
}


function gallery_controller( p_arr_entiteti, p_size, p_url_template, p_url_target, p_galerija_suff, p_app_rewrite_base, p_use_additional_overlay, p_use_hover_thumb )
{
    if(p_arr_entiteti.length == 0) return false;

    var THUMB_COUNT = 0;

    var SLIKA_ID = 1;
    var ENTITET_TIP = 0;
    var ENTITET_OPIS = 2;
    var VIDEO_TIP = 3;
    var VIDEO_CODE = 4;
    var KEYFIELD_VALUE = 5;

    this._arr_entiteti = p_arr_entiteti;
    this._size = p_size;

    this._current_page = 1;
    this._current_index = 0;

    this._total_pages = 1;
    this._thumbs_per_page = 0;

    this._main_varijacija = null;

    this._galerija_suff = p_galerija_suff;
    this._use_additional_overlay = p_use_additional_overlay;
    this._use_hover_thumb = p_use_hover_thumb;

    // array sa brojem thumbova ovisno o velicini galerije
    this._arr_size_defs = [
    [5],
    [2]
    ];

    // array sa velicinom glavne slike ovisno o velicini galerije
    this._arr_img_size = [
    ['500x329f'],
    ['w185']
    ];

    // array sa velicinom thumba ovisno o velicini galerije
    this._arr_thumb_size = [
    ['83x54'],
    ['83x54']
    ];

    this._url_template = p_url_template;
    this._url_target = p_url_target;
    
    this._app_rewrite_base = p_app_rewrite_base;

    this._init = function()
    {
        this._thumbs_per_page = this._arr_size_defs[ this._get_size_index() ][ THUMB_COUNT ];
        this._total_pages = Math.ceil( this._arr_entiteti.length / this._thumbs_per_page);
        this._main_varijacija = this._arr_img_size[ this._get_size_index() ][ 0 ];
        this.show_thumbs();

        this.show( 0 );
    }

    this.show_thumbs = function()
    {
        var _html = '';
        // popuni thumbs dio
        var _thumb_size = this._arr_thumb_size[ this._get_size_index() ];

        var _app_rewrite_base = this._app_rewrite_base;
        
        for ( index = 0; index < this._thumbs_per_page; index++ ){
            var _abs_index = this._get_absolute_index( index );

            var arr_entitet = this._arr_entiteti[ _abs_index ];

            var _galerija_thumb_id = '#galerija_thumb_' + (index + 1) + '_' + this._galerija_suff;

            if( _abs_index <= this._arr_entiteti.length -1 ){
                // prikazi thumb

            	var _slika_id = arr_entitet[ SLIKA_ID ];

                if( arr_entitet[ ENTITET_TIP ] != 1 ){
                    // video
                    _html = '<a href="javascript:obj_galerija_' + this._galerija_suff +'.show(' + index + ')"><img src="' + _app_rewrite_base + 'fw3k/util_scripts/get_slika_varijacija.php?slika_id=' + _slika_id + '&var_suff=' + _thumb_size + '" border="0" />';
                } else {
                    // slika
                    _html = '<a href="javascript:obj_galerija_' + this._galerija_suff +'.show(' + index + ')"><img src="' + _app_rewrite_base + 'fw3k/util_scripts/get_slika_varijacija.php?slika_id=' + _slika_id + '&var_suff=' + _thumb_size + '" border="0" />';
                }
                if (this._use_additional_overlay) {
                    _html += '<span class="video_name_container"><div class="video_overlay"></div><h4>' + arr_entitet[ ENTITET_OPIS ] + '</h4></span>';
                }
                _html += '</a>';

                $(_galerija_thumb_id).html(_html);
                
                if (this._use_hover_thumb) {
                	this.set_img_hover(_galerija_thumb_id, _slika_id);
                }
                
            } else {
                // prikazi prazan thumb
                $( '#galerija_thumb_' + (index + 1) + '_' + this._galerija_suff ).html( '&nbsp;' );
            }
        }

    }

    this.set_img_hover = function (parent, slika_id)
    {
    	var _app_rewrite_base = this._app_rewrite_base;
    	
    	var parent_cont = $(parent);

    	var img_src = _app_rewrite_base + 'fw3k/util_scripts/get_slika_varijacija.php?slika_id=' + slika_id + '&var_suff=';
    	
    	var preload_img = new Image();
    	preload_img.src = img_src + '190x125';
    	
    	var a    = parent_cont.find('a');
    	var img  = a.find('img');
    	var span = a.find('span.video_name_container');
    	
    	a.hover(function() {
    		img.css({
    			width: '190px',
    			height: '125px'
			}).attr('src', img_src +  '190x125');
    		parent_cont.css({'z-index': '1000'});
    		a.css({
    			position: 'absolute',
    			'z-index': '1000',
    			top: '-40px',
    			left: '-55px',
    			width: '190px',
    			height: '125px',
    			display: 'block'
    		});
    		a.addClass('frame');
    		span.show();
    	}, function() {
    		a.removeClass('frame');
    		img.css({
				width: '83px',
				height: '54px'
			});
    		img.attr('src', img_src  + '83x54');
    		span.hide();
    		parent_cont.css({'z-index': '50'});
    		a.css({
    			position: 'relative',
    			'z-index': '50',
				top: '0',
    			left: '0',
    			width: '83px',
    			height: '54px'
    		});
		});
    }

    
    this.show = function( p_index )
    {
        this._current_index = p_index;

        var arr_entitet = this._arr_entiteti[ this._get_absolute_index( p_index ) ];

        var _app_rewrite_base = this._app_rewrite_base;
        
        if( (arr_entitet != 'undefined') ){

            var _omjer_id = 0;

            var _url_template = this._url_template;
            var _url_target = this._url_target;
            var _var_suff = this._main_varijacija;
            var _size = this._size;
            var _galerija_suff = this._galerija_suff;

            var _obj_gallery = this;

            if( _url_target == null ){
                _url_target = '_self';
            }

            $( '#galerija_canvas_' + _galerija_suff ).fadeOut( 50, function()
            {

                $( '#galerija_spinner_' + _galerija_suff ).show();

                if( arr_entitet[ ENTITET_TIP ] == 1 ){
                    //alert( 'tu sam!' );

                    var _html = '<img id="galerija_image" onload="javascript:obj_galerija_' + _galerija_suff + '.hide_spinner()" src="' + _app_rewrite_base + 'fw3k/util_scripts/get_slika_varijacija.php?slika_id=' + arr_entitet[ SLIKA_ID ] + '&var_suff=' + _var_suff + '" border="0">';

                    if( _url_template != null ){
                        //alert( this._url_template );
                        _url_template = _url_template.replace( '{id}', arr_entitet[ KEYFIELD_VALUE ] );
                        _url_template = _url_template.replace( '{slika_id}', arr_entitet[ SLIKA_ID ] );
                        
                        _html = '<a href="' + _url_template + '" target="' + _url_target + '">' + _html + '</a>';

                        //_link = '<a href="' + _url_template.replace( '{id}', arr_entitet[ KEYFIELD_VALUE ] ) + '" target="' + _url_target + '">' + _link + '</a>';
                    }

                    // slika
                    $( '#galerija_canvas_' + _galerija_suff ).html( _html );
                    //alert( _html );
                    if( $.browser.opera ){
                        _obj_gallery.hide_spinner();
                    }
                    // link
                    //$( '#galerija_link_' + _galerija_suff ).html( _link );

                } else {
                    //alert( '#galerija_canvas_' + _galerija_suff );
                    var video_code = arr_entitet[ VIDEO_CODE ];
                    var video_tip = arr_entitet[ VIDEO_TIP ];
                    // video
                    $('#galerija_canvas_' + _galerija_suff ).load( _app_rewrite_base + 'index.php?cmd=ajax_show_video&video_code=' + video_code + '&video_tip=' + video_tip + '&video_slika_id=' + arr_entitet[ SLIKA_ID ] + '&size=' + _size, null, function()
                    {
                        // sakrij spinner
                        $( '#galerija_spinner_' + _galerija_suff ).hide();
                        $( '#galerija_canvas_' + _galerija_suff ).show();
                    }
                    );

                    if( _url_template != null ){
                        var _txt_link = '<a href="' + _url_template.replace( '{id}', arr_entitet[ KEYFIELD_VALUE ] ) + '" target="' + _url_target + '">' + arr_entitet[ ENTITET_OPIS ] + '</a>';

                        $( '#galerija_canvas_caption_link_' + _galerija_suff ).html( _txt_link );
                    }
                }


            });

            // prikazi caption
            $( '#galerija_canvas_caption_' + _galerija_suff ).text( arr_entitet[ ENTITET_OPIS ] );

            // ukoliko postoji funkcija za update velicine captiona pozovi ju
            if( typeof( update_gallery_caption_height ) != 'undefined' ){
                update_gallery_caption_height();
            }

            // prikazi lead
            $( '#galerija_canvas_lead_' + _galerija_suff ).text( arr_entitet[ 3 ] );

            // prikazi poziciju
            $( '#galerija_status_' + _galerija_suff ).text( (this._get_absolute_index( this._current_index ) + 1) + '/' + this._arr_entiteti.length );
        }
    }

    this.next = function()
    {
        if( this._get_absolute_index( this._current_index ) < (this._arr_entiteti.length - 1) ){
            this._current_index ++;

            // ako prelazimo na slijedecu stranicu
            if( this._current_index > this._thumbs_per_page - 1 ){
                this._current_index = 0;
                this._current_page++;

                this.show_thumbs();
            }

            this.show( this._current_index );
        }
    }

    this.prev = function()
    {
        if( this._get_absolute_index( this._current_index ) > 0 ){
            this._current_index --;

            // ako prelazimo na prethodnu stranicu
            if( this._current_index < 0){
                this._current_index = this._thumbs_per_page - 1;
                this._current_page--;

                this.show_thumbs();
            }

            this.show( this._current_index );
        }
    }

    this.next_page = function()
    {
        if( this._current_page < this._total_pages ){
            this._current_page ++;
            this._current_index = 0;

            this.show_thumbs();
            //this.show( this._current_index );
        }
    }

    this.prev_page = function()
    {
        if( this._current_page > 1 ){
            this._current_page --;
            this._current_index = this._thumbs_per_page - 1;

            this.show_thumbs();
            //this.show( this._current_index );
        }
    }


    this.hide_spinner = function()
    {
        $( '#galerija_spinner_' + this._galerija_suff ).hide();
        $( '#galerija_canvas_' + this._galerija_suff ).fadeIn( 50 );
    }

    this.show_spinner = function()
    {
        //$( '#galerija_canvas' ).html( '&nbsp;' );
        $( '#galerija_canvas_' + this._galerija_suff ).hide();
        $( '#galerija_spinner_' + this._galerija_suff ).show();
    }

    this._get_size_index = function()
    {
        if( this._size == 'default' ){
            return 0;
        }
        if( this._size == 'small' ){
            return 1;
        }
        return null
    }

    // index je zero based
    this._get_absolute_index = function( p_index )
    {
        return (this._current_page - 1) * this._arr_size_defs[ this._get_size_index() ][ THUMB_COUNT ] + p_index;
    }

    if( typeof( this._app_rewrite_base ) == 'undefined' ){
        this._app_rewrite_base = '';
    }

    if( typeof( this._use_hover_thumb ) == 'undefined' ){
        this._use_hover_thumb = false;
    }
    
    this._init();
}


function fw3k_anketa_controller( p_anketa_id, p_app_rewrite_base, p_answer_count )
{

    this._anketa_id = p_anketa_id;
    this._app_rewrite_base = p_app_rewrite_base;
    this._url = p_app_rewrite_base + (window.location.href.indexOf('/sport/')>-1 ? 'sport/' : '') +'index.php?cmd=show_anketa&anketa_id=' + p_anketa_id;
    this._window_parameters = 'width=640, height=480, scrollbars=yes';
    this.additional_parameters = '';
	this._answer_count = parseInt( p_answer_count );

    this.set_cookie = function( name, value, expires, path, domain, secure )
    {
        // set time, it's in milliseconds
        var today = new Date();
        today.setTime( today.getTime() );

        /*
        if the expires variable is set, make the correct
        expires time, the current script below will set
        it for x number of days, to make it for hours,
        delete * 24, for minutes, delete * 60 * 24
        */
        if ( expires )
        {
            expires = expires * 1000 * 60 * 60 * 24;
        }
        var expires_date = new Date( today.getTime() + (expires) );

        document.cookie = name + "=" +escape( value ) +
            ( ( expires ) ? ";expires=" + expires_date.toGMTString() : "" ) +
            ( ( path ) ? ";path=" + path : "" ) +
            ( ( domain ) ? ";domain=" + domain : "" ) +
            ( ( secure ) ? ";secure" : "" );
    }

    this.get_cookie = function( name ) {

        var start = document.cookie.indexOf( name + "=" );
        var len = start + name.length + 1;
        if ( ( !start ) && ( name != document.cookie.substring( 0, name.length ) ) )  { return null; }
        if ( start == -1 ) return null;

        var end = document.cookie.indexOf( ";", len );
        if ( end == -1 ) end = document.cookie.length;
        return unescape( document.cookie.substring( len, end ) );
    }



    this.glasaj = function()
    {
        var _input_name = 'anketa_' + this._anketa_id;

        var _cookie = 'VECERNJI_aodg_'+this._anketa_id;
        var _cookie_val = this.get_cookie(_cookie);
        if (_cookie_val == null) {
            this.set_cookie(_cookie, 0, false, '/');
        }

        var _odgovor_id = $( "input[@name='" + _input_name + "']:checked" ).val();

        if( typeof( _odgovor_id ) != 'undefined' ){
            if( typeof( document.getElementById( 'float_anketa' ) ) != 'undefined' ){
                $( '#float_overlay' ).show();
                $( '#float_spinner' ).show();
                $( '#float_anketa' ).hide();

                $( '#float_anketa' ).load( this._url + '&action=odgovori&odgovor_id=' + _odgovor_id + this.additional_parameters, '', function()
                {
                    $( '#float_overlay' ).show();
					$( '#float_spinner' ).hide();
                    $( '#float_anketa' ).show();
                }
                );

            } else {
                var obj_win = window.open( this._url + '&action=odgovori&odgovor_id=' + _odgovor_id + this.additional_parameters, 'obj_win', this._window_parameters );
            }
        }
    };

	this.ocjeni = function()
	{
        var _form_name = 'forma_anketa_' + this._anketa_id;

        var _cookie = 'VECERNJI_aodg_'+this._anketa_id;
        var _cookie_val = this.get_cookie(_cookie);
        if (_cookie_val == null) {
            this.set_cookie(_cookie, 0, false, '/');
        }

		var $form = $('#'+_form_name);
		var inputs = $( '#'+_form_name+' input:radio:checked' )
		var select_count =  inputs.length;

		// imamo sve odgovore
		if ( ( select_count > 0 ) && ( select_count == this._answer_count ) )
		{
			// kreiranje querystringa sa odgovorima
			var arr = [];
			$.each(inputs, function(idx,value)
				{
					odgovor_id = $(value).attr('rel');
					var odg = 'o['+odgovor_id+']='+$(value).val();
					arr.push( odg );

				}
			);

			var odg_qstr = arr.join('&');

			var _url = this._url + '&action=ocjeni&'+odg_qstr;

			if( typeof( document.getElementById( 'float_anketa' ) ) != 'undefined' )
			{
                $( '#float_overlay' ).show();
                $( '#float_spinner' ).show();
                $( '#float_anketa' ).hide();

                $( '#float_anketa' ).load(_url, null, function()
					{
					    $( '#float_overlay' ).show();
						$( '#float_spinner' ).hide();
					    $( '#float_anketa' ).show();
					}
                );

			} else {
                var obj_win = window.open( _url, 'obj_win', this._window_parameters );
			}
		}


	}

	this.captcha_glasaj = function() {
		var _input_name= 'anketa_' + this._anketa_id;

        var _cookie = 'VECERNJI_aodg_'+this._anketa_id;
        var _cookie_val = this.get_cookie(_cookie);
        if (_cookie_val == null) {
            this.set_cookie(_cookie, 0, false, '/');
        }

        var _odgovor_id   = $( "form#captcha input[@name='" + _input_name + "']:checked" ).val();
		var _captcha_hash = $( "form#captcha #captcha_hash").val();
		var _captcha_str  = escape($( "form#captcha #captcha").val());

        if( typeof( _odgovor_id ) != 'undefined' ){
            if( typeof( document.getElementById( 'float_anketa' ) ) != 'undefined' ){
                $( '#float_overlay' ).show();
                $( '#float_spinner' ).show();
                $( '#float_anketa' ).hide();

                $( '#float_anketa' ).load( this._url + '&action=odgovori&captcha=true&captcha_str=' + _captcha_str + '&captcha_hash=' + _captcha_hash + '&odgovor_id=' + _odgovor_id + this.additional_parameters, '', function()
                {
					$( '#float_overlay' ).show();
					$( '#float_spinner' ).hide();
                    $( '#float_anketa' ).show();
                }
                );

            } else {
                var obj_win = window.open( this._url + '&action=odgovori&odgovor_id=' + _odgovor_id + this.additional_parameters, 'obj_win', this._window_parameters );
            }
        }
	}

    this.rezultati = function()
    {
        if( typeof( document.getElementById( 'float_anketa' ) ) != 'undefined' ){
            $( '#float_overlay' ).show();
            $( '#float_spinner' ).show();
            $( '#float_anketa' ).hide();
            $( '#float_anketa' ).load( this._url + this.additional_parameters, '', function()
            {
                $( '#float_spinner' ).hide();
                $( '#float_anketa' ).show();
            }
            );

        } else {
            var obj_win = window.open( this._url + this.additional_parameters, 'obj_win', this._window_parameters );
        }
    };

    fw3k_anketa_controller.close = function()
    {
        $( '#float_overlay' ).hide();
        $( '#float_anketa' ).hide();
    }

}


function naslovnica_level2_list_controller( p_app_rewrite_base, p_items_per_page, p_tag_id, p_str_exclude_id, p_alter_template )
{
    this._url = p_app_rewrite_base  + 'index.php?cmd=ajax_cmp_naslovnica_clanak_auto_sadrzaj&action=show_level2_list',
    this._items_per_page = p_items_per_page,
    this._tag_id = p_tag_id,
    this._str_exclude_id = p_str_exclude_id,
    this._alter_template = p_alter_template,

    this.show_page = function( p_page, p_template_prefix )
    {
        var _prefix = p_template_prefix;
        
        if( typeof( _prefix ) == 'undefined' ){
            _prefix = '';
        }

      
        $( '#div_level2_auto_content_list' ).hide();
        $( '#div_level2_auto_content_list_spinner' ).show();

        //alert( '#' + div_prefix  + '_div_auto_clanak_content' );

        var _alter_template = this._alter_template;

        if( typeof( _alter_template ) == 'undefined' ){
            _alter_template = '';
        }
        
        $( '#div_level2_auto_content_list' ).load( this._url , {
            page: p_page,
            items_per_page: this._items_per_page,
            tag_id: this._tag_id,
            template_prefix: _prefix,
            str_exclude_id: this._str_exclude_id,
            alter_template: _alter_template
        }, function()
        {
            //alert( 'tu sam' );
            $( '#div_level2_auto_content_list_spinner' ).hide();
            $( '#div_level2_auto_content_list' ).show();
        }
        );

    }
    
    this.exclude_items = function(p_arr_exclude){
        this._str_exclude_id = p_arr_exclude;
    }

}


