﻿// JScript File

function check_values_Update()
{
	var frm=document.form1;
	if(frm.txt_FirstName.value=="")
	{
	
		alert("First Name cannot be Empty!");
		frm.txt_FirstName.focus();
		return(false);
	}
	else if(frm.txt_Address1.value=="")
	{		
        alert("Address1 cannot be empty");
		frm.txt_Address1.focus();
		return(false); 
	}
	else if(frm.txt_City.value=="")
     {
      alert("City cannot be empty");
      frm.txt_City.focus();
       return(false); 
   }
	else if( (frm.list_Country.value!="1") && (document.getElementById("txt_State").value==""))
	{
		alert("State Cannot be Empty!");
		document.getElementById("txt_State").focus();
		return(false);					
				}
	else if(frm.txtEmailId.value=="")
	{
		alert("Email Address cannot be empty");
		frm.txtEmailId.focus();
		return(false); 
	}
	else if(frm.txtEmailId.value!="")
	{
        var email_id=document.getElementById("txtEmailId").value;
		var at,colon; 
		at=email_id.indexOf("@");
		colon=email_id.indexOf(".");
		if(at <=0 || colon<=0 || at+1==colon)
		{
			alert("Invalid email Id");
			document.getElementById("txtEmailId").focus();
			return(false);
		}

	}
	else
	{
		return(true);
	}
}

function Display_StateControl()
{
	var frm= document.form1;
	if(document.getElementById("list_Country").value=="1")
	{
		document.getElementById("list_State").style.display = "block";
		document.getElementById("txt_State").style.display = "none";
	}
	else
	{
		document.getElementById("list_State").style.display = "none";
		document.getElementById("txt_State").style.display = "Block";
		document.getElementById("txt_State").value = "";
	}
}