function ajaxJSON(json){
	var obj = (typeof(json) == 'object') ? json : eval('(' + json + ')');
	eval(obj.script);
	if(obj.confirm){
		obj.success = confirm(obj.confirm);
	}
	return obj;
}

$(function(r){
	
	$('a.toggle').click(function(c){
		var href = $(this).attr('href');
		var cls = $(this).clone().removeClass('toggle').attr('class');
		var speed = (cls) ? cls : 'normal';
		$(href).toggle(speed);
		return false;
	});
	
	$('a.slidetoggle').click(function(c){
		var href = $(this).attr('href');
		var cls = $(this).clone().removeClass('slidetoggle').attr('class');
		var speed = (cls) ? cls : 'normal';
		$(href).slideToggle(speed);
		return false;
	});
	
	if($(".wysiwyg_user").length > 0){
		$(".wysiwyg_user").tinymce({
			mode : "textareas",
			editor_selector : "wysiwyg_user",
			theme : "advanced",
			file_browser_callback : "tinyBrowser",
			plugins : "paste,preview,advimage,tabfocus,table,fullscreen,media",
			theme_advanced_buttons1 : "formatselect,|,bold,italic,underline,|,link,unlink,cut,copy,paste,pastetext,pasteword",
			//theme_advanced_buttons2 : "fontsizeselect,,|,bullist,numlist,indent,outdent",
			//theme_advanced_buttons2 : "tablecontrols,|,hr,removeformat,visualaid,separator,image,media,|,code,preview,fullscreen",
			theme_advanced_buttons2 : "",
			theme_advanced_buttons3 : "",
			theme_advanced_toolbar_location : "top",
			theme_advanced_toolbar_align : "left",
			theme_advanced_resizing: true,
			theme_advanced_blockformats : "h3,p",
			theme_advanced_font_sizes : "8px=8px, 10px=10px, 11px=11px, 12px=12px, 14px=14px, 16px=16px, 18px=18px, 22px=22px,24px=24px, 36=36px",
			relative_urls : false, 
			inline_styles : true,
			force_p_newlines: true,
			force_br_newlines : true,
			tab_focus : ':prev,:next',
			content_css: "/site/views/think/css/wysiwyg_profile.css"
		});
	}
	
});
