/*function getSliderPosts(category, count) {
	var url = "/blog/getSliderPosts.php?category=" + category + "&count=" + count;

	var slider_ajax = $.ajax({
		async: true,
		url: url,
		success: function(html) {
			//$('#slider_content').html(html);
			var api = scroller.data("scrollable");
			var divs = $(html).filter(function(){ return $(this).is('div') });
			divs.each(function () {
				//console.log('test');
				api.addItem(this);
			});
		}
	});
}*/

$(document).ready(function() {
	$('#try_it_now').focus(function() {
		if ($(this).val() == 'Enter your Etsy ID') {
			$(this).val('');
		}
		//$(this).removeClass('error');
		//$('#no_id_error').remove();
		//error_set = 0;
	});

	$('#etsy_id').focus(function() {
		if ($(this).val() == 'Enter your Etsy ID') {
			$(this).val('');
		}
	});

	$('#try_it_now').keydown(function(event) {
		var regex = /[^a-zA-Z0-9]/gi;
		if (regex.test(event.keyCode)) {
			return true;
		}
		if (event.keyCode == '13') {
			$('.try_it_now .btn').click();
		}
	});

	$('#etsy_id').keydown(function(event) {
		if (event.keyCode == '13') {
			$('.etsy_id_box .btn').click();
		}
	});

	//var error_set = 0;
	$('.try_it_now .btn').click(function() {
		var etsy_id = ($('#try_it_now').val() == 'Enter your Etsy ID') ? '' : $.trim($('#try_it_now').val());
		var join_url = '/join.php';
		if (etsy_id != '') {
			join_url += '?etsy_id=' + encodeURIComponent(etsy_id);
		}
		document.location.href = join_url;

		return false;
	});

	$('.etsy_id_box .btn').click(function() {
		var etsy_id = ($('#etsy_id').val() == 'Enter your Etsy ID') ? '' : $('#etsy_id').val();
		var join_url = '/join.php';
		if (etsy_id != '') {
			join_url += '?etsy_id=' + encodeURIComponent(etsy_id);
		}
		document.location.href = join_url;

		return false;
	});
});

