function adjustLayout(){

	//Get natural heights
	var cHeight = xHeight("body");
	var rHeight = xHeight("info")+260;
	var lHeight = xHeight("coach")+260;
	
	//Find Maximum height
	var maxHeight = Math.max(lHeight, Math.max(cHeight, rHeight));
	
	//Apply the height to all columns
	xHeight("body", maxHeight);
	xHeight("info", maxHeight-260);
	xHeight("coach", maxHeight-260);

}

function verifyMailshot(){
	
	document.add_mailshot.email.value=validateEmail(document.add_mailshot.email.value);
	var report="There is a problem\nPlease check the following:\n\n"
	var flag=0;
	
	if(document.add_mailshot.name.value=="" || document.add_mailshot.name.value=="name")
		{
		flag=1; report += "...Please enter your name\n";
		}
	
	if(document.add_mailshot.address1.value=="" || document.add_mailshot.address1.value=="address1")
		{
		flag=1; report += "...Please enter your address\n";
		}
		
	if(document.add_mailshot.town.value=="" || document.add_mailshot.town.value=="town")
		{
		flag=1; report += "...Please enter your town\n";
		}
		
		
	if(document.add_mailshot.email.value=="" || document.add_mailshot.email.value=="email")
	    {
		flag=1; report += "...Please enter an email address to proceed\n";
		} else {
		if(document.add_mailshot.email.value.indexOf("@")==-1 || document.add_mailshot.email.value.indexOf(".")==-1)
		    {
			flag=1; report += "...Please check your email address, it appears invalid\n";
			}
		}
	
	if(flag==1)
	{
		alert(report);
		} else {
		document.add_mailshot.submit();
	}
	
}

function removeMailshot(){

	document.remove_mailshot.email.value=validateEmail(document.remove_mailshot.email.value);
	var report="There is a problem unsubscribing\n\n"
	var flag=0;
	if(document.remove_mailshot.email.value!=document.remove_mailshot.addr.value)
		{
		flag=1; report += "...Please check your email address, it does not match the address the mailing you wish to unsubscribe from was sent to\n";
		report += "...Please ensure that your email address is entirely in lower case\n"
		}
		
	if(flag==1)
	{
		alert(report);
		} else {
		document.remove_mailshot.submit();
	}	
	
}



/* Standard Functions */

function validateNum(string)
    {
    for (var i=0, output='', valid="1234567890"; i<string.length; i++)
    if (valid.indexOf(string.charAt(i)) != -1)
    output += string.charAt(i)
    return output;
	} 
	
function validateAlpha(string)
    {
    for (var i=0, output='', valid="1234567890abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ "; i<string.length; i++)
    if (valid.indexOf(string.charAt(i)) != -1)
    output += string.charAt(i)
    return output;
	}
	
function validateEmail(string)
    {
    for (var i=0, output='', valid="1234567890abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ-_.@+"; i<string.length; i++)
    if (valid.indexOf(string.charAt(i)) != -1)
    output += string.charAt(i)
    return output;
	}
	
function checkboxToggle(control){
	if(control.value==0){
		control.value=1;
		document.checkbox.src='static_images/form_checkbox_selected.gif';
	} else {
		control.value=0;
		document.checkbox.src='static_images/form_checkbox.gif';
	}
}