
$(document).ready(function()
{ 
  $('ul.sf-menu').supersubs({
            minWidth:    12,   // minimum width of sub-menus in em units 
            maxWidth:    27,   // maximum width of sub-menus in em units 
            extraWidth:  1     // extra width can ensure lines don't sometimes turn over 
                               // due to slight rounding differences and font-family );
      }).superfish();           // call supersubs first, then superfish, so that subs are 
                                // not display:none when measuring. Call before initialising 
                                // containing tabs for same reason

  $('#polec_znajomemu').jqm();
  
  
//  $('.lightbox').lightBox();


  $("a.fancybox").fancybox({
						   frameWidth: 750,
						   frameHeight: 500
						   }); 
});
function checkform()
{
  var imienazwisko = $('#Imie_i_nazwisko').val();
  var tel = $('#Telefon_kontaktowy').val();
  
  if (imienazwisko == '' || tel == '')
  {
    $('#error').show().html('Pola oznaczone gwiazdką są wymagane');
    return false;
  }
  else
    return true;
}
function zmniejsztekst()
{
  
  $(".resize p, .resize td ul li").css({'font-size' : '11px'});
  $("#ikozmn").trigger('mouseover');
}

function zwieksztekst()
{
  $("#ikozw").trigger('mouseover');
  $(".resize p, .resize td ul li").css({'font-size' : '14px'});
}

function validateemail(address)
{
   var reg = /^([A-Za-z0-9_\-\.])+\@([A-Za-z0-9_\-\.])+\.([A-Za-z]{2,4})$/;
   if(reg.test(address) == false)
   {
      return false;
   }
   else
      return true;
}
function validatermdform()
{
  var kto = $('#kto').val();
  var kto_email = $('#kto_email').val();
  var komu_email = $('#komu_email').val();
  if (kto == '' || kto_email == '' || komu_email == '')
  {
    $('#recommenderrors').fadeIn(2000).html('Pola oznaczone gwiazdką są wymagane');
    return false;
  }
  else if (validateemail(kto_email) == false)
  {
    $('#recommenderrors').fadeIn(2000).html('Niepoprawny e-mail polecającego');
    return false;
  }
  else if (validateemail(komu_email) == false)
  {
    $('#recommenderrors').fadeIn(2000).html('Niepoprawny e-mail odbiorcy');
    return false;
  }
  else
  {
    $.post(
  					'ajx_recommend.php',
  					{
              kto: $('#kto').val(),
              kto_email: $('#kto_email').val(),
              komu_email: $('#komu_email').val(),
              komentarz: $('#komentarz').val()
            },
  					function(data)
            {
                  $('#recommenderrors').html('');
                  $('#recommendcontent').html(data);
            }
          );
  }
}




