
function CheckEmpty( e, strCaption )
{
	var temp, re

	re = /\s/g;
	temp = e.value.replace( re, "" )
	if(temp=="")
	{
		alert("Please enter " + strCaption + "." );
		e.focus();
		return false;
	}
	else
		return true;
}

function CheckOneWord( e, strCaption )
{
	var temp, re

	re = /\S+\s+\S+/g;
	temp = e.value.match( re )
	if(temp!=null)
	{
		alert("Please enter a valid " + strCaption + "." );
		e.focus();
		return false;
	}
	else
		return true;
}
function IsEmailValid( e )
{
	if( e.value == "" )
		return( false );

	var index1, index2

	index1 = e.value.indexOf( "@" );
	index2 = e.value.indexOf( "." );

	if(( index1 <= 0 ) ||
	   ( index2 <= 0 ) ||
	   ( index2 == e.value.length - 1  ))
		return false;
	else
		return true;
}

function CheckEmail( e )
{
	if( e.value == "" )
	{
		alert( "Please enter your e-mail address." );
		e.focus();
		return false;
	}

	if( !IsEmailValid( e ))
	{
		alert( "Please enter a valid e-mail address." );
		e.focus();
		return false;
	}
	else
		return true;
}

function CheckIsFloat( e, msg )
{
	if( e.value == "" )
	{
		alert( "Please enter a valid " + msg );
		e.focus();
		return( false );
	}

	var temp, re

	re = /^[\d|\.]*$/
	temp = e.value.match( re )
	if( temp == null )
	{
		alert( "Please enter a valid " + msg );
		e.focus();
		return false;
	}
	else
		return true;		
}


function CheckRadioValue( e, n, eOther, message )
{
	return( CheckRadioValueLow( e, n, eOther, "Other", message ));
}

function CheckRadioValueLow( e, n, eOther, strValue, message )
{
	temp = "undefined";

	for( i = 0; i < n; i++ )
		if( e[i].checked )
			temp = e[i].value

	if(( temp == strValue ) && ( eOther.value == "" ))
	{
		alert( message + "." );
		eOther.focus();
		return false;
	}
	return true;
}

function SubmitCustomForm()
{
	if( CheckInput() )
	{
		document.theform.bQuote.value = false;
		return( true );
	}
	return( false );
}

function RequestQuotation( strURL )
{
	if( CheckInput() )
	{
		document.theform.action = strURL;
		document.theform.bQuote.value = true;
		document.theform.submit();
	}
}
function SubmitCustomService( strURL, strQuote )
{
	if( CheckInput() )
	{
		document.theform.action = strURL;
		document.theform.bQuote.value = strQuote;
		document.theform.submit();
	}
}
