function check_ExistUser()
{
    var username = document.getElementById("username").value;
    if (username == "")
    {
        alert('Please enter the UserName.');
        return false;
    }
    
    var refPage = "checkUserName.php";
    var paraMeter = "uname=" + username;
    
    var result = ajaxpost(refPage, paraMeter, "post");
    alert(result);
}

function checkRegUserInput()
{
    var mail1 = document.getElementById('email').value;
    var mail2 = document.getElementById('email2').value;
    var city = document.getElementById('city').value;
    var usernm = document.getElementById('username').value;
    var pwd1 = document.getElementById('passwd').value;
    var pwd2 = document.getElementById('passwd2').value;
    var que = document.getElementById('question').value;
    var ans = document.getElementById('answer').value;
    var county = document.getElementById('county').value;
    var region = document.getElementById('region').value;
    var phe = document.getElementById('phone').value;
    var arcode = document.getElementById('area_code').value;
    //var scode = document.getElementById('SecurityCode').value;
      
    if (usernm=="")
    {
        alert("Please enter a user name.");
        document.getElementById('username').focus();
        return false;
    }

    if(usernm.indexOf("'")>=1 || usernm.indexOf("\"")>=1)
    {
        alert("The username you've submitted contains unallowed symbols; only letters, numerals and spaces may be used. Please edit your user name and submit again.");
        document.getElementById('username').focus();
        return false;
    }

    if (pwd1==""||pwd2=="")
    {        
        alert("Please enter a password");
        document.getElementById('passwd').focus();
        return false;
    }

    if(pwd1.indexOf("'")>=1 || pwd1.indexOf("\"")>=1)
    {
        alert("The password you've submitted contains unallowed symbols; only letters, numerals and spaces may be used. Please edit your password and submit again.");
        document.getElementById('passwd').focus();
        return false;
    }

    if (pwd1!==pwd2)
    {
        alert("Your password is not identical in both fields - please check and re-enter.");
        document.getElementById('passwd').focus();
        return false;
    }
      
    if (mail1.indexOf("@")<1)
    {
        alert("Your email address is not valid, please check and re-enter.");
        document.getElementById('email').focus();
        return false;
    }

    if (mail2.indexOf("@")<1)
    {
        alert("Your repeat email address is not valid, please check and re-enter.");
        document.getElementById('email2').focus();
        return false;
    }

    if (mail1!==mail2)
    {
        alert("Your email address is not identical in both fields - please check and re-enter.");
        document.getElementById('email').focus(); 
        return false;
    }

    if (city=="")
    {
        alert("Please enter the city name!");
        document.getElementById('city').focus();
        return false;
    }

    if (county=="")
    {
        alert("Please select your county!");
        document.getElementById('county').focus();
        return false;
    }

    if (region=="")
    {
        alert("Please select your region!");
        document.getElementById('region').focus();
        return false;
    }

    if (arcode=="")
    {
        alert("Please enter your area code!");
        document.getElementById('area_code').focus();
        return false;
    }

    if (phe=="")
    {
        alert("Please enter your phone number!");
        document.getElementById('phone').focus();
        return false;
    }

    if (que=="")
    {
        alert("Please select a get-password question.");        
        return false;
    }
    
    if (ans=="")
    {
        alert("Please enter your get-password answer.");
        document.getElementById('answer').focus();
        return false;
    }
    /*
    if (scode=="")
    {
        alert("Please enter the Security Code.");
        document.getElementById('SecurityCode').focus();
        return false;
    }  */  
    
}