//All this code was written by Derek Sanford for his website, Scanda Web Design.com.  Of course, by looking at this file you are probably also a coder either checking to see how I write code or to learn code yourself or just to steal the code and use it on your site.  Well, I can't stop you can I?  I won't even know if you steal it; however, if you do wish to use this code, let me know and I can probably help you. -- D-Rok

rolloverimg = new Image(25,25); 
rolloverimg.src = "http://www.scandawebdesign.com/images/blurred2.jpg";

function changeNav(NAME, ACTION) {
	if (ACTION == 'On') {
		document.getElementById(NAME).style.background = "url('http://www.scandawebdesign.com/images/blurred2.jpg')";
	}
	if (ACTION == 'Off') {
		document.getElementById(NAME).style.background = "url('http://www.scandawebdesign.com/images/blurred.jpg')";
	}
}

function fieldFocus(NAME) {
	var curText = document.getElementById(NAME).value;
	if (curText == 'Username') {
		document.getElementById(NAME).value = '';			
	}
	if (curText == 'password') {
		document.getElementById(NAME).value = '';			
	}
}

function fieldBlur(NAME) {
	var curText = document.getElementById(NAME).value;
	var curLength = curText.length;
	if (curLength == 0) {
		if (NAME == 'loguser') {
			document.getElementById(NAME).value = 'Username';
		}
		if (NAME == 'logpass') {
			document.getElementById(NAME).value = 'password';
		}
	}
}

function winChange(NAME) {
	window.location = 'http://www.scandawebdesign.com/' + NAME + '/';	
}

function checkFields() {
	var numExp = /^[0-9]+$/;
	var alphaNumeric = /^[0-9a-zA-Z]+$/;
	var alphaExp = /^[a-zA-Z]+$/;
	var errorMessage = 'Please Correct The Following:\n';
	var errorCount = 0;
	if(document.cform.fname.value.length == 0 || !document.cform.fname.value.match(alphaNumeric)) {
		errorCount++;
		errorMessage += '\n' + errorCount + '. First Name';
	}
	if(document.cform.bname.value.length == 0 || !document.cform.bname.value.match(alphaNumeric)) {
		errorCount++;
		errorMessage += '\n' + errorCount + '. Business Name';
	}
	if(document.cform.address.value.length == 0 || !document.cform.address.value.match(alphaNumeric)) {
		errorCount++;
		errorMessage += '\n' + errorCount + '. Address';
	}
	if(document.cform.zip.value.length != 5 || !document.cform.zip.value.match(numExp)) {
		errorCount++;
		errorMessage += '\n' + errorCount + '. Zip Code';
	}
	if(document.cform.website.value.length == 0) {
		errorCount++;
		errorMessage += '\n' + errorCount + '. Website';
	}
	if(document.cform.bestway.value == 'none') {
		errorCount++;
		errorMessage += '\n' + errorCount + '. Preffered Contact Method';
	}
	if(document.cform.message.value.length == 0) {
		errorCount++;
		errorMessage += '\n' + errorCount + '. Message';
	}
	if (errorMessage.length > 35) {
		alert(errorMessage);
		return false;
	}
	return true;
}