$(document).ready(function(){
    
    $('.lightbox').lightBox({fixedNavigation:false});
    
    /*stare menu
    var menuHover = {    
        sensitivity: 3, // number = sensitivity threshold (must be 1 or higher)    
        interval: 100, // number = milliseconds for onMouseOver polling interval    
        over: menuHoverShow, // function = onMouseOver callback (REQUIRED)    
        timeout: 100, // number = milliseconds delay before onMouseOut    
        out: menuHoverHide // function = onMouseOut callback (REQUIRED)    
    };
    //$("#menu .level_2").hoverIntent( menuHover );
    
   // var width_menu=0;
    //    $("#menu span.level_2").each(function(i){
    //        width_menu = width_menu +$(this).width();
    //    })
    //$('#menu').width(width_menu);
    
    /*formularz kontaktowy*/
   
   if($('#emailArea')[0] && $('#emailArea').val().length == 0){
       $('#emailArea').val($('#emailAreaDefault').text());
   }
   if($('#textArea')[0] && $('#textArea').val().length == 0){
       $('#textArea').val($('#textAreaDefault').text());
   }
   $('#emailArea').click(function(){
       if ($(this).val() == $('#emailAreaDefault').text()) {
           $(this).val('');
       }
   })
   $('#emailArea').blur(function(){
       if( $(this).val()=='' || $(this).val() == $('#emailAreaDefault').text() ){
           $(this).val($('#emailAreaDefault').text());
       }
   })
   $('#textArea').click(function(){
       if ($(this).val() == $('#textAreaDefault').text()) {
           $(this).val('');
       }
   })
   $('#textArea').blur(function(){
       if( $(this).val()=='' || $(this).val() == $('#textAreaDefault').text() ){
           $(this).val($('#textAreaDefault').text());
       }
   })
   $('.Contact form').submit(function(){
       
       var error=false;
       if( $('#textArea').val()=='' || $('#textArea').val() == $('#textAreaDefault').text()){
           error=true;
           $('#textArea').addClass('error')
       } else {
           $('#textArea').removeClass('error')
       }
       if( $('#emailArea').val()=='' || $('#emailArea').val() == $('#emailAreaDefault').text()){
           error=true;
           $('#emailArea').addClass('error')
       } else {
            var regex = /^[a-zA-Z0-9._-]+@([a-zA-Z0-9.-]+\.)+[a-zA-Z0-9.-]{2,4}$/;
               if(regex.test($('#emailArea').val())){
                   $('#emailArea').removeClass('error')
               } else {
                   error=true;
                   $('#emailArea').addClass('error')
               }
       }
       if(error){
           alert($('#errorMessage').text());
           return false;    
       }
   })
   
   //pathway komonent ostatnia pozycja pogrubiona
   var links = $('.Widget a.pathway');
   $(links[links.length-1]).addClass("bold");
});
/*
function menuHoverShow(){
    $(this).children('a').addClass("activemenu");
    $(this).prev().children('a').css("background-position","right -50px");
    $(this).children('.outer_level_3').show();
    var width = $(this).children('.outer_level_3').width();
    if(width<$(this).width()) {
        //width=$(this).width()+4;
    }
    $(this).children('.outer_level_3').children('.end').children('.center').width(width-10)
    $(this).children('.outer_level_3').children('.level_3').width(width)
    //console.log()
}
function menuHoverHide(){
    $(this).children('a').removeClass("activemenu");
    $(this).prev().children('a').css("background-position","right 0px");
    $(this).children('.outer_level_3').hide();
    $(this).children('.outer_level_3').children('.end').children('.center').width(0);
}
*/
