// JavaScript Document

function check()
{	
CategoryName=document.category.CategoryName.value;   	//CategoryName
if (CategoryName=="") 
	{
		 alert ("Enter CategoryName");
		 document.category.CategoryName.focus();
		 return false;
	 }


if(CategoryName == 17 || CategoryName == 23)
{
	if(document.category.SubCategory)
	{
	 SubCategory =document.category.SubCategory.value;   	//CategoryName
		if (SubCategory == "") 
		{
			 alert ("Enter SubCategory Name");
			 document.category.SubCategory.focus();
			 return false;
		 }
	}
	 
	ProductName=document.category.ProductName.value;   	//ProductName
	
	
	if (ProductName=="") 
	{
		 alert ("Enter ProductName");
		 document.category.ProductName.focus();
		 return false;
	 }
	 
	ProductDesc=document.category.ProductDesc.value;   	//Product Description
	
	if (ProductDesc == "") 
	{
		
		 alert ("Enter Product Description");
		 document.category.ProductDesc.focus();
		 return false;
	 }
	 
	/* ProductQty=document.category.ProductQty.value;   	//Product Quantity
	if (ProductQty=="") 
	{
		 alert ("Enter Product Quantity");
		 document.category.ProductQty.focus();
		 return false;
	 }
	 if( isNaN(ProductQty) ||  ProductQty.indexOf("-") >= 0 || ProductQty.indexOf(".")>=0 )
	{
		 alert ("Enter valid Amount");
		 document.category.ProductQty.value = "";
		 document.category.ProductQty.focus();
		 return false;
	 } */
	ProductCName=document.category.ProductCName.value;   	//Product Casino Name
	if (ProductCName=="") 
	{
		 alert ("Enter Product Casino Name");
		 document.category.ProductCName.focus();
		 return false;
	 }
	 
/*	Location=document.category.Location.value;   	//Location
	if (Location=="") 
	{
		 alert ("Enter Location");
		 document.category.Location.focus();
		 return false;
	 }
	 */
	State = document.category.State.value;   		//State
	if (State=="") 
	{
		 alert ("Enter State");
		 document.category.State.focus();
		 return false;
	 }
	
	if(document.category.City)
	{
		City = document.category.City.value;   		//City
		if (City=="") 
		{
			 alert ("Enter City");
			 document.category.City.focus();
			 return false;
		}
	}
	 
	Country=document.category.Country.value;   		//Country
	
	if (Country=="") 
	{
		 alert ("Enter Country");
		 document.category.Country.focus();
		 return false;
	 }
	 
	Denomination=document.category.Denomination.value;   		//Denomination
	if (Denomination=="") 
	{
		 alert ("Enter Denomination");
		 document.category.Denomination.focus();
		 return false;
	 }
	  if(isNaN(Denomination))
	{
		 alert ("Enter valid Amount");
		 document.category.Denomination.value = "";
		 document.category.Denomination.focus();
		 return false;
	 }
	 
	MoldType=document.category.MoldType.value;   		//MoldType
	if (MoldType=="") 
	{
		 alert ("Enter MoldType");
		 document.category.MoldType.focus();
		 return false;
	 }
	 
	ConditionGrade = document.category.ConditionGrade.value;   		//ConditionGrade
	if (ConditionGrade=="") 
	{
		 alert ("Enter Condition Grade");
		 document.category.ConditionGrade.focus();
		 return false;
	 }
	 
	Thumbnail_Front = document.category.Thumbnail_Front.value;   		//Thumbnail_Front
	if (Thumbnail_Front=="") 
	{
		 alert ("Enter Image Url For Front End - Thumbnail");
		 document.category.Thumbnail_Front.focus();
		 return false;
	 }
	 
	Thumbnail_Back=document.category.Thumbnail_Back.value;   		//Thumbnail_Back
	if (Thumbnail_Back=="") 
	{
		 alert ("Enter Image Url For Back End - Thumbnail");
		 document.category.Thumbnail_Back.focus();
		 return false;
	 }
	 
	
	Large_Front=document.category.Large_Front.value;   		//Large_Front
	if (Large_Front=="") 
	{
		 alert ("Enter Image Url For Front End - Large");
		 document.category.Large_Front.focus();
		 return false;
	 }
	 
	Large_Back=document.category.Large_Back.value;   		//Large_Back
	if (Large_Back=="") 
	{
		 alert ("Enter Image Url For Back End - Large");
		 document.category.Large_Back.focus();
		 return false;
	 }
	
	ProductPrice=document.category.ProductPrice.value;   		//ProductPrice
	if (ProductPrice=="") 
	{
		 alert ("Enter Product Price");
		 document.category.ProductPrice.focus();
		 return false;
	 }
	 if(isNaN(ProductPrice)  || ProductPrice.indexOf("-") >= 0)
	{
		 alert ("Enter valid Amount");
		 document.category.ProductPrice.value = "";
		 document.category.ProductPrice.focus();
		 return false;
	 }
	 
	SalesPrice=document.category.SalesPrice.value;   		//SalesPrice
	if (SalesPrice=="" ) 
	{
		 alert ("Enter Sales Price");
		 document.category.SalesPrice.focus();
		 return false;
	 }
	  if(isNaN(SalesPrice) ||  SalesPrice.indexOf("-") >= 0 )
	{
		 alert ("Enter valid Amount");
		 document.category.SalesPrice.value = "";
		 document.category.SalesPrice.focus();
		 return false;
	 }   
	if ((document.category.ConProduct[0].checked == false) && (document.category.ConProduct[1].checked == false))
	{
		 alert ("Check Consignment Product Or Not");
		 document.category.ConProduct[0].focus();
		 return false;
	 }
	
	if (document.category.ConProduct[0].checked == true)
	{
		Con_Name=document.category.Con_Name.value;   		//SalesPrice
		if (Con_Name=="") 
		{
			 alert ("Enter Consignor Name");
			 document.category.Con_Name.focus();
			 return false;
		 }
	}
	
	if ((document.category.Pic_Chip[0].checked == false) && (document.category.Pic_Chip[1].checked == false))
	{
		 alert ("Check pictured chip or not");
		 document.category.Pic_Chip[0].focus();
		 return false;
	 }
	
	if ((document.category.FeaturedProduct[0].checked == false) && (document.category.FeaturedProduct[1].checked == false))
	{
		 alert ("Check Featured Product Or Not");
		 document.category.FeaturedProduct[0].focus();
		 return false;
	 }
	 
	 stock=document.category.int_Stock.value;   	//Available Stock
	if (stock=="") 
	{
		 alert ("Enter Available Stock");
		 document.category.int_Stock.focus();
		 return false;
	 }

   }
   //If other thean the chips category
else{
				
			if(document.category.SubCategory)
			{
						SubCategory =document.category.SubCategory.value;   	//CategoryName		 
	
				if (SubCategory == "") 
				{
					 alert ("Enter SubCategory Name");
					 document.category.SubCategory.focus();
					 return false;
				 }
			}
				 
				ProductName=document.category.ProductName.value;   	//ProductName
				
				
				if (ProductName=="") 
				{
					 alert ("Enter ProductName");
					 document.category.ProductName.focus();
					 return false;
				 }
				 
				ProductDesc=document.category.ProductDesc.value;   	//Product Description
				
				if (ProductDesc == "") 
				{
					
					 alert ("Enter Product Description");
					 document.category.ProductDesc.focus();
					 return false;
				 }
				 
				/* ProductQty=document.category.ProductQty.value;   	//Product Quantity
				if (ProductQty=="") 
				{
					 alert ("Enter Product Quantity");
					 document.category.ProductQty.focus();
					 return false;
				 }
				 if( isNaN(ProductQty) ||  ProductQty.indexOf("-") >= 0 || ProductQty.indexOf(".")>=0 )
				{
					 alert ("Enter valid Amount");
					 document.category.ProductQty.value = "";
					 document.category.ProductQty.focus();
					 return false;
				 } 
				
				 
				Location=document.category.Location.value;   	//Location
				if (Location=="") 
				{
					 alert ("Enter Location");
					 document.category.Location.focus();
					 return false;
				 }*/
				State = document.category.State.value;   		//State
				if (State=="") 
				{
					 alert ("Enter State");
					 document.category.State.focus();
					 return false;
				 }

				if(document.category.City)
				{
					City = document.category.City.value;   		//City
					if (City=="") 
					{
						 alert ("Enter City");
						 document.category.City.focus();
						 return false;
					 }
				}
				 
				Country=document.category.Country.value;   		//Country
				
				if (Country=="") 
				{
					 alert ("Enter Country");
					 document.category.Country.focus();
					 return false;
				 }
				 
				 
				Thumbnail_Front = document.category.Thumbnail_Front.value;   		//Thumbnail_Front
				if (Thumbnail_Front=="") 
				{
					 alert ("Enter Image Url For Front End - Thumbnail");
					 document.category.Thumbnail_Front.focus();
					 return false;
				 }
				
				Large_Front=document.category.Large_Front.value;   		//Large_Front
				if (Large_Front=="") 
				{
					 alert ("Enter Image Url For Front End - Large");
					 document.category.Large_Front.focus();
					 return false;
				 }
				
				ProductPrice=document.category.ProductPrice.value;   		//ProductPrice
				if (ProductPrice=="") 
				{
					 alert ("Enter Product Price");
					 document.category.ProductPrice.focus();
					 return false;
				 }
				 if(isNaN(ProductPrice) || ProductPrice.indexOf("-") >= 0)
				{
					 alert ("Enter valid Amount");
					 document.category.ProductPrice.value = "";
					 document.category.ProductPrice.focus();
					 return false;
				 }
				 
				SalesPrice=document.category.SalesPrice.value;   		//SalesPrice
				if (SalesPrice=="") 
				{
					 alert ("Enter Sales Price");
					 document.category.SalesPrice.focus();
					 return false;
				 }
				  if(isNaN(SalesPrice) || SalesPrice.indexOf("-") >= 0)
				{
					 alert ("Enter valid Amount");
					 document.category.SalesPrice.value = "";
					 document.category.SalesPrice.focus();
					 return false;
				 }   
				if ((document.category.ConProduct[0].checked == false) && (document.category.ConProduct[1].checked == false))
				{
					 alert ("Check Consignment Product Or Not");
					 document.category.ConProduct[0].focus();
					 return false;
				 }
				
				if (document.category.ConProduct[0].checked == true)
				{
					Con_Name=document.category.Con_Name.value;   		//SalesPrice
					if (Con_Name=="") 
					{
						 alert ("Enter Consignor Name");
						 document.category.Con_Name.focus();
						 return false;
					 }
				}
				  stock=document.category.int_Stock.value;   	//Available Stock
					if (stock=="") 
					{
						 alert ("Enter Available Stock");
						 document.category.int_Stock.focus();
						 return false;
					 }


/*				if ((document.category.FeaturedProduct[0].checked == false) && (document.category.FeaturedProduct[1].checked == false))
				{
					 alert ("Check Featured Product Or Not");
					 document.category.FeaturedProduct[0].focus();
					 return false;
				 }
*/				 
	}//End of else

}       // Function End Here


///-------------------casino_feedback.php --------------------------------//
function checkfeedback()
{
	if(document.feedback.Name.value == "")
	{
		alert("Enter Your Name");
		document.feedback.Name.focus();
		return false;
	}
	if(document.feedback.Email.value == "")
	{
		alert("Enter Your Email");
		document.feedback.Email.focus();
		return false;
	}
	 if (document.feedback.Email.value != "")						//Valid Email ID
	 {
		var findchar = document.feedback.Email.value;
		var var1 = findchar.indexOf("@");
		var var2 = findchar.indexOf(".");
		var totallength = document.feedback.Email.value.length;
			if((var1==-1) || (var2<=var1+1) || (var1==0)|| (totallength-1==var2))
			{
				alert("Invalid Email");
				document.feedback.Email.value="";
				document.feedback.Email.focus();
				return false;
			}				
	}
		
	if(document.feedback.Comments.value == "")
	{
		alert("Enter Your Comments");
		document.feedback.Comments.focus();
		return false;
	}
}


//--------------------  add_con_percentage.php ---------------------------//
function percentage_check()
{
	if(document.percentage.List.value == "")
	{
		alert("Choose The Consignor Name");
		document.percentage.List.focus();
		return false;
	}
	if(document.percentage.Level1.value == "")
	{
		alert("Enter Level1");
		document.percentage.Level1.focus();
		return false;
	}
	if(document.percentage.Level2.value == "")
	{
		alert("Enter Level2");
		document.percentage.Level2.focus();
		return false;
	}
	if(document.percentage.Level3.value == "")
	{
		alert("Enter Level3");
		document.percentage.Level3.focus();
		return false;
	} 
	if(document.percentage.Level1_Per.value == "")
	{
		alert("Enter Level1 Percentage");
		document.percentage.Level1_Per.focus();
		return false;
	}
	if(document.percentage.Level2_Per.value == "")
	{
		alert("Enter Level2 Percentage");
		document.percentage.Level2_Per.focus();
		return false;
	}
	if(document.percentage.Level3_Per.value == "")
	{
		alert("Enter Level3 Percentage");
		document.percentage.Level3_Per.focus();
		return false;
	}
}

//-------------------------------------------------------------------------//



// ------------------- forget_password.php --------------------------------//
function forget_mail()
{	

    Email=document.forget.Email.value;   	//CategoryName
	if (Email == "") 
	{
		 alert ("Enter Email Address");
		 document.forget.Email.focus();
		 return false;
	 }
	 
	 if (document.forget.Email.value != "")						//Valid Email ID
	 {
		var findchar = document.forget.Email.value;
		var var1 = findchar.indexOf("@");
		var var2 = findchar.indexOf(".");
		var totallength = document.forget.Email.value.length;
			if((var1==-1) || (var2<=var1+1) || (var1==0)|| (totallength-1==var2))
			{
				alert("Invalid Email");
				document.forget.Email.value="";
				document.forget.Email.focus();
				return false;
			}				
	}
}
//-------------------------------------------------------------------------//


//------------change_password.php ----------------------------------------//

function password_check()
{	
	if(document.ChangePass.OldPassword.value == "")
	{
	alert("Enter Old Password");
	document.ChangePass.OldPassword.focus();
	return false;
	}
	if(document.ChangePass.NewPassword.value == "")
	{
	alert("Enter New Password");
	document.ChangePass.NewPassword.focus();
	return false;
	}
	if(document.ChangePass.ConPassword.value == "")
	{
	alert("Enter Confirm Password");
	document.ChangePass.ConPassword.focus();
	return false;
	}
	if(document.ChangePass.NewPassword.value != document.ChangePass.ConPassword.value)
	{
	alert("Password Does Not Match");
	document.ChangePass.ConPassword.value = "";
	document.ChangePass.ConPassword.focus();
	return false;
	}
	else
	{
		return true;
	}
}
//-------------------------------------------------------------------------//



//  ---------------- add_category.php -----------------------------------------//

function sub_check()
{
	if(document.category.Category.value == "")
	{
		alert("Enter Category Name");
		document.category.Category.focus();
		return false;
	}
	
	if(document.category.Sub_Category.value == "")
	{
		alert("Enter Sub Category Name");
		document.category.Sub_Category.focus();
		return false;
	}

	if(document.category.Status.value == "")
	{
		alert("Enter Status");
		document.category.Status.focus();
		return false;
	}
}

//------------------------------------------------------------------------------//

//--------------------------------Shipchoice Check -----------------------------//
function shipingchoice_check()
{
	if(document.city.sname.value == "")
	{
		alert("Enter Shiping Choice Name");
		document.city.sname.focus();
		return false;
	}
	var Scost = document.city.scost.value;
	if(Scost == "")
	{
		alert("Enter Shiping Choice Cost");
		document.city.scost.focus();
		return false;
	}
	if(isNaN(Scost))
	{
		alert("Enter Shiping Choice Cost in Numeric Value");
		document.city.scost.value = "";
		document.city.scost.focus();
		return false;
	}
}

//------------------------------------------------------------------------------//
