// Support Script (746)
function AddToValidateArray(strElementName)
{
    var strName = strElementName

    if (!document.ValidateArray) 
    {
        document.ValidateArray = new Array
    }

    document.ValidateArray[document.ValidateArray.length] = strName
}

// Support Script (582)
function ValidateNonBlank()
{
  var msg = "";
  var val = this.getText();  

  if (StripChars(" \n\t\r",val).length == 0)
  {
    if (Trim(this.ErrorMsg) != "")
      msg = "Required field. " + this.ErrorMsg
    else
      msg = "Required field. Please enter an appropriate value."
  }

  return msg;
}

// Support Script (747)
function StripChars(theFilter,theString)
{
	var strOut,i,curChar

	strOut = ""
	for (i=0;i < theString.length; i++)
	{		
		curChar = theString.charAt(i)
		if (theFilter.indexOf(curChar) < 0)	// if it's not in the filter, send it thru
			strOut += curChar		
	}	
	return strOut
}

function AllInRange(x,y,theString)
{
	var i, curChar
	
	for (i=0; i < theString.length; i++)
	{
		curChar = theString.charAt(i)
		if (curChar < x || curChar > y) //the char is not in range
			return false
	}
	return true
}


function reformat (s)
{
    var arg;
    var sPos = 0;
    var resultString = "";

    for (var i = 1; i < reformat.arguments.length; i++) {
       arg = reformat.arguments[i];
       if (i % 2 == 1) 
           resultString += arg;
       else 
       {
           resultString += s.substring(sPos, sPos + arg);
           sPos += arg;
       }
    }
    return resultString;
}

function Trim(theString)
{
 var i,firstNonWhite

 if (StripChars(" \n\r\t",theString).length == 0 ) return ""

	i = -1
	while (1)
	{
		i++
		if (theString.charAt(i) != " ")
			break	
	}
	firstNonWhite = i
	//Count the spaces at the end
	i = theString.length
	while (1)
	{
		i--
		if (theString.charAt(i) != " ")
			break	
	}	

	return theString.substring(firstNonWhite,i + 1)

}
// Support Script (576)
function ValidateEMail()
{
   var msg = "";
   var val = this.getText();
   var msgInvalid = "Please enter a valid e-mail address\n(a valid e-mail address contains the @ character)";

  	var theLen = StripChars(" ",val).length
	  if (theLen == 0)	
		  if (!this.Required) return ""		
		  else return "Required field.  " + msgInvalid

   if (val.indexOf("@",0) < 0) 
   {
      msg = msgInvalid 
   }
   return msg;
}

function document_onLoad() {
Surname.Validate=ValidateNonBlank;
Surname.ErrorMsg = "Please enter Your Surname"
AddToValidateArray("Surname")
Tel.Validate=ValidateNonBlank;
Tel.ErrorMsg = "Please enter telephone number"
AddToValidateArray("Tel")
Email.Validate = ValidateEMail;
Email.Required = Number("1");
AddToValidateArray("Email")
if (String(typeof(Section1))!="undefined") centerPage("800")
if (String(typeof(eval("document.LyrSection1")))!="undefined") centerPage("800")
 }
function Check1__onClick() {
if (Check1.getState())
{ 
    deladd1.setText(Add1.getText())
}
else
{
    deladd1.clear()
}
if (Check1.getState())
{ 
    deladd2.setText(Add2.getText())
}
else
{
    deladd2.clear()
}
if (Check1.getState())
{ 
    deltown.setText(Town.getText())
}
else
{
    deltown.clear()
}
if (Check1.getState())
{ 
    delcounty.setText(County.getText())
}
else
{
    delcounty.clear()
}
if (Check1.getState())
{ 
    delpostcode.setText(Postcode.getText())
}
else
{
    delpostcode.clear()
}
if (Check1.getState())
{ 
    DelCountry.setText(BilCountry.getText())
}
else
{
    DelCountry.clear()
}
 }
function _Check1__onClick() { if (Check1) return Check1.onClick(); }

