$(document).ready(function() {
	// lotto stebuklu pagalba
	$('#lotto-help').click(function() {
		if ($('#lotto-rules').is(":visible")) {
			$('#lotto-rules').hide("slide", { direction: "up" }, 500);
		} else {
			$('#lotto-rules').show("slide", { direction: "up" }, 500);
		}
	});
	// loterijos pirkimas internetu
	$('#lotto-buy-web').click(function() {
		if ($('#lotto-buy-web-text').is(":visible")) {
			$('#lotto-buy-web-text').hide("slide", { direction: "up" }, 500);
		} else {
			$('#lotto-buy-web-text').show("slide", { direction: "up" }, 500);
		}
	});

	// loterijos pirkimas telefonu
	$('#lotto-buy-phone').click(function() {
		if ($('#lotto-buy-phone-text').is(":visible")) {
			$('#lotto-buy-phone-text').hide("slide", { direction: "up" }, 500);
		} else {
			$('#lotto-buy-phone-text').show("slide", { direction: "up" }, 500);
		}
	});

	// loterijos patarimas
	$('#lotto-buy-tip').click(function() {
		if ($('#lotto-buy-tip-text').is(":visible")) {
			$('#lotto-buy-tip-text').hide("slide", { direction: "up" }, 500);
		} else {
			$('#lotto-buy-tip-text').show("slide", { direction: "up" }, 500);
		}
	});
	
	// galimybiu skaiciuokle
	if ($("#galimybes_in")) {
		$("#galimybes_in").keydown(function(event) {
			if ( event.keyCode == 46 || event.keyCode == 8 ) {
			} else {
				if (event.keyCode < 95) {
					if (event.keyCode < 48 || event.keyCode > 57 ) {
						event.preventDefault();
					}
				} else {
					if (event.keyCode < 96 || event.keyCode > 105 ) {
						event.preventDefault();
					}
				}
			}
		}); 
		
		$('#galimybes_in').keyup(function() {
			var num = parseInt($(this).val());
			if (num<1) { num = 0; var formula = 0;}
			else {
				var formula = 5*num*(num+1)-9;
			}
			$('#galimybes_out').html(formula);
		});
		$('#galimybes_in').change(function() {
			var num = parseInt($(this).val());
			if (num<1) { num = 0; var formula = 0;}
			else {
				var formula = 5*num*(num+1)-9;
			}
			$('#galimybes_out').html(formula);
		});
	}
});

function fnc_display_error() {
	$('#error').effect("pulsate", { times:3 }, 300);
}

function fnc_switch() {
	if ($('#switcher').val() == '1') {
		$('#mega-banner').hide();
		$('#switcher').val('0')
	} else {
		$('#mega-banner').show();
		$('#switcher').val('1')
	}
}

function fnc_show_hint (obj, hint) {
	var pos = $(obj).position();
	$('#floating-hint-container').show().css('top', pos.top - 7);
	$('#hint-text').html(hint);
}

function fnc_hide_hint () {
	$('#floating-hint-container').hide();
}

function fnc_multilotto_gain() {
	window.location = 'http://www.lottofix.eu/credit/cashOutForm';
}


