$( document ).ready( function(){
    
    if (window != top){
        $( '#bg-left-background' ).hide();
        $( '#bg-right-background' ).hide();
        $( '#footer' ).hide();
        $( '#top-logo' ).hide();
        $( '#top-menu' ).hide();
        $( '#page' ).css('margin-left','50px');
        $( '#page-top' ).css('margin-top','70px');
        $( '#page-sub-menu' ).css('left','-50px');
        $( '.page-titles-konkurs' ).css('left','150px');
        $( 'body' ).css('background','none');
        
    }
    
	var flashvars = new Array();
	var params = new Array();
	var attributes = new Array();
    swfobject.embedSWF( '/media/f/movie.swf?v=1', "flash-player", '100%', '500%', '10.0.0', "/media/f/expressInstall.swf", flashvars, params, attributes );
	attributes.id = 'content';
    //params.wmode = "opaque";
    //params.allowScriptAccess = "always";
	swfobject.embedSWF( '/media/f/preloader.swf?v=1', "flash-content", '100%', '100%', '10.0.0', "/media/f/expressInstall.swf", flashvars, params, attributes );


	if ( !swfobject.hasFlashPlayerVersion( '10.0.0' ) ) {
		$( '#no-flash' ).css('display', 'block');
	}
	 
});

function search(){
    if ( $('#searchText').val() == 'Miasto' ){
      $('#searchText').val("");
    }
}

function vote( id, title ){
    $('#message-container').show();
    $('#message-container').attr('class','message-container');
    $('#message').html( $('#vote-confirm').html() );
    $('body').css('overflow', 'hidden');
    $('#vote-title').html( '"'+title+'"?' );
    $('#vote-button').click(function(){
        document.location = '/glosowanie/ksiazka:'+id
    });
}



$(window).resize(function(){
	scale();
});	

function scale(){
    if (window != top)return;
    
	if( document.getElementById( 'footer' ) ){
		swfHeight =  ( $( 'body' ).height() - $('#footer').height() -5 ) ;
	} else {
		swfHeight =  ( $( 'body' ).height()  ) ;
		$( 'body' ).css( 'line-height', '0' );
	}
    //alert( 'body height '+ swfHeight );
    //alert( 'footer height:'+ $('#footer').height() );
	if( swfHeight < 780 ){
		swfHeight = '780';
	}
	swfHeight += 'px';
	
	if( $( 'body' ).width() < 960 ){
		swfWidth = '960px';
	}
	//alert( swfHeight+' '+ swfHeight);
    
	$( '#content' ).attr( 'height', swfHeight );
	$( '#content' ).css( 'height', swfHeight );
}
