$(document).ready(function() {
	
    $("#subscribe_form select").uniform();
	
	$(".link-button").click(function() {
		document.location = _ABS_PATH + $(this).attr('data-href');
	});
	
	$('.banner-slider').anythingSlider({
		width: 270,
		height: 204
	});
	
	$('.global-box').show();	
	
    $("#subscribe_form .subscribe-input").each(function (type) {
		var label = $("label[for=" + this.id + "]");
		
	    if($(this).val()) { 
            label.hide();
        }
	
        $(this).focus(function () {
            if($(this).val() == '') 
                label.fadeTo('fast',0.45);
        });
	
		$(this).keypress(function () {
            label.fadeTo('fast',0);
        });

        $(this).blur(function () {
            if($(this).val() == ''){
                label.fadeTo('fast',1);
            }
        });
    });
	
	$("#subscribe_form").submit(function() {
		if (!emailCheck($(this).find('#email').val())) {
			alert('Prašome įvesti savo el.paštą')
			return false;
		}
			
		$("#subscribe_form_container").hide();
		$("#subscribe_loader").show();
		
		$.post(this.action, $(this).serialize(), function(data) {
			if (!data) return;
			
			$("#subscribe_loader").hide();
			$('#subscribed_container').show();	
		});
		
		return false;
	});

	$("marquee").marquee('pointer').mouseover(function () {
        $(this).trigger('stop');
    }).mouseout(function () {
        $(this).trigger('start');
    }).mousemove(function (event) {
        if ($(this).data('drag') == true) {
            this.scrollLeft = $(this).data('scrollX') + ($(this).data('x') - event.clientX);
        }
    }).mousedown(function (event) {
        $(this).data('drag', true).data('x', event.clientX).data('scrollX', this.scrollLeft);
    }).mouseup(function () {
        $(this).data('drag', false);
    });
	
		
});
