var magic = 'bi'+'u'+''+'ro';
var malpa = '@';
var dom = 'net' + 'create' + '.' +  'pl';
var protocol = 'ma'+''+'il'+'to:';
var whole = magic + '' + malpa + dom;


function runSite() {

    if ($('#stronaglowna').length != 0 && !$.browser.msie) {
        $('#top').hide().fadeIn(1800);
        $('.footer').hide().fadeIn(1800);
    }
    
    $('acronym').hover(function() {
        $(this).append('<em class="acos">'+$(this).attr('title')+'</em>');
        $('acronym em').append('<img src="/css/gfx/cycek.png" alt="php" class="wypustek" />');
        $(this).find('em').css({'top': (-15-$(this).find('em').height())+'px'});
        if ($.browser.msie) 
            $('acronym em').corner('5px');
        $(this).find('em').stop(true, true).fadeIn(200);
    }, function() {
        $(this).find('em').stop(true, true).fadeOut(200, function() {
            $(this).remove();
        });
    });
    $('#menu a').hover(function() {
            $(this).stop().animate({paddingTop:"20px"}, 200, 'easeOutBack');
        }, function() {
            $(this).stop().animate({paddingTop:"4px"}, 200, 'easeOutBack');
        });
    

    $('#amailem').append('<a href="'+protocol+whole+'">'+whole+'</a>');

    $('#actualwork').after('<div id="actualswitch">');
    $('#slider').cycle({
        fx:     'scrollHorz',
        speed:  800,
        timeout: 4000,
        pager:  '#actualswitch'
    });
    
    $('.minis a .obraz').hover(function() {
        $(this).append('<div class="miniover"><strong>'+$(this).attr('alt')+'</strong><br/><br/><br/>Wykorzystane technologie: '+$(this).attr('title')+'</div>');
        if ($.browser.msie) 
            $('.miniover').corner('tl 15px').corner('bl 15px');
        $(this).find('.miniover').stop(true,true).animate({'left':0},200,'swing');
        $(this).stop(true,true).animate({width: '360px', height: '150px', top: '-15px', opacity: 1},300);
    }, function() {
        $(this).find('.miniover').stop(true,true).animate({'left':-150},200,'swing',function() {$(this).remove()});
        $(this).find('img').animate({'left':0}, 1000);
        $(this).stop(true,true).animate({width: '320px', height: '120px', top: 0, opacity: 0.7},300);
    }).each(function() {
        $(this).css('background-image', 'url('+$(this).find('img').attr('src')+')');
        $(this).attr('alt', $(this).find('img').attr('alt'));
        $(this).attr('title', $(this).find('img').attr('title'));
        $(this).find('img').remove();
    });
    $('.pages a').hover(function() {
        $(this).stop(true,true).animate({'opacity': 1}, 300,'easeOutBack');
    }, function() {
        $(this).stop(true,true).animate({'opacity': 0.5}, 300,'easeOutBack');
    });

    $('.minis .subtitle').hide();

    $('#glownateksty .section, #listauslug .section').hover(function(){
        $(this).append('<div class="hover"></div>');
        if ($.browser.msie) 
            $('.hover').corner('15px');
        $(this).find('.hover').stop(true,true).css({'width':$(this).width(), 'height':$(this).height()}).animate({
            'opacity': 0.4,
            'left':-10,
            'top':-10,
            'width':$(this).width()+20,
            'height':$(this).height()+20

        },300,'easeOutBack',function(){});
    },function(){
        $(this).find('.hover').stop(true,true).animate({
            'opacity': 0,
            'left':30+'px',
            'top':30+'px',
            'width':$(this).width()-60,
            'height':$(this).height()-60

        },500, 'easeOutBack', function() {$(this).remove();});
    });
  
    $(document).keyup(function(e) {
      if(e.keyCode == 37) { // left
          $('#slider').cycle('next');
      }
      else if(e.keyCode == 39) { // right
          $('#slider').cycle('prev');
      }
      else if(e.keyCode == 27) { // esc
          closehelp();
      }
    });
}
/*
$(document).ready(function() {
    runSite();
});
*/
function drawBottom() {
    $('#botbg').css('width', $(document).width()+'px');
    $('#botbg').css('top', ($(document).height()-164)+'px');
}
