<!-- Check for bad language -->
function checkLanguage(item){
	var checkList = new Array("ARSE","BASTARD","BITCH","BUGGER","CUNT","FUCK","TOSSER","TWAT","WANK");
	var addList = new Array("ER", "ING", "S", "ED");
	var currentString = "";
	var currentWord = "";
	var excerpt = "";
	var messageTxt = "hmmm...... one of the words in your submission sounds a bit dirty to us! We will have to check it out before we post your entry to the site."

	for(var i=0;i<item.elements.length;i++){		
		currentString = currentString + item.elements[i].value.toUpperCase() + " ";		
	}
	
	<!-- loop through all words on the page looking for matches -->	
	while (currentString.length > 1){
		currentWord = currentString.substring(0,currentString.indexOf(" "));
		for(var n=0;n<checkList.length;n++){
			if(checkList[n] == currentWord){
				//alert(messageTxt);
				return false;
			}else{
				for(var x=0;x<addList.length;x++){
					if(currentWord == (checkList[n] + addList[x])){
						//alert(messageTxt);
						return false;
					}
				}
			}
		}
		excerpt =  currentString.substring(currentString.indexOf(" ")+1,currentString.length);
		currentString = excerpt;
		
	}	
return true;	
}

<!-- Check that mandatory fields have information in them -->
function checkMandatoryFields(form,items){
	for(var i=0;i<items.length;i++){
		if(form.elements[items[i]].value == "")	{
			var messageTxt = "Please enter a value in the " + items[i] + " field before submitting."
			alert(messageTxt);
			return false;
		}
	}
return true;
}

<!-- Check that the passwords match -->
function checkPasswordsMatch(pass1,pass2){
	if(pass1.value == pass2.value){
		return true;
	}else{
		alert("Your passwords are different. please try again");
		return false;
	}
}

<!-- Change the color of text -->
function changeColor(item,color){
	item.style.color = color
}

<!--check submissions do not exceed the maximum word allowance -->
function checkWordAllowance(form,items,itemtitles,nos){
	for(m=0;m<items.length;m++){		
		if(form.elements[items[m]].value.length > nos[m]){
			alert("The " + itemtitles[m] + " field exceeds the maximum number of characters allowed. \n please re-type and keep the length below " + (nos[m]).toString()+ " characters")
			return false;		
		}		
	}
	return true;	
}

// PRELOAD NAVIGATION IMAGES
if (document.images) {
 img_home_on =new Image();  img_home_on.src ="images/home_O.gif"; 
 img_home_off=new Image();  img_home_off.src="images/home.gif"; 

 img_buyNow_on =new Image(); img_buyNow_on.src ="images/buyNow_O.gif"; 
 img_buyNow_off=new Image(); img_buyNow_off.src="images/buyNow.gif"; 

 img_productDetails_on =new Image(); img_productDetails_on.src ="images/productDetails_O.gif"; 
 img_productDetails_off=new Image(); img_productDetails_off.src="images/productDetails.gif"; 

 img_aboutUs_on =new Image(); img_aboutUs_on.src ="images/aboutUs_O.gif"; 
 img_aboutUs_off=new Image(); img_aboutUs_off.src="images/aboutUs.gif"; 

 img_testLatin_on =new Image(); img_testLatin_on.src ="images/testYourLatin_O.gif"; 
 img_testLatin_off=new Image(); img_testLatin_off.src="images/testYourLatin.gif"; 

 img_faq_on =new Image(); img_faq_on.src ="images/faq_O.gif"; 
 img_faq_off=new Image(); img_faq_off.src="images/faq.gif"; 

 img_contactDetails_on =new Image(); img_contactDetails_on.src ="images/contactDetails_O.gif"; 
 img_contactDetails_off=new Image(); img_contactDetails_off.src="images/contactDetails.gif"; 

 img_downloadDemo_on =new Image(); img_downloadDemo_on.src ="images/downloadDemo_O.gif"; 
 img_downloadDemo_off=new Image(); img_downloadDemo_off.src="images/downloadDemo.gif"; 

 img_links_on =new Image(); img_links_on.src ="images/links_O.gif"; 
 img_links_off=new Image(); img_links_off.src="images/links.gif"; 

 img_testimonials_on =new Image(); img_testimonials_on.src ="images/testimonials_O.gif"; 
 img_testimonials_off=new Image(); img_testimonials_off.src="images/testimonials.gif"; 

 img_sitemap_on =new Image(); img_sitemap_on.src ="images/sitemap_O.gif"; 
 img_sitemap_off=new Image(); img_sitemap_off.src="images/sitemap.gif"; 

}

function movr(k) {
 if (document.images) 
  eval('document.img'+k+'.src=img'+k+'_on.src');
}

function mout(k) {
 if (document.images) 
  eval('document.img'+k+'.src=img'+k+'_off.src');
}
