<!--
//blah dee blah
ns6_index=0;

var errfound = false;
function ValidLength(item, len) {
   return (item.length >= len);
}
function ValidEmail(item) {
   if (!ValidLength(item, 5)) return false;
   if (item.indexOf ('@', 0) == -1) return false;
   if (item.indexOf ('.', 0) == -1) return false;
   return true;
}
function error(elem, text, tflag) {
   if (errfound) return;
   window.alert(text);
   if (tflag == 1) {
		elem.select();
   		elem.focus();
   }
   errfound = true;
}
function CheckMemberForm() {
   errfound = false;
   PassFirst = document.RegisterForm.PassWord.value;
   PassSecond = document.RegisterForm.PassWordCheck.value;

   if (!ValidLength(document.RegisterForm.MemberName.value,3))
      error(document.RegisterForm.MemberName,"Your Real Name appears to be invalid!",1);
   if (!ValidEmail(document.RegisterForm.EmailAddy.value))
      error(document.RegisterForm.EmailAddy,"Please enter a valid email address!",1);
   if (document.RegisterForm.EmailAddy.value != document.RegisterForm.EmailAddyCheck.value)
      error(document.RegisterForm.EmailAddyCheck,"Your email address and repeat email address do not match!",1);
   if (!ValidLength(document.RegisterForm.ReqUserName.value,5))
      error(document.RegisterForm.ReqUserName,"Your required User Name appears to be too short or invalid!",1);
   if (!ValidLength(document.RegisterForm.PassWord.value,5))
      error(document.RegisterForm.PassWord,"Your Password appears to be too short or invalid!",1);
   if (PassFirst != PassSecond)
      error(document.RegisterForm.PassWordCheck,"Your Password and Repeat Password do not match!",1);
   if (document.RegisterForm[11].checked) { return !errfound; } 
   else { error(document.RegisterForm.AcceptTerms,"You must accept the terms of membership before you can continue!",0); }

   return !errfound;
}

function CheckContactForm() {
   errfound = false;
   if (!ValidLength(document.EnquireForm.FirstName.value,2))
      error(document.EnquireForm.FirstName,"Your First Name appears to be invalid!",1);
   if (!ValidEmail(document.EnquireForm.MailAddy.value))
      error(document.EnquireForm.MailAddy,"Please enter a valid email address!",1);
   if (!ValidLength(document.EnquireForm.Comments.value,2))
      error(document.EnquireForm.Comments,"Please enter your query in the Comments box!",1);

   return !errfound;
}

function CheckForumPost() {
   errfound = false;
   if (!ValidLength(document.NewForumPost.NewTopicName.value,3))
      error(document.NewForumPost.NewTopicName,"Please enter a topic for your post!",1);
//   if (!ValidLength(document.NewForumPost.Message.value,3))
//      error(document.NewForumPost.Message,"Please type in a message to post!",1);
   return !errfound;
}
function CheckEmailAddy() {
   errfound = false;
   if (!ValidEmail(document.ProfileForm.EmailAddy.value))
      error(document.ProfileForm.EmailAddy,"Please enter a valid email address!",1);
   return !errfound;
}
function CheckPassChange() {
   errfound = false;
   PassFirst = document.PassWordChange.NewPassWord.value;
   PassSecond = document.PassWordChange.RepPassWord.value;

   if (!ValidLength(document.PassWordChange.OldPassWord.value,5))
      error(document.PassWordChange.OldPassWord,"Your Old Password appears to be too short or invalid!",1);
   if (!ValidLength(document.PassWordChange.NewPassWord.value,5))
      error(document.PassWordChange.NewPassWord,"Your New Password appears to be too short or invalid!",1);
   if (PassFirst != PassSecond)
      error(document.PassWordChange.RepPassWord,"Your New Password and Repeat Password do not match!",1);

   return !errfound;
}
function CheckAddCategory() {
   errfound = false;

   if (!ValidLength(document.AddCategory.NewCatName.value,3))
      error(document.AddCategory.NewCatName,"Please enter a name for your new category!",1);
   if (!ValidLength(document.AddCategory.NewCatDescript.value,3))
      error(document.AddCategory.NewCatDescript,"Please enter a description for your new category!",1);

   return !errfound;
}
function CheckEditCategory() {
   errfound = false;

   if (!ValidLength(document.EditCategory.NewCatName.value,3))
      error(document.EditCategory.NewCatName,"Please enter a valid name for this category!",1);
   if (!ValidLength(document.EditCategory.CatDescript.value,3))
      error(document.EditCategory.CatDescript,"Please enter a valid description for this category!",1);

   return !errfound;
}
function CheckNewArticle() {
   errfound = false;

   if (!ValidLength(document.CreateArticle.PubDate.value,3))
      error(document.CreateArticle.PubDate,"Error: Please select a valid Publication Date!",1);
   if (!ValidLength(document.CreateArticle.ArtTitle.value,3))
      error(document.CreateArticle.ArtTitle,"Error: Please enter a valid Title for your new Article!",1);
   if (!ValidLength(document.CreateArticle.OrigAuthor.value,1))
      error(document.CreateArticle.OrigAuthor,"Error: Please enter a valid Original Author!",1);
//   if (!ValidLength(document.CreateArticle.elm2.value,1))
//      error(document.CreateArticle.elm2,"Error: Please enter some text in your Article Body!",1);
   if (!ValidLength(document.CreateArticle.KeyWords.value,1))
      error(document.CreateArticle.KeyWords,"Error: Please enter some Keywords for your new Article!",1);
   if (!ValidLength(document.CreateArticle.SummaryText.value,1))
      error(document.CreateArticle.SummaryText,"Error: Please enter a Summary for your New Article!",1);

   return !errfound;
}

function SaveFormSubmit(SubType) {
	document.CreateArticle.ItemSave.value = 1;
	if (SubType == 2) {
		errfound = false;
		BypassFormCheck = 0;
	}
	document.CreateArticle.submit();
}
function CheckSaveStatus() {
	var BypassFormCheck = document.CreateArticle.ItemSave.value;
	if (BypassFormCheck == 1) {
		document.CreateArticle.submit();
		window.alert("Please Save or Cancel this new item before proceding!");
		timeout = setTimeout('return',2000);	
	}
}

function SetFormFocus(FieldName) {
	elem.select(FieldName);
  elem.focus(FieldName);
}

function OpenDailyTarot() {
	OpenURL = "../cgi-bin/tarot.pl";
	thewindow = window.open(OpenURL, 'TarotWindow', config='height=320,width=560,toolbar=no,menubar=no,scrollbars=yes,resizable=yes,location=no,directories=no,status=no');
}
function OpenPollWindow(PollId,UserId) {
	OpenURL = "../cgi-bin/polls.pl?pid=" + PollId + "&uid=" + UserId;
	thewindow = window.open(OpenURL, 'PollWindow', config='height=490,width=440,toolbar=no,menubar=no,scrollbars=yes,resizable=yes,location=no,directories=no,status=no');
}
function OpenAskGuru() {
	OpenURL = "../dev/ask_guru.html";
	thewindow = window.open(OpenURL, 'GuruWindow', config='height=400,width=350,toolbar=no,menubar=no,scrollbars=yes,resizable=yes,location=no,directories=no,status=no');
}

var highlightbehavior="TD"
var ns6=document.getElementById&&!document.all
var ie=document.all

function changeto(e,highlightcolor) {
	source=ie? event.srcElement : e.target
	if (source.tagName=="TABLE")
	return
	while(source.tagName!=highlightbehavior && source.tagName!="HTML")
	source=ns6? source.parentNode : source.parentElement
	if (source.style.backgroundColor!=highlightcolor&&source.id!="ignore")
	source.style.backgroundColor=highlightcolor
}

function contains_ns6(master, slave) { 
while (slave.parentNode)
if ((slave = slave.parentNode) == master)
return true;
return false;
}

function changeback(e,originalcolor){
if (ie&&(event.fromElement.contains(event.toElement)||source.contains(event.toElement)||source.id=="ignore")||source.tagName=="TABLE")
return
else if (ns6&&(contains_ns6(source, e.relatedTarget)||source.id=="ignore"))
return
if (ie&&event.toElement!=source||ns6&&e.relatedTarget!=source)
source.style.backgroundColor=originalcolor
}


var dom = (document.getElementById && !document.all)? 1: 0;
function show_hide(the_id,Hide_1,Hide_2)
{
 var obj_1 = (dom)? document.getElementById(Hide_1): document.all[Hide_1];
 var obj_2 = (dom)? document.getElementById(Hide_2): document.all[Hide_2];
  obj_1.style.visibility = "hidden";
  obj_1.style.display = "none";
  obj_2.style.visibility = "hidden";
  obj_2.style.display = "none";

 var obj = (dom)? document.getElementById(the_id): document.all[the_id];
 if(obj.style.visibility == "hidden"){ // show
   obj.style.visibility = "visible";
   obj.style.display = "block"; 
 }
 else { // hide
    obj.style.visibility = "hidden";
    obj.style.display = "none";
  }
}



//-->

