﻿function Validate(frm)
{
    var intError = 0;
	var focus_field = null;
	if (Validator.isEmpty(frm.firstname) || frm.firstname.value == txtValue[0])
	{
	    frm.firstname.parentNode.className = "error";
	    intError = 1;
		if (focus_field == null) focus_field = frm.firstname;
	}
	else
	{
	    frm.firstname.parentNode.className = "";
	}
	if (Validator.isEmpty(frm.lastname) || frm.lastname.value == txtValue[1])
	{
	    frm.lastname.parentNode.className = "error";
	    intError = 1;
		if (focus_field == null) focus_field = frm.lastname;
	}
	else
	{
	    frm.lastname.parentNode.className = "";
	}
	if (Validator.isEmpty(frm.email) || frm.email.value == txtValue[2])
	{
	    frm.email.parentNode.className = "error";
	    intError = 1;
		if (focus_field == null) focus_field = frm.email;
	}
	else if (!Validator.isEmail(frm.email.value))
	{
	    frm.email.parentNode.className = "error";
	    intError = 1;
		if (focus_field == null) focus_field = frm.email;
	}
	else
	{
	    frm.email.parentNode.className = "";
	}
	
    if (focus_field != null)
	    focus_field.focus();
	    
	return (intError == 0);
}

function onFocusInput(obj,id)
{
    if(obj.value == txtValue[id])
        obj.value = "";
}

function onBlurInput(obj,id)
{
    if(obj.value == "")
        obj.value = txtValue[id];
}

function onSelect(obj,element)
{
    var flag = false;
    if (isSelectProperty!=null)
    {
        for(var i = 0; i<isSelectProperty.length; i++)
        {
            if(obj.value == isSelectProperty[i])
                flag = true;
        }
        if (flag)
            document.getElementById(element).parentNode.className = 'notline2';
        else
        {
            document.getElementById(element).parentNode.className = 'notline2 hide';
            document.getElementById(element).value = '';
        }
    }
}