function checkName() {
	var name = document.getElementById("name");
	var check_n = document.getElementById("check_n");
	var sp = name.value.indexOf(" ");	
	
	for ( ; ; ) {
		if (name.value.length == 0) {
			name.style.border='thin solid black';
			check_n.innerHTML = '<img src="/images/icon_spacer.gif"/>';
		break;} // endIf
		if (sp > 1) {
			name.style.border = 'thin solid green';
			check_n.innerHTML = '<img src="/images/icon_success.gif" alt="Success"/>';
			var varify_name = 1;
		break;} // endIf
		else {
			name.style.border = 'thin solid red';
			check_n.innerHTML = '<img src="/images/icon_error.gif" alt="Error"/>';
		break;} // endElse
	} // endFor
} // endcheckName


		

function checkEmail(str) {

	var email = document.getElementById("email");
	var at = email.value.indexOf("@");
	var pd = (email.value.indexOf(".")) -1;
	var sp = email.value.indexOf(" ");
	var check_e = document.getElementById("check_e");

	for ( ; ; ) {
		if (email.value.length == 0) {
			email.style.border='thin solid black';
			check_e.innerHTML = '<img src="/images/icon_spacer.gif"/>';
		break;} //endIf

		if (at !== -1 && pd > at && sp == -1) { 
			email.style.border = 'thin solid green';
			check_e.innerHTML = '<img src="/images/icon_success.gif" alt="Success"/>';
			var varify_email = 1;
		break;} //endIf

		else {
			email.style.border = 'thin solid red';
			check_e.innerHTML = '<img src="/images/icon_error.gif" alt="Error"/>';
		break;} //endElse
		
	} //endFor

} //endcheckEmail


function tabPhone(field,flength) {
	
	
	ph_count = document.getElementById("phonenumber1").value.length + document.getElementById("phonenumber2").value.length + document.getElementById("phonenumber3").value.length;
	if (ph_count == 10) {
		document.getElementById("check_p").innerHTML='<img src="/images/icon_success.gif"/>';
		document.getElementById("phonenumber1").style.border='thin solid green';
		document.getElementById("phonenumber2").style.border='thin solid green';
		document.getElementById("phonenumber3").style.border='thin solid green';
		var varify_phone = 1;
	} // end If
	if (ph_count < 10) {
		document.getElementById("check_p").innerHTML='<img src="/images/icon_spacer.gif"/>';
		document.getElementById("phonenumber1").style.border='thin solid red';
		document.getElementById("phonenumber2").style.border='thin solid red';
		document.getElementById("phonenumber3").style.border='thin solid red';
	} // end If
	if (ph_count > 0 && ph_count < 10) {
		document.getElementById("check_p").innerHTML='<img src="/images/icon_error.gif"/>';
	} // end If

	if (flength.length == field.maxLength) {
		var next = field.tabIndex;
		document.getElementById("contact_us").elements[next].focus();
	} //end If
	
} // end tabPhone


function tabFax(field,flength) {

	fax_count = document.getElementById("faxnumber1").value.length + document.getElementById("faxnumber2").value.length + document.getElementById("faxnumber3").value.length;
	

	if (fax_count == 10) {
		document.getElementById("check_f").innerHTML='<img src="/images/icon_success.gif"/>';
		document.getElementById("faxnumber1").style.border='thin solid green';
		document.getElementById("faxnumber2").style.border='thin solid green';
		document.getElementById("faxnumber3").style.border='thin solid green';
		var varify_fax = 1;
	} // end If
	if (fax_count < 10) {
		document.getElementById("check_f").innerHTML='<img src="/images/icon_spacer.gif"/>';
		document.getElementById("faxnumber1").style.border='thin solid red';
		document.getElementById("faxnumber2").style.border='thin solid red';
		document.getElementById("faxnumber3").style.border='thin solid red';
	} // end If
	if (fax_count > 0 && fax_count < 10) {
		document.getElementById("check_f").innerHTML='<img src="/images/icon_error.gif"/>';
	} // end If

	if (flength.length == field.maxLength) {
		var next = field.tabIndex;
		document.getElementById("contact_us").elements[next].focus();
	} //end If
} // end tabFax

function ContactForm(way) {

	var contact1 = document.getElementById("contact1");
	var contact2 = document.getElementById("contact2");

	if (way == 'ph') {
		var ph = '( <input type="text" size="2" maxlength="3" name="phonenumber1" id="phonenumber1" tabindex="6" style="border: thin solid black; font-family: arial" onfocus="this.style.backgroundColor=\'#fcdf59\'" onblur="this.style.backgroundColor=\'\'" onkeyup="tabPhone(this,this.value)"/> ) - ';
		ph += '<input type="text" size="2" maxlength="3" name="phonenumber2" id="phonenumber2" tabindex="7" style="border: thin solid black; font-family: arial" onfocus="this.style.backgroundColor=\'#fcdf59\'" onblur="this.style.backgroundColor=\'\'" onkeyup="tabPhone(this,this.value)"/> - ';
		ph += '<input type="text" size="3" maxlength="4" name="phonenumber3" id="phonenumber3" tabindex="8" style="border: thin solid black; font-family: arial" onfocus="this.style.backgroundColor=\'#fcdf59\'" onblur="this.style.backgroundColor=\'\'" onkeyup="tabPhone(this,this.value)"/>';
/*		ph += '<input type="text" size="8" name="phonenumber4" id="phonenumber4" tabindex="9" style="border: thin solid black; font-family: arial" onfocus="this.style.backgroundColor=\'#fcdf59\'" onblur="this.style.backgroundColor=\'\'"/>'; */
		contact1.innerHTML = 'Phone Number:';
		contact2.innerHTML = ph + ' <span id="check_p"><img src="/images/icon_spacer.gif" alt=""/></span>';
		document.getElementById('phonenumber1').focus();
	} // endIf

	if (way == 'fx') {
		var fx = '( <input type="text" size="2" maxlength="3" name="faxnumber1" id="faxnumber1" tabindex="6" style="border: thin solid black; font-family: arial" onfocus="this.style.backgroundColor=\'#fcdf59\'" onblur="this.style.backgroundColor=\'\'" onkeyup="tabFax(this,this.value)"/> ) - ';
		fx += '<input type="text" size="2" maxlength="3" name="faxnumber2" id="faxnumber2" tabindex="7" style="border: thin solid black; font-family: arial" onfocus="this.style.backgroundColor=\'#fcdf59\'" onblur="this.style.backgroundColor=\'\'" onkeyup="tabFax(this,this.value)"/> - ';
		fx += '<input type="text" size="3" maxlength="4" name="faxnumber3" id="faxnumber3" tabindex="8" style="border: thin solid black; font-family: arial" onfocus="this.style.backgroundColor=\'#fcdf59\'" onblur="this.style.backgroundColor=\'\'" onkeyup="tabFax(this,this.value)"/>';
		contact1.innerHTML = 'Fax Number:';
		contact2.innerHTML = fx +' <span id="check_f"><img src="/images/icon_spacer.gif" alt=""/></span>';
		document.getElementById('faxnumber1').focus();
	} //endIf

	if (way == 'em') {
		var email = '\n';
		email += '<input type="text" id="email" name="email" tabindex="12" size="33" style="border: thin solid black; font-family: arial" onfocus="this.style.backgroundColor=\'#fcdf59\'" onblur="checkEmail(this.value), this.style.backgroundColor=\'\'"/> <span id="check_e"><img src="/images/icon_spacer.gif" alt=""/></span><br/>\n';
		email += '<div style="font-size:8pt; color:#666666;font-style:italic" align="left">yourname@domain.com</div>\n';
		email += '\n';
		contact1.innerHTML = 'Email:';
		contact2.innerHTML = email;
		document.getElementById('email').focus();
	} //endIf

} //endContactForm

function checkState(str) {

	var check_state = document.getElementById("check_state");
	if (str.length == 0) {
		check_state.innerHTML = '<img src="/images/icon_error.gif"/>';
	} else {
		check_state.innerHTML = '<img src="/images/icon_success.gif"/>';
		var varify_state = 1;
	} // <= if else
} // <= checkState()

function checkProp(str) {

	var check_prop = document.getElementById("check_prop");
	if (str.length == 0) {
		check_prop.innerHTML = '<img src="/images/icon_error.gif"/>';
	} else {
		check_prop.innerHTML = '<img src="/images/icon_success.gif"/>';
		var varify_prop = 1;
	} // <= if else
} // <= checkProp()

function checkSize(str) {

	var check_size = document.getElementById("check_size");
	if (str.length == 0) {
		check_size.innerHTML = '<img src="/images/icon_error.gif"/>';
	} else {
		check_size.innerHTML = '<img src="/images/icon_success.gif"/>';
		var varify_size = 1;
	} // <= if else
} // <= checkProp()

function Varify() { }
