<!-- // load htmlarea
	_editor_url = "/htmlarea/";                     // URL to htmlarea files
	var win_ie_ver = parseFloat(navigator.appVersion.split("MSIE")[1]);
	if (navigator.userAgent.indexOf('Mac')        >= 0) { win_ie_ver = 0; }
	if (navigator.userAgent.indexOf('Windows CE') >= 0) { win_ie_ver = 0; }
	if (navigator.userAgent.indexOf('Opera')      >= 0) { win_ie_ver = 0; }
	if (win_ie_ver >= 5.5) {
	document.write('<scr' + 'ipt src="' +_editor_url+ 'editor.js"');
	document.write(' language="Javascript1.2"></scr' + 'ipt>');  
	} else { document.write('<scr'+'ipt>function editor_generate() { return false; }</scr'+'ipt>'); }
// -->

// JScript source code
function format_quote(ID) {
  var str;

	if (document.getSelection) {
    str = document.getSelection();
  } else if (document.selection && document.selection.createRange) {
    var range = document.selection.createRange();
    str = range.text;
  } else {
  }


    str = str.replace(/\r\n/g, '<BR>');
    strs = str.replace(/\n/g, '<BR>');
    str = str.replace(/\r/g, '<BR>');
 <!--  str = str.replace(/\r\n/g, '\r' + "<BR><BR>");

  str = "[quote]" + str + "[/quote]" + '\r\r';

  editor_insertHTML(ID, str)

  return;
}

function insert_link() {
  var str = document.selection.createRange().text;
  document.frmAddReply.message.focus();
  var my_link = prompt("Enter URL:","http://");
  if (my_link != null) {
    var sel = document.selection.createRange();
	if (str){
	sel.text = "<a class=\"content\" href=\"" + my_link + "\">" + str + "</a>";
	}else{
	sel.text = "<a class=\"content\" href=\"" + my_link + "\">link</a>";
	}
  }
  return;
}

function doInsert(ibTag, ibClsTag, isSingle)
{
var isClose = false;
var sel = document.selection;
var rng = sel.createRange();

rng.colapse;
	if((sel.type == "Text" || sel.type == "None") && rng != null){
		if(ibClsTag != "" && rng.text.length > 0)
			ibTag += rng.text + ibClsTag;
		else if(isSingle)

		isClose = true;
		rng.text = ibTag;
	}
return isClose;
}	


function Format_Selection(ID, sItem) {
	var sStr;

	if (window.getSelection) {
		var sStr = window.getSelection();
	} else if (document.selection && document.selection.createRange) {
		var range = document.selection.createRange();
		var sStr = range.text;
	} else {
	}

	//alert(navigator.userAgent);
	// Mozilla + Opera Browsers ====================================
	if (navigator.userAgent.indexOf('Gecko')>= 0) { 

		var objTextArea = document.getElementById(ID);
		var ss = objTextArea.selectionStart;
		var st = objTextArea.scrollTop;
		var es = objTextArea.selectionEnd;
		
		if (es <= 2){ es = objTextArea.textLength; }
		
		var start  = (objTextArea.value).substring(0, ss);
		var middle = (objTextArea.value).substring(ss, es);
		var end    = (objTextArea.value).substring(es, objTextArea.textLength);
		
		if (objTextArea.selectionEnd - objTextArea.selectionStart > 0){
			middle = "[" + sItem + "]" + middle + "[/" + sItem + "]";
		}
		else { alert("Sorry, unable to insert the HTML [" + sItem + "] tag.  No Text Has Been Highlighted."); }
		
		objTextArea.value = start + middle + end;
		
		return;
	} else if (navigator.userAgent.indexOf('Opera')>= 0) { return alert("Sorry, unable to insert the HTML [" + sItem + "] tag.  \n\nOpera browsers are not supported at this time."); }
	//=====================================================

 if (sStr == '') { return alert("Sorry, unable to insert the HTML [" + sItem + "] tag.  No Text Has Been Highlighted."); }

   	sStr = sStr.replace(/\r\n/g, '<BR>');
   	sStr = sStr.replace(/\n/g, '<BR>');
   	sStr = sStr.replace(/\r/g, '<BR>');
    	// sStr  = "[" + sItem + "]" + sStr  + "[/" + sItem + "]"; 

	doInsert("[" + sItem + "]" + sStr + "[/" + sItem + "]", "", false)

  return;
}

function InsertIMG(ID) {
	var sImgURL = prompt("Enter the URL to an image you wish to insert.","");
	sImgURL = "[img]" + sImgURL + "[/img]" + '\r\r';
  	editor_insertHTML(ID, sImgURL)
	return;
}

function InsertLink(ID) {
	var sLinkURL = prompt("Enter the URL of the link you wish to insert.","");
	sLinkURL = "[link]" + sLinkURL  + "[/link]" + '\r\r';
  	editor_insertHTML(ID, sLinkURL)
	return;
}

function InsertEmail(ID) {
	var sLinkURL = prompt("Enter the email address you wish to insert.","");
	sLinkURL = "[email]" + sLinkURL  + "[/email]" + '\r\r';
  	editor_insertHTML(ID, sLinkURL)
	return;
}

function ValidateCommentField(ID, bValidateName)
{

	var str = document.getElementById(ID).value;
	if( Trim(str) == '' )
	{
		alert("You cannot Leave the TextArea Blank.");
		return false;
	}
	
	if( bValidateName == true )
	{
		if( Trim(document.getElementById("ucCommentForm_txtNickName").value) == '' )
		{
			alert("You must enter a name before you can leave a comment.");
			return false;
		}
	}
	
	return true;
}

function Trim(s) 
{
  // Remove leading spaces and carriage returns
  
  while ((s.substring(0,1) == ' ') || (s.substring(0,1) == '\n') || (s.substring(0,1) == '\r'))
  {
    s = s.substring(1,s.length);
  }

  // Remove trailing spaces and carriage returns

  while ((s.substring(s.length-1,s.length) == ' ') || (s.substring(s.length-1,s.length) == '\n') || (s.substring(s.length-1,s.length) == '\r'))
  {
    s = s.substring(0,s.length-1);
  }
  return s;
}


function validateDelete() 
{
 if (!confirm("Are you sure you wish to delete this item!")) 
 {
        event.returnValue=false;
       }
}


function showModList(mode, id)
{
	if (mode==1){
		document.getElementById(id).style.display='block';
		document.getElementById(id).style.border='solid 1px #000000';
		document.getElementById(id).style.backgroundColor='#FFFFFF';
		document.getElementById(id).style.paddingTop='5px';
		document.getElementById(id).style.paddingBottom='5px';
		document.getElementById(id).style.paddingLeft='15px';
		document.getElementById(id).style.paddingRight='15px';
		document.getElementById(id).style.position='absolute';
		document.getElementById(id).style.marginLeft='-10px';
		document.getElementById(id).style.color='#FF0000';
		setTimeout("showModList(0, '" + id + "');", 6000);
	}else{
		document.getElementById(id).style.display='none';
	}
}

function ShowWCCertifiedWindow()
{
	var DisplayWindow
	DisplayWindow = window.open('','','toolbar=no,location=no,directories=no,status=no,menubar=no,resizable=yes,copyhistory=no,scrollbars=yes,width=550,height=170');	

	DisplayWindow.document.write("<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.0 Transitional//EN\">");
	DisplayWindow.document.write("<HTML>");
	DisplayWindow.document.write("<HEAD>");
	DisplayWindow.document.write("<title>WinCustomize Certified</title>");
	DisplayWindow.document.write("<style type=\"text/css\">");
	DisplayWindow.document.write("body { font-family: arial; font-size: 12px; line-height: 16px; color: #000000; }");
	DisplayWindow.document.write("A {COLOR: #003399; TEXT-DECORATION: UNDERLINE;}");
	DisplayWindow.document.write("A:hover {COLOR: #550000; TEXT-DECORATION: UNDERLINE;}");
	DisplayWindow.document.write("</style>");
	DisplayWindow.document.write("</HEAD>");
	DisplayWindow.document.write("<body text=\"#000000\" link=\"#000000\" vlink=\"#000000\" alink=\"#000000\" rightmargin=\"5\" leftmargin=\"5\" marginwidth=\"0\" topmargin=\"5\" bottommargin=\"5\" marginheight=\"0\" bgcolor=\"#EEEEEE\" background=\"http://images.stardock.com/wc/T_AERO/images/wc-lizard-big.gif\" style=\"background-repeat: no-repeat; background-position: top right;\">");
	DisplayWindow.document.write("<table width=\"100%\" height=\"100%\" cellpadding=10 cellspacing=0 style=\"border: dashed 1px #B5B5B5;\"><tr><td valign=top>");
	DisplayWindow.document.write("<img src=\"http://images.stardock.com/wc/WC_Certified.gif\">");
	DisplayWindow.document.write("<BR><B>What is WinCustomize Certified?</B>");
	DisplayWindow.document.write("<BR><span style=\"font-size: 11px;\">If you notice the WinCustomize Certified logo while browsing WinCustomize.com, then you know a WinCustomize moderator has tried, tested and otherwise approved of that particular item on the website for download.<P>Please feel free to use this helpful indicator when making your next download decision.</span>");	
	DisplayWindow.document.write("</td></tr></table>");
	DisplayWindow.document.write("</body>");
	DisplayWindow.document.write("</HTML>");
}