<!--//

//  Function which loads HTML into the iframe for editing
function LoadHTMLContent()
{
	HTMLContent.document.body.innerHTML = document.getElementById("MainForm1").Text.value;
}

var isHTMLMode=false        // variable to determine wether to show HTML or formatted content.



// *** INSERTED Try...Catch error check to prevent (HTMLContent invalid object error when not editiing)
// *** OJ, ChicagoEtools.com, Jan 2004
function document.onreadystatechange()
{
  	try { HTMLContent.document.designMode="On"; }
	catch(error){}
}


// Function to execute the requested button command (fomatting italic, bold, underline etc...)
// Coded By: Carl Deathe, June 2003
	var isHTMLMode=false
	function setMode()
	{
		var sTempVar;
		//Swap the isHTMLMode status
		isHTMLMode=!isHTMLMode;

		// check current HTML mode (raw or formatted) and set to opposite...
		if (isHTMLMode) {
			sTempVar=HTMLContent.document.body.innerHTML;HTMLContent.document.body.innerText=sTempVar;
			//document.all['StateofPlay'].src='../core/gfx/buttons/btn_add_on.gif';
			document.all['StateofPlay'].alt='HIDE HTML';

		} else {
			sTempVar=HTMLContent.document.body.innerText;HTMLContent.document.body.innerHTML=sTempVar;
			//document.all['StateofPlay'].src='../core/gfx/buttons/btn_add_on.gif';
			document.all['StateofPlay'].alt='SHOW HTML';
		}

	  	HTMLContent.focus();	// Reset the focus back to the IFrame named 'HTMLContent'.
	}
	
	function cmdExec(cmd,opt) 
	{
  	if (isHTMLMode){alert("Please de-select '<HTML>'");return;}
  	HTMLContent.document.execCommand(cmd,"",opt);HTMLContent.focus();
	}


function inserturl(){
	var d = document.forms.MainForm1;
	
	if(d.linktext.value.length==0){
		alert("You must provide text for the link");
	}else if(d.linkurl.value.length==0){
		alert("You must provide a URL for the link");
	}
	else{
		if(d.typeoflink[0].checked){
			linktext='<a href="'+d.linkurl.value+'" target="_blank">'+d.linktext.value+'</a>';
		}else if(d.typeoflink[1].checked){
			linktext='<a href="'+d.linkurl.value+'">'+d.linktext.value+'</a>';
		}else if(d.typeoflink[2].checked){
			linktext='<a href="javascript:openpopup(\''+d.linkurl.value+'\',\''+d.popwidth.value+'\',\''+d.popheight.value+'\')">'+d.linktext.value+'</a>';
		}else if(d.typeoflink[3].checked){
			linktext='<a href="mailto:'+d.linkurl.value+'?subject='+d.emailsubject.value+'">'+d.linktext.value+'</a>';
		}
		HTMLContent.document.body.innerHTML=HTMLContent.document.body.innerHTML+linktext;
	}
}	

	
// Submit the Form....
function submitForm()
{
	document.getElementById("MainForm1").Text.value = HTMLContent.document.body.innerHTML	
	return true;
}
	
//Table inserter
function openTableWindow()
{
	window.open('/core/table_popup.htm','Table','width=560,height=660,resizable=yes,scrollbars=yes,top=30,left=20');
}

//-->
