function removeBg(un, pwd)
{
	var username = document.getElementById(un);
	var password = document.getElementById(pwd);
	if(username != null && password != null)
	{
		if(username.value != '')
		{
			username.style.backgroundImage = "none";
		}
		
	    if(password.value != '')
		{
			password.style.backgroundImage = "none";
		}
	}
}

function pwdField(input)
{
	if(input != '')
	{
		var bg;
        if(input.name == 'q')
        {
			bg = 'url(/img/google_bg.gif)';
        }
	    if((input.style.backgroundImage == "none" || input.style.backgroundImage == "") && input.value == '')
	    {
			input.style.backgroundImage = bg;
	        input.style.backgroundRepeat = 'no-repeat';
	    }
	    else if(input.style.backgroundImage == bg)
	    {
			input.style.backgroundImage = "none";
	    }
	}
}

  /***********************************************
  * Textarea Maxlength script- © Dynamic Drive (www.dynamicdrive.com)
  * This notice must stay intact for legal use.
  * Visit http://www.dynamicdrive.com/ for full source code
  ***********************************************/
    function ismaxlength(obj){
      var mlength=obj.getAttribute? parseInt(obj.getAttribute("maxlength")) : ""
      if (obj.getAttribute && obj.value.length>mlength)
        obj.value=obj.value.substring(0,mlength)
    }
    function validate_required(field,alerttxt) {
      with (field) {
        if (value==null||value=="")
          {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 {return true;}
      }
    }
    
    //Written by Neil Campbell
    function validate_checked(field,alerttxt)
    {
        with (field)
        {
            if(checked == false)
            {
                alert(alerttxt);return false;
            }
            else
            {
                return true;
            }
        }
    }
      
    function validate_form(thisform) {
      with (thisform) {
        //if (validate_required(mb-name,"Please enter your name")==false)
        //  {name.focus();return false;}
        //if (validate_required(mb.f-tihkl,"Please enter your surname")==false)
        //  {name.focus();return false;}
        //if (validate_required(mb-bddtu-bddtu,"Please enter your email address")==false)
        //  {email.focus();return false;}
        //if (validate_email(mb-bddtu-bddtu,"Your email address does not appear to be valid, please try again")==false)
        //  {email.focus();return false;}
        if (validate_checked(agree,"Please agree to the subscription terms")==false)
          {agree.focus();return false;}
      }
    }