var browserName=navigator.appName;
var browserVer=parseInt(navigator.appVersion); 
var TMCELoad = 0;
//	LoadMCEopt();
//if (browserName == "Microsoft Internet Explorer" && browserVer < 7) {
//	alert("IE 7 or greater is required to view this site. This is " + browserName + " " + browserVer);
//}

function globalError1() {
	//ShowNote();
	alOUT = "";
	for (i=0;i<arguments.length;i++) {
		if (i > 0) {
			alOUT = alOUT + ", "	
		}
		alOUT = alOUT + arguments[i]; 
	}
	alert(alOUT);
	//document.getElementById('errorinfo').className = "loadvistrue";
	return false;
}

function activateEditor(id) {
	tinyMCE.execCommand('mceAddControl', false, id);
}

function deactivateEditors(id) {
	curFUN = "deactivateEditors";
    if (activeEditors == 1) {
        tinyMCE.execCommand('mceRemoveControl', false, id);
		activeEditors = 0;
		tinyMCE.idCounter = 0;
    }
}

function DisContent(id) {
	tinyMCE.execCommand('mceFocus', false, id);                    
	tinyMCE.execCommand('mceRemoveControl', false, id);
}

function SaveMCE() {
	if (tinyMCE.getInstanceById('elm1')) {
		document.getElementById('elm1').value = tinyMCE.activeEditor.getContent();
	}
}

//function LoadMCEopt() {
	tinyMCE.init({
	// General options
		mode : "none",
		theme : "advanced",
		cleanup : false,
		plugins :  "cammimage,emotions,autoresize,advimage,advlink,iespell,media,contextmenu,wordcount",

		// Theme options
		theme_advanced_buttons1 : "cammimage,emotions,|,bold,italic,underline,strikethrough,|,undo,redo,|,forecolor,|,iespell",
		theme_advanced_buttons2 : "",
		theme_advanced_buttons3 : "",
		theme_advanced_buttons4 : "",
		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 : "css/style.css",
		//init_instance_callback : "resizeEditorBox",
		// Drop lists for link/image/media/template dialogs
		//template_external_list_url : "mce/lists/template_list.js",
		//external_link_list_url : "mce/lists/link_list.js",
		//external_image_list_url : "lists/image_list.js",
		//media_external_list_url : "mce/lists/media_list.js",

		// Style formats
		style_formats : [
			{title : 'Bold text', inline : 'b'},
			{title : 'Red text', inline : 'span', styles : {color : '#ff0000'}},
			{title : 'Red header', block : 'h1', styles : {color : '#ff0000'}},
			{title : 'Example 1', inline : 'span', classes : 'example1'},
			{title : 'Example 2', inline : 'span', classes : 'example2'},
			{title : 'Table styles'},
			{title : 'Table row 1', selector : 'tr', classes : 'tablerow1'}
		]

		// Replace values for the template plugin
		//template_replace_values : {
		//	username : "Some User",
		//	staffid : "991234"
		//}

    });
//}

function ReLoadEditor() {
	if (document.getElementById('elm1')) {
		if (!tinyMCE.getInstanceById('elm1')) {
			document.getElementById('elm1').className = "loadvistrue";
			tinyMCE.execCommand('mceAddControl', false, 'elm1');
		} else {
			alert('Editor Loaded');
		}
	}
	
}
window.onerror = globalError1;
