function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_findObj(n, d) { //v4.0
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && document.getElementById) x=document.getElementById(n); return x;
}

function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}

function MM_openBrWindow(theURL,winName,features) { //v2.0
  window.open(theURL,winName,features);
}

function formCheck(me){
	if (me.username.value == "") {
			returnVal = false
			me.username.focus()
			alert("Please enter your username")
			return returnVal 
	}

	else if (me.password.value == "") {
			returnVal = false
			me.password.focus()
			alert("Please enter your password")
			return returnVal 
	}
			
	else {
		returnVal = true
		return returnVal
	} 
}


function reg1Check(){
	var myForm = document.form1;
	var rtrn = 0;

	if(myForm.firstname.value == ""){
		rtrn = 1;
		alert("Please provide your first name");
		myForm.firstname.focus();
		return false;
	}
	if(myForm.surname.value == ""){
		rtrn = 1;
		alert("Please provide your surname");
		myForm.surname.focus();return false;
	}
	if(myForm.address1.value == ""){
		rtrn = 1;
		alert("Please provide your first line of address");
		myForm.address1.focus();return false;
	}
	
	if(myForm.town.value == ""){
		rtrn = 1;
		alert("Please provide your Town");
		myForm.town.focus();return false;
	}
	
	if(myForm.postcode.value == ""){
		rtrn = 1;
		alert("Please provide your postcode");
		myForm.postcode.focus();return false;
	}
	
	
	if(myForm.county.value == ""){
		rtrn = 1;
		alert("Please provide your county");
		myForm.county.focus();return false;
	}
	
	if(myForm.daytel.value == ""){
		rtrn = 1;
		alert("Please provide your daytime telephone number");
		myForm.daytel.focus();return false;
	}
	
	if(myForm.eveningtel.value == ""){
		rtrn = 1;
		alert("Please provide your evening telephone number");
		myForm.eveningtel.focus();return false;
	}
	
	if(myForm.mobile.value == ""){
		rtrn = 1;
		alert("Please provide your mobile telephone number");
		myForm.mobile.focus();return false;
	}
	
	if(myForm.email.value == ""){
		rtrn = 1;
		alert("Please provide your email address");
		myForm.email.focus();return false;
	}

	if(myForm.expertise.selected == "select area of expertise"){
		rtrn = 1;
		alert("Please provide your area of expertise");
		myForm.expertise.focus();return false;
	}

	if(myForm.username.value == ""){
		rtrn = 1;
		alert("Please provide a username");
		myForm.username.focus();return false;
	}
	
	if(myForm.password.value == ""){
		rtrn = 1;
		alert("Please provide a password");
		myForm.password.focus();return false;
	}
	
	
	if(myForm.password.value != myForm.password2.value){
		rtrn = 1;
		alert("Passwords do not match please try again");
		myForm.password.focus();return false;
	}

   if(myForm.memberLevel.value == ""){
		rtrn = 1;
		alert("Please select a membership level you wish to purchase");
		myForm.memberLevel.focus();return false;
	}

	if(myForm.checkbox.checked == false){
		rtrn = 1;
		alert("You must agree to our terms and conditions before continuing");return false;
	}

	if(rtrn == 1){
		return false;
	}else{
		return true;
	}

}


function checkCount(){  	
	var data = document.form.myProfile.value;
	var extract = data.split(" ");
	var out = extract.length;
	alert("Number of words:" + out);
}

function checkForm(){
	var rtn = 0;
	var data = document.form.myProfile.value;
	var extract = data.split(" ");
	var out = extract.length;
	
	if(out > 100){
		alert("You have too many words in your profile please remove some and try again");
		rtn = 1;
	}
	
	if(rtn == 1){
		return false;
	}else{
		return true;
	}

}