

// Init fancybox
$( document ).ready( function() {
  $( '#news a' ).fancybox();
} );


// Create font size changer
var FSC = {};

FSC.containerId = 'main';
FSC.defaultSize = '12';
FSC.cookieName  = 'FSC';
FSC.maxFontSize = 18;
FSC.minFontSize = 6;
FSC.step        = 2;

FSC.go = function( direction )
{
  var direction = direction || direction == 'inc' || direction == 'increment' ? true : false;
  var content = $( '#' + FSC.containerId ),
      size    = parseInt( content.css( 'font-size' ) ) + ( direction ? 1 : -1 )*FSC.step;
  if( size > FSC.maxFontSize || size < FSC.minFontSize )
    return;
  content.css( { fontSize: size } );
  $.cookie( FSC.cookieName, size );
}

$( document ).ready( function() {
  var size = parseInt( $.cookie( FSC.cookieName ) );
  if( size > 0 )
    $( '#' + FSC.containerId ).css( { fontSize: size } );
} );

// Search
$( document ).ready( function() {

  var string  = 'търсене...';
  $( '#search input[type="text"]' )
    .focus( function() { if( this.value == string ) this.value = '' } )
    .blur( function() { if( this.value == '' ) this.value = string } );
    
  var input = document.getElementsByName( 's' )[0];
  if( input.value == '' )
    input.value = string;
    
} );