// JavaScript Document
// JavaScript Document

function chkValidationLogin()
{
	if(document.frmLogin.txtLogin.value == "")
	{
		alert("Please enter Login ID");
		document.frmLogin.txtLogin.focus();
		return false;
	}
	if(document.frmLogin.txtPassword.value == "")
	{
		alert("Please enter Password");
		document.frmLogin.txtPassword.focus();
		return false;
	}
	document.frmLogin.action = "index.php";
	document.frmLogin.submit();	
}
function checkRegistration()
{
		if(document.frmRegister.txtEmail.value == "")
		{
			alert('Please Enter your Email Address');
			document.frmRegister.txtEmail.focus();
			return false;
		}
		if(document.frmRegister.txtEmail.value.indexOf("@") == -1 || document.frmRegister.txtEmail.value.indexOf(".") == -1)
		{
			alert("Please Enter Valid Email Address!!!");
			document.frmRegister.txtEmail.focus();
			return false;
		}
		if(document.frmRegister.txtPassword.value == "")
		{
			alert('Please enter the Password');
			document.frmRegister.txtPassword.focus();
			return false;
		}
		if(document.frmRegister.txtRePassword.value == "")
		{
			alert('Please retype the Password');
			document.frmRegister.txtRePassword.focus();
			return false;
		}
		if(document.frmRegister.txtPassword.value != document.frmRegister.txtRePassword.value)
		{
			alert('Password and repassword should be same');
			document.frmRegister.txtPassword.focus();
			return false;
		}
		if(document.frmRegister.txtFName.value == "")
		{
			alert('Please enter your name');
			document.frmRegister.txtFName.focus();
			return false;
		}
		/*if(document.frmRegister.txtPhoneNo.value == "")
		{
			alert('Please enter the Phone Number');
			document.frmRegister.txtPhoneNo.focus();
			return false;
		}
		if(!IsNumericforReg(document.frmRegister.txtPhoneNo.value))
		{
			alert('Please enter the Phone Number');
			document.frmRegister.txtPhoneNo.focus();
			return false;
		}*/
		document.frmRegister.action = "register.php";
		document.frmRegister.submit();
}
function checkProfile()
{
		if(document.frmProfile.txtEmail.value == "")
		{
			alert('Please Enter your Email Address');
			document.frmProfile.txtEmail.focus();
			return false;
		}
		if(document.frmProfile.txtEmail.value.indexOf("@") == -1 || document.frmProfile.txtEmail.value.indexOf(".") == -1)
		{
			alert("Please Enter Valid Email Address!!!");
			document.frmProfile.txtEmail.focus();
			return false;
		}
		if(document.frmProfile.txtPassword.value == "")
		{
			alert('Please enter the Password');
			document.frmProfile.txtPassword.focus();
			return false;
		}
		if(document.frmProfile.txtRePassword.value == "")
		{
			alert('Please retype the Password');
			document.frmProfile.txtRePassword.focus();
			return false;
		}
		if(document.frmProfile.txtPassword.value != document.frmProfile.txtRePassword.value)
		{
			alert('Password and repassword should be same');
			document.frmProfile.txtPassword.focus();
			return false;
		}
		if(document.frmProfile.txtFName.value == "")
		{
			alert('Please enter your name');
			document.frmProfile.txtFName.focus();
			return false;
		}
		/*if(document.frmRegister.txtPhoneNo.value == "")
		{
			alert('Please enter the Phone Number');
			document.frmRegister.txtPhoneNo.focus();
			return false;
		}
		if(!IsNumericforReg(document.frmRegister.txtPhoneNo.value))
		{
			alert('Please enter the Phone Number');
			document.frmRegister.txtPhoneNo.focus();
			return false;
		}*/
		document.frmProfile.action = "yourprofile.php";
		document.frmProfile.submit();
}
function closewindow()
{
	opener.location.reload(true);
      window.close();
}
function chkValidationLogin1()
{
	if(document.frmLogin1.txtLogin.value == "")
	{
		alert("Please enter Login ID");
		document.frmLogin1.txtLogin.focus();
		return false;
	}
	if(document.frmLogin1.txtPassword.value == "")
	{
		alert("Please enter Password");
		document.frmLogin1.txtPassword.focus();
		return false;
	}
	document.frmLogin1.action = "login.php";
	document.frmLogin1.submit();	
}
function checkBAddress()
{
	//alert(frmpara);
	document.frmOrder.txtBillingAddress.disabled=false;
	document.frmOrder.txtbCity.disabled=false;
	document.frmOrder.txtbState.disabled=false;
	document.frmOrder.txtbCountry.disabled=false;
	document.frmOrder.action = "order.php";
	//document.frmOrder.submit();
}
function checkSAddress()
{
	//alert(frmpara);
	document.frmOrder.txtShippingAddress.disabled=false;
	document.frmOrder.txtsCity.disabled=false;
	document.frmOrder.txtsState.disabled=false;
	document.frmOrder.txtsCountry.disabled=false;
	document.frmOrder.action = "order.php";
	//document.frmOrder.submit();
}
function chkLoginClient()
{
	if(document.frmLogin.txtLogin.value == "")
	{
		alert("Please enter Login ID");
		document.frmLogin.txtLogin.focus();
		return false;
	}
	if(document.frmLogin.txtPassword.value == "")
	{
		alert("Please enter Password");
		document.frmLogin.txtPassword.focus();
		return false;
	}
	document.frmLogin.action = "login.php";
	document.frmLogin.submit();
}
function changePassword(password, user_id, session)
{
	if(document.frmEditPass.txtOld.value == "")
	{
		alert('Enter Value in Old Password');
		document.frmEditPass.txtOld.focus();
		return false;
	}
	if(document.frmEditPass.txtNew.value == "")
	{
		alert('Enter Value in New Password');
		document.frmEditPass.txtNew.focus();
		return false;
	}
	if(document.frmEditPass.txtConfirm.value == "")
	{
		alert('Enter Value in New Password Again');
		document.frmEditPass.txtConfirm.focus();
		return false;
	}
	if(document.frmEditPass.txtOld.value != password)
	{
		alert('Your Old Password not match with your Entered Password');
		document.frmEditPass.txtOld.focus();
		return false;
	}
	if(document.frmEditPass.txtNew.value != document.frmEditPass.txtConfirm.value)
	{
		alert('Please Enter Same password In both Field');
		document.frmEditPass.txtConfirm.focus();
		return false;		
	}
	return true;
	
}
function changePasswordcli(password, user_id, session)
{
	if(document.frmEditcliPass.txtOld.value == "")
	{
		alert('Enter Value in Old Password');
		document.frmEditcliPass.txtOld.focus();
		return false;
	}
	if(document.frmEditcliPass.txtNew.value == "")
	{
		alert('Enter Value in New Password');
		document.frmEditcliPass.txtNew.focus();
		return false;
	}
	if(document.frmEditcliPass.txtConfirm.value == "")
	{
		alert('Enter Value in New Password Again');
		document.frmEditcliPass.txtConfirm.focus();
		return false;
	}
	if(document.frmEditcliPass.txtOld.value != password)
	{
		alert('Your Old Password not match with your Entered Password');
		document.frmEditcliPass.txtOld.focus();
		return false;
	}
	if(document.frmEditcliPass.txtNew.value != document.frmEditcliPass.txtConfirm.value)
	{
		alert('Please Enter Same password In both Field');
		document.frmEditcliPass.txtConfirm.focus();
		return false;		
	}
	return true;
	
}
//For User
function InsertUser(FrmPara)
{
	document.frmUserMgmt.action = FrmPara;
	document.frmUserMgmt.submit();
}
function InsertSeller(FrmPara)
{
	document.frmSellerMgmt.action = FrmPara;
	document.frmSellerMgmt.submit();
}
function InsertCustomer(FrmPara)
{
	document.frmCustomerMgmt.action = FrmPara;
	document.frmCustomerMgmt.submit();
}
function InsertCategory(FrmPara)
{
	document.frmCategoryMgmt.action = FrmPara;
	document.frmCategoryMgmt.submit();
}
function InsertSubCategory(FrmPara)
{
	document.frmSubCategoryMgmt.action = FrmPara;
	document.frmSubCategoryMgmt.submit();
}
function InsertOrder(FrmPara)
{
	document.frmOrderMgmt.action = FrmPara;
	document.frmOrderMgmt.submit();
}
function InsertProduct(FrmPara)
{
	document.frmProductMgmt.action = FrmPara;
	document.frmProductMgmt.submit();
}
function InsertComment(FrmPara)
{
	document.frmCommentMgmt.action = FrmPara;
	document.frmCommentMgmt.submit();
}
function deleteUser(FrmPara)
{
	//alert("hi");
	var ans = confirm("Would you like to  Delete User?");
	if(ans==true)
	{
		document.frmUserMgmt.hidFrmVal.value = "Delete";
		document.frmUserMgmt.action = FrmPara;
		document.frmUserMgmt.submit();
	}
	else
	{
		document.frmUserMgmt.action = FrmPara;
	}
	
}
function deleteSeller(FrmPara)
{
	//alert("hi");
	var ans = confirm("Would you like to  Delete seller?");
	if(ans==true)
	{
		document.frmSellerMgmt.hidFrmVal.value = "Delete";

		document.frmSellerMgmt.action = FrmPara;
		document.frmSellerMgmt.submit();
	}
	else
	{
		document.frmSellerMgmt.action = FrmPara;
	}
	
}
function deleteCustomer(FrmPara)
{
	//alert("hi");
	var ans = confirm("Would you like to  Delete seller?");
	if(ans==true)
	{
		document.frmCustomerMgmt.hidFrmVal.value = "Delete";
		document.frmCustomerMgmt.action = FrmPara;
		document.frmCustomerMgmt.submit();
	}
	else
	{
		document.frmCustomerMgmt.action = FrmPara;
	}
	
}
function displayHomePage1(FrmPara1)
{
	var ans = confirm("Are you shore u want to display on home page?");
	if(ans==true)
	{
		for( var i=0;i<document.frm.Chk.length;i++)
		{
		document.frmCategoryMgmt.ChkHome.value+=","+document.frmCategoryMgmt.Chk[i];
		}
		document.frmCategoryMgmt.action = FrmPara;
		document.frmCategoryMgmt.submit();
	}
	else
	{
		document.frmCategoryMgmt.action = "category_mgmt.php";
	}
	
}
function displayHomePage(FrmPara)
{
	var ans = confirm("Are you shore u want to display on home page?");
	if(ans==true)
	{
		document.frmCategoryMgmt.action = FrmPara;
		document.frmCategoryMgmt.submit();
	}
	else
	{
		document.frmCategoryMgmt.action = "category_mgmt.php";
	}
	
}
function displayProductOnHomePage(FrmPara)
{
	var ans = confirm("Are you shore u want to display on home page?");
	//alert(document.frmProductMgmt.ChkProductHome.value);
	if(ans==true)
	{
		document.frmProductMgmt.action = FrmPara;
		document.frmProductMgmt.submit();
	}
	else
	{
		document.frmProductMgmt.action = "product_mgmt.php";
	}
	
}
function displaySubOnHomePage(FrmPara)
{
	var ans = confirm("Are you shore u want to display on home page?");
	if(ans==true)
	{
		document.frmSubCategoryMgmt.action = FrmPara;
		document.frmSubCategoryMgmt.submit();
	}
	else
	{
		document.frmSubCategoryMgmt.action = "category_mgmt.php";
	}
	
}
function deleteAllCatagory(FrmPara)
{
	//alert("hi");
	var ans = confirm("All the Product Under This Category will Also Deleted.\n Would you like to Delete Catagory?");
	if(ans==true)
	{
		document.frmCategoryMgmt.action = FrmPara;
		document.frmCategoryMgmt.submit();
	}
	else
	{
		document.frmCategoryMgmt.action = "category_mgmt.php";
	}
	
}
function deleteCatagory(FrmPara)
{
	//alert("hi");
	var ans = confirm("All the Order Under This Product will Also Deleted.\n Would you like to Delete Catagory?");
	if(ans==true)
	{
		document.frmCategoryMgmt.hidFrmVal.value = "Delete";
		document.frmCategoryMgmt.action = FrmPara;
		document.frmCategoryMgmt.submit();
	}
	else
	{
		document.frmCategoryMgmt.action = FrmPara;
	}
	
}
function deleteSubCatagory(FrmPara)
{
	//alert("hi");
	var ans = confirm("All the Order Under This Product will Also Deleted.\n Would you like to Delete Catagory?");
	if(ans==true)
	{
		document.frmSubCategoryMgmt.hidFrmVal.value = "Delete";
		document.frmSubCategoryMgmt.action = FrmPara;
		document.frmSubCategoryMgmt.submit();
	}
	else
	{
		document.frmSubCategoryMgmt.action = FrmPara;
	}
	
}
function deleteComment(FrmPara)
{
	//alert("hi");
	var ans = confirm("Would you like to Delete Comment?");
	if(ans==true)
	{
		document.frmCommentMgmt.hidFrmVal.value = "Delete";
		document.frmCommentMgmt.action = FrmPara;
		document.frmCommentMgmt.submit();
	}
	else
	{
		document.frmCommentMgmt.action = FrmPara;
	}
	
}
function deleteList(FrmPara)
{
	//alert("hi");
	var ans = confirm("Would you like to Delete List?");
	if(ans==true)
	{
		document.frnViewlist.hidFrmVal.value = "Delete";
		document.frnViewlist.action = FrmPara;
		document.frnViewlist.submit();
	}
	else
	{
		document.frnViewlist.action = FrmPara;
	}
	
}
function deleteOrder(FrmPara)
{
	//alert("hi");
	var ans = confirm("Would you like to  Delete Order?");
	if(ans==true)
	{
		document.frmOrderMgmt.hidFrmVal.value = "Delete";
		document.frmOrderMgmt.action = FrmPara;
		document.frmOrderMgmt.submit();
	}
	else
	{
		document.frmOrderMgmt.action = FrmPara;
	}
}
function deleteProduct(FrmPara)
{
	//alert("hi");
	var ans = confirm("All the Order Under This Product will Also Deleted.\n Would you like to Delete Product?");
	if(ans==true)
	{
		document.frmProductMgmt.hidFrmVal.value = "Delete";
		document.frmProductMgmt.action = FrmPara;
		document.frmProductMgmt.submit();
	}
	else
	{
		document.frmProductMgmt.action = FrmPara;
	}
}
function editReg()
{
		if(document.frmRegister.txtEmail.value == "")
		{
			alert('Please Enter your Email Address');
			document.frmRegister.txtEmail.focus();
			return false;
		}
		if(document.frmRegister.txtEmail.value.indexOf("@") == -1 || document.frmRegister.txtEmail.value.indexOf(".") == -1)
		{
			alert("Please Enter Valid Email Address!!!");
			document.frmRegister.txtEmail.focus();
			return false;
		}
		if(document.frmRegister.txtPhone.value == "")
		{
			alert('Please enter the Phone Number');
			document.frmRegister.txtPhone.focus();
			return false;
		}
		if(document.frmRegister.txtScreen.value.indexOf("@") == -1 || document.frmRegister.txtScreen.value.indexOf(".") == -1)
		{
			alert("Please Enter Valid Screen Name!!!");
			document.frmRegister.txtScreen.focus();
			return false;
		}
		if(!IsNumericforReg(document.frmRegister.txtPhone.value))
		{
			return false;
		}
		document.frmRegister.action = "register.php";
		document.frmRegister.submit();
}
function chkCategoryValidation(val){
	if(document.frmCategory.txtCategoryName.value==""){
		alert("Catagory Name should not be blank");
		document.frmCategory.txtCategoryName.focus();
		return false;
	}
	document.frmCategory.action ="category.php";
	document.frmCategory.submit();	
}
function chkSubCategoryValidation(val){
	/*if(document.frmSubCategory.txtCategoryName.value==""){
		alert("Please Select the category");
		document.frmSubCategory.txtCategoryName.focus();
		return false;
	}*/
	if(document.frmSubCategory.txtSubCategoryName.value==""){
		alert("SubCategory Name should not be blank");
		document.frmSubCategory.txtSubCategoryName.focus();
		return false;
	}
	
	document.frmSubCategory.action ="subcategory.php";
	document.frmSubCategory.submit();	
}
function chkSellingInfo()
{
	if(document.frmSell.category.value==""){
		alert("Please select the category");
		document.frmSell.category.focus();
		return false;
	}
	if(document.frmSell.condition.value==""){
		alert("Please select the condition");
		document.frmSell.condition.focus();
		return false;
	}
	if(document.frmSell.txtPrice.value==""){
		alert("Please enter the price");
		document.frmSell.txtPrice.focus();
		return false;
	}
	if(document.frmSell.txtQuantity.value==""){
		alert("Please enter Quantity");
		document.frmSell.txtQuantity.focus();
		return false;
	}
	document.frmSell.action ="sendmail.php";
	document.frmSell.submit();	
}
function chkProductValidation(val){
	if(document.frmProduct.sel.value==""){
		alert("Please Select the Catagory Name");
		document.frmProduct.sel.focus();
		return false;
	}
	if(document.frmProduct.txtProductName.value==""){
		alert("Product Name should not be blank");
		document.frmProduct.txtProductName.focus();
		return false;
	}

	if(document.frmProduct.txtProductPrice.value==""){
		alert("Product Price should not be blank");
		document.frmProduct.txtProductPrice.focus();
		return false;
	}
	if(!IsNumericforReg(document.frmProduct.txtProductPrice.value))
		{
			alert("Please Enter Valid Price");
			document.frmProduct.txtProductPrice.focus();
			return false;
		}
	document.frmProduct.action ="product.php";
	document.frmProduct.submit();	
}
function getcategoryid(){	
var str="";

			//alert(document.frmProduct.txtCategoryName.length);
			//if(document.frmProduct.ch.length > 1){
			for(var i=0;i<document.frmProduct.sel.length ;i++)
			{
					if(document.frmProduct.sel[i].selected)
					{
					  
					 str+=","+document.frmProduct.sel[i].value;
					 
					  
					  }
			}
		document.frmProduct.iChk.value=str;
	//alert(str);	
}
function cSubmit(){
	if(document.frmClient1.txtOrderNo.value==""){
		alert("Please Enter OrderNo");
		document.frmClient1.txtOrderNo.focus();
		return false;
	}
	document.frmClient1.action ="index.php";
	document.frmClient1.submit();
}
function chkUserValidation(val){
	if(document.frmUser.txtUName.value == ""){
		alert(" User Name should not be blank");
		document.frmUser.txtUName.focus();
		return false;
	}
	if(document.frmUser.txtUName.value.indexOf("@") == -1){
		alert("Please enter valid Email");
		document.frmUser.txtUName.focus();
		return false;
	}
	if(document.frmUser.txtUName.value.indexOf(".") == -1){
		alert("Please enter valid Email");
		document.frmUser.txtUName.focus();
		return false;
	}
	if(document.frmUser.txtFName.value == ""){
		alert("First Name should not be blank");
		document.frmUser.txtFName.focus();
		return false;
	}	
	if(document.frmUser.txtLName.value == ""){
		alert("Last Name should not be blank");
		document.frmUser.txtLName.focus();
		return false;
	}
	if(document.frmUser.txtPhone.value == ""){
		alert("Phone no should not be blank");
		document.frmUser.txtPhone.focus();
		return false;
	}
	if(!IsNumericforReg(document.frmUser.txtPhone.value))
		{
			alert("Please Enter Valid Phone Number");
			document.frmUser.txtPhone.focus();
			return false;
		}
	if(document.frmUser.selStatus.value==""){
		alert("Please Select the User Status");
		document.frmUser.selStatus.focus();
		return false;
	}	
	document.frmUser.action ="user.php";
	document.frmUser.submit();	
}
function chkCustValidation(val){
	
	if(document.frmCustomer.txtUName.value == ""){
		alert("Email should not be blank");
		document.frmCustomer.txtUName.focus();
		return false;
	}			
	if(document.frmCustomer.txtUName.value.indexOf("@") == -1){
		alert("Please enter valid Email");
		document.frmCustomer.txtUName.focus();
		return false;
	}
	if(document.frmCustomer.txtUName.value.indexOf(".") == -1){
		alert("Please enter valid Email");
		document.frmCustomer.txtUName.focus();
		return false;
	}
	if(document.frmCustomer.txtFName.value == ""){
		alert("First Name should not be blank");
		document.frmCustomer.txtFName.focus();
		return false;
	}	
	if(document.frmCustomer.txtLName.value == ""){
		alert("Last Name should not be blank");
		document.frmCustomer.txtLName.focus();
		return false;
	}
	if(document.frmCustomer.txtAddress.value ==""){
		alert("Address should not be blank");
		document.frmCustomer.txtAddress.focus();
		return false;
	}
	
	if(document.frmCustomer.txtCity.value == ""){
		alert("City should not be blank");
		document.frmCustomer.txtCity.focus();
		return false;
	}	
	if(document.frmCustomer.txtState.value == ""){
		alert("State should not be blank");
		document.frmCustomer.txtState.focus();
		return false;
	}
	
	if(document.frmCustomer.txtCountry.value == ""){
		alert("Country should not be blank");
		document.frmCustomer.txtCountry.focus();
		return false;
	}
	if(document.frmCustomer.txtPhoneNo.value == ""){
		alert("Phone should not be blank");
		document.frmCustomer.txtPhoneNo.focus();
		return false;
	}
	if(!IsNumericforReg(document.frmCustomer.txtPhoneNo.value))
		{
			alert("Please Enter Valid Phone Number");
			document.frmCustomer.txtPhoneNo.focus();
			return false;
		}
	document.frmCustomer.action ="customer.php";
	document.frmCustomer.submit();				
}


function chkValidation(val){
	
	if(document.frmSeller.txtUName.value == ""){
		alert("Email should not be blank");
		document.frmSeller.txtUName.focus();
		return false;
	}			
	if(document.frmSeller.txtUName.value.indexOf("@") == -1){
		alert("Please enter valid Email");
		document.frmSeller.txtUName.focus();
		return false;
	}
	if(document.frmSeller.txtUName.value.indexOf(".") == -1){
		alert("Please enter valid Email");
		document.frmSeller.txtUName.focus();
		return false;
	}
	if(document.frmSeller.txtFName.value == ""){
		alert("First Name should not be blank");
		document.frmSeller.txtFName.focus();
		return false;
	}	
	if(document.frmSeller.txtLName.value == ""){
		alert("Last Name should not be blank");
		document.frmSeller.txtLName.focus();
		return false;
	}
	if(document.frmSeller.txtAddress.value ==""){
		alert("Address should not be blank");
		document.frmSeller.txtAddress.focus();
		return false;
	}
	
	if(document.frmSeller.txtCity.value == ""){
		alert("City should not be blank");
		document.frmSeller.txtCity.focus();
		return false;
	}	
	if(document.frmSeller.txtState.value == ""){
		alert("State should not be blank");
		document.frmSeller.txtState.focus();
		return false;
	}
	
	if(document.frmSeller.txtCountry.value == ""){
		alert("Country should not be blank");
		document.frmSeller.txtCountry.focus();
		return false;
	}
	if(document.frmSeller.txtPhoneNo.value == ""){
		alert("Phone should not be blank");
		document.frmSeller.txtPhoneNo.focus();
		return false;
	}
	if(!IsNumericforReg(document.frmSeller.txtPhoneNo.value))
		{
			alert("Please Enter Valid Phone Number");
			document.frmSeller.txtPhoneNo.focus();
			return false;
		}
	document.frmSeller.action ="seller.php";
	document.frmSeller.submit();				
}
function addReg()
{

		///alert("hi");
		if(document.frmRegister.txtEmailID.value == "")
		{
			alert('Please Enter your Email Address');
			document.frmRegister.txtEmailID.focus();
			return false;
		}
		if(document.frmRegister.txtEmailID.value.indexOf("@") == -1 || document.frmRegister.txtEmail.value.indexOf(".") == -1)
		{
			alert("Please Enter Valid Email Address!!!");
			document.frmRegister.txtEmailID.focus();
			return false;
		}
		/*if(document.frmRegister.txtPassword.value == "")
		{
			alert('Please Enter your Password');
			document.frmRegister.txtPassword.focus();
			return false;
		}
		if(document.frmRegister.txtConfPassword.value == "")
		{
			alert('Please Enter your Email Address');
			document.frmRegister.txtConfPassword.focus();
			return false;
		}
		if(document.frmRegister.txtPassword.value != document.frmRegister.txtConfPassword.value)
		{
			alert('password and confirm password are not same');
			document.frmRegister.txtPassword.focus();
			return false;
		}*/
		if(document.frmRegister.txtPhoneNo.value == "")
		{
			alert('Please enter the Phone Number');
			document.frmRegister.txtPhoneNo.focus();
			return false;
		}
	/*	if(document.frmRegister.txtScreen.value.indexOf("@") == -1 || document.frmRegister.txtScreen.value.indexOf(".") == -1)
		{
			alert("Please Enter Valid Screen Name!!!");
			document.frmRegister.txtScreen.focus();
			return false;
		}*/
		if(!IsNumericforReg(document.frmRegister.txtPhoneNo.value))
		{
			return false;
		}
		document.frmRegister.action = "client.php";
		document.frmRegister.submit();

}

function IsNumericforReg(sText)
{   
   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 deletePhoto(id,photo_id)
{
	
	var ans = confirm("Are you sure want to Delete Photo?");
	if(ans==true)
	{
		document.frmShowPhoto.action = "photo_mgmt.php?do=delete&id="+id+"&photo_id="+photo_id;
		document.frmShowPhoto.submit();
	}
}

function editPhoto(type,FrmPara)
{

	document.frmPhotoAdd.action = FrmPara;
	document.frmPhotoAdd.submit();
}
function editPhotoclient(type,FrmPara)
{
	document.frmPhotoAdd.action = FrmPara;
	document.frmPhotoAdd.submit();
}
function deletePhotoClient(id,photo_id)
{
	
	var ans = confirm("Are you sure want to Delete Photo?");
	if(ans==true)
	{
		document.frmShowPhoto.action = "show_photo.php?do=delete&id="+id+"&photo_id="+photo_id;
		document.frmShowPhoto.submit();
	}
}
function chk1()
	{
			var str="";
			//alert(document.form1.ch.length);
			if(document.form1.ch.length > 1){
			for(var i=0;i<document.form1.ch.length ;i++)
			{
					if(document.form1.ch[i].checked)
					{
					  document.form1.ch[i].checked=true;
					 //alert(document.form1.ch[i].value);
					 str+=document.form1.ch[i].value;
					 // alert(str);
					  document.form1.iChk.value=str;
					  }
			}
		//alert(str);	
		}
		else
		{
		if(document.form1.ch.checked){
		document.form1.ch.checked=true;
					 //alert(document.form1.ch[i].value);
					 str=document.form1.ch.value;
					  //alert(str);
					  document.form1.iChk.value=str;
					  }
		}
		
	}
function  checkall()
{
	var iChk=new Array();
	//alert(document.frmCategoryMgmt.ch.length);
	if(document.frmCategoryMgmt.ch.length>1)
	{
		if(document.frmCategoryMgmt.chkall.checked)
		{
				
				for(var i=0;i<document.frmCategoryMgmt.ch.length;i++)
				{
						  document.frmCategoryMgmt.ch[i].checked=true;
							iChk[i]=document.frmCategoryMgmt.ch[i].value;
						  //alert(iChk[i]);
				}
		}
		else{
			for(var i=0;i<document.frmCategoryMgmt.ch.length;i++)
				{
						  document.frmCategoryMgmt.ch[i].checked=false;
				}
		}
	}
	else
	{
		if(document.frmCategoryMgmt.chkall.checked)
		{
					  document.frmCategoryMgmt.ch.checked=true;
							iChk[0]=document.frmCategoryMgmt.ch.value;
						  //alert(iChk[i]);
		}
		else{
				 document.frmCategoryMgmt.ch.checked=false;
		}
	}
	document.frmCategoryMgmt.iChk.value=iChk;
	//alert(document.frmCategoryMgmt.iChk.value=iChk);
}
function checkchk()
{
		var iChk=new Array();
		var j=0;
		if(document.frmCategoryMgmt.ch.length>1)
		{
			for(var i=0;i<document.frmCategoryMgmt.ch.length;i++)
			{
					if(document.frmCategoryMgmt.ch[i].checked)
					{
					  	document.frmCategoryMgmt.ch[i].checked=true;
					 	iChk[j]=document.frmCategoryMgmt.ch[i].value;
					 // document.form1.iChk.value=str;
					 	j+=1;
					 	//alert(iChk[i]);
					 }
			}	
			document.frmCategoryMgmt.iChk.value=iChk;
	    	//alert(document.frmCategoryMgmt.iChk.value=iChk);
		}
		else
		{
			if(document.frmCategoryMgmt.ch.checked)
			{
				document.frmCategoryMgmt.iChk.value=document.frmCategoryMgmt.ch.value;	
			}
			else
			{
				document.frmCategoryMgmt.iChk.value="";
			}
			//alert(document.frmCategoryMgmt.iChk.value);
		}
}
function chkcheckhome2(frmpara,url)
{
		var index;
		for(var i=0;i<document.frmCategoryMgmt.chhome.length;i++)
		{
			if(document.frmCategoryMgmt.chhome[i].value==frmpara.value)
			{
				index=i;
			}
		}	
		if(document.frmCategoryMgmt.chhome[index].checked)
		{
			var ans = confirm("Are you sure you want to display on home page");
			if(ans==true)
			{
					document.frmCategoryMgmt.action=url+"&flg=add&id="+frmpara.value;
					document.frmCategoryMgmt.submit();
			}else{
				document.frmCategoryMgmt.chhome[index].checked=false	
			}
		}else{
			var ans = confirm("Are you sure you don't want to display on home page");
			if(ans==true)
			{
				document.frmCategoryMgmt.action=url+"&flg=delete&id="+frmpara.value;
				document.frmCategoryMgmt.submit();
			}else{
				document.frmCategoryMgmt.chhome[index].checked=true	
			}	
		}
	
}
function chkcheckhome1(frmpara)
{
	var index;
	for(var i=0;i<document.frmCategoryMgmt.chhome.length;i++)
	{
		if(document.frmCategoryMgmt.chhome[i].value==frmpara.value)
		{
			index=i;
		}
	}	
	if(document.frmCategoryMgmt.chhome[index].checked)
	{
		//alert(frmpara.value);
		if(document.frmCategoryMgmt.Chk.length>0)
		{
			j=document.frmCategoryMgmt.Chk.length;
		}
		else
		{
			j=0;
		}
		document.frmCategoryMgmt.Chk[j]=frmpara.value;
		document.frmCategoryMgmt.Chk.length=j+1;
		//alert(document.frmCategoryMgmt.Chk[j]);
	}else{
		var temp=new Array();
		var k=0;
		for(var i=0;i<document.frmCategoryMgmt.Chk.length;i++)
		{
			if(document.frmCategoryMgmt.Chk[i]!=frmpara.value)
			{
				temp[k]=document.frmCategoryMgmt.Chk[i];
				k+=1;
			}
		}
		for(var i=0;i<temp.length;i++)
		{
			document.frmCategoryMgmt.Chk[i]=temp[i];
		}
		document.frmCategoryMgmt.Chk.length=temp.length;
	}
}
function chkcheckhome()
{
	var iChk=new Array();
	var f=0;
		var j=0;
			for(var i=0;i<document.frmCategoryMgmt.chhome.length ;i++)
			{
					if(document.frmCategoryMgmt.chhome[i].checked)
					{
					  	
						if(iChk.length>=3)
						{
							f=1;
							alert('U can Select Maximum Three Category');
						}	
						if(f==0)
						{
						document.frmCategoryMgmt.chhome[i].checked=true;
					 	iChk[j]=document.frmCategoryMgmt.chhome[i].value;
					 // document.form1.iChk.value=str;
					 	
					 	j+=1;
					 	//alert(iChk[i]);
						}else{ document.frmCategoryMgmt.chhome[i].checked=false; }
					 }
			}	
			
			document.frmCategoryMgmt.ChkHome.value=iChk;
			//alert(document.frmCategoryMgmt.ChkHome.value=iChk);
}
function chkSubCategoryHomeFlg()
{
	var iChk=new Array();
		var j=0;
			for(var i=0;i<document.frmSubCategoryMgmt.chhome.length ;i++)
			{
					if(document.frmSubCategoryMgmt.chhome[i].checked)
					{
					  	document.frmSubCategoryMgmt.chhome[i].checked=true;
					 	iChk[j]=document.frmSubCategoryMgmt.chhome[i].value;
					 // document.form1.iChk.value=str;
					 	j+=1;
					 	//alert(iChk[i]);
					 }
			}	
			document.frmSubCategoryMgmt.ChkHome.value=iChk;
			alert(document.frmSubCategoryMgmt.ChkHome.value=iChk);
}
function chkchk1(FrmPara)
{
	for(var i=0;i<document.frmProductMgmt.chhome.length ;i++)
			{
					if(document.frmProductMgmt.chhome[i].checked==false && document.frmProductMgmt.chhome[i].value==FrmPara )
					{
						
					  	//alert(document.frmProductMgmt.chhome[i].value);
					 	document.frmProductMgmt.action="updateprocount.php?iProductID="+document.frmProductMgmt.chhome[i].value;
						document.frmProductMgmt.submit();
					 }
			}	
}
function chkProductOnHomePage()
{
	var iChk=new Array();
		var j=0;
			for(var i=0;i<document.frmProductMgmt.chhome.length ;i++)
			{
					if(document.frmProductMgmt.chhome[i].checked)
					{
					  	document.frmProductMgmt.chhome[i].checked=true;
					 	iChk[j]=document.frmProductMgmt.chhome[i].value;
					 // document.form1.iChk.value=str;
					 	//alert(iChk[j]);
					 	j+=1;
					 }
			}	
			document.frmProductMgmt.ChkProductHome.value=iChk;
			//alert(document.frmProductMgmt.ChkProductHome.value=iChk);	
}
function chkchk(FrmPara)
{
	for(var i=0;i<document.frmProductMgmt.chhome.length ;i++)
			{
					if(document.frmProductMgmt.chhome[i].checked==false && document.frmProductMgmt.chhome[i].value==FrmPara )
					{
						
					  	//alert(document.frmProductMgmt.chhome[i].value);
					 	document.frmProductMgmt.action="updateprocount.php?iProductID="+document.frmProductMgmt.chhome[i].value;
						document.frmProductMgmt.submit();
					 }
			}	
}
function chkListValidation(val){
	
	if(document.frmAddlist.txtName.value == ""){
		alert("Listname should not be blank");
		document.frmAddlist.txtName.focus();
		return false;
	}			
	document.frmAddlist.action ="addlist.php";
	document.frmAddlist.submit();				
}
function AddItemToList(id){
	document.frmViewDetail.iListID.value=id;
	document.frmViewDetail.action="viewdetail.php?FrmPara=Add";
	document.frmViewDetail.submit();
}
