/* 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');
});
/*
$('label[for=anon]').toggle(
	function(){$('input[name=name]').attr({value:'123'});
	},function(){$('input[name=name]').attr({value:''});}
   );
*/

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

	//$('a[rel="example2"]').colorbox({transition:'fade', width:"75%", height:"75%"});
	$('a[rel="lightbox-rel"]').colorbox({slideshow:true, resize:true, maxWidth:'100%', maxHeight:'100%', width:'1024px', height:'800px'});
	//$().bind('cbox_complete', function(){ setTimeout($.fn.colorbox.next, 3000); });
	//$().bind('resize.cbox_resize', function(){ $.fn.colorbox.resize, 200, 200 });

	//$('.nav').click(function(e) { e.preventDefault(); });
	//$('.tabNav').tabs('.tabs > div').history();
	$('#comments').live('click', function() { $(this).expose({api:true, lazy:true, loadSpeed:100, closeSpeed:100, color:'#111'}).load(); });
	$('#commentcontent').live('click', function() { $(this).expose({api:true, lazy:true, loadSpeed:100, closeSpeed:100, color:'#111'}).load(); });
	//$('#albums').live('click', function() { $(this).expose({api:true, lazy:true, loadSpeed:100, closeSpeed:100, color:'#111'}).load(); });
	//$('*[title]').tooltip({position:'bottom center', offset:[10, 30], tip:'.tooltip'});
		
	$('#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 );
	});
	
	
});

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


