// ***********************************************************
// * to cap the user text entry on the comment form textarea 
// ***********************************************************

function imposeMaxLength(Event, Object, MaxLen)
{
        return (Object.value.length <= MaxLen)||(Event.keyCode == 8 ||Event.keyCode==46||(Event.keyCode>=35&&Event.keyCode<=40))
}

// *********************************************
// * clears the form fields on click
// **********************************************

function fieldreset()
{
	document.beadqueen.username.value = "";
	document.beadqueen.email.value = "";
	document.beadqueen.comment.value = "";
	document.beadqueen.usercode.value = "";
}

// ***********************************************************************
// * jquery rollover code
// ************************************************************************
	$(document).ready(function() {
		
		// Preload all rollovers
		$("#nav img").each(function() {
			// Set the original src
			rollsrc = $(this).attr("src");
			rollON = rollsrc.replace(/.png$/ig,"_over.");
			$("<img>").attr("src", rollON);
		});
		
		// Navigation rollovers
		$("#nav a").mouseover(function(){
			imgsrc = $(this).children("img").attr("src");
			matches = imgsrc.match(/_over/);
			
			// don't do the rollover if state is already ON
			if (!matches) {
			imgsrcON = imgsrc.replace(/.png$/ig,"_over.png"); // strip off extension
			$(this).children("img").attr("src", imgsrcON);
			}
			
		});
		$("#nav a").mouseout(function(){
			$(this).children("img").attr("src", imgsrc);
		});
		
	
	});

// ***********************************************************************
// * adds cursor to name field onLoad of page / nice little touch 
// ************************************************************************
document.beadqueen.username.focus();

