/* $Id: nh_contEmailValidaton.js,v 1.5 2009/06/08 06:36:56 riddhi Exp $*/

function contReq(loginFlag,contUser)
{
	if(contUser == "D")
	{
		for(var i=0; i < document.contRequest.contact_info.length; i++)
		{
			if (document.contRequest.contact_info[i].checked)
			var opt_val = document.contRequest.contact_info[i].value;
		}
    }

	if(loginFlag == 0)
	{
        if(isblank(document.getElementById("firstname").value))
        {
            alert(msgFLnameBlank);
            return false;
        }
        if(isblank(document.getElementById("lastname").value))
        {
            alert(msgFLnameBlank);
            return false;
        }
        if(isblank(document.getElementById("emailAdd").value))
        {
            alert(msgInvalidEmail);
            return false;
        }
        if(!emailInvalid(document.getElementById("emailAdd").value))
        {
            alert(msgInvalidEmail);
            return false;
        }
        if(isblank(document.getElementById("phone").value))
        {
            alert(msgPhoneFormat);
            return false;
        }
        if(!(check(document.getElementById("phone").value)) || document.getElementById("phone").value.match(/^[0\s+-]{0,}$/))
        {
            alert(msgPhoneFormat);
            return false;
        }

		if(opt_val == "ord_brochure")
		{
			if(isblank(document.getElementById("address").value))
			{
				alert(msgMandet);
				return false;
			}
			if(isblank(document.getElementById("zip").value))
			{
				alert(msgMandet);
				return false;
			}
            if(!checkZip(document.getElementById("zip").value))
            {
                alert(msgZip);
                return false;
            }
			if(isblank(document.getElementById("town").value))
			{
				alert(msgMandet);
				return false;
			}
		}

        if(isblank(document.getElementById("user_code").value))
        {
            alert(magWordMatch);
            return false;
        }
		return true;
	}
	else
	{
		if(opt_val == "ord_brochure")
		{
			if(isblank(document.getElementById("address").value))
			{
				alert(msgMandet);
				return false;
			}
			if(isblank(document.getElementById("zip").value))
			{
				alert(msgMandet);
				return false;
			}
            if(!checkZip(document.getElementById("zip").value))
            {
                alert(msgZip);
                return false;
            }
			if(isblank(document.getElementById("town").value))
			{
				alert(msgMandet);
				return false;
			}
		}
		return true;
	}
}

function display()
{
	document.getElementById("broucher").style.display = 'inline';
}

function hideexch()
{
	document.getElementById("broucher").style.display = 'none';
}