function upozorni(val) {
    alert(val);
}

function cookieReadValue(cookieName) {
    var countbegin = (document.cookie.indexOf(cookieName+"=") +
cookieName.length+1);
    var countend = countbegin + document.cookie.substring( countbegin
).indexOf(";");
    if ( countend < countbegin ) countend = document.cookie.length;
        return document.cookie.substring( countbegin, countend);
}

function go_to(url) {
    document.location.href=url;
}

function is_leap(year) {
    return (((year % 4 == 0) && (year % 100 != 0)) || (year % 400 == 0))
? 1 : 0;
}

// ON PAGE READY
$(function(){

  // replace all "(TM)" with ™
  /*
  $("p, a, h1, h2, h3, h4, h5, li").each( function()
  {
    $(this).html( $(this).html().replace('Protheus®','Protheus<sup>®</sup>'));
  });
  */
  

  // slide menu hide on load
  $('#submmenu').css( 'opacity', 0.85);
  $('#submmenu').hide();
  // slide menu rollover
  $('#mmenuItem63, #mmenuItem67').mouseover( function()
  {
    $('#submmenu').slideDown( 200 );
  });
  // slide menu rollout
  $('#submmenu').mouseleave( function()
  {
    $('#submmenu').slideUp( 100 );
  });
  $('#mmenu li a:not(#mmenuItem63, #mmenuItem67), #hbq_header, #productBoxes, #left h1').mouseover( function()
  {
    $('#submmenu').slideUp( 100 );
  });
  
  // JQML :)
  $( 'a.jqml' ).each( function()
  {
    var aLinkTexts = $( this ).attr( 'rel' ).split( '/' );
    var sLinkText = aLinkTexts[ 0 ] + '@' + aLinkTexts[ 1 ] + '.' + aLinkTexts[ 2 ];
    var sLink = 'mai' + 'lto' + ':' + sLinkText;
    $( this ).html( sLinkText );
    $( this ).attr( 'href', sLink );
  });
  
  // custom file field hover
  $( '#real_ff' ).mouseover(function()
  {
    $( '#fake_ff a' ).css( 'backgroundPosition', "0 -40px" ); // url('/img/btn/support_browse_hover.gif')
  });
  $( '#real_ff' ).mouseout(function()
  {
    $( '#fake_ff a' ).css( 'backgroundPosition', "0 0" ); // url('/img/btn/support_browse.gif')
  });
  
  // replace empty field text "-" for span
  $( 'div.val' ).each(function()
  {
    $( this ).html( $( this ).html().replace( '-', '<span class="noVal">no value</span>' ) );
  });
  
  // search field focus in and out homepage
  $( '#quickSearchHomepage div.bright, #quickSearch div.bright' ).css( 'opacity', '0');
  
  $( '#quickSearchHomepage input' ).focusin(function(){
    $( '#quickSearchHomepage input' ).css( 'color', '#2B2B2B' );
    $( '#mmenuBox' ).animate( {left: '26px'}, 200 ); // whole stripe shift
    $( '#quickSearchHomepage' ).animate( {width: '200px'}, 200 );
    $( '#quickSearchHomepage div.frm' ).animate( {width: '164px'}, 200 );
    $( '#quickSearchHomepage div.bright' ).animate( {width: '164px', opacity: 1}, 200 );
    $( '#quickSearchHomepage div.dark' ).animate( {width: '164px', opacity: 0}, 200 );
  });
  
  $( '#quickSearchHomepage input' ).focusout(function(){
    $( '#quickSearchHomepage input' ).css( 'color', '#FFFFFF' );
    $( '#quickSearchHomepage' ).animate( {width: '130px'}, 200 );
    $( '#mmenuBox' ).animate( {left: '61px'}, 200 );
    $( '#quickSearchHomepage div.frm' ).animate( {width: '94px'}, 200 );
    $( '#quickSearchHomepage div.bright' ).animate( {width: '94px', opacity: 0}, 200 );
    $( '#quickSearchHomepage div.dark' ).animate( {width: '94px', opacity: 1}, 200 );
  });
  
  // search field focus in and out others
  $( '#quickSearch input' ).focusin(function(){
    $( '#quickSearch input' ).css( 'color', '#2b2b2b' );
    $( '#quickSearch' ).animate( {width: '200px'}, 200 );
    $( '#quickSearch div.frm' ).animate( {width: '164px'}, 200 );
    $( '#quickSearch div.bright' ).animate( {width: '164px', opacity: 1}, 200 );
    $( '#quickSearch div.dark' ).animate( {width: '164px', opacity: 0}, 200 );
  });
  
  $( '#quickSearch input' ).focusout(function(){
    $( '#quickSearch input' ).css( 'color', '#FFFFFF' );
    $( '#quickSearch' ).animate( {width: '130px'}, 200 );
    $( '#quickSearch div.frm' ).animate( {width: '94px'}, 200 );
    $( '#quickSearch div.bright' ).animate( {width: '94px', opacity: 0}, 200 );
    $( '#quickSearch div.dark' ).animate( {width: '94px', opacity: 1}, 200 );
  });
  
});           
