	function test()
		{
			var x;
			var tot=0;
			var totweight=0;
			var totrate=0;
			var totqty=0;
			//alert(window.document.Frm_Offline.selprd.value);
			for(i=0;i<window.document.Frm_Offline.selprd.length;i++)
			{//alert(window.document.Frm_Offline.selprd[i].options[window.document.Frm_Offline.selprd[i].selectedIndex].value);
				if(window.document.Frm_Offline.selprd[i].options[window.document.Frm_Offline.selprd[i].selectedIndex].value!="")
					{
						
							window.document.Frm_Offline.txtqty[i].value=1;	
							x=window.document.Frm_Offline.selprd[i].options[window.document.Frm_Offline.selprd[i].selectedIndex].value;

						
						//for(y=0;y<x.length;y++)
						//	{
						//		if(x.charAt(y)==",")
						//		{
							//	alert(y);
						//		break;
						//		}	
						//	} 
						//prdid=x.substring(0,y);
						//prdpr=x.substring(y+1);	
						//for(y=0;y<prdid.length;y++)
						//	{
						//		if(x.charAt(y)==".")
						//		{
						//	//	alert(y);
						//		break;
						//		}	
						//	} 
						

						//x="1,2"
						var xarr=x.split(",");
						
						prdid = xarr[0];
						prdpr = xarr[1];
						prdweight = xarr[2];

						prdidarr = prdid.split(".");
						itemcode = prdidarr[0];
						prmscode = prdidarr[1];
						
// Discount
						prddis = xarr[3];
						

						//itemcode=prdid.substring(0,y);
						//prmscode=prdid.substring(y+1);
						qty=window.document.Frm_Offline.txtqty[i].value;
						//window.document.Frm_Offline.txtitemcode[i].value=itemcode;

						window.document.Frm_Offline.txtweight[i].value=prdweight;
						window.document.Frm_Offline.txtrate[i].value=prdpr;
// Discount

						window.document.Frm_Offline.txtdiscount[i].value=prddis;
						window.document.Frm_Offline.txttot[i].value=(prdpr - (prdpr*prddis/100))*qty;


				//		tot=eval(tot)+eval(window.document.Frm_Offline.txttot[i].value);	
				//		totweight=eval(totweight)+eval(window.document.Frm_Offline.txtweight[i].value);	
				//		totrate=eval(totrate)+eval(window.document.Frm_Offline.txtrate[i].value);
				//		totqty=eval(totqty)+eval(window.document.Frm_Offline.txtqty[i].value);

						tot=eval(tot)+eval(window.document.Frm_Offline.txttot[i].value);	
						totweight=eval(totweight)+eval(window.document.Frm_Offline.txtweight[i].value);	
						totrate=eval(totrate)+eval(window.document.Frm_Offline.txtrate[i].value);
//						totrate = tot;
						totqty=eval(totqty)+eval(window.document.Frm_Offline.txtqty[i].value);
						
						

						

					}
				else
					{
					window.document.Frm_Offline.txtqty[i].value="";
					//window.document.Frm_Offline.txtitemcode[i].value="";
					window.document.Frm_Offline.txtrate[i].value="";
					window.document.Frm_Offline.txttot[i].value="";
					
					window.document.Frm_Offline.txtdisc.value=""
					window.document.Frm_Offline.txtdisc.value=""

					}
				//window.document.Frm_Offline.txtgrtot.value=eval(tot);	
				
			}
				
				window.document.Frm_Offline.txtgrtot.value=Number(tot);
//				alert(window.document.Frm_Offline.txtgrtot.value);
				window.document.Frm_Offline.txttotrate.value=Number(totrate);
				window.document.Frm_Offline.txttotqty.value=Number(totqty);
				window.document.Frm_Offline.txttotweight.value=Math.round(totweight,2)

				
				window.document.Frm_Offline.txtdisc.value=""
				window.document.Frm_Offline.txtdiscamt.value=""

				curpaytext=window.document.Frm_Offline.rad_payment(window.document.Frm_Offline.rad_payment.selectedIndex).text
			if(curpaytext=="ICICI Credit Card")
				{
					
					crdno=window.document.Frm_Offline.creditcardno.value
					crdno=crdno.substring(0, 6)
					if(crdno=='447746' || crdno=='447747' || crdno=='402368' || crdno=='447758' || crdno=='486409' || crdno == '486410' || crdno == '517637' || crdno == '517719' || crdno=='540282')	
						{
							tot=window.document.Frm_Offline.txtgrtot.value
							if (Number(tot)>5001)
								{
									window.document.Frm_Offline.creditcardtype.value="ICICI"
									//window.document.Frm_Offline.txtgrtot.value=Number(window.document.Frm_Offline.txttotrate.value)*Number(window.document.Frm_Offline.txttotqty.value)
									discamt=Number(tot)*20/100
									discamt=Math.round(discamt,2)
									window.document.Frm_Offline.txtdisc.value="20%"
									window.document.Frm_Offline.txtdiscamt.value=discamt
									window.document.Frm_Offline.txtgrtot.value=Number(window.document.Frm_Offline.txtgrtot.value)-Number(discamt)
								}
						}
				}

		}
	function open_cod()
		{
			window.document.Frm_Offline.rad_payment_cod.disabled=false;
		}
	function cal()
		{
		var tot=0;
		var totrate=0;
		var totqty=0;
		var a=0;
			for(i=0;i<window.document.Frm_Offline.selprd.length;i++)
				{
				//alert(isNaN(parseInt(window.document.Frm_Offline.txtqty[i].value)));
				if(window.document.Frm_Offline.selprd[i].options[window.document.Frm_Offline.selprd[i].selectedIndex].value!="")
					{
						if(window.document.Frm_Offline.txtqty[i].value!="")
						{		
						if(isNaN(parseInt(window.document.Frm_Offline.txtqty[i].value))!=true)
						{	
						x=window.document.Frm_Offline.selprd[i].options[window.document.Frm_Offline.selprd[i].selectedIndex].value;

						//for(y=0;y<x.length;y++)
						//{
						//	if(x.charAt(y)==",")
						//	{
						//		break;
						//	}	
						//} 
						
						var xarr=x.split(",");
						
						prdid = xarr[0];
						prdpr = xarr[1];
// Discount
						prddis = xarr[3];
						
						///prdid=x.substring(0,y);
						//prdpr=Number(x.substring(y+1));				
					//window.document.Frm_Offline.txtrate[i].value=prdpr;

// Discount

						window.document.Frm_Offline.txtdiscount[i].value=prddis;
						window.document.Frm_Offline.txttot[i].value=(prdpr - (prdpr*prddis/100))*qty;


//					window.document.Frm_Offline.txttot[i].value=prdpr*window.document.Frm_Offline.txtqty[i].value;

						tot=eval(tot)+eval(window.document.Frm_Offline.txttot[i].value);	
						totweight=eval(totweight)+eval(window.document.Frm_Offline.txtweight[i].value);	
						totrate=eval(totrate)+eval(window.document.Frm_Offline.txtrate[i].value);
//						totrate = tot;
						totqty=eval(totqty)+eval(window.document.Frm_Offline.txtqty[i].value);
						

//						tot=eval(tot)+eval(window.document.Frm_Offline.txttot[i].value);
//					totrate=eval(totrate)+eval(window.document.Frm_Offline.txtrate[i].value);
//					totqty=eval(totqty)+eval(window.document.Frm_Offline.txtqty[i].value);
					

					a=1;
					}
					else
					{
					a=0;
					alert("Please Enter Numeric.");
					break;
					}
					}
					}
				}
			
			if(a==1)
			{
			window.document.Frm_Offline.txtgrtot.value=eval(tot);
			window.document.Frm_Offline.txttotrate.value=eval(totrate);
			window.document.Frm_Offline.txttotqty.value=eval(totqty);
			}

			window.document.Frm_Offline.txtdisc.value=""
				window.document.Frm_Offline.txtdiscamt.value=""

			curpaytext=window.document.Frm_Offline.rad_payment(window.document.Frm_Offline.rad_payment.selectedIndex).text
			if(curpaytext=="ICICI Credit Card")
				{
					
					crdno=window.document.Frm_Offline.creditcardno.value
					crdno=crdno.substring(0, 6)

					if(crdno=='447746' || crdno=='447747' || crdno=='402368' || crdno=='447758' || crdno=='486409' || crdno == '486410' || crdno == '517637' || crdno == '517719' || crdno=='540282')
						{
							
							tot=window.document.Frm_Offline.txtgrtot.value
							if (Number(tot)>5001)
								{
									//window.document.Frm_Offline.txtgrtot.value=Number(window.document.Frm_Offline.txttotrate.value)*Number(window.document.Frm_Offline.txttotqty.value)
									window.document.Frm_Offline.creditcardtype.value="ICICI"
									discamt=Number(tot)*20/100
									discamt=Math.round(discamt,2)
									window.document.Frm_Offline.txtdisc.value="20%"
									window.document.Frm_Offline.txtdiscamt.value=discamt
									window.document.Frm_Offline.txtgrtot.value=Number(window.document.Frm_Offline.txtgrtot.value)-Number(discamt)
											
								}
						}
				}
				}

	function validate()
		{
				if (window.document.Frm_Offline.txtuname.value=="")
					{
						alert("User Name cant be Null");
						window.document.Frm_Offline.txtuname.focus();
						return false;
					}
				if (window.document.Frm_Offline.Txtpwd.value=="")
					{
						alert("Password cant be Null");
						window.document.Frm_Offline.Txtpwd.focus();
						return false;
					}
				var	a = window.document.Frm_Offline.Txtpwd.value;				
				if (a.length <=4)
					{
						alert("Password cant be lesss than 5 character");
						window.document.Frm_Offline.Txtpwd.focus();
						return false;
					}
				if (window.document.Frm_Offline.TxtConPwd.value=="")
					{
						alert("Conforming  Password is not matching with  Password");
						window.document.Frm_Offline.TxtConPwd.focus();
						return false;
					}
				if (window.document.Frm_Offline.TxtConPwd.value != window.document.Frm_Offline.Txtpwd.value)
					{
						alert("Conforming  Password is not matching with  Password");
						window.document.Frm_Offline.TxtConPwd.focus();
						return false;
					}	
				if (window.document.Frm_Offline.txtfname.value=="")
					{
						alert("First Name cant be Null");
						window.document.Frm_Offline.txtfname.focus();
						return false;
					}
				if (window.document.Frm_Offline.txtaddr1.value=="")
					{
						alert("Address cant be Null");
						window.document.Frm_Offline.txtaddr1.focus();
						return false;
					}				
				/*if (window.document.Frm_Offline.txtlandmark.value=="")
					{
						alert("Landmark cant be Null");
						window.document.Frm_Offline.txtlandmark.focus();
						return false;
					}*/
					var	b = window.document.Frm_Offline.otherCity.value;				    
					if (window.document.Frm_Offline.city.value=="0" && b.length <=2) 
					{
						alert("Please enter/select a correct city Name.");
						window.document.Frm_Offline.city.focus();
						return false;
					}
					if (window.document.Frm_Offline.state.value=="0")
					{
						alert("Please select a state.");
						window.document.Frm_Offline.state.focus();
						return false;
					}
					if (window.document.Frm_Offline.txtzip.value=="")
					{
						alert("Pincode cant be Empty");
						window.document.Frm_Offline.txtzip.focus();
						return false;
					}
			

				
					/*if(parseInt(window.document.Frm_Offline.txtzip.value)==true)
					{
						return true;
					}
					else{
							alert("Please Enter Pincode in Numbers");
							window.document.Frm_Offline.txtzip.focus();
							return false;
						}*/
				if (window.document.Frm_Offline.txtphone.value=="")
					{
						alert("Please enter phone no.");
						window.document.Frm_Offline.txtphone.focus();
						return false;
					}
				//check for date of birth
/*				var day=eval(window.document.Frm_Offline.seldobday.options[window.document.Frm_Offline.seldobday.selectedIndex].value);
				var mth=eval(window.document.Frm_Offline.seldobmth.options[window.document.Frm_Offline.seldobmth.selectedIndex].value);
				var year=eval(window.document.Frm_Offline.seldobyear.options[window.document.Frm_Offline.seldobyear.selectedIndex].value);
				
				var dt=new Date();
				var yr=0;
				var mm=0;
				if(checkdate(day,mth,year)==false)
					{
					
						alert("Invalid Date Of Birth");
						return false;	
					}
				if(year>dt.getYear())
					{
							alert("Invalid Date Of Birth");
							return false;	
					}
					else
					{
							yr=1
					}*/

					//check for desired date of delivery
				/*var day=eval(window.document.Frm_Offline.seldodday.options[window.document.Frm_Offline.seldodday.selectedIndex].value);
				var mth=eval(window.document.Frm_Offline.seldodmth.options[window.document.Frm_Offline.seldodmth.selectedIndex].value);
				var year=eval(window.document.Frm_Offline.seldodyear.options[window.document.Frm_Offline.seldodyear.selectedIndex].value);
				
				var dt=new Date();
				//alert("datehere :"+dt);
				var yr=0;
				var mm=0;
				if(checkdate(day,mth,year)==false)
					{
					
						alert("Invalid required date of delivery");
						return false;	
					}
				if( (year<dt.getYear() ) || (mth < (dt.getMonth()+1) && year == dt.getYear() ) || (day < dt.getDate() && mth == (dt.getMonth()+1) && year == dt.getYear() ) )
					{
							alert("..Invalid desired date of delivery");
							return false;	
					}
					else
					{
							yr=1
					}*/
				//alert(mth +"ff"+(dt.getMonth()+1));
				//checking for proper email validations
				
				if(isEmail(window.document.Frm_Offline.txtemail.value)==false)
				{
					alert("Please enter proper email address");
					window.document.Frm_Offline.txtemail.focus();
					return false;	
				}

				if (window.document.Frm_Offline.txtusername.value=="")
					{
						alert("UserName cant be Empty");
						window.document.Frm_Offline.txtusername.focus();
						return false;
					}
				
				if (window.document.Frm_Offline.txtpassword.value=="")
					{
						alert("Password cant be Empty");
						window.document.Frm_Offline.txtpassword.focus();
						return false;
					}
				var invalid = " ";
				
				if (window.document.Frm_Offline.txtusername.value.indexOf(invalid) > -1) 
					{
						window.document.Frm_Offline.txtusername.focus();
						alert("Sorry, spaces are not allowed.");
						return false;
					}
				if (window.document.Frm_Offline.txtpassword.value.indexOf(invalid) > -1) {
						window.document.Frm_Offline.txtpassword.focus();
						alert("Sorry, spaces are not allowed.");
				return false;
				}
				
				if(window.document.Frm_Offline.country.options[window.document.Frm_Offline.country.selectedIndex].value==0)
				{
					alert("Please select the country");
					window.document.Frm_Offline.country.focus();
					return false;
				}

				var invalid1 = "'";
				
				if (window.document.Frm_Offline.txtusername.value.indexOf(invalid1) > -1) 
					{
						window.document.Frm_Offline.txtusername.focus();
						alert("Sorry, ' are not allowed.");
						return false;
					}
				if (window.document.Frm_Offline.txtpassword.value.indexOf(invalid1) > -1) {
						window.document.Frm_Offline.txtpassword.focus();
						alert("Sorry, ' are not allowed.");
						return false;
				}
				
				if(window.document.Frm_Offline.country.options[window.document.Frm_Offline.country.selectedIndex].value==0)
				{
					alert("Please select the country");
					window.document.Frm_Offline.country.focus();
					return false;
				}



				/*if(window.document.Frm_Offline.txtemail.value=="")
				{
					alert("Please enter proper email address");
					window.document.Frm_Offline.txtemail.focus();
					return false;	
				}*/
				//check for product(s) selecttion
					qtyl=window.document.Frm_Offline.txtqty.length;		
					var x=0;
					var y=0;
					var z=0;
					var arrl= new Array();

					for(i=0;i<qtyl;i++)
					{
						if(window.document.Frm_Offline.selprd[i].options[window.document.Frm_Offline.selprd[i].selectedIndex].value=="")
						{			
							if(window.document.Frm_Offline.txtqty[i].value=="")
							{
								++x;					
								//alert("DFFDF");
								//return false;
								//break;

							}
							else
							{
								if(window.document.Frm_Offline.selprd[i].options[window.document.Frm_Offline.selprd[i].selectedIndex].value=="")
								{
										alert("Select the product");
										window.document.Frm_Offline.selprd[i].focus();								
										return false;
										break;
								}
								else
								{
									arrl[y]=window.document.Frm_Offline.selprd[i].options[window.document.Frm_Offline.selprd[i].selectedIndex].value;
									++y;	
									continue;
								}
									
							}
						}
						else
						{
							//if the product is selected and not the txtqty entered		
							if(window.document.Frm_Offline.txtqty[i].value=="")
							{
								alert("Please enter the quantity for the selected product");
								window.document.Frm_Offline.txtqty[i].focus();
								return false;
								break;			
							}
							else
								{
									arrl[y]=window.document.Frm_Offline.selprd[i].options[window.document.Frm_Offline.selprd[i].selectedIndex].value;
									++y;			
									continue;
								}
						}
					}
				//	alert(x);

					if(x==qtyl)
					{
							alert("Please select at least one product")
							return false;
					}
					for (a=0;a<arrl.length;a++)
					{
							for(b=a+1;b<arrl.length;b++)
							{
								if(arrl[a]==arrl[b])
								{
								z=1;
								break;
								}
							}
						if(z==1)
						{
								alert("2 or more selected products cannot be same")
								return false;
								break;
						}
					}
					//checking for payments validations
					//if(window.document.Frm_Offline.rad_payment[2].checked==true)
						//{
						//script for 
									//var credit;
									//credit=CheckCreditCard(ccname,ccno,ccexpmth,finalyear)	
										//alert(credit);
										//if(credit!=true)
											//{
											//alert(credit);
											//return false;
											//}
											//else
											//{
											//return true;
											//}		
						//}	
					

					return true;

		}


