// JavaScript Document

function formvalidation(thisform)
{
	with (thisform)
	{	
		// Check if f_name was entered
		if (document.rrform.f_name.value < "   ")
		{
			window.alert('Please enter a first name');
			document.rrform.f_name.focus();
			document.rrform.clicked_once.value = 0;
			return false;
		};
		// Check if l_name was entered
		if (document.rrform.l_name.value < "   ")
		{
			window.alert('Please enter a last name');
			document.rrform.l_name.focus();
			document.rrform.clicked_once.value = 0;
			return false;
		};
		// Check for a valid email address
		if (emailvalidation(document.rrform.email, "Please enter a valid email address.")==false) 
			{
			document.rrform.email.focus(); 
			return false;};
		// Check if address is req'd
//		if (eval(document.rrform.req_addr.value) == 1)
//		{
			if (document.rrform.address.value < "   ")
			{
			window.alert('Please provide a mailing address');
			document.rrform.address.focus();
			document.rrform.clicked_once.value = 0;
			return false;
			};
//		};
	    // Check if city is req'd
//		if (eval(document.rrform.req_city.value) == 1)
//		{
			if (document.rrform.city.value < "   ")
			{
			window.alert('Please provide a mailing address');
			document.rrform.city.focus();
			document.rrform.clicked_once.value = 0;
			return false;
			};
			if (document.rrform.state.selectedIndex == 0)
			{
			window.alert('Please provide a mailing address');
			document.rrform.state.focus();
			document.rrform.clicked_once.value = 0;
			return false;
			};
//		};
			// Check if zip is req'd
//		if (eval(document.rrform.req_zip.value) == 1)
//		{
			if (document.rrform.zip.value < "   ")
			{
			window.alert('Please enter your zip or postal code');
			document.rrform.zip.focus();
			document.rrform.clicked_once.value = 0;
			return false;
			};
//		};
		// Check if phone is req'd
//		if (eval(document.rrform.req_phone.value) == 1)
//		{
			if (document.rrform.areacode_1.value < "   ")
			{
			window.alert('Please provide your phone number');
			document.rrform.areacode_1.focus();
			document.rrform.clicked_once.value = 0;
			return false;
			};
			if (document.rrform.phone_1.value < "   ")
			{
			window.alert('Please provide your phone number');
			document.rrform.phone_1.focus();
			document.rrform.clicked_once.value = 0;
			return false;
			};
//		};
		// Check if best_time is req'd
//		if (eval(document.rrform.req_call.value) == 1)
//		{
			if (document.rrform.best_time.value < "   ")
			{
			window.alert('Please indicate the best time to call');
			document.rrform.best_time.focus();
			document.rrform.clicked_once.value = 0;
			return false;
			};
//		};
		// Check if liq_cap is req'd
//		if (eval(document.rrform.req_cap.value) == 1)
//		{
			if (document.rrform.liq_cap.selectedIndex == 0)
			{
			window.alert('Please indicate a liquid capital amount');
			document.rrform.liq_cap.focus();
			document.rrform.clicked_once.value = 0;
			return false;
			};
//		};
		// Check if desired business location is req'd
//		if (eval(document.rrform.req_loc.value) == 1)
//		{
//			if (document.rrform.preferred_location.value < "   ")
//			{
//			window.alert('Please indicate your preferred business location(s)');
//			document.rrform.preferred_location.focus();
//			document.rrform.clicked_once.value = 0;
//			return false;
//			};
//		};
		
		// Check to see if they've clicked more than once
		//document.rrform.clicked_once.value = document.rrform.clicked_once.value+1;
		//if (document.rrform.clicked_once.value > 1)
		//{
			//window.alert('You only need to click Submit once.');
			//return false;
		//};
	 } // end of with(thisform)
} 


function emailvalidation(entered, alertbox)
{
// E-mail Validation by Henrik Petersen / NetKontoret
// Explained at www.echoecho.com/jsforms.htm
// Please do not remove this line and the two lines above.
with (entered)
	{
	apos=value.indexOf("@"); 
	dotpos=value.lastIndexOf(".");
	lastpos=value.length-1;
	if (apos<1 || dotpos-apos<2 || lastpos-dotpos>3 || lastpos-dotpos<2) 
	{if (alertbox) {alert(alertbox);} return false;}
		else {return true;}
	}
} 

function OpenLiqCap(){
	window.open('/dsp_liquid_capital.cfm', 'FS_liquid_capital', 'width=370,height=228')}
	
