// FCKeditor_OnComplete is a special function that is called when an editor
// instance is loaded ad available to the API. It must be named exactly in
// this way.
function FCKeditor_OnComplete( editorInstance )
{
	// Show the editor name and description in the browser status bar.
	document.getElementById('eMessage').innerHTML = 'Instance "' + editorInstance.Name + '" loaded - ' + editorInstance.Description ;

	// Show this sample buttons.
	document.getElementById('eButtons').style.visibility = '' ;
}

function InsertHTML()
{
	// Get the editor instance that we want to interact with.
	var oEditor = FCKeditorAPI.GetInstance('FCKeditor1') ;

	// Check the active editing mode.
	if ( oEditor.EditMode == FCK_EDITMODE_WYSIWYG )
	{
		// Insert the desired HTML.
		oEditor.InsertHtml( '- This is some <b>sample</b> HTML -' ) ;
	}
	else
		alert( 'You must be on WYSIWYG mode!' ) ;
}

function SetContents()
{
	// Get the editor instance that we want to interact with.
	var oEditor = FCKeditorAPI.GetInstance('FCKeditor1') ;

	// Set the editor contents (replace the actual one).
	// Remove By Jun: 20050824 oEditor.SetHTML( 'This is the <b>new content</b> I want in the editor.' ) ;
	
	oEditor.SetHTML(document.Form1.txtContent.value); //Add by Jun: 20050824
}

function GetContents()
{
	// Get the editor instance that we want to interact with.
	var oEditor = FCKeditorAPI.GetInstance('FCKeditor1') ;
	document.Form1.txtContent.value= oEditor.GetXHTML( true ) ;//Add by Jun: 20050824
	// Get the editor contents in XHTML.
	// Remove by Jun: 20050824 alert( oEditor.GetXHTML( true ) ) ;		// "true" means you want it formatted.
	document.Form1.txtCONTENTSEARCH.value = oEditor.EditorDocument.body.innerText;
	//alert('xxx');
	//FCKeditor1.innerText;;
	
}

function ExecuteCommand( commandName )
{
	// Get the editor instance that we want to interact with.
	var oEditor = FCKeditorAPI.GetInstance('FCKeditor1') ;

	// Execute the command.
	oEditor.Commands.GetCommand( commandName ).Execute() ;
}

function GetLength()
{
	// This functions shows that you can interact directly with the editor area
	// DOM. In this way you have the freedom to do anything you want with it.

	// Get the editor instance that we want to interact with.
	var oEditor = FCKeditorAPI.GetInstance('FCKeditor1') ;

	// Get the Editor Area DOM (Document object).
	var oDOM = oEditor.EditorDocument ;

	var iLength ;

	// The are two diffent ways to get the text (without HTML markups).
	// It is browser specific.

	if ( document.all )		// If Internet Explorer.
	{
		iLength = oDOM.body.innerText.length ;
	}
	else					// If Gecko.
	{
		var r = oDOM.createRange() ;
		r.selectNodeContents( oDOM.body ) ;
		iLength = r.toString().length ;
	}

	alert( 'Actual text length (without HTML markups): ' + iLength + ' characters' ) ;
}













var ie = document.all ? 1 : 0
var ns = document.layers ? 1 : 0
if(ns){doc = "document."; sty = ""}
if(ie){doc = "document.all."; sty = ".style"}
var initialize = 0
var Ex, Ey, topColor, subColor, ContentInfo
if(ie){
Ex = "event.x"
Ey = "event.y"
}
if(ns){
Ex = "e.pageX"
Ey = "e.pageY"
window.captureEvents(Event.MOUSEMOVE)
window.onmousemove=overhere
}


function CheckIsShow()
{
	if (document.Form1.cbISSHOW.checked == true)
	{
		if (document.all.txtExpireDate.value != '')
		{
		document.all.txtExpireDate.value = '99999999';
		document.Form1.ExpriedCal.style.visibility = 'hidden';	
		}
		else if (document.all.txtExpireDate.value == '')
		{
		document.all.txtExpireDate.value = '99999999';
		document.Form1.ExpriedCal.style.visibility = 'hidden';	
		}
	}
	else if (document.Form1.cbISSHOW.checked == false)
	{
		if ( document.all.txtExpireDate.value != '99999999' && document.all.txtExpireDate.value != '' )
		{
		document.all.txtExpireDate.value = document.all.txtExpireDate.value;
		document.Form1.ExpriedCal.style.visibility = 'visible';	
		}
		else
		{
						document.all.txtExpireDate.value = '';
		document.Form1.ExpriedCal.style.visibility = 'visible';	
		}
	}
}


function Calendar_Select(e) {
	var myCalTemp;
	if (document.getElementById("myCal").style.visibility=="hidden") {
		myCalTemp = document.getElementById("myCal");
		myCalTemp.style.visibility="visible";
		//alert('document.body.scrollTop=' + document.documentElement.scrollTop);
		//alert('top='+(eval(Ey) + document.body.scrollTop));
		//alert('left='+(eval(Ex) + (-15)));
		if(ie){eval("myCalTemp" + sty + ".top = "  + (eval(Ey) + document.documentElement.scrollTop))}
		if(ns){eval("myCalTemp" + sty + ".top = "  +  eval(Ey))}
		eval("myCalTemp" + sty + ".left = " + (eval(Ex) + (-15)))
		myCalTemp.style.visibility = "inherit";
		myCalTemp.className=e.previousSibling.id;
	}
	else {
		document.getElementById("myCal").style.visibility="hidden";
	}
}
		
function FCKeditor_OnComplete( editorInstance )
{
	window.status = editorInstance.Description ;
}




