//<script type="text/javascript">
var list; // global list variable cache
var tickerObj; // global tickerObj cache
var hex = 255;

var interval = 10; // interval in seconds
var fadeSpeed = 40; // fade speed, the lower the speed the faster the fade.  40 is normal.

function fadeText(divId) {
  if(tickerObj)
  {
    if(hex>0) {
      hex-=5; // increase color darkness
      tickerObj.style.color="rgb("+hex+","+hex+","+hex+")";
      setTimeout("fadeText('" + divId + "')", fadeSpeed); 
    } else
      hex=255; //reset hex value
  }
}

function initialiseList(divId) {
  tickerObj = document.getElementById(divId);
  if(!tickerObj)
    reportError("Could not find a div element with id \"" + divId + "\"");
  list = tickerObj.childNodes;
  if(list.length <= 0)
    reportError("The div element \"" + divId + "\" does not have any children");
  for (var i=0; i<list.length; i++) {
    var node = list[i];
    if (node.nodeType == 3 && !/\S/.test(node.nodeValue)) 
              tickerObj.removeChild(node);
  }
  run(divId, 0);
}

function run(divId, count) {
  fadeText(divId);
  list[count].style.display = "block";
  if(count > 0)
    list[count-1].style.display = "none";
  else
    list[list.length-1].style.display = "none";
  count++;
  if(count == list.length)
    count = 0;
  window.setTimeout("run('" + divId + "', " + count+ ")", interval*400);
}
function reportError(error) {
  alert("The script could not run because you have errors:\n\n" + error);
  return false;
}

//</script>

//²åÈë´úÂë
//<script language="JavaScript" type="text/javascript" >
	function ShowMyDialog(button)
	{
		var editor=CuteEditor_GetEditor(button);
		//var newwin=showModelessDialog("insertcode.aspx?_rand="+new Date().getTime(),editor,"dialogWidth:600px;dialogHeight:430px");
		if(navigator.appName == 'Microsoft Internet Explorer')
		{
			returnstr=showModalDialog( 'insertcode.aspx',editor,'dialogWidth:550px; dialogHeight:400px;help:0;status:0;resizeable:1;');
		}
		else
		{
			var CodeInsertWindow = window.open( 'insertcode.aspx?_rand='+new Date().getTime(),editor,'width=550,height=400,toolbars=0,resizable=1');
			CodeInsertWindow.focus();
			return false;
		}
	}
//</script>
