jQuery.fn.rdy = function(func) {
	this.length && func.apply(this);
	return this;
};

jQuery.fn.placeHolder = function(default_value) {
	var el = jQuery(this);
	default_value = default_value || el.attr('placeholder');
	
	if(default_value && default_value.length) {
		el.focus(function() {
			if(el.val() == el.data('default_value')) el.val('').removeClass('empty');
		});

		el.blur(function() {
			if(!el.val().length) el.val(el.data('default_value')).addClass('empty');
		});

		el.closest('form').submit(function() {
			if(el.val() == el.data('default_value')) el.val('');
		});

		el.data('default_value', default_value).attr('title', default_value).trigger('blur');
	}
	
	return this;
};

jQuery(function($) {



	//slider
	$('#slider').rdy(function() {

		$('#slider .a-project:nth-child(4n)').addClass('last');
		var current = 0, length = Math.ceil($('#slider .article').length / 4);

		$('#slider .prev, #slider .next').click(function() {
			var i = $(this).attr('class').indexOf('next') != -1 ? 1 : -1;
			current += i;
			if(current < 0) current = length - 1;
			if(current > length - 1) current = 0;
			$('#slider-inner').animate({ left: -704 * current });
			return false;
		});
	});







});
