<!--
$(function()
	{
    $('a.lightbox').lightBox();
    });

$(document).ready
	(
	function()
		{
		$("#pl_pl").click(function()
			{
			var stop = false;
			
			if (($("#pay_form select").val()=="t") &&
				(parseInt($("#amount").attr("value"))>100000))
				{
				stop = true;
				alert("Maksymalna kwota transakcji typu TESTOWEGO to: 1 000 zł");
				}
			else 
				if (
					($("#pay_form select").val()=="c") &&
					(parseInt($("#amount").attr("value"))>700000)
					)
					{
					stop = true;
					alert("Maksymalna kwota transakcji typu Karta Kredytowa to: 7 000 zł");
					}
				else
					if (
						($("#pay_form select").val()=="w") &&
						(parseInt($("#amount").attr("value"))>700000)
						)
						{
						stop = true;
						alert("Maksymalna kwota transakcji typu BZWBK - Przelew24 to: 7 000 zł");
						}
					else
						if (parseInt($("#amount").attr("value"))>99999999)
						{
						stop = true;
						alert("Maksymalna kwota transakcji tego typu to: 999 999,99 zł");
						}
						
				if (stop)
					{
					return false;
					}
			});
			
		$("#ile").blur(function(){
				var i;
				i=(parseInt($(this).attr("value")))*(parseFloat($("#cena").text().replace(',','.').replace(' ','')));
				$("#suma").text(i.toFixed(2));
			});
			
		$("#email").blur(function(){
				
				if (checkemail($(this).attr("value"))){
					$(this).css("border-color","#c3d7db");
				}else{
					$(this).css("border-color","red")
				}
			});
			
		$("#f_nip").blur(function(){
				
				if (sprawdzNIP($(this).attr("value"))){
					$(this).css("border-color","#c3d7db");
				}else{
					$(this).css("border-color","red")
				}
			});
			
		$(".string").blur(function(){
				if ($(this).attr("value").length>=2){
					$(this).css("border-color","#c3d7db");
				}else{
					$(this).css("border-color","red")
				}
			});
			
		$("#nr").blur(function(){
				if ($(this).attr("value").length>=1){
					$(this).css("border-color","#c3d7db");
				}else{
					$(this).css("border-color","red")
				}
			});
			
		$("#f_nr").blur(function(){
				if ($(this).attr("value").length>=1){
					$(this).css("border-color","#c3d7db");
				}else{
					$(this).css("border-color","red")
				}
			});
			
		$("#tel").blur(function(){
				if ($(this).attr("value").length>=9){
					var tel=parseFloat($(this).attr("value"));
					tel=parseInt(tel);
					
					var tel_string=$(this).attr("value").toString();
					tel_string=tel_string.replace(' ','');
					tel_string=tel_string.replace(' ','');
					tel_string=tel_string.replace(' ','');
					tel_string=tel_string.replace(' ','');
					tel_string=tel_string.replace(' ','');
					tel_string=tel_string.replace(' ','');
					tel_string=tel_string.replace('-','');
					tel_string=tel_string.replace('-','');
					tel_string=tel_string.replace('-','');
					tel_string=tel_string.replace('-','');
					tel_string=tel_string.replace('(','');
					tel_string=tel_string.replace('(','');
					tel_string=tel_string.replace('(','');
					tel_string=tel_string.replace('(','');
					tel_string=tel_string.replace(')','');
					tel_string=tel_string.replace(')','');
					tel_string=tel_string.replace(')','');
					tel_string=tel_string.replace(')','');
					tel=parseFloat(tel_string)
					if ((tel>=99999999)&&(tel==tel_string)){
						$(this).css("border-color","#c3d7db");
						$(this).attr("value",tel);
					}
					else{
						$(this).css("border-color","red")
					}
				}else{
					$(this).css("border-color","red")
				}
			});
			
			$('#fak').bind('click', function() {
     			if ($(this).is(':checked')) {
         			$("#faktura").show();
         			//document.order.submit();
				}else {         
					$("#faktura").css('display','none');    
				}
			});
			
			$("#plus").click(function(){
				var i;
				//alert();
				i=1+parseInt($("#ile").attr("value"));
				if (i<100){
					$("#ile").attr("value",i);
					//alert(parseFloat($("#cena").text().replace(',','.')));
					i=i*parseFloat($("#cena").text().replace(',','.').replace(' ',''));
					$("#suma").text(i.toFixed(2).replace('.',','));
				}
			});
			
			$("#minus").click(function(){
				var i;
				//alert();
				i=(parseInt($("#ile").attr("value")))-1;
				if (i>0){
					$("#ile").attr("value",i);
					i=i*parseFloat($("#cena").text().replace(',','.').replace(' ',''));
					$("#suma").text(i.toFixed(2).replace('.',','));
				}
			});
			
	$("#searchText").click(function()
		{
		$("#searchText").val('');
		});

	$('#searchText').keypress(function(event)
		{
		if (event.keyCode == '13')
			search();
		});

	$("#searchImg").click(function()
		{
		search();
		});
	});
	
function search()
	{
	window.location.href = baseUrl + 'index/search/text/' + $("#searchText").val();
	}
	
var testresults;

function checkemail(str) {

var filter=/^([\w-]+(?:\.[\w-]+)*)@((?:[\w-]+\.)*\w[\w-]{0,66})\.([a-z]{2,6}(?:\.[a-z]{2})?)$/i

if (filter.test(str))
	{
	testresults = true;
	}
else
	{
	testresults = false;
	}

return (testresults)

}

function sprawdzNIP( input_data ) {

if (
	!input_data.match( /^[0-9]{3}-[0-9]{2}-[0-9]{2}-[0-9]{3}$/ ) &&
	!input_data.match( /^[0-9]{3}-[0-9]{3}-[0-9]{2}-[0-9]{2}$/ ) &&
	!input_data.match( /^[0-9]{10}$/ ) 
	)
	return false;

var my_nums = input_data.replace(/-/g,'');
var valid_nums = "657234567";
var sum = 0;

for (var temp = 8; temp >= 0; temp--)
	sum += (parseInt(valid_nums.charAt(temp)) * parseInt(my_nums.charAt(temp)));
	
if ( (sum % 11) == 10 ? false : ((sum % 11) == parseInt(my_nums.charAt(9))) )
	return true;
else
	return false;

}
-->
