
rollupdown = true;

$(function(){
    $('.elgroupname').click(function(){
//      alert('grupa');
      
      if (rollupdown)
        {
         if ($('div', this).height()==0) $('div', this).animate({'height' : $('ul', this).height()}, 200);
         else                            $('div', this).animate({'height' : '0'}, 50);
        }
      
      rollupdown = true;
    });
    $('.grelement').click(function(){
      //alert('element');
      rollupdown = false;
    });
});
//leftmenu

function formSend()
{
 err = 0;
 

 var arr = new Array(3);
 var msg = new Array(3);
 
 arr[0] = 'email';
 arr[1] = 'temat';
 arr[2] = 'tresc';
 msg[0] = 'E-mail';
 msg[1] = 'Temat';
 msg[2] = 'Treść';
 
 
 for (i=0; i<arr.length; i++)
 {
  if (jQuery('#'+arr[i]).val()=='' || jQuery('#'+arr[i]).val()==msg[i])
    {
     jQuery('#'+arr[i]).css({'background' : '#ffb0b0'});
     err++;
    }
  else jQuery('#'+arr[i]).css({'background' : '#ffffff'});                                                   
 }

 
 
 
 if (!/^[a-z0-9\-_\.]+?@[a-z0-9\-_\.]+?\.[a-z]{2,5}$/.test(jQuery('#email').val()))
   {
    jQuery('#email').css({'background' : '#ffb0b0'});
    err++;
   }
 else jQuery('#email').css({'background' : '#ffffff'});
 
if (err==0)
   {
    $.post("da.php", { act: "submit_contact_form", 
                       email : jQuery('#email').val(),
                       temat : jQuery('#temat').val(),
                       tresc : jQuery('#tresc').val()
                     }, function(data){
      
      jQuery("#formkontaktowy").html(data);
    });
   }
 
}








function showQuickOfferPreview()
{
 $('.quickgal').css({opacity : '0', display : 'block', 'z-index' : '10000'});
 
 $('.quickgal').animate({opacity : '1'}, 900);
}








function hideQuickOfferPreview()
{
 $('.quickgal').animate({opacity : '0'}, 400, function(){
 
   $('.quickgal').css({display : 'none'});
 
 });
 
}




function rolldownOnPicShortDesc(id)
{
 addh = $('#onpicdesc'+id).height()+5;
 
 if ($('#onpicvis'+id).height()==1)
   {
    $('#onpicvis'+id).animate({height : $('#onpicvis'+id).height()+addh}, 400);
    $('#onpic'+id).animate({height : $('#onpic'+id).height()+addh}, 400);
   }
}



function rollupOnPicShortDesc(id)
{
 addh = $('#onpicdesc'+id).height()+5;
 
 $('#onpicvis'+id).animate({height : 1}, 100);
 $('#onpic'+id).animate({height : $('#onpic'+id).height()-addh}, 100);
}



