/*
     FILE ARCHIVED ON 3:56:46 Feb 23, 2011 AND RETRIEVED FROM THE
     INTERNET ARCHIVE ON 17:47:50 Jan 26, 2015.
     JAVASCRIPT APPENDED BY WAYBACK MACHINE, COPYRIGHT INTERNET ARCHIVE.
     ALL OTHER CONTENT MAY ALSO BE PROTECTED BY COPYRIGHT (17 U.S.C.
     SECTION 108(a)(3)).
*/
	var req;
	var td = null;
	var ret = "";
	var url = '#topofpage';
	var counter =0;
	var xml = '';
	var what ='';
	function DoCallback(data)
	{
		// branch for native XMLHttpRequest object
		if (window.XMLHttpRequest) {
			req = new XMLHttpRequest();
			req.onreadystatechange = processReqChange;
			req.open('POST', url, true);
			req.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
			req.send(data);
		// branch for IE/Windows ActiveX version
		} else if (window.ActiveXObject) {
			req = new ActiveXObject('Microsoft.XMLHTTP')
			if (req) {
				req.onreadystatechange = processReqChange;
				req.open('POST', url, true);
				req.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
				req.send(data);
			}
		}
	}
	function processReqChange() {
		// only if req shows 'loaded'
		if (req.readyState == 4) {
			// only if 'OK'
			if (req.status == 200) {
				 eval(what);
			} else {
				alert('There was a problem retrieving the XML data:\n' +
					req.responseText);
			}
		}
	}
function clearFont()
{
	code = wysiwyg.getHTMLContent();
	code = code.replace(/])*face="([^"]*)"/gi," 0){
		what = "CheckUsernameReturn(req.responseXML)";
		DoCallback("w=CheckUsername" + "&Username=" + document.getElementById('Username').value	);
		return true;
	}else{
		alert('Please enter a username to check its availability.');
	}
}
function CheckLength(textarea) {
	var MaxLength = 500;
	biolen = textarea.value.length;
	if (biolen > MaxLength) {
		textarea.value = textarea.value.substr(0, MaxLength);
		return;
	}
	var RemainingLength = (MaxLength - biolen);
	limitcheck = 'You can type another ' + RemainingLength + ' characters into your biography.';
	document.getElementById('biolength').innerHTML = limitcheck;
}
function CheckUsernameReturn(returned){
		
		// get the status of the ajax response
		// our getXMLData function relies on a global variable called 'xml'
		// so we just put the response into that.
		xml = returned.documentElement;
		var status = getXMLData('status');
		if(status == 1){
			// user account was successfully create
			document.getElementById("UsernameCheck").innerHTML =  getXMLData('message');
			return true;
			
		}else{
			document.getElementById("UsernameCheck").innerHTML = 'There was an error checking that username.';
			return false;
		}
}
function CheckSubmitArticleForm()
{
	if(document.getElementById("Title").value == "")
	{
		alert("Please enter an article title.");
		document.getElementById("Title").focus();
		return false;
	}
	if(document.getElementById("Summary").value == "")
	{
		alert("Please enter a summary.");
		document.getElementById("Summary").focus();
		return false;
	}
	if(document.getElementById("ACategories").selectedIndex == -1)
	{
		alert("Please select a category.");
		document.getElementById("ACategories").focus();
		return false;
	}
	
	return true;
}
function CheckSubmitBlogForm(){
	
	if(document.getElementById("Title").value == "")
	{
		alert("Please enter a title");
		document.getElementById("Title").focus();
		return false;
	}
	if(wysiwyg.getHTMLContent() == " " || wysiwyg.getHTMLContent() == "
" || wysiwyg.getHTMLContent() == "
 " || wysiwyg.getHTMLContent() == "" || wysiwyg.getHTMLContent() == " 
" || wysiwyg.getHTMLContent() == "
 ")
	{
		alert('Please enter some content for your blog post');
		return false;
	}
}
function CheckSubmitArticleForm2()
{
	atype = document.getElementById('ArticleType');
	articleType = atype.options[atype.selectedIndex].value;
	
	if(document.getElementById("Title").value == "")
	{
		alert("Please enter an article title.");
		document.getElementById("Title").focus();
		return false;
	}
	if(document.getElementById("Summary").value == "")
	{
		alert("Please enter a summary.");
		document.getElementById("Summary").focus();
		return false;
	}
	if(document.getElementById("ACategories").selectedIndex == -1)
	{
		alert("Please select a category.");
		document.getElementById("ACategories").focus();
		return false;
	}
	if(articleType == 1) // full article
	{
		if(document.getElementById("PageTitle").value == "")
		{
			alert("You need to insert a both an article title and a page title.");
			document.getElementById("PageTitle").focus();
			return false;
		}
		if(wysiwyg.getHTMLContent() == " " || wysiwyg.getHTMLContent() == "
" || wysiwyg.getHTMLContent() == "" || wysiwyg.getHTMLContent() == " 
")
		{
			alert('Please enter some content for the article into the editor.');
			return false;
		}
	}
	return true;
}
function CheckLoginForm()
{
	if(document.getElementById("Username").value == "")
	{
		alert("Please enter your username.");
		document.getElementById("Username").focus();
		return false;
	}
	if(document.getElementById("Password").value == "")
	{
		alert("Please enter your password.");
		document.getElementById("Password").focus();
		return false;
	}
	return true;
}
function CheckAuthorForm()
{
	
	if(document.getElementById("Username").value == "")
	{
		alert("Please enter your username.");
		document.getElementById("Username").focus();
		return false;
	}
	if(document.getElementById("Password").value == "")
	{
		alert("Please enter your password.");
		document.getElementById("Password").focus();
		return false;
	}
	if(document.getElementById("Password").value != document.getElementById("PasswordConfirm").value)
	{
		alert("Your passwords don't match.");
		document.getElementById("Password").focus();
		document.getElementById("Password").select();
		return false;
	}
	if(document.getElementById("FirstName").value == "")
	{
		alert("Please enter your first name.");
		document.getElementById("FirstName").focus();
		return false;
	}
	if(document.getElementById("LastName").value == "")
	{
		alert("Please enter your last name.");
		document.getElementById("LastName").focus();
		return false;
	}
	if(document.getElementById("Email2").value == "")
	{
		alert("Please enter your email address.");
		document.getElementById("Email2").focus();
		return false;
	}
	
	if(document.getElementById("Email2").value.indexOf('.') == -1 || document.getElementById("Email2").value.indexOf('@') == -1)
			{
				alert('This email address is not valid.');
				document.getElementById("Email2").focus();
				document.getElementById("Email2").select();
				return false;
			}
	if(document.getElementById("Biography").value == "")
	{
		alert("Please enter your biography.");
		document.getElementById("Biography").focus();
		return false;
	}
	return true;
}
function CheckUserForm()
{
	if(document.getElementById("Username").value == "")
	{
		alert("Please enter your username.");
		document.getElementById("Username").focus();
		return false;
	}
	if(document.getElementById("Password").value == "")
	{
		alert("Please enter your password.");
		document.getElementById("Password").focus();
		return false;
	}
	if(document.getElementById("Password").value != document.getElementById("PasswordConfirm").value)
	{
		alert("Your passwords don't match.");
		document.getElementById("Password").focus();
		document.getElementById("Password").select();
		return false;
	}
	if(document.getElementById("FirstName").value == "")
	{
		alert("Please enter your first name.");
		document.getElementById("FirstName").focus();
		return false;
	}
	if(document.getElementById("LastName").value == "")
	{
		alert("Please enter your last name.");
		document.getElementById("LastName").focus();
		return false;
	}
	if(document.getElementById("Email2").value == "")
	{
		alert("Please enter your email address.");
		document.getElementById("Email2").focus();
		return false;
	}
	
	if(document.getElementById("Email2").value.indexOf('.') == -1 || document.getElementById("Email2").value.indexOf('@') == -1)
	{
		alert('This email address is not valid.');
		document.getElementById("Email2").focus();
		document.getElementById("Email2").select();
		return false;
	}
	
	return true;
}
function UserAccountReturn(returned){
		
		// get the status of the ajax response
		// our getXMLData function relies on a global variable called 'xml'
		// so we just put the response into that.
		xml = returned.documentElement;
		var status = getXMLData('status');
		if(status == 1){
			// user account was successfully create
			document.getElementById("custom").value = getXMLData('usertoken');
			document.getElementById("UserForm").submit();
			return true;
			
		}else{
			var message = getXMLData('message');
			alert(message);
			return false;
		}
}
function isdefined(variable)
{
    return eval('(typeof('+variable+') != "undefined");');
}
function getXMLData(name){
	// we rely on a global variable called 'xml'
	if(isdefined('xml')){
		return xml.getElementsByTagName(name)[0].firstChild.data;
	}else{
		return '';
	}
}
function emailToFriend(ArticleLink)
{
	var t = (screen.availHeight/2) - (485/2);
	var l = (screen.availWidth/2) - (605/2);
	var emailWin = window.open(ArticleLink+"#topofpage", "emailWin", "scrollbars=yes,toolbar=1,statusbar=0,width=605,height=485,top="+t+",left="+l);
}
function CheckArticleCommentForm()
{
	if(document.getElementById('ArticleRating_3')){
		var sel = false;
		var ok = false;
		for(i = 1; i  0){
		if(CurrentReplyBox == 0){
			// we're moving from the default position to a comment
			document.getElementById('ReplyToComment'+id).innerHTML = document.getElementById('SubmitCommentForm').innerHTML;
			$('#ReplyToComment'+id).show("normal");
			$('#SubmitCommentForm').hide("normal");
			document.getElementById('SubmitCommentForm').innerHTML = '';
		//	document.getElementById('commentReplyRow').style.display = '';
			document.getElementById('ReplyToCommentLink'+id).style.display = 'none';
			document.getElementById('CancelReplyLink'+id).style.display = '';
			document.getElementById('CommentParentID').value = id;
		} else {
			// we're moving from one comment to another
			document.getElementById('ReplyToComment'+id).innerHTML = document.getElementById('ReplyToComment'+CurrentReplyBox).innerHTML;
			$('#ReplyToComment'+id).show("normal");
			$('#ReplyToComment'+CurrentReplyBox).hide("normal");
			document.getElementById('ReplyToComment'+CurrentReplyBox).innerHTML = '';
			//document.getElementById('commentReplyRow').style.display = '';
			document.getElementById('ReplyToCommentLink'+CurrentReplyBox).style.display = '';
			document.getElementById('CancelReplyLink'+CurrentReplyBox).style.display = 'none';
			document.getElementById('ReplyToCommentLink'+id).style.display = 'none';
			document.getElementById('CancelReplyLink'+id).style.display = '';
			document.getElementById('CommentParentID').value = id;
		}
		
	} else {
		// we are cancelling a reply
		document.getElementById('SubmitCommentForm').innerHTML = document.getElementById('ReplyToComment'+CurrentReplyBox).innerHTML;
		$('#SubmitCommentForm').show("slow");
		$('#ReplyToComment'+CurrentReplyBox).hide("slow");
		document.getElementById('ReplyToComment'+CurrentReplyBox).innerHTML = '';
		//document.getElementById('commentReplyRow').style.display = 'none';
		document.getElementById('ReplyToCommentLink'+CurrentReplyBox).style.display = '';
		document.getElementById('CancelReplyLink'+CurrentReplyBox).style.display = 'none';
		document.getElementById('CommentParentID').value = 0;
	}
	CurrentReplyBox = id;
}
function LoadUploadedImage(){
	var FeatureImageThumbnailName = document.getElementById('FeatureImageThumbnailName').value;
	var FeatureImageName = document.getElementById('FeatureImageName').value;
	document.getElementById('FeatureImageFrame').src = '#topofpage';
	document.getElementById('FeatureImageFrame').style.display = 'none';
	document.getElementById('FeatureImagePreview').src = '#topofpage'+FeatureImageThumbnailName;
	document.getElementById('FullImageLink').href = '#topofpage'+FeatureImageName;
	document.getElementById('FeatureImageOptions').style.display = '';
}
function ArticleImageToggle(onlyEnabled){
	var list = new Array;
	list[0] = 'artimage_url_row';
	list[1] = 'artimage_file_row';
	if(onlyEnabled == 'artimage_file_row'){
		document.getElementById('FeatureImageFrame').style.display = '';
	}
	if(onlyEnabled == 'artimage_file_row1'){
		document.getElementById('FeatureImageFrame').style.display = 'none';
		onlyEnabled = 'artimage_file_row';
	}
	
	for(i=0;i