// #@(#)marketing_enq.js	1.2 17:55:17,07/02/13 (yy/mm/dd)

function blank_field(theform,input_title,input_name)
	{
	if ((errors == 0) && (theform[input_name].value == ""))
		{
		alert("Please enter a value for the \"" + input_title + "\" field.");
		theform[input_name].focus();
		errors = 1;
		}
	}

function create_form_check(theform)
{
	var wholeFormOK = false;

	var checkOK = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyzƒŠŒšœŸÀÁÂÃÄÅÆÇÈÉÊËÌÍÎÏÐÑÒÓÔÕÖØÙÚÛÜÝÞßàáâãäåæçèéêëìíîïðñòóôõöøùúûüýþ0123456789-_-.@";
	var checkStr = theform.Email.value;
	var allValid = true;

	errors = 0;

	for (i = 0;  i < checkStr.length;  i++)
		{
		ch = checkStr.charAt(i);
		for (j = 0;  j < checkOK.length;  j++)
			if (ch == checkOK.charAt(j))
				break;
		if (j == checkOK.length)
			{
			allValid = false;
			break;
			}
		}

	if (!allValid)
		{
		alert("Please enter only letter, digit and \"_-.@\" characters in the \"Email\" field.");
		theform.Email.focus();
		errors = 1;

		}

	blank_field(theform,"Company Name",                     "Agency Name");
	blank_field(theform,"First Name",                       "First Name");
	blank_field(theform,"Last Name",                        "Last Name");
	blank_field(theform,"Job Title",                        "Job Title");
	blank_field(theform,"Phone Number",                     "Telephone");
	blank_field(theform,"Company Web Site",                 "URL");
	blank_field(theform,"Company Address",                  "Address");
	blank_field(theform,"Postcode / Zipcode",               "Postcode");
	blank_field(theform,"Country",	                        "Country");
	
	if (errors == 0)
	{
	    wholeFormOK = true;
	}

	return wholeFormOK;
}

