/* custom made js */
$(document).ready(function() {
	$('#xnipCodeForm').ajaxForm({
		dataType: 'json',
		success: function(response) {
			if(response.status == 'OK') {
				document.location.href = response.url;
			} else {
				alert('Code not found');
			}
		}
	});
	$('input[type=text]').labelify({labelledClass: 'labelHighlight'});
	$('input[type=password]').labelify({labelledClass: 'labelHighlight'});
	$('.colorbox').colorbox();

	$('.showRegistrationDialog').click(function() {
		$('#registrationContainer').dialog({
			width:'auto',
			height:'auto',
			modal:true
		});
	});

});
var gallery = [];
function scrollGalleryBrowser(galleryId, direction) {

	var innerScroll = $('#galleryInnerScroll_'+galleryId);

	if(direction == 'left') {
		if(gallery[galleryId].actUnit > 0) {
			gallery[galleryId].actUnit--;
			
			innerScroll.animate({
				left: '-'+gallery[galleryId].unitWidth*gallery[galleryId].actUnit
			});
		}
	} else {
		if( (gallery[galleryId].actUnit+gallery[galleryId].visibleUnits) < gallery[galleryId].units) {
			gallery[galleryId].actUnit++;
			innerScroll.animate({
				left: '-'+gallery[galleryId].unitWidth*gallery[galleryId].actUnit
			});
		}
	}
	return false;
}

function deleteXnip(element) {
	$.post(
		$(element).attr('href'), 
		function(response) {
			if(response == "success") {
				$('#'+$(element).attr('rel')).slideUp(); 
			}
		},
		'json'

	);
	return false;
}

