	
		function valid_user(f) 
		{

			f.value=filterNum(f.value);

    			function filterNum(str) 
    			{
          			re = /\$|,|@|#|~|`|\%|\*|\^|\&|\(|\)|\+|\=|\[|\]|\[|\}|\{|\;|\:|\'|\"|\<|\>|\?|\||\\|\!|\/|\$/g;
                  		return str.replace(re, "");
     			}
     			
     			

		}


		
		function valid_email(f) 
		{
			f.value=filterNum(f.value);

    			function filterNum(str) 
    			{
          			re = /\$|,|#|~|`|\%|\*|\^|\&|\(|\)|\+|\=|\[|\]|\[|\}|\{|\;|\:|\'|\"|\<|\>|\?|\||\\|\!|\/|\$/g;
                  		return str.replace(re, "");
     			}
		} 
		
		function validate_required(field,alerttxt)
		{
			with (field)
			{			
				if (value==null||value=="")
  				{
  					alert(alerttxt);
  					return false;
  				}else{
  					return true;
  				}
			}
		}
		function validate_password(field,alerttxt)
		{
			with (field)
			{			
				if (value==null||value=="")
  				{
  					alert(alerttxt);
  					return false;
  				}else{
  					if(value.length < 6)
  					{
  					
  						alert("The Password required at least 6 character.");
  						return false;
  					
  					}else{
  					
  						if(value != document.red_signup.retype_password.value)
  						{
  							alert("The Password does not match!");
  							return false;
  						
  						}else{
  						
  							return true;
  						}
  					}
  					
  				}
			}
		}
		function cp_validate_password(field,alerttxt)
		{
			with (field)
			{			
				if (value==null||value=="")
  				{
  					alert(alerttxt);
  					return false;
  				}else{
  					if(value.length < 6)
  					{
  					
  						alert("The new Password required at least 6 character.");
  						return false;
  					
  					}else{
  					
  						if(value != document.cp_changepass.retype_pass.value)
  						{
  							alert("The new Password does not match!");
  							return false;
  						
  						}else{

							if(value == document.cp_changepass.current_pass.value)
  							{
  								alert("The new Password and current Password are the same!");
  								return false;
							}


						}  						
  					}
  					
  				}
			}
		}
		function validate_checkbox(field,alerttxt)
		{
			with (field)
			{		
				if (checked == false)
  				{
  					alert(alerttxt);
  					return false;
  				}else{
  					return true;
  				}
  			}
			
		}
		function validate_email(field,alerttxt)
		{
			with (field)
			{
				apos=value.indexOf("@");
				dotpos=value.lastIndexOf(".");
				if (apos<1||dotpos-apos<2) 
  				{
  					alert(alerttxt);
  					return false;
  				}else{
  					if(value != document.red_signup.retype_email.value)
  					{
  						alert("The Email does not match!");
  						return false;
  					
  					}else{
  						return true;
  					}
  				}
			}
		}
		function validate_email_add(field,alerttxt)
		{
			with (field)
			{
				apos=value.indexOf("@");
				dotpos=value.lastIndexOf(".");
				if (apos<1||dotpos-apos<2) 
  				{
  					alert(alerttxt);
  					return false;
  				}
			}
		}
		
		function validate_form(thisform)
		{
			with (thisform)
			{
				if (validate_required(username,"Please fill out the Username field.")==false || validate_password(password,"Please fill out the Password field.")==false || validate_required(email,"Please fill out the Email field.")==false)
  				{
  					return false;
  				}else{
  				
  					if (validate_email(email,"Not a valid Email address!")==false)
  					{
  						return false;
  					}else{
  					
  						if (validate_checkbox(agree,"Please tick the box if you agreed to TheREDcolour's Terms and Conditions")==false)
  						{
  							return false;
  						}
  				
  					
  					}
  					
  					

  				
  				}
  				
  				
			}
		}

		function cp_validate_form(thisform)
		{
			with (thisform)
			{
				if (validate_required(current_pass,"Please fill out your current password.")==false || cp_validate_password(new_pass,"Please enter your new password.")==false)
				{
  					return false;
  				}
  				
  				
			}
		}

		function cp_validate_form_email(thisform)
		{
			with (thisform)
			{
				if (validate_required(email,"Please fill out the Email field.")==false)
				{
  					return false;
  				}
  				
  				
			}
		}

		function validate_form_upload(thisform)
		{
			with (thisform)
			{
				if (validate_required(title,"Please fill out the Title field.")==false)
				{
  					return false;
  				}
  				
  				
			}
		}
	
