$(document).ready(function()
{
	
	if(!$.browser.msie)
	{
		$('.noJsTest').show();
	}
	else
	{
		if($.browser.version == '6.0')
		{
			$('.jsTest').show();
		}
		else
		{
			$('.noJsTest').show();
		}
	}
	
	$('.loginJs').click(function(){
		$('.darkBg').show();
		$('.jsLoginBg').show();

		return false;
	});
	
	$('.darkBg').click(function(){
		$(this).hide();
		$('.jsLoginBg').hide();
		
		return false;
	});
	
	$('.validateForm').click(function(){
		var reg = /^([A-Za-z0-9_\-\.])+\@([A-Za-z0-9_\-\.])+\.([A-Za-z]{2,4})$/;
		var email = $('#email').val();
		var info = '';
		
          if(reg.test(email) == false) info += 'Niepoprawny email.' + "\n";
		
		var reg = /^\+?[\d\s\-]{3,}$/;
		var telefon = $('#telefon').val();
		
          if(reg.test(telefon) == false) info += 'Niepoprawny numer telefonu.' + "\n";
		
		if(info != '')
		{
			alert(info);
			return false;
		}
	});
	
	$('.toggleKatalogi').click(function(){
		var vars = $(this).attr('alt').split(',');
		var id = vars[0];
		var type = vars[1];
		
		
		if($('#' + id).css('display') == 'none')
		{ 
			$(this).attr('src', 'public/gfx/kolkoMinus' + type + '.png');
			$('#' + id).fadeIn();
		}
		else
		{
			$(this).attr('src', 'public/gfx/kolkoPlus' + type + '.png');
			$('#' + id).fadeOut();	
		}
	});
	
});
