function clearme(formItem, keyword)
{
    if (formItem.value == keyword) formItem.value = ''; 
}

function ClearInput(target, defaultval){
	if(target.value == defaultval){
		target.value = "";
		target.style.color = "#00A2E0";
	}
}

function ReplaceInputPrompt(target,defaultval){
	if(target.value == ""){
		target.value = defaultval;
		target.style.color = "#B7B7B7";
	}
}

function ValidateForm(isTech)
{    
    var isValid = true;    
    
    if(!isTech)
    {
        if(document.getElementById("CbAgree").checked)
            isValid = validateCommon();
        else
        {
            alert("Please agree to our Terms & Conditions");
            isValid = false;
        }        
    }
    else isValid = validateCommon();
    return isValid;
}

function validateCommon()
{ 
    var isValid = true;
    var fname = document.getElementById("first_name");
    var surname = document.getElementById("surname");
    var email = document.getElementById("email");  
    var country = document.getElementById("country");  

    if((fname.value == "Contact First Name") || (fname.value.length == 0))
    {
        alert("Please enter a First Name");
        isValid = false;
    }            
    else if((surname.value == "Contact Surname") || (surname.value.length == 0))
    {
        alert("Please enter a Surname");
        isValid = false;
    }
    else if(((email.value == "Email") || (email.value.length == 0)) || (!(isEmailAddress(email.value))))
    {
        alert("Please enter a valid Email Address");
        isValid = false;
    }    
    else if((country.value == "Country") || (country.value.length == 0))
    {
        alert("Please enter a Country");
        isValid = false;
    }    
    return isValid;
}

function isEmailAddress(str) 
{   
    var pattern = /^[_a-zA-Z0-9-]+(\.[_a-zA-Z0-9-]+)*@[a-zA-Z0-9-]+(\.[a-zA-Z0-9-]+)*\.(([0-9]{1,3})|([a-zA-Z]{2,3})|(aero|coop|info|museum|name))$/;        
    return pattern.test(str);
}