function toggleEditor(id) {
	if (!tinyMCE.get(id))
		tinyMCE.execCommand('mceAddControl', false, id);
	else
		tinyMCE.execCommand('mceRemoveControl', false, id);
}

function conv(){
if(document.REPLIER.pain.checked==true){
}else
{
toggleEditor('Post');
}
}


	tinyMCE.init({
		// General options
		mode : "exact",
		elements : "Post",
		language : "ar",
		theme : "advanced",
		skin : "o2k7",
    	directionality : "rtl",
       convert_urls : false,
		plugins : "autosave,safari,pagebreak,style,layer,table,save,advhr,advimage,advlink,emotions,iespell,inlinepopups,insertdatetime,preview,media,searchreplace,print,contextmenu,paste,directionality,fullscreen,noneditable,visualchars,nonbreaking,xhtmlxtras,template,imagemanager",
   		imagemanager_insert_template : '<DIV style="PADDING-RIGHT: 2px; PADDING-LEFT: 2px;  PADDING-BOTTOM: 2px; PADDING-TOP: 2px; TEXT-ALIGN: center"><DIV style="WIDTH: {$custom.width}px; height:{$custom.height}"><IMG src="{$url}" border="1" ></DIV><DIV class=photo_desc style="WIDTH: {$custom.width}px">عنوان اسفل الصورة</DIV></DIV>',


		
		
		// Theme options
		theme_advanced_buttons1 : "newdocument,|,bold,italic,underline,strikethrough,|,styleselect,formatselect,fontselect,fontsizeselect",
		theme_advanced_buttons2 : "cut,copy,paste,pastetext,pasteword,|,search,replace,|,bullist,numlist,|,outdent,indent,blockquote,|,undo,redo,|,link,unlink,anchor,image,insertimage,cleanup,help,code,|,insertdate,inserttime,preview,|,forecolor,backcolor",
		theme_advanced_buttons3 : "tablecontrols,|,hr,removeformat,visualaid,|,sub,sup,|,charmap,emotions,iespell,media,advhr,|,print,|,ltr,rtl,|,fullscreen",
		theme_advanced_buttons4 : "insertlayer,moveforward,movebackward,absolute,|,styleprops,|,cite,abbr,acronym,del,ins,attribs,|,visualchars,nonbreaking,template,pagebreak,justifyleft,justifycenter,justifyright,justifyfull",
		theme_advanced_toolbar_location : "top",
		theme_advanced_toolbar_align : "left",
		theme_advanced_statusbar_location : "bottom",
		theme_advanced_resizing : true,
		


		// Example content CSS (should be your site CSS)
		content_css : "../../style1.css",

		// Drop lists for link/image/media/template dialogs
		template_external_list_url : "lists/template_list.js",
		external_link_list_url : "lists/link_list.js",
		external_image_list_url : "lists/image_list.js",
		media_external_list_url : "lists/media_list.js",

		// Replace values for the template plugin
		template_replace_values : {
			username : "Some User",
			staffid : "991234"
		},
	template_templates : [
		{
			title : "Editor Details",
			src : "editor_details.htm",
			description : "Adds Editor Name and Staff ID"
		},
		{
			title : "Timestamp",
			src : "time.htm",
			description : "Adds an editing timestamp."
		}
	]

		
	
    
	});
	function Footer() {
		var num = prompt("ادخل رقم الهامش", "");
		var txt = prompt("ادخل نص الهامش", "");
		if (num) {
				if (txt) {
					tinyMCE.execCommand('mceInsertContent',true,"<sup><a name='t" + num + "' href='#b" + num + "'>[" + num + "]</a></sup>");
					document.REPLIER.note.value = document.REPLIER.note.value+"<a name='b" + num + "' href='#t" + num + "'>[" + num + "]</a> " + txt +"<br>";
				}
		}
		}
		
		function Quote() {
		var html = prompt("ادخل نص الإقتباس هنا", "");
		if (html) {
				tinyMCE.execCommand('mceInsertContent',true,"<div class='quote_cont' style='text-align: center;'><div class='quote_up'>&nbsp;</div><div class='quote_author' style='text-align: right;'>" + html + "</div><div class='quote_down'>&nbsp;</div></div>");
		}
	}
	
		function quran() {
		var html = prompt("ادخل النص القرأنى", "");
		if (html) {
				tinyMCE.execCommand('mceInsertContent',true,"<font color=#990033 face='traditional arabic' size=4> &#64831; " + html + " &#64830;   </font>");
		}
	}
	
	function letter() {
		var html = prompt("ادخل النص الاول", "");
		var html2 = prompt("ادخل النص الثانى", "");
		if (html) {
				tinyMCE.execCommand('mceInsertContent',true,"<fieldset><legend> " + html + "</legend><br>" + html2 + "</fieldset>");
		}
	}
	
		function tablz() {

html='<table style="width: 95%;" border="0" cellspacing="1" cellpadding="3">';
html +='<tbody>';
html +='<tr>';
html +='<th>عمود1</th> <th>عمود 2<br /></th> <th>عمود 3<br /></th> <th>عمود 4 </th>';
html +='</tr>';
html +='<tr>';
html +='<td class="row1b">تجربة</td>';
html +='<td class="row1">تجربة</td>';
html +='<td class="row1b">تجربة</td>';
html +='<td class="row1">تجربة</td>';
html +='</tr>';
html +='<tr>';
html +='<td class="row0b">تجربة</td>';
html +='<td class="row0">تجربة</td>';
html +='<td class="row0b">تجربة</td>';
html +='<td class="row0">تجربة</td>';
html +='</tr>';
html +='<tr>';
html +='<td class="row1b">تجربة</td>';
html +='<td class="row1">تجربة</td>';
html +='<td class="row1b">تجربة</td>';
html +='<td class="row1">تجربة</td>';
html +='</tr>';
html +='</tbody>';
html +='</table>';
	tinyMCE.execCommand('mceInsertContent',true,html);
		}
