$(document).ready(function(){

	var oMetaPro = { src: '_swf/metapro-blackitalic.swf' };
	sIFR.activate(oMetaPro);
	sIFR.replace(oMetaPro, {
		selector: 'h3'
		,css: {
			'.sIFR-root': { 'color': '#F4F4F4', 'font-size': 20, 'margin-left': '2px' } 
		}
		,wmode: 'transparent'
		,filters: {
			DropShadow: {
				knockout: false
				,distance: 1
				,color: '#C50808'
				,strength: 2
			}
		}
	});

	$('input').each(function (i) {
		if($(this).next().attr('class') == 'oHint') {
			$(this).focus(function () {
				$(this).parent().children('span').fadeIn("fast");
			}).blur(function () {
				$(this).parent().children('span').fadeOut("fast");
			});
		}
	});
	
	$('#oFormContact').validate({
			debug: true,
			errorElement: "div",
			errorClass: "oHintError",
			focusCleanup: true,
			success: function(label) {
				label.text("").addClass("oHintSuccess");
			},
			rules: {
				sEmail: {
					required: true,
					email: true
				},
				sName: 'required',
				sCompanyName: {
					required: false,
					rangelength: [1, 150]
				},
				sTelephone: {
					required: false,
					digits: true,
					rangelength: [9, 9]
				},
				sText: 'required'
			},
			messages: {
				sEmail: 'niepoprawny adres email <div class="oHintError-pointer">&nbsp;</div>',
				sTelephone: {
					digits: 'dozwolone tylko cyfry  <div class="oHintError-pointer">&nbsp;</div>',
					rangelength: 'wymagane 9 cyfr bez kodu kraju <div class="oHintError-pointer">&nbsp;</div>'
				}
			},
			submitHandler: function(oForm) {
			   $('#iSendedForm').val(1);
			   oForm.submit();
			 }
	});
	
});
