/* author: ACSS Ltd */
/* Creation date: 17/01/2007 */
// Removes leading whitespaces
function LTrim( value ) {
	
	var re = /\s*((\S+\s*)*)/;
	return value.replace(re, "$1");
	
}

// Removes ending whitespaces
function RTrim( value ) {
	
	var re = /((\s*\S+)*)\s*/;
	return value.replace(re, "$1");
	
}

// Removes leading and ending whitespaces
function trim( value ) {
	
	return LTrim(RTrim(value));
	
}

function validInput(infoForm, box)
{
infoForm[box].value = trim(infoForm[box].value);

switch (txtInput(infoForm[box].value)){
	case "Empty string":
		//alert("empty string in "+box);
		return false;
		break;
	case true:
		//alert ("OK");
		return true;
		break;
		}
}

function txtInput(txt)
{

if (trim(txt)==""){
	return "Empty string";
	}
else
{return true;}
}

function chkinput(infoForm)
{

if (!validInput(infoForm, 'email'))
	{
	alert ('you have not entered your email address!');
	return false;
	}
if (!validInput(infoForm, 'scripts'))
	{
	alert ('you have not entered names of scripts required!');
	return false;
	}
if (!validInput(infoForm, 'message'))
	{
	alert ('you have not entered address for invoice and delivery!');
	return false;
	}
}