/* Full Featured Toolbar */

// tinyMCE.init({
// 	// mode : "none",
// 	cleanup_on_startup : true,
// 	mode : "specific_textareas",
// 	textarea_trigger : "mce_editable1",
// 	theme : "advanced",
// 	plugins : "style,layer,table,save,advhr,advimage,advlink,emotions,iespell,insertdatetime,preview,media,searchreplace,print,contextmenu,paste,directionality,fullscreen,noneditable,visualchars,nonbreaking,xhtmlxtras,template,spellchecker,inlinepopups",
// 	theme_advanced_buttons1 : "bold,italic,underline,strikethrough,separator,justifyleft,justifycenter,justifyright,justifyfull,separator,styleselect,formatselect,fontselect,fontsizeselect,forecolor,backcolor",
// 	theme_advanced_buttons2 : "cut,copy,paste,pastetext,pasteword,separator,search,replace,separator,bullist,numlist,separator,outdent,indent,separator,undo,redo,separator,link,unlink,anchor,image,separator,insertdate,inserttime,preview,separator",/*cleanup,help,code,*/
// 	theme_advanced_buttons3 : "tablecontrols,separator,hr,removeformat,visualaid,separator,sub,sup,separator,charmap,emotions,iespell,media,advhr,separator,print,separator,ltr,rtl,separator,fullscreen",
// 	theme_advanced_buttons4 : "insertlayer,moveforward,movebackward,absolute,|,styleprops,|,cite,abbr,acronym,del,ins,attribs,|,visualchars,nonbreaking,template,|,spellchecker",
// 
// /*	theme_advanced_buttons1_add : "fontselect,fontsizeselect,forecolor,backcolor",
// 	theme_advanced_buttons2_add : "separator,insertdate,inserttime,preview,separator",
// 	theme_advanced_buttons2_add_before: "cut,copy,paste,pastetext,pasteword,separator,search,replace,separator",
// 	theme_advanced_buttons3_add_before : "tablecontrols,separator",
// 	theme_advanced_buttons3_add : "emotions,iespell,media,advhr,separator,print,separator,ltr,rtl,separator,fullscreen",
// 	theme_advanced_buttons4 : "insertlayer,moveforward,movebackward,absolute,|,styleprops,|,cite,abbr,acronym,del,ins,attribs,|,visualchars,nonbreaking,template,|",
// 	theme_advanced_buttons4_add : "spellchecker",*/
// 	spellchecker_languages : "+English=en",/*,Swedish=sv*/
// 	theme_advanced_toolbar_location : "top",
// 	theme_advanced_toolbar_align : "left",
// 	content_css : "/addons/tinymce/editor_css.css",
// 	plugin_insertdate_dateFormat : "%d-%b-%Y",
// 	plugin_insertdate_timeFormat : "%H:%M:%S",
// 	extended_valid_elements : "hr[class|width|size|noshade],font[face|size|color|style],span[class|align|style]",
// 	external_link_list_url : "example_link_list.js",
// 	external_image_list_url : "example_image_list.js",
// 	flash_external_list_url : "example_flash_list.js",
// 	media_external_list_url : "example_media_list.js",
// 	template_external_list_url : "example_template_list.js",
// 	theme_advanced_resize_horizontal : false,
// 	theme_advanced_resizing : true,
// 	nonbreaking_force_tab : true,
// 	apply_source_formatting : true
// 
// });


/* Basic Featured Toolbar - 1 */
tinyMCE.init({
	// mode : "none",
	cleanup_on_startup : true,
	mode : "specific_textareas",
	textarea_trigger : "mce_editable2",
	theme : "advanced",
	plugins : "style,layer,table,save,advhr,advimage,advlink,emotions,iespell,insertdatetime,preview,media,searchreplace,print,contextmenu,paste,directionality,fullscreen,noneditable,visualchars,nonbreaking,xhtmlxtras,template,spellchecker,inlinepopups",
	theme_advanced_buttons1 : "cut,copy,paste,bold,italic,underline,strikethrough,separator,justifyleft,justifycenter,justifyright,justifyfull,separator,fontselect,fontsizeselect,forecolor,backcolor,spellchecker",

	spellchecker_languages : "+English=en",
	theme_advanced_toolbar_location : "top",
	theme_advanced_toolbar_align : "left",
	content_css : "/addons/tinymce/editor_css.css",
	plugin_insertdate_dateFormat : "%d-%b-%Y",
	plugin_insertdate_timeFormat : "%H:%M:%S",
	extended_valid_elements : "hr[class|width|size|noshade],font[face|size|color|style],span[class|align|style]",
	external_link_list_url : "example_link_list.js",
	external_image_list_url : "example_image_list.js",
	flash_external_list_url : "example_flash_list.js",
	media_external_list_url : "example_media_list.js",
	template_external_list_url : "example_template_list.js",
	theme_advanced_resize_horizontal : false,
	theme_advanced_resizing : true,
	nonbreaking_force_tab : true,
	apply_source_formatting : true

});
/* Basic Featured Toolbar - 2 */
tinyMCE.init({
	// mode : "none",
	cleanup_on_startup : true,
	mode : "specific_textareas",
	textarea_trigger : "mce_editable3",
	theme : "advanced",
	plugins : "style,layer,table,save,advhr,advimage,advlink,emotions,iespell,insertdatetime,preview,media,searchreplace,print,contextmenu,paste,directionality,fullscreen,noneditable,visualchars,nonbreaking,xhtmlxtras,template,spellchecker,inlinepopups",
	theme_advanced_buttons1 : "bold,italic,underline,separator,justifyleft,justifycenter,justifyright,justifyfull,separator,fontselect,fontsizeselect,spellchecker",

	spellchecker_languages : "+English=en",
	theme_advanced_toolbar_location : "top",
	theme_advanced_toolbar_align : "left",
	content_css : "/addons/tinymce/editor_css.css",
	plugin_insertdate_dateFormat : "%d-%b-%Y",
	plugin_insertdate_timeFormat : "%H:%M:%S",
	extended_valid_elements : "hr[class|width|size|noshade],font[face|size|color|style],span[class|align|style]",
	external_link_list_url : "example_link_list.js",
	external_image_list_url : "example_image_list.js",
	flash_external_list_url : "example_flash_list.js",
	media_external_list_url : "example_media_list.js",
	template_external_list_url : "example_template_list.js",
	theme_advanced_resize_horizontal : false,
	theme_advanced_resizing : true,
	nonbreaking_force_tab : true,
	apply_source_formatting : true

});

function removeEditor(id){
	var tabobj = document.getElementById(id);
	var textarea = tabobj.getElementsByTagName("textarea");
// 	alert(textarea.length);
	if(textarea.length > 0){
	for(var i=0;i<textarea.length;i++){
		var tmptxtarea = textarea[i].id.split("_");
		if(tmptxtarea[0] == 'edittextResume'){tinyMCE.execCommand('mceRemoveControl', false, textarea[i].id);}
		if(tmptxtarea[0] == 'jobdescrip'){tinyMCE.execCommand('mceRemoveControl', false, textarea[i].id);}
		if(tmptxtarea[0] == 'jobresp'){tinyMCE.execCommand('mceRemoveControl', false, textarea[i].id);}
		if(tmptxtarea[0] == 'copypasteResume'){tinyMCE.execCommand('mceRemoveControl', false, textarea[i].id);}
	}
	}
}

function toggleEditor(id) {
	var elm = document.getElementById(id);

	if (tinyMCE.getInstanceById(id) == null){tinyMCE.execCommand('mceAddControl', false, id);}
	else{
		tinyMCE.execCommand('mceFocus', false, id);
		document.getElementById(id).style.display = "none";
		tinyMCE.execCommand('mceRemoveControl', false, id);
	}
}
// function toggleEditor(id) {
// tinyMCE.execCommand('mceRemoveControl', false, id);

// var tmpvar = '';
// 	for (n in tinyMCE.instances){
// 	var inst = tinyMCE.instances[n];
// 	if (!tinyMCE.isInstance(inst))
// 	continue;
// 
// 	tmpvar += inst.formTargetElementId+",";
// 	}
// 	tmpvar = tmpvar.slice(0, -1);
// 	var t = setTimeout("tinymceremovecontrol('"+tmpvar+"');", 0);
// }
// function tinymceremovecontrol(tmpvar){
// var tmparr = new Array();
// 	tmparr = tmpvar.split(",");
// 	for(var i=0;i<tmparr.length;i++){
// 		alert(tmparr[i]);
// 		if(!document.getElementById(tmparr[i])){
// 			alert(tmparr[i]);
// 	alert(tmpvar+" -- "+tinyMCE.idCounter);
// 			tinyMCE.execCommand('mceRemoveControl', false, tmparr[i]);
// 		}else{alert(document.getElementById(tmparr[i]));}
// 	}
// }