/* jQuery functions */
$(document).ready(function() {
//var $ = jQuery.noConflict();

// Forms Input defaultValue
$('.inputbox').live('focus', function(){
	if(this.value==this.defaultValue)this.value=''; $(this).addClass('focus');
	}).bind('blur',function(){ 
	if(this.value=='')this.value=this.defaultValue; $(this).removeClass('focus');
});

$('img').lazyload({placeholder:'/images/grey.gif', effect:'fadeIn'})

// Hide the elements initially
var lis = $('.thumb').hide();
var i = 0;
(function displayImages() {
	lis.eq(i++).fadeIn(200, displayImages);
})();


//$('a[rel="lightbox-rel"]').colorbox({slideshow:true, resize:true, maxWidth:'100%', maxHeight:'100%', width:'1024px', height:'800px'});
$('a[rel="lightbox-rel"]').colorbox();

		
$('#comment').one('focus', function() {
	$('#comment').after('<div id="preview-box"><h4>предварительный просмотр</h4><div id="live-preview"></div></div>');
});
var $comment = ''; // that's two single quotation-marks at the end
$('#comment').keyup(function() {
	$comment = $(this).val();
	$comment = $comment.replace(/\n/g, '<br />').replace(/\n\n+/g, '<br /><br />');
	$('#live-preview').html( $comment );
});


$('.album:nth-child(2n)').addClass('last');
$('.thumb:nth-child(5n3)').addClass('clean');



/* end of $(document).ready */
});



