// JavaScript Document


function chk_client_login()   
{
			if ((document.frmLogin.username.value == "" ) ||(document.frmLogin.username.value == "User Name" ) )
			{
				alert("Please enter user name") ;
				document.frmLogin.username.focus();
				return false ;
			}
			if ((document.frmLogin.password.value == "" ) ||(document.frmLogin.password.value == "Password" ))
			{
				alert("Please enter password") ;
				document.frmLogin.password.focus();
				return false ;
			}


			document.frmLogin.submit();
			return true ;
}

function chk_Comment_Registration()   
{
			if (document.frmCommentRegistration.txtFname.value == "" )
			{
				alert("Please enter first name") ;
				document.frmCommentRegistration.txtFname.focus();
				return false ;
			}

			if (document.frmCommentRegistration.txtLname.value == "" )
			{
				alert("Please enter last name") ;
				document.frmCommentRegistration.txtLname.focus();
				return false ;
			}

			if (document.frmCommentRegistration.drpSex.value == "0" )
			{
				alert("Please select sex") ;
				document.frmCommentRegistration.drpSex.focus();
				return false ;
			}

			if (document.frmCommentRegistration.txtAddress.value == "" )
			{
				alert("Please enter address") ;
				document.frmCommentRegistration.txtAddress.focus();
				return false ;
			}


			document.frmCommentRegistration.submit();
			return true ;
}


function chk_User_Registration()   
{
			if (document.frmUserRegistration.txtRegFname.value == "" )
			{
				alert("Please enter first name") ;
				document.frmUserRegistration.txtRegFname.focus();
				return false ;
			}

			if (document.frmUserRegistration.txtRegLname.value == "" )
			{
				alert("Please enter last name") ;
				document.frmUserRegistration.txtRegLname.focus();
				return false ;
			}
			
			if (document.frmUserRegistration.txtRegUserName.value == "" )
			{
				alert("Please enter user name") ;
				document.frmUserRegistration.txtRegUserName.focus();
				return false ;
			}

			if (document.frmUserRegistration.txtRegUserPassword.value == "" )
			{
				alert("Please enter password") ;
				document.frmUserRegistration.txtRegUserPassword.focus();
				return false ;
			}


			if (document.frmUserRegistration.txtRegUserPassword.value == "Password" )
			{
				alert("Please enter password other than 'Password'") ;
				document.frmUserRegistration.txtRegUserPassword.focus();
				return false ;
			}

			if (document.frmUserRegistration.txtRegConfPassword.value == "" )
			{
				alert("Please enter confirm password") ;
				document.frmUserRegistration.txtRegConfPassword.focus();
				return false ;
			}

			if (document.frmUserRegistration.txtRegConfPassword.value != document.frmUserRegistration.txtRegUserPassword.value )
			{
				alert("Confirm password does not match with password") ;
				document.frmUserRegistration.txtRegConfPassword.focus();
				return false ;
			}

			if (document.frmUserRegistration.drpRegSex.value == "0" )
			{
				alert("Please select sex") ;
				document.frmUserRegistration.drpRegSex.focus();
				return false ;
			}

			if (document.frmUserRegistration.txtRegDateOfBirth.value == "" )
			{
				alert("Please enter date of birth") ;
				document.frmUserRegistration.txtRegDateOfBirth.focus();
				return false ;
			}


			if (dateCheck(document.frmUserRegistration.txtRegDateOfBirth) == false)
			{
				document.frmUserRegistration.txtRegDateOfBirth.focus();
				return false ;
			}

			if (document.frmUserRegistration.txtRegAddress.value == "" )
			{
				alert("Please enter address") ;
				document.frmUserRegistration.txtRegAddress.focus();
				return false ;
			}

			if (document.frmUserRegistration.txtRegState.value == "" )
			{
				alert("Please enter state") ;
				document.frmUserRegistration.txtRegState.focus();
				return false ;
			}

			if (document.frmUserRegistration.txtRegCountry.value == "" )
			{
				alert("Please enter country") ;
				document.frmUserRegistration.txtRegCountry.focus();
				return false ;
			}

			if (document.frmUserRegistration.txtRegEmail.value == "" )
			{
				alert("Please enter email") ;
				document.frmUserRegistration.txtRegEmail.focus();
				return false ;
			}

			if (checkEmail(document.frmUserRegistration.txtRegEmail.value) == false)
			{
				document.frmUserRegistration.txtRegEmail.focus();
				return false ;
			}


			document.frmUserRegistration.submittype.value="true" ;
			document.frmUserRegistration.submit();
			return true ;
}


function chk_User_LoginInfo()   
{
			if ((document.frmUserLogin.txtusername.value == "" ) ||(document.frmUserLogin.txtusername.value == "User Name" ) )
			{
				alert("Please enter user name") ;
				document.frmUserLogin.txtusername.focus();
				return false ;
			}
			if ((document.frmUserLogin.txtpassword.value == "" ) ||(document.frmUserLogin.txtpassword.value == "Password" ))
			{
				alert("Please enter password") ;
				document.frmUserLogin.txtpassword.focus();
				return false ;
			}

			document.frmUserLogin.submittype.value="true" ;
			document.frmUserLogin.submit();
			return true ;
}

function chk_User_Post_Comment()   
{
			if (document.frmUserComment.Guest_Book_Subject_ID.value == "0")
			{
				alert("Please select guest book subject") ;
				document.frmUserComment.Guest_Book_Subject_ID.focus();
				return false ;
			}
			if (document.frmUserComment.txtGuestBookComment.value == "")
			{
				alert("Please enter comment") ;
				document.frmUserComment.txtGuestBookComment.focus();
				return false ;
			}

			document.frmUserComment.Comment_Submittype.value="true" ;
			document.frmUserComment.submit();
			return true ;
}

function chk_Send_Card(getActionPageName)   
{
			var isCardSelected = false;

			if(document.frmSendCard.Puja_Card_ID.length > 0)
			{
				for(var k=0; k< document.frmSendCard.Puja_Card_ID.length; k++)
				{
					if (document.frmSendCard.Puja_Card_ID[k].checked == true)
						isCardSelected = true;
				}
			}
			else
			{
				if (document.frmSendCard.Puja_Card_ID.checked != false)
					isCardSelected = true;
			}

			if (isCardSelected == false)
			{
				alert("Please select any puja card") ;

				if(document.frmSendCard.Puja_Card_ID.length > 0)
					document.frmSendCard.Puja_Card_ID[0].focus();
				else
					document.frmSendCard.Puja_Card_ID.focus();

					return false ;
			}

			if (document.frmSendCard.txtReceiverName.value == "")
			{
				alert("Please enter your friend's name") ;
				document.frmSendCard.txtReceiverName.focus();
				return false ;
			}

			if (document.frmSendCard.txtSenderName.value == "")
			{
				alert("Please enter your name") ;
				document.frmSendCard.txtSenderName.focus();
				return false ;
			}

			if (document.frmSendCard.txtReceiverEmail.value == "")
			{
				alert("Please enter your friend's email") ;
				document.frmSendCard.txtReceiverEmail.focus();
				return false ;
			}

			if (checkEmail(document.frmSendCard.txtReceiverEmail.value) == false)
			{
				document.frmSendCard.txtReceiverEmail.focus();
				return false ;
			}

			if (document.frmSendCard.txtSenderEmail.value == "")
			{
				alert("Please enter your email") ;
				document.frmSendCard.txtSenderEmail.focus();
				return false ;
			}

			if (checkEmail(document.frmSendCard.txtSenderEmail.value) == false)
			{
				document.frmSendCard.txtSenderEmail.focus();
				return false ;
			}

			document.frmSendCard.Card_Submittype.value="true" ;

			document.frmSendCard.action = getActionPageName;
			document.frmSendCard.submit();

			return true ;
}

function chage_card()
{
			document.frmSendCard.action = "select_card.php";
			document.frmSendCard.submit();

			return true ;
}

function chk_Send_view_Card()   
{		

			document.frmSendCard.Card_View_Submittype.value="true" ;
			document.frmSendCard.submit();

			return true ;
}

function chk_User_ForgetPassword()   
{
			

			if (document.frmUserForgetPassword.txtForgetEmail.value == "" )
			{
				alert("Please enter email") ;
				document.frmUserForgetPassword.txtForgetEmail.focus();
				return false ;
			}

			if (checkEmail(document.frmUserForgetPassword.txtForgetEmail.value) == false)
			{
				document.frmUserForgetPassword.txtForgetEmail.focus();
				return false ;
			}


			document.frmUserForgetPassword.submittype.value="true" ;
			document.frmUserForgetPassword.submit();
			return true ;
}





function chk_User_ContactUs()   
{
			if (document.frmUserContactUs.txtContFname.value == "" )
			{
				alert("Please enter first name") ;
				document.frmUserContactUs.txtContFname.focus();
				return false ;
			}
			if (document.frmUserContactUs.txtContLname.value == "" )
			{
				alert("Please enter last name") ;
				document.frmUserContactUs.txtContLname.focus();
				return false ;
			}
			if (document.frmUserContactUs.txtContAddress.value == "" )
			{
				alert("Please enter address") ;
				document.frmUserContactUs.txtContAddress.focus();
				return false ;
			}

			if (document.frmUserContactUs.txtContState.value == "" )
			{
				alert("Please enter state") ;
				document.frmUserContactUs.txtContState.focus();
				return false ;
			}

			if (document.frmUserContactUs.txtContCountry.value == "" )
			{
				alert("Please enter country") ;
				document.frmUserContactUs.txtContCountry.focus();
				return false ;
			}

			if (document.frmUserContactUs.txtContEmail.value == "" )
			{
				alert("Please enter email") ;
				document.frmUserContactUs.txtContEmail.focus();
				return false ;
			}

			if (checkEmail(document.frmUserContactUs.txtContEmail.value) == false)
			{
				document.frmUserContactUs.txtContEmail.focus();
				return false ;
			}
			if (document.frmUserContactUs.txtContQuery.value == "" )
			{
				alert("Please enter your Query") ;
				document.frmUserContactUs.txtContQuery.focus();
				return false ;
			}


			document.frmUserContactUs.submittype.value="true" ;
			document.frmUserContactUs.submit();
			return true ;
}