function initObservableActions(scope){
	var query = '.observable-actions';
	if (typeof(scope) == 'string'){
		query = scope + " " + query;
	}
	$(query).each(function(){
		var oa = $(this);
		oa.parent().mouseover(function(){
			oa.show();
		});
		oa.parent().mouseout(function(){
			oa.hide();
		});
	});
}

function initFckEditor(){
	if(typeof(CKEDITOR)=="undefined") return;
	CKEDITOR.config.contentsCss = BASE + '/css/default.css';
	CKEDITOR.config.bodyClass = "entry-editor entry";


	$("textarea.editor").ckeditor({
		filebrowserBrowseUrl : BASE + '/js/ckeditor/ckfinder/ckfinder.html',
		filebrowserImageBrowseUrl : BASE + '/js/ckeditor/ckfinder/ckfinder.html?Type=Images',
		filebrowserFlashBrowseUrl : BASE + '/js/ckeditor/ckfinder/ckfinder.html?Type=Flash',
		filebrowserUploadUrl : BASE + '/js/ckeditor/ckfinder/core/connector/php/connector.php?command=QuickUpload&type=Files',
		filebrowserImageUploadUrl : BASE + '/js/ckeditor/ckfinder/core/connector/php/connector.php?command=QuickUpload&type=Images',
		filebrowserFlashUploadUrl : BASE + '/js/ckeditor/ckfinder/core/connector/php/connector.php?command=QuickUpload&type=Flash'


	});
}

function makeTabs() {
	if(typeof($().tabs)=="undefined") return;
	$('.tabs').tabs('.pane');
}


$(function(){
	$('a[rel*=facebox]').facebox();
	initObservableActions();
	initFckEditor();
	makeTabs();
})
