$().ready(function(){
	resetGrass();
	$(window).resize(function(){
		resetGrass();
	});
	$("#content a img").not('.nofancy').each(function(){
		$(this).parent().attr('rel', 'fancybox');
		$(this).parent().attr('class', 'fancybox');
	});
	$("#content a.fancybox").fancybox(fancyboxSettings);

	$.getScript('/js/jquery.innerfade.js', function(){
		$('#innerfade').innerfade({ speed: 'slow', timeout: 5000, type: 'sequence', containerheight: '256px' });
	});
});

$(window).load(function(){
	if ($('#newsTextEdit').size() > 0)
	{
		if (typeof CKEDITOR == 'object')
		{
			CKEDITOR.replace('newsText', {
				toolbar : [['Bold','Italic','Link','Unlink','/','TextColor']],
				height : 100,
				resize_enabled : false,
				enterMode : CKEDITOR.ENTER_DIV,
				filebrowserBrowseUrl : '/ckfinder/ckfinder.html',
				filebrowserImageBrowseUrl : '/ckfinder/ckfinder.html?Type=content',
				filebrowserUploadUrl : '/ckfinder/core/connector/php/connector.php?command=QuickUpload&type=download',
				filebrowserImageUploadUrl : '/ckfinder/core/connector/php/connector.php?command=QuickUpload&type=content'
			});
		}
	}
});

function resetGrass()
{
	if ($('#DocumentEditorForm').size() > 0)
	{
		$('#grassSpace').hide();
		$('#grass').hide();
	}
	else
	{
		documentHeight = $(document).height();
		grassHeight = $('#grass').height();
		$('#grass').css('top', (documentHeight-grassHeight) + 'px');
		$('#grass').show();
	}
}

fancyboxSettings =
{
	'hideOnContentClick': true,
	'overlayShow': true,
	'padding': 1,
	'titleShow': false
}

