// Image swap code

one=null;
two=null;
three=null;
four=null;
five=null;
six=null;
seven=null;
eight=null;
nine=null;
ten=null;
eleven=null;
twelve=null;
thirteen=null;
fourteen=null;
	
function off_image(img) { }
function on_image(loc, img) {  }

menuImages = new Array(28)

for (i = 1; i <= 28; i++)
{
 	menuImages[i] = new Image(20,20)
	menuImages[i].src = "http://www.remweb.net/remweb/graphics/navbar/button"+i+".gif"
}

function on_image(loc, img)
{
   loc.src=menuImages[img].src;
}

function off_image(loc, img) 
{
   loc.src=menuImages[img].src;
}

// End of image swap code


// Random image: Image tag generator


// Picture image open function.

function openPic(imgFile,imgWidth,imgHeight,imgAlt) {
		 var theLink = 'http://www.edlingua.com/edlingua/picture.php?jpgFile='
		 	 + imgFile + '&picWidth=' + imgWidth + '&picHeight=' + imgHeight + 
			 '&picAlt=' + imgAlt;
		 var winWidth = imgWidth + 30;
		 if (winWidth < 400) { winWidth = 400; }
		 var winHeight = imgHeight + 180;
		 var winSize = "width=" + winWidth + ",height=" + winHeight;
		 window.open(theLink,'',winSize);
		 }

// End of picture open function





// Email form field validity checker

function IsEmailValid(FormName,MailElement)
{ 
   var EmailOk = true
   var TheMailElement = document.forms[FormName].elements[MailElement]

   var AtSym = TheMailElement.value.indexOf('@')
   var Length = TheMailElement.value.length - 1   // Array is from 0 to length-1
  
   // Check a valid e-mail address has been entered
   if ((AtSym < 1)  ||	(AtSym == Length)) // '@' cannot be in first or last position.
   { 
   	  EmailOk = false
   	  alert('You must enter a valid E-Mail address.')
   	  TheMailElement.focus()
   }
   return EmailOk
}

// End of Mail form validity checker

// Checkbox checker

function IsItChecked(FormName,ElementName)
{
   var TheElement = document.forms[FormName].elements[ElementName].checked
   
   // Check if the checkbox is checked
   if (TheElement == true)  //If it is checked submit the form
   {
      document.forms[FormName].submit();
   }
   else // Alert
   { 
   	  alert('You must check the box to indicate that\n your site meets the guidelines.')
//   	  TheElement.focus()
   }
   
   return TheElement;
}

// End of checkbox checker function

// Blank form field checker

function IsElementBlank(FormName,ElementName)
{
   var ElementOk = true
   var TheElement = document.forms[FormName].elements[ElementName]
   
   // Check the field hasn't been left blank
   if (TheElement.value.length == 0)
   { 
   	  ElementOk = false
   	  alert('You must enter some text in the ' + ElementName + ' box.')
   	  TheElement.focus()
   }
   return ElementOk
}

// End of Blank form field checker function


// Mail form check and submit function

function IsFormValid(FormName,EmailElement,SubjectElement,MessageElement)
{ 
   var FormOk = true
   var EmailField = IsEmailValid(FormName,EmailElement)
   
   if (EmailField == false)
   {
   	  FormOk = false;
   	  return FormOk;
   }
   
   var SubjectField = IsElementBlank(FormName,SubjectElement)
   if (SubjectField == false)
   {
   	  FormOk = false;
   	  return FormOk;
   }
   
   var MessageField = IsElementBlank(FormName,MessageElement)
   if (MessageField == false)
   {
   	  FormOk = false;
   	  return FormOk;
   }
   
   if (FormOk == true)
   { 
   	  document.forms[FormName].submit();
   	  return FormOk;
   }
}

// End of Mail form check and submit function


// WebRing submission form checker

function IsSubmitValid(FormName,EmailElement,SubjectElement,MessageElement,TitleElement,NameElement)
{
 		 var TitleField = IsElementBlank(FormName,TitleElement)
		 if (TitleField == false)
		 {
		  	FormOk = false;
		 	return FormOk;
		 }
		 var NameField = IsElementBlank(FormName,NameElement)
		 if (NameField == false)
		 {
		  	FormOk = false;
		 	return FormOk;
		 } 

		 var MailForm = IsFormValid(FormName,EmailElement,SubjectElement,MessageElement);
		 if (MailForm == false)
		 {
		  	FormOk = false;
			return FormOk;
		 }
}

// Email field check and submitter

function IsEmailOk(FormName,EmailElement)
{
   var FormOk = true
   var EmailField = IsEmailValid(FormName,EmailElement)
   
   if (EmailField == false)
   {
   	  FormOk = false;
   	  return FormOk;
   }
   
   if (FormOk == true)
   { 
   	  document.forms[FormName].submit();
   	  return FormOk;
   }
}