function fn_ValidateForm(L_strButtonName)
{	
	
	var objFormElement=fn_GetHtmlObject("frmAction");	

	switch(L_strButtonName)
	{
		case 'btnadminLogin':
		{
				 
			if(fn_Trim(fn_GetHtmlObject("txtAdminName").value)=="")
			{
				alert("Please Enter Email Address.");
				fn_GetHtmlObject("txtAdminName").focus();
				return false;
			}
			 
			 if(fn_Trim(fn_GetHtmlObject("txtAdminPassword").value)=="")
			{
				alert("Please Enter Password.");
				fn_GetHtmlObject("txtAdminPassword").focus();
				return false;
			}
/*
			if((fn_Trim(fn_GetHtmlObject("txtAdminName").value)!=admin))
			{
				alert("Invalid Username Or Password");
				return false;
			}
			if((fn_Trim(fn_GetHtmlObject("txtAdminPassword").value)!=password))
			{
				
				alert("Invalid Username Or Password");
				return false;
			}*/
             fn_GoToAction('actadminLogin');
			break;
		}
		case 'btnUserLogin':
		{
				 
				
				
			if(fn_Trim(fn_GetHtmlObject("txtUserName").value)=="")
			{
				alert("Please Enter Email Address.");
				fn_GetHtmlObject("txtUserName").focus();
				return false;
			}
			 
			 if(fn_Trim(fn_GetHtmlObject("txtPassword").value)=="")
			{
				alert("Please Enter Password.");
				fn_GetHtmlObject("txtPassword").focus();
				return false;
			}

			
             fn_GoToAction('userLogin');
			break;
		}
		case 'btnUserValidate':
		{
			 if(fn_Trim(fn_GetHtmlObject("txtPassword").value)=="")
			{
				alert("Please Enter Password.");
				fn_GetHtmlObject("txtPassword").focus();
				return false;
			}

			
             fn_GoToAction('userEventPassword');
			break;

		}

		case 'btnUserfavoriteLogin':
		{
				 
				
				
			if(fn_Trim(fn_GetHtmlObject("txtUserName").value)=="")
			{
				alert("Please Enter Email Address.");
				fn_GetHtmlObject("txtUserName").focus();
				return false;
			}
			 
			 if(fn_Trim(fn_GetHtmlObject("txtPassword").value)=="")
			{
				alert("Please Enter Password.");
				fn_GetHtmlObject("txtPassword").focus();
				return false;
			}

			
             fn_GoToAction('userFavoriteLogin');
			break;
		}
		case 'btnUserShoppingLogin':
		{
				 
				
				
			if(fn_Trim(fn_GetHtmlObject("txtUserName").value)=="")
			{
				alert("Please Enter Email Address.");
				fn_GetHtmlObject("txtUserName").focus();
				return false;
			}
			 
			 if(fn_Trim(fn_GetHtmlObject("txtPassword").value)=="")
			{
				alert("Please Enter Password.");
				fn_GetHtmlObject("txtPassword").focus();
				return false;
			}

			
             fn_GoToAction('userShoppingCartLogin');
			break;
		}
		case 'btnAddUser':
		{
				 
				
				
			if(fn_Trim(fn_GetHtmlObject("txtUserFirstName").value)=="")
			{
				alert("Please Enter User First Name.");
				fn_GetHtmlObject("txtUserFirstName").focus();
				return false;
			}
			if(fn_Trim(fn_GetHtmlObject("txtUserLastName").value)=="")
			{
				alert("Please Enter User Last Name.");
				fn_GetHtmlObject("txtUserLastName").focus();
				return false;
			}
			 if(fn_Trim(fn_GetHtmlObject("txtUserEmail").value)=="")
			{
				alert("Please Enter Your Email-id.");
				fn_GetHtmlObject("txtUserEmail").focus();
				return false;
			}
			if(!/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,4})+$/.test(fn_Trim(fn_GetHtmlObject("txtUserEmail").value)))
		 {
				alert("Please enter valid email address");
				fn_GetHtmlObject("txtUserEmail").focus();
				return false;
            }
          if(fn_Trim(fn_GetHtmlObject("EventSel").value)=="")
			{
				alert("Please Select Event.");
				fn_GetHtmlObject("EventSel").focus();
				return false;
			}
			
             fn_GoToAction('userRegisterEvent');
			break;
		}
		case 'btnforgotPassword':
		{
				 
				
				
			
			 if(fn_Trim(fn_GetHtmlObject("txtUserEmail").value)=="")
			{
				alert("Please Enter Your Email-id.");
				fn_GetHtmlObject("txtUserEmail").focus();
				return false;
			}
			if(!/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,4})+$/.test(fn_Trim(fn_GetHtmlObject("txtUserEmail").value)))
		 {
				alert("Please enter valid email address");
				fn_GetHtmlObject("txtUserEmail").focus();
				return false;
            }
          if(fn_Trim(fn_GetHtmlObject("EventSel").value)=="")
			{
				alert("Please Select Event.");
				fn_GetHtmlObject("EventSel").focus();
				return false;
			}
			
             fn_GoToAction('userforgotPassword');
			break;
		}
		case 'btnAddEvent':
		{
			if(fn_Trim(fn_GetHtmlObject("txt_event_name").value)=="")
			{
				alert("Please Enter Event Name.");
				fn_GetHtmlObject("txt_event_name").focus();
				return false;
			}
		  if(checkNumeric(fn_Trim(fn_GetHtmlObject("txt_event_name").value)))
			{
				alert("Invalid Event Name.");
				fn_GetHtmlObject("txt_event_name").focus();
				return false;
			}
	        if((fn_GetHtmlObject("Category").value)=="")
			{
				alert("Please Select Category name");
				fn_GetHtmlObject("Category").focus();
				return false;
			}
			
			 if(fn_Trim(fn_GetHtmlObject("txt_event_location").value)=="")
			{
				alert("Please Event Location Name.");
				fn_GetHtmlObject("txt_event_location").focus();
				return false;
			}
		    if(checkNumeric(fn_Trim(fn_GetHtmlObject("txt_event_location").value)))
			{
				alert("Invalid Event Location");
				fn_GetHtmlObject("txt_event_location").focus();
				return false;
			}
			if(document.getElementById('event_secure').checked==true)
			{
			  if(fn_Trim(fn_GetHtmlObject("event_password").value)=="")
			{
				alert("Please give Event Password.");
				fn_GetHtmlObject("event_password").focus();
				return false;
			}

			}
		   if(fn_Trim(fn_GetHtmlObject("txt_event_Date").value)=="")
			{
				alert("Please Enter Event Date.");
				fn_GetHtmlObject("txt_event_Date").focus();
				return false;
			}
			
			
				fn_GoToAction('addEvent');
			
			
			break;
		}

	case 'btnEditAdmin':
		{
			
			if(fn_Trim(fn_GetHtmlObject("txtAdminName").value)=="")
			{
				alert("Please give Admin  Name.");
				fn_GetHtmlObject("txtAdminName").focus();
				return false;
			}
		
				else if(checkNumeric(fn_Trim(fn_GetHtmlObject("txtAdminName").value)))
			{
				alert("Please Enter characters for Admin Name .");
				fn_GetHtmlObject("txtAdminName").focus();
				return false;
			}
			else if(fn_Trim(fn_GetHtmlObject("txtAdminLogin").value)=="")
			{
				alert("Please Give Admin Login.");
				fn_GetHtmlObject("txtAdminLogin").focus();
				return false;
			}
			
			else if(fn_Trim(fn_GetHtmlObject("txtAdminEmail").value)=="")
			{
				alert("Please Give Admin email.");
				fn_GetHtmlObject("txtAdminEmail").focus();
				return false;
			}
			else if(fn_Trim(fn_GetHtmlObject("txtAdminPassword").value)=="")
			{
				alert("Please Enter Admin Password .");
				fn_GetHtmlObject("txtAdminPassword").focus();
				return false;
			}
			
			else
			{
				fn_GoToAction('editAdminAccount');
			
			}
			break;
		}
		case 'btnEditEvent':
		{
			if(fn_Trim(fn_GetHtmlObject("txt_event_name").value)=="")
			{
				alert("Please Enter Event Name.");
				fn_GetHtmlObject("txt_event_name").focus();
				return false;
			}
	 if(checkNumeric(fn_Trim(fn_GetHtmlObject("txt_event_name").value)))
			{
				alert("Invalid Event Name.");
				fn_GetHtmlObject("txt_event_name").focus();
				return false;
			}
		if((fn_GetHtmlObject("Category").value)=="")
			{
				alert("Please Select Category name");
				fn_GetHtmlObject("Category").focus();
				return false;
			}
			
		 if(fn_Trim(fn_GetHtmlObject("txt_event_location").value)=="")
			{
				alert("Please Event Location Name.");
				fn_GetHtmlObject("txt_event_location").focus();
				return false;
			}
		 if(checkNumeric(fn_Trim(fn_GetHtmlObject("txt_event_location").value)))
			{
				alert("Invalid Event Location ");
				fn_GetHtmlObject("txt_event_location").focus();
				return false;
			}
			if(fn_Trim(fn_GetHtmlObject("txt_event_Date").value)=="")
			{
				alert("Please Enter Event Date.");
				fn_GetHtmlObject("txt_event_Date").focus();
				return false;
			}
			
			
				fn_GoToAction('editEvent');
			
			
			break;
		}

		case 'btnAddSize':
		{
			if(fn_Trim(fn_GetHtmlObject("txtSizeName1").value)=="")
			{
				alert("Please Enter Size Name.");
				fn_GetHtmlObject("txtSizeName1").focus();
				return false;
			}
           if(!checkNumeric(fn_Trim(fn_GetHtmlObject("txtSizeName1").value)))
			{
				alert("Please Enter Size in numeric.");
				fn_GetHtmlObject("txtSizeName1").focus();
				return false;
			}
			if(fn_Trim(fn_GetHtmlObject("txtSizeName2").value)=="")
			{
				alert("Please Enter Size Name.");
				fn_GetHtmlObject("txtSizeName2").focus();
				return false;
			}
			if(!checkNumeric(fn_Trim(fn_GetHtmlObject("txtSizeName2").value)))
			{
				alert("Please Enter Size in numeric.");
				fn_GetHtmlObject("txtSizeName2").focus();
				return false;
			}
			else
			{
				fn_GoToAction('addSize');
				
			}
			break;
		}
		case "btnAddCategory":
		{
			if(fn_Trim(fn_GetHtmlObject("txt_categ_name").value)=="")
			{
				alert("Please Enter Category Name.");
				fn_GetHtmlObject("txt_categ_name").focus();
				return false;
			}
			else if(checkNumeric(fn_Trim(fn_GetHtmlObject("txt_categ_name").value)))
			{
				alert("Invalid Category Name.");
				fn_GetHtmlObject("txt_categ_name").focus();
				return false;
			}
			else
			{
				fn_GoToAction('addCategory');
				
			}
			break;
		}
		case "btnEditCategory":
		{
			if(fn_Trim(fn_GetHtmlObject("txt_categ_name").value)=="")
			{
				alert("Please Enter Category Name.");
				fn_GetHtmlObject("txt_categ_name").focus();
				return false;
			}
			else if(checkNumeric(fn_Trim(fn_GetHtmlObject("txt_categ_name").value)))
			{
				alert("Invalid Category Name.");
				fn_GetHtmlObject("txt_categ_name").focus();
				return false;
			}
			
			else
			{
		
				fn_GoToAction('editCategory');
				
			}
			break;
		}

		case "btnEditSize":
		{
			if(fn_Trim(fn_GetHtmlObject("txtSizeName1").value)=="")
			{
				alert("Please Enter Size Name.");
				fn_GetHtmlObject("txtSizeName1").focus();
				return false;
			}
           if(!checkNumeric(fn_Trim(fn_GetHtmlObject("txtSizeName1").value)))
			{
				alert("Please Enter Size in numeric.");
				fn_GetHtmlObject("txtSizeName1").focus();
				return false;
			}
			if(fn_Trim(fn_GetHtmlObject("txtSizeName2").value)=="")
			{
				alert("Please Enter Size Name.");
				fn_GetHtmlObject("txtSizeName2").focus();
				return false;
			}
			if(!checkNumeric(fn_Trim(fn_GetHtmlObject("txtSizeName2").value)))
			{
				alert("Please Enter Size in numeric.");
				fn_GetHtmlObject("txtSizeName2").focus();
				return false;
			}
			
			else
			{
		
				fn_GoToAction('editSize');
				
			}
			break;
		}

		case "btnSearch":
		{
			fn_GoToAction('actSearch');
			break;
		}
		case "btnAddShipping":
		{
			
			fn_GoToAction('addShippingMthd');
			break;
		}
      case "btnAddShippingCost":
		{
            if(document.getElementById("txtShippingCost1").value=="")
			{
				alert("Please Enter shipping Range");
				return false;
			}
			 if(document.getElementById("txtShippingCost2").value=="")
			{
				alert("Please Enter shipping Range");
				return false;
			}
			if((parseInt(document.getElementById("txtShippingCost1").value))>=(parseInt(document.getElementById("txtShippingCost2").value)))
			{
				//alert(document.getElementById("txtShippingCost1").value);
				//alert(document.getElementById("txtShippingCost2").value);
				alert("Shipping Cost Range Should be proper.");
				document.getElementById("txtShippingCost1").value="";
				document.getElementById("txtShippingCost2").value="";
				return false;
			}
			 if(document.getElementById("txtShippingCost").value=="")
			{
				alert("Please Enter shipping Cost");
				return false;
			}
			 if(!checkNumeric(document.getElementById("txtShippingCost").value))
			{
				alert("Please Enter shipping Cost in Numeric");
				return false;
			}
			if(document.getElementById("ShippingMethod").value=="")
			{
				alert("Please Enter Shipping Method");
				return false;
			}
			fn_GoToAction('addShippingCost');
			break;
		}

		case "btnEditShippingCost":
		{
            if(document.getElementById("txtShippingCost1").value=="")
			{
				alert("Please Enter shipping Range");
				return false;
			}
			 if(document.getElementById("txtShippingCost2").value=="")
			{
				alert("Please Enter shipping Range");
				return false;
			}
			if((parseInt(document.getElementById("txtShippingCost1").value))>=(parseInt(document.getElementById("txtShippingCost2").value)))
			{
				//alert(document.getElementById("txtShippingCost1").value);
				//alert(document.getElementById("txtShippingCost2").value);
				alert("Shipping Cost Range Should be proper.");
				document.getElementById("txtShippingCost1").value="";
				document.getElementById("txtShippingCost2").value="";
				return false;
			}
			 if(document.getElementById("txtShippingCost").value=="")
			{
				alert("Please Enter shipping Cost");
				return false;
			}
			 if(!checkNumeric(document.getElementById("txtShippingCost").value))
			{
				alert("Please Enter shipping Cost in Numeric");
				return false;
			}
			if(document.getElementById("ShippingMethod").value=="")
			{
				alert("Please Enter Shipping Method");
				return false;
			}
			fn_GoToAction('editShippingCost');
			break;
		}
		case "btnEditShipping":
		{
			
			fn_GoToAction('editShippingMthd');
			break;
		}
		case "btnEditMailSetting":
		{
			if(fn_Trim(fn_GetHtmlObject("txtSubject").value)=="")
			{
				alert("Please Enter Subject.");
				fn_GetHtmlObject("txtSubject").focus();
				return false;
			}
			if(fn_Trim(fn_GetHtmlObject("message").value)=="")
			{
				alert("Please Enter Message.");
				fn_GetHtmlObject("message").focus();
				return false;
			}
			fn_GoToAction('emailFriendSetting');
			break;
		}
		/*case "btnAddShoppingProd":
		{
			fn_GoToAction('actSearch');
			break;
		}*/
case "btnEditPorfolio":
		{
			
			
			
			if(document.getElementById('image')!=null)
			{
			 if((fn_GetHtmlObject("image").value)=="")
			{
				alert("Please Upload Image.");
				fn_GetHtmlObject("image").focus();
				return false;
			}
			}
           if((fn_GetHtmlObject("category").value)=="")
			{
				alert("Please Select Category.");
				fn_GetHtmlObject("category").focus();
				return false;
			}
			fn_GoToAction('editPortfolio');			
		
				break;
		}
		case "btnAddProduct":
		{
			
			if(fn_Trim(fn_GetHtmlObject("txt_product_name").value)=="")
			{
				
				alert("Please Enter Product Name");
				fn_GetHtmlObject("txt_product_name").focus();
				return false;
			}
			
				if(checkNumeric(fn_Trim(fn_GetHtmlObject("txt_product_name").value)))
			{
				
				alert("Invalid Product Name");
				fn_GetHtmlObject("txt_product_name").focus();
				return false;
			}
			if(document.getElementById('image')!=null)
			{
			 if((fn_GetHtmlObject("image").value)=="")
			{
				alert("Please Upload Image.");
				fn_GetHtmlObject("image").focus();
				return false;
			}
			}
           if((fn_GetHtmlObject("Event").value)=="")
			{
				alert("Please Select Event.");
				fn_GetHtmlObject("Event").focus();
				return false;
			}
          
		    
            var numb = (document.getElementById('hidActualCounter1').value);
									
	        var i;
			
			for(i=0;i<parseInt(numb);i++)
			{
				
				if(document.getElementById('selectsize'+i+'')!=null)
			 {

             if(document.getElementById('selectsize'+i+'').value=="")
				{
				
                  alert("Please Select Size");
                  return false;

				}
			 }
			}
			for(i=0;i<numb;i++)
			{
           	
				for(j=(numb-1);j>0;j--)
					{
					if(j!=i)
						{
                      if((document.getElementById('selectsize'+i+'')!=null)&&(document.getElementById('selectsize'+j+'')!=null))
							{
                         if((document.getElementById('selectsize'+i+'').value)==(document.getElementById('selectsize'+j+'').value))     
			
				             {
	                            alert("please select different Size");
                                return false;
			                 }
							}
						}
			        }
				
			}
			for(i=0;i<numb;i++)
			{
			if((document.getElementById('txtProductPrice'+i+'')!=null))
				{
             if((document.getElementById('txtProductPrice'+i+'').value)=="")
				{
                            alert("please enter Price");
							return false;
                }
			if((!checkNumeric(document.getElementById('txtProductPrice'+i+'').value)))
				{
                            alert("please enter Price in Numeric");
							return false;
                }
				}
			}
							
				fn_GoToAction('addProduct');			
		
				break;
		}

case "btnEditProduct":
		{
			
			if(fn_Trim(fn_GetHtmlObject("txt_product_name").value)=="")
			{
				
				alert("Please Enter Product Name");
				fn_GetHtmlObject("txt_product_name").focus();
				return false;
			}
			
				if(checkNumeric(fn_Trim(fn_GetHtmlObject("txt_product_name").value)))
			{
				
				alert("Invalid Product Name");
				fn_GetHtmlObject("txt_product_name").focus();
				return false;
			}
			if(document.getElementById('image')!=null)
			{
			 if((fn_GetHtmlObject("image").value)=="")
			{
				alert("Please Upload Image.");
				fn_GetHtmlObject("image").focus();
				return false;
			}
			}
           if((fn_GetHtmlObject("Event").value)=="")
			{
				alert("Please Select Event.");
				fn_GetHtmlObject("Event").focus();
				return false;
			}
          
		    
            var num = (document.getElementById('hidCounter').value);			
	
	        var i;
			for(i=0;i<=parseInt(num);i++)
			{
			for(j=0;j<=parseInt(num);j++)
			{	if((document.getElementById('selectsize'+i+'')!=null)&&(document.getElementById('selectNewsize'+j+'')!=null))
			 {

				if((document.getElementById('selectsize'+i+'').value)==(document.getElementById('selectNewsize'+j+'').value))
                   {
					alert("please Select different Size");
					return false;
				   }
			 }
			}
		   }

			for(i=0;i<parseInt(num);i++)
			{
				
				if(document.getElementById('selectNewsize'+i+'')!=null)
			 {

             if(document.getElementById('selectNewsize'+i+'').value=="")
				{
				
                  alert("Please Select Size");
                  return false;

				}
			 }
			}
			for(i=0;i<num;i++)
			{
           	
				for(j=(num-1);j>0;j--)
					{
					if(j!=i)
						{
                      if((document.getElementById('selectNewsize'+i+'')!=null)&&(document.getElementById('selectNewsize'+j+'')!=null))
							{
                         if((document.getElementById('selectNewsize'+i+'').value)==(document.getElementById('selectNewsize'+j+'').value))     
			
				             {
	                            alert("please select different Size");
                                return false;
			                 }
							}
						}
			        }
				
			}
			for(i=0;i<num;i++)
			{
				if((document.getElementById('txtProductNewPrice'+i+'')!=null))
				{
             if((document.getElementById('txtProductNewPrice'+i+'').value)=="")
				{
                            alert("please enter Price");
							return false;
                }
				if((!checkNumeric(document.getElementById('txtProductNewPrice'+i+'').value)))
				{
                            alert("please enter Price in Numeric");
							return false;
                }
				}
			}
			var num2 = (document.getElementById('hidnum').value);
									
	        var i;
			
			for(i=0;i<parseInt(num2);i++)
			{
				
				if(document.getElementById('selectsize'+i+'')!=null)
			 {

             if(document.getElementById('selectsize'+i+'').value=="")
				{
				
                  alert("Please Select Size");
                  return false;

				}
			 }
			}
			for(i=0;i<num2;i++)
			{
           	
				for(j=(num2-1);j>0;j--)
					{
					if(j!=i)
						{
                      if((document.getElementById('selectsize'+i+'')!=null)&&(document.getElementById('selectsize'+j+'')!=null))
							{
                         if((document.getElementById('selectsize'+i+'').value)==(document.getElementById('selectsize'+j+'').value))     
			
				             {
	                            alert("please select different Size");
                                return false;
			                 }
							}
						}
			        }
				
			}
			for(i=0;i<num2;i++)
			{
				if((document.getElementById('txtProductPrice'+i+'')!=null))
				{
             if((document.getElementById('txtProductPrice'+i+'').value)=="")
				{
                            alert("please enter Price");
							return false;
                }
			if(!checkNumeric(document.getElementById('txtProductPrice'+i+'').value))
				{           
                            alert("please enter Price in Numeric");
							return false;
                }
				}
			}				
				fn_GoToAction('editProduct');			
		
				break;
		}

		case "btnPreviewForumDesc":
		{
			if(fn_Trim(fn_GetHtmlObject("txtSubject").value)=="")
			{
				alert("Please Enter Subject.");
				fn_GetHtmlObject("txtSubject").focus();
				return false;
			}
			else if(fn_Trim(fn_GetHtmlObject("taComment").value)=="")
			{
				alert("Please Enter Comment.");
				fn_GetHtmlObject("taComment").focus();
				return false;
			}
			else
			{
				fn_GoToAction('previewForumDesc');
				
			}
			break;
		}

		case "btnInvite":
		{
			if(fn_Trim(fn_GetHtmlObject("taTo").value)=="")
			{
				alert("Please Enter Email Address.");
				fn_GetHtmlObject("taTo").focus();
				return false;
			}
			else 
			{
				var emails=fn_Trim(fn_GetHtmlObject("taTo").value);
				var emailArr=new Array();
				emailArr=emails.split(",");
				
				var flag=true;
				
				for(var i=0;i<emailArr.length;i++)
				{
					if(!echeck(emailArr[i],"Email-Id"))
					{
						flag=false;
						break;
					}
				}

				if(flag)
				{
					fn_GoToAction('sendInvitation');
					
				}
				else
				{
					fn_GetHtmlObject("taTo").focus();
					return false;
				}
			}
			break;
		}

		case "btnEditAccount":
		{
			if(fn_Trim(fn_GetHtmlObject("txtName").value)=="")
			{
				alert("Please Enter Name.");
				fn_GetHtmlObject("txtName").focus();
				return false;
			}
			else
			{
				fn_GoToAction("editAccount");
			}
			break;
		}

		case "btnChangePassword":
		{
			if((fn_GetHtmlObject("passOldPassword").value)=="")
			{
				alert("Please Enter Old Password.");
				fn_GetHtmlObject("passOldPassword").focus();
				return false;
			}
			else if((fn_GetHtmlObject("passNewPassword").value)=="")
			{
				alert("Please Enter New Password.");
				fn_GetHtmlObject("passNewPassword").focus();
				return false;
			}
			else if((fn_GetHtmlObject("passNewPassword").value)!=(fn_GetHtmlObject("passRePassword").value))
			{
				alert("The two passwords are not matching.")
				fn_GetHtmlObject("passNewPassword").focus();
				return false;
			}
			else
			{
				fn_setValue("hidSavePassword","save","changePasswordForm");
			
			}
				break;
		}
		case "btnpaymentCheckout":
		{
			if(fn_Trim(fn_GetHtmlObject("txtBillFname").value)=="")
			{
				alert("Please Enter  First Name.");
				fn_GetHtmlObject("txtBillFname").focus();
				return false;
			}
			 if(checkNumeric(fn_Trim(fn_GetHtmlObject("txtBillFname").value)))
			{
				alert("Invalid First Name.");
				fn_GetHtmlObject("txtBillFname").focus();
				return false;
			}
			if(fn_Trim(fn_GetHtmlObject("txtBillLname").value)=="")
			{
				alert("Please Enter Last Name.");
				fn_GetHtmlObject("txtBillLname").focus();
				return false;
			}
		 if(checkNumeric(fn_Trim(fn_GetHtmlObject("txtBillLname").value)))
			{
				alert("Invalid Last Name.");
				fn_GetHtmlObject("txtBillLname").focus();
				return false;
			}
			if(fn_Trim(fn_GetHtmlObject("txtBillStreet").value)=="")
			{
				alert("Please Enter Street Address.");
				fn_GetHtmlObject("txtBillStreet").focus();
				return false;
			}
		 if(checkNumeric(fn_Trim(fn_GetHtmlObject("txtBillStreet").value)))
			{
				alert("Invalid Street Address.");
				fn_GetHtmlObject("txtBillStreet").focus();
				return false;
			}
			if(fn_Trim(fn_GetHtmlObject("Billcountry").value)=="")
			{
				alert("Please Select Country.");
				fn_GetHtmlObject("Billcountry").focus();
				return false;
			}
			if(fn_Trim(fn_GetHtmlObject("txtBillCity").value)=="")
			{
				alert("Please Enter City.");
				fn_GetHtmlObject("txtBillCity").focus();
				return false;
			}
			if(fn_Trim(fn_GetHtmlObject("txtBillZip").value)=="")
			{
				alert("Please Enter Zip/Post Code.");
				fn_GetHtmlObject("txtBillZip").focus();
				return false;
			}
			/*if(!checkNumeric(fn_Trim(fn_GetHtmlObject("txtBillZip").value)))
			{
				alert("Please Enter Zip/Post Code in Numeric.");
				fn_GetHtmlObject("txtBillZip").focus();
				return false;
			} */
			
			if((fn_GetHtmlObject("txtBillZip").value.length <4)||(fn_GetHtmlObject("txtBillZip").value.length > 6))
				{
				alert("Invalid Zip code.Zip code should be between 4 and 6 digits.");
				fn_GetHtmlObject("txtBillZip").focus();
				return false;
				}
			
			
			if(fn_Trim(fn_GetHtmlObject("txtBillEmail").value)=="")
			{
				alert("Please Enter Email Address.");
				fn_GetHtmlObject("txtBillEmail").focus();
				return false;
			}
			else 
			{
				var emails=fn_Trim(fn_GetHtmlObject("txtBillEmail").value);
				var emailArr=new Array();
				emailArr=emails.split(",");
				
				var flag=true;
				
				for(var i=0;i<emailArr.length;i++)
				{
					if(!echeck(emailArr[i],"Email-Id"))
					{
						flag=false;
						
					}
				}
			}
			if(fn_Trim(fn_GetHtmlObject("txtBillPhone").value)=="")
			{
				alert("Please Enter Phone.");
				fn_GetHtmlObject("txtBillPhone").focus();
				return false;
			}
			if(!checkNumeric(fn_Trim(fn_GetHtmlObject("txtBillPhone").value)))
			{
				alert("Please Enter Phone in Numeric.");
				fn_GetHtmlObject("txtBillPhone").focus();
				return false;
			}
			if(document.getElementById('div1').style.visibility == "visible")
			{
				if(fn_Trim(fn_GetHtmlObject("txtShipFname").value)=="")
			{
				alert("Please Enter  First Name for shipping.");
				fn_GetHtmlObject("txtShipFname").focus();
				return false;
			}
			 if(checkNumeric(fn_Trim(fn_GetHtmlObject("txtShipFname").value)))
			{
				alert("Invalid First Name for shipping.");
				fn_GetHtmlObject("txtShipFname").focus();
				return false;
			}
			if(fn_Trim(fn_GetHtmlObject("txtShipLname").value)=="")
			{
				alert("Please Enter Last Name for shipping.");
				fn_GetHtmlObject("txtShipLname").focus();
				return false;
			}
		 if(checkNumeric(fn_Trim(fn_GetHtmlObject("txtShipLname").value)))
			{
				alert("Invalid Last Name for shipping.");
				fn_GetHtmlObject("txtShipLname").focus();
				return false;
			}
			if(fn_Trim(fn_GetHtmlObject("txtShipStreet").value)=="")
			{
				alert("Please Enter Street Address for shipping.");
				fn_GetHtmlObject("txtShipStreet").focus();
				return false;
			}
		 if(checkNumeric(fn_Trim(fn_GetHtmlObject("txtShipStreet").value)))
			{
				alert("Invalid Street Address for shipping.");
				fn_GetHtmlObject("txtShipStreet").focus();
				return false;
			}
			if(fn_Trim(fn_GetHtmlObject("Shipcountry").value)=="")
			{
				alert("Please Select Country for shipping.");
				fn_GetHtmlObject("Shipcountry").focus();
				return false;
			}
			if(fn_Trim(fn_GetHtmlObject("txtShipCity").value)=="")
			{
				alert("Please Enter City for shipping.");
				fn_GetHtmlObject("txtShipCity").focus();
				return false;
			}
			if(fn_Trim(fn_GetHtmlObject("txtShipZip").value)=="")
			{
				alert("Please Enter Zip/Post Code for shipping.");
				fn_GetHtmlObject("txtShipZip").focus();
				return false;
			}
			/*if(!checkNumeric(fn_Trim(fn_GetHtmlObject("txtShipZip").value)))
			{
				alert("Please Enter Zip/Post Code in Numeric for shipping.");
				fn_GetHtmlObject("txtShipZip").focus();
				return false;
			}*/

			
			if((fn_GetHtmlObject("txtShipZip").value.length <4) || (fn_GetHtmlObject("txtShipZip").value.length >6))
				{
				alert("Invalid Zip code.Zip code should be between 4 and 6 digits.");
				fn_GetHtmlObject("txtShipZip").focus();
				return false;
				}

			
			if(fn_Trim(fn_GetHtmlObject("txtShipPhone").value)=="")
			{
				alert("Please Enter Phone for shipping.");
				fn_GetHtmlObject("txtShipPhone").focus();
				return false;
			}
          if(!checkNumeric(fn_Trim(fn_GetHtmlObject("txtShipPhone").value)))
			{
				alert("Please Enter Phone in Numeric for shipping.");
				fn_GetHtmlObject("txtShipPhone").focus();
				return false;
			}
			}
			if(fn_Trim(fn_GetHtmlObject("shippingMthd").value)=="")
			{
				alert("Please select shipping method.");
				fn_GetHtmlObject("shippingMthd").focus();
				return false;
			}
			else
			{
				fn_GoToAction("paymentCheckout");
			}
			break;
		}
		case "btnconfirmCheckout":
		{
			if(fn_Trim(fn_GetHtmlObject("paymentMthd").value)=="")
			{
				alert("Please Select Payment method.");
				fn_GetHtmlObject("paymentMthd").focus();
				return false;
			}
			else
			{
				fn_GoToAction("confirmCheckout");
			}
			break;
		}

		case "btnplaceOrder":
		{
			fn_GoToAction("placeOrder");
			break;
		}
		
		
		case "btnUpdateStatus":
		{
			fn_GoToAction("editOrder");
			break;
		}
		case "btnAddPorfolio":
		{
			if(document.getElementById('image')!=null)
			{
			 if((fn_GetHtmlObject("image").value)=="")
			{
				alert("Please Upload Image.");
				fn_GetHtmlObject("image").focus();
				return false;
			}
			}
			if((fn_GetHtmlObject("category").value)=="")
			{
				alert("Please Select Category.");
				fn_GetHtmlObject("category").focus();
				return false;
			}
			else
			{
				fn_GoToAction("addPortfolio");
			}
          
		}
		
	}
	
}

// fnGetHtmlObject
// Function Description:
//				Function Return the object of html element
//Takes One Argument
//First -- Id of Html Element

function fn_GetHtmlObject(L_strHtmlElementId)
{
	var objName=document.getElementById(L_strHtmlElementId);

	return objName
}

function fn_LTrim( value ) 
{
	
	var re = /\s*((\S+\s*)*)/;
	return value.replace(re, "$1");
	
}

// Removes ending whitespaces
function fn_RTrim( value ) 
{
	
	var re = /((\s*\S+)*)\s*/;
	return value.replace(re, "$1");
	
}

// Removes leading and ending whitespaces
function fn_Trim( value ) 
{
	
	return fn_LTrim(fn_RTrim(value));
	
}

function echeck(str,name) 
{
	var at="@"
	var dot="."
	var lat=str.indexOf(at)
	var lstr=str.length
	var ldot=str.indexOf(dot)
	if (str.indexOf(at)==-1){
	   alert("Invalid "+name)
	   return false
	}

	if (str.indexOf(at)==-1 || str.indexOf(at)==0 || str.indexOf(at)==lstr){
	   alert("Invalid "+name)
	   return false
	}

	if (str.indexOf(dot)==-1 || str.indexOf(dot)==0 || str.indexOf(dot)==lstr){
		alert("Invalid "+name)
		return false
	}

	 if (str.indexOf(at,(lat+1))!=-1){
		alert("Invalid "+name)
		return false
	 }

	 if (str.substring(lat-1,lat)==dot || str.substring(lat+1,lat+2)==dot){
		alert("Invalid "+name)
		return false
	 }

	 if (str.indexOf(dot,(lat+2))==-1){
		alert("Invalid "+name)
		return false
	 }
	
	 if (str.indexOf(" ")!=-1){
		alert("Invalid "+name)
		return false
	 }

	 return true					
}

//function checkNumeric(value)
function checkNumeric(sText)
   //  check for valid numeric strings	
   {
   var ValidChars = "0123456789";
   var IsNumber=true;
   var Char;

 
   for (i = 0; i < sText.length && IsNumber == true; i++) 
      { 
      Char = sText.charAt(i); 
      if (ValidChars.indexOf(Char) == -1) 
         {
         IsNumber = false;
         }
      }
   return IsNumber;
   
   }

//function attached image

function fn_AttachImage()
{
	subLen=fn_Trim(fn_GetHtmlObject("fImage").value).length;
	ext=fn_Trim(fn_GetHtmlObject("fImage").value).substring(subLen-3,subLen).toLowerCase();

	if(ext == "jpg" || ext == "gif" || ext == "png")
	{
		/*imagePath=fn_Trim(fn_GetHtmlObject("fImage").value);
		//get object of ddl.

		//find image name
		tempNameArray=imagePath.split("\\");

		imageName=tempNameArray[tempNameArray.length-1];

		objImageList=fn_GetHtmlObject("ddlFile");
		var newOpt = new Option(imageName,imagePath);

		objImageList.options[objImageList.options.length] = newOpt;
		//fn_GetHtmlObject("fImage").value="";*/
	}
	else
	{	
		alert("Invalid file path.");
		fn_GetHtmlObject("fImage").focus();
		return false;
	}

	fn_setValue('hidAction','attached','postListing');
}

function fn_RemoveImage()
{
	objImageList=fn_GetHtmlObject("ddlFile");
	
	if(objImageList.selectedIndex==-1)
	{
		alert("Select Image.");
	}
	else
	{
		//objImageList.options[objImageList.selectedIndex]=null;

		fn_setValue('hidAction','remove','postListing');
	}
}

function fn_keypress(event,act)
{
	if(event.keyCode == 13)
	{
		if(fn_ValidateForm(act))
		{
			return true;
		}
		else
		{
			return false;
		}
	}
	
}
function fn_keypress1(event)
{
	if(event.keyCode == 13)
	{
		fn_getSelectedvalue();
	}

}
function fn_keypress2(event)
{
	if(event.keyCode == 13)
	{
		fn_getSelectedvalue1();
	}
	
}





 