jQuery(document).ready( function() {

    if( jQuery("#image_individual").length ) {
        url = jQuery("#image_individual").parent().attr('href');
        jQuery("#image_individual").flash({
            swf: 'http://'+document.domain+'/images/swf/domek2.swf?url='+url,
            width: 346,
            height: 158,
            params: { wmode: 'transparent' }
        });
        jQuery("#image_individual").children().live ('click', function(){
            window.location = 'http://'+document.domain+'/images/swf/domek2.swf';
        });
        
    }
    if( jQuery("#image_law_help").length ) {
        url = jQuery("#image_law_help").parent().attr('href');
        jQuery("#image_law_help").flash({
            swf: 'http://'+document.domain+'/images/swf/kartki2.swf?url='+url,
            width: 346,
            height: 158,
            params: {
                wmode: 'transparent',
                url: $(this).parent().attr('href')
            }
        });
    }
    if( jQuery("#image_advices").length ) {

        jQuery("#image_advices").flash({
            swf: 'http://'+document.domain+'/images/swf/pytajnik.swf',
            width: 346,
            height: 253,
            params: { wmode: 'transparent', url: $(this).parent().attr('href') }
        });
    }
    if( jQuery("#image_building").length ) {
        jQuery("#image_building").flash({
            swf: 'http://'+document.domain+'/images/swf/mlotek1.swf',
            width: 346,
            height: 253,
            params: { wmode: 'transparent' }
        });
    }
    if( jQuery("#image_read").length ) {
        jQuery("#image_read").flash({
            swf: 'http://'+document.domain+'/images/swf/wykrzyknik.swf',
            width: 346,
            height: 253,
            params: { wmode: 'transparent', url: $(this).parent().attr('href') }
        });
    }
    if( jQuery("#image_performers").length ) {
        jQuery("#image_performers").flash({
            swf: 'http://'+document.domain+'/images/swf/mapa.swf',
            width: 346,
            height: 253,
            params: { wmode: 'transparent' }
        });
    }

    // ----- bannery ----
    var banners = new Array(
        'b_1',
        'b_2'
    );
    jQuery.each(banners, function(){
        if(  jQuery("#"+this).length ) {
            banner_elem = jQuery("#"+this);
            jQuery(banner_elem).flash({
                swf: 'http://'+document.domain+'/uploads/banners/'+this+'.swf',
                width: jQuery("#"+this).css('width'),
                height: jQuery("#"+this).css('height'),
                params: { wmode: 'transparent' }
            });
            var link = jQuery(banner_elem).attr('href');
            jQuery(banner_elem).append("<a href='"+link+"' title='"+link+"' class='pointer' target='_blank'></a>");
        }
    });

/*
    if(  jQuery("#b_1").length ) {
        jQuery("#b_1").flash({
            swf: 'http://'+document.domain+'/uploads/banners/b_1.swf',
            width: 468,
            height: 60,
            params: { wmode: 'transparent' }
        });
        jQuery("#b_1").append("<a href='http://google.pl' class='pointer'></a>");
    }
    if(  jQuery("#b_2").length ) {
        jQuery("#b_2").flash({
            swf: 'http://'+document.domain+'/uploads/banners/b_2.swf',
            width: 160,
            height: 600,
            params: { wmode: 'transparent' }
        })
    }
*/

    // activate flashes hack
    $('object').mouseover(function(){this.focus()}).focus(function(){this.blur()});
    $('object').onfocus = function stopLinkFocus(){this.hideFocus=true;}
        
    $('object').live('mouseover', function() {
       $(this).focus();
    }).live('focus', function() {
       $(this).blur();
    });


});

