function textComment() 
	{
		if(document.frmEmail != null)
		{
	   	if (document.frmEmail.comment.value.length > 255) // if too long...trim it!
	   		document.frmEmail.comment.value = document.frmEmail.comment.value.substring(0, 255);
	   	// otherwise, update 'characters left' counter
	   	else 
	   	document.frmEmail.remLen.value = 255 - document.frmEmail.comment.value.length;
	  }
	}

function textEntryCounter() 
	{
		if(document.frmRequest != null)
		{
	   	if (document.frmRequest.txtEntry.value.length > 1000) // if too long...trim it!
	   		document.frmRequest.txtEntry.value = document.frmRequest.txtEntry.value.substring(0, 1000);
	   	// otherwise, update 'characters left' counter
	   	else 
	   	document.frmRequest.remLen.value = 1000 - document.frmRequest.txtEntry.value.length;
	  }
	}

function emailAddr(user, host, dot)
{
	var username = user;
	var hostname = host;
	var dotcom = "." + dot;
	var linktext = user + "@" + host + dotcom;
	document.write("<a href=" + "mail" + "to:" + username +
	"@" + hostname + dotcom + ">" + linktext + "</a>")
}


function checkSubscribeForm(form)
{
  
  if(!checkMail(form.txtEmailAddr.value))
  {
    form.txtEmailAddr.focus();
    form.txtEmailAddr.select();
    return false;
  }
  return true;
  
}  

function openWin(strLink,strName) 
		{
			strLink = strLink + '.html';
			var strWindow = window.open(strLink, strName, 'toolbar=no,location=no,directories=no,status=yes,menubar=yes,scrollbars=yes,resizable=yes,width=675,height=450,top=25,left=25')
		}	

function checkMail(emailaddr)
{
	
	var x = emailaddr;
	var filter  = /^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$/;
	if (filter.test(x)) 
	{
	  return true;
	}
	else 
	{
	  alert('It appears you have given an incorrect email address:\n' + emailaddr);
	  return false;
	}
}

function isEmpty(txtField)
{
	txtField = txtField.replace(/^\s*|\s*$/,"");
	if (txtField == "") 
	{
	  return true;
	}
	else 
	{
	  return false;
	}
}

	function prayit()
	{
	  document.liftitupform.submit;
		alert ("Thank you for praying!");
		return;
	}
	  
	function praiseit()
	{
	  document.liftitupform.submit;
		alert ("Thank you for joining in praise to God!");
		return;
	}
	  

	function openMovie(strName)
	{
		var strLink = strName + ".html";
		var strWindow = window.open(strLink, 'Movie', 'toolbar=no,location=no,directories=no,status=yes,menubar=yes,scrollbars=yes,resizable=yes,width=750,height=525,top=25,left=25')
	}
	  
 function openGuestmap()
	{
		strLink = "../guestmap/index.php"; 
  	var strWindow = window.open(strLink, 'guestmap', 'toolbar=no,location=no,directories=no,status=yes,menubar=yes,scrollbars=yes,resizable=yes,width=750,height=525,top=25,left=25');
	}

 function openPrayer(id)
	{
		strLink = "prayerentryxl.php?id=" + id; 
  	
  	//IE
  	var strWindow = window.open(strLink, null, 'toolbar=no,location=no,directories=no,status=yes,menubar=yes,scrollbars=yes,resizable=yes,width=600,height=400,top=100,left=100');
  	
  	//NS
  	//var strWindow = window.open(strLink, prayerxl, 'toolbar=no,location=no,directories=no,status=yes,menubar=yes,scrollbars=yes,resizable=yes,width=600,height=400,top=100,left=100');
	}

function genCode(form)
{
   //check table width
   txtCode = "<script type=\"text/javascript\" src=\"http://www.holyisthelamb.com/cgi-bin/dailyh.cgi?tablewidth=";
   //linkCode = "../cgi-bin/dailypreview.cgi?tablewidth=";
   linkCode = "javascript:void openPreview('../cgi-bin/dailypreviewh.cgi?tablewidth=";
   
   //check table width
   if (form.tablewidth.value == "")
   {
      txtCode += "200";
      linkCode += "200";
   }
   txtCode += form.tablewidth.value;
   linkCode += form.tablewidth.value;
   
   //check border width
   txtCode += "&borderwidth=";
   linkCode += "&borderwidth=";
   if (form.borderwidth.value == "")
   {
      txtCode += "2";
      linkCode += "2";
   }
   txtCode += form.borderwidth.value;
   linkCode += form.borderwidth.value;
   
   //check border color
   txtCode += "&bordercolor=";
   linkCode += "&bordercolor=";
   if (form.bordercolor.value == "")
   {
      if (form.bordercolorother.value != "")
      {
         txtCode += form.bordercolorother.value;
         linkCode += form.bordercolorother.value;    
      }
      else
      {
         txtCode += "000000";
         linkCode += "000000";
      }
   }
   else
   {
      txtCode += form.bordercolor.value; 
      linkCode += form.bordercolor.value;      
   }
   
   //check font color
   txtCode += "&fontcolor=";
   linkCode += "&fontcolor=";
   if (form.fontcolor.value == "")
   {
      if (form.fontcolorother.value != "")
      {
         txtCode += form.fontcolorother.value; 
         linkCode += form.fontcolorother.value;    
      }
      else
      {
         txtCode += "000000";
         linkCode += "000000";
      }
   }
   else
   {
      txtCode += form.fontcolor.value; 
      linkCode += form.fontcolor.value;     
   }
   
   //check graphic color
   txtCode += "&graphiccolor=";
   linkCode += "&graphiccolor=";
   for(var i = 0; i < 7; i++)
   {
      if (form.graphiccolor[i].checked)
      {
         txtCode += form.graphiccolor[i].value;
         linkCode += form.graphiccolor[i].value;
      }
   }
   
   txtCode += "&linkclass=";
   linkCode += "&linkclass=";
   txtCode += form.linkclass.value;
   linkCode += form.linkclass.value;
   
   txtCode += "\"></script>";
   
   linkCode += "');";
   form.code.value = txtCode;
   form.code.style.visibility = "visible";
   
   document.anchors[0].href= linkCode;
   document.getElementById('clickcode').style.visibility = "visible";
   document.getElementById('directions').style.visibility = "visible";

}
