function doValidateName(vart,vat)
{
	var valid = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ/ "
	var ok = "yes";
	var temp;
	var vart1 = vart.value;

	for (var i=0; i<vart.value.length; i++) 
	{	
	temp = "" + vart.value.substring(i, i+1);	
	if (valid.indexOf(temp) == "-1") ok = "no";
	}
	
	if (ok == "no")
	{
	alert(vat + " Invalid! Only alphabets are accepted!");
	vart.focus();
	vart.select();
	return 1;
	}
	return 2;
}
function doValidateNumber(vart,vat)
{
	var valid = "0123456789/"
	var ok = "yes";
	var temp;
	for (var i=0; i<vart.value.length; i++) 
	{
	temp = "" + vart.value.substring(i, i+1);
	if (valid.indexOf(temp) == "-1") ok = "no";
	}
	if (ok == "no")
	{
	alert(vat + " Invalid! Only number are accepted!");
	vart.focus();
	vart.select();
	return 1;
	}
	return 2;
}
function doValidateAlphaNumeric(vart,vat)
{
	var valid = "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ/"
	var ok = "yes";
	var temp;
	for (var i=0; i<vart.value.length; i++) 
	{
	temp = "" + vart.value.substring(i, i+1);
	if (valid.indexOf(temp) == "-1") ok = "no";
	}
	if (ok == "no")
	{
	alert(vat + " Invalid! Space are not accepted!");
	vart.focus();
	vart.select();
	return 1;
	}
	return 2;
}

function doValidateInfo()
{
		var nvar1 = document.getElementById('addlcountry');
		var nvar2 = document.getElementById('addlstate');
		var nvar3 = document.getElementById('addlcity');
		if(nvar1.selectedIndex < 1)
		{
			alert('Please specify your country');
			return false;
		}
		if(nvar2.selectedIndex < 1)
		{
			alert('Please specify your state');
			return false;
		}
		if(nvar3.selectedIndex < 1)
		{
			alert('Please specify your city');
			return false;
		}
		return true;
}
			function doValidatemember(vart,vat)
			{
				var valid = "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ/";						
				var temp;
				var ok="yes";

				for(var i=0;i<vart.value.length;i++)
				{
				temp = "" + vart.value.substring(i,i+1);
				if(valid.indexOf(temp)== "-1")
				ok="no";
				}
				if(ok=="no")
				{
				alert(vat + "Please choose alphanumeric characters only");
				vart.focus();
				vart.select();
				return 1; 
				}
				return 2;
			}
			
			function doValidatememberCheck()
			{
				var valid = "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ/";						
				var temp;
				var ok="yes";
				var vart = document.getElementById('txtMemberId');

					for(var i=0;i<vart.value.length;i++)
					{
						temp = "" + vart.value.substring(i,i+1);
						if(valid.indexOf(temp)== "-1")
						ok="no";
					}
					if(ok=="no")
					{
						alert("No special character is allowed");
						return false; 
					}
				return true;
			}

			function doValidatememberMember(vart,vat)
			{
			var valid = "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ_";						
			var temp;
			var ok="yes";

			for(var i=0;i<vart.value.length;i++)
			{
			temp = "" + vart.value.substring(i,i+1);
			if(valid.indexOf(temp)== "-1")
			ok="no";
			}
			if(ok=="no")
			{
			alert(vat + "Please choose alphanumeric characters only");
			vart.focus();
			vart.select();
			return 1; 
			}
			return 2;

	}

			function doValidateNumber(vart,vat)
			{
				var valid = "0123456789/"
				var ok = "yes";
				var temp;
				for (var i=0; i<vart.value.length; i++) 
					{
						temp = "" + vart.value.substring(i, i+1);
						if (valid.indexOf(temp) == "-1") ok = "no";
					}
					if (ok == "no")
					{
						alert(vat + " Should be in numeric");
						vart.focus();
						vart.select();
						return 1;
					}
					return 2;
			}
		
								function doValidate()
								{
											var var1 = document.getElementById('txtMemberId');
											var var2 = document.getElementById('txtPassword');
											var var3 = document.getElementById('txtConfirmPassword');
											var var4 = document.getElementById('txFName');
											var var5 = document.getElementById('dlDesignation');
											var var6 = document.getElementById('txMobile');
											var var7 = document.getElementById('txtCompany');		
											var var8 = document.getElementById('txEMail');
											var var9 = document.getElementById('dlBusinessType');
											var var10 = document.getElementById('dlIndustry');
											
											
											var var11 = document.getElementById('txStreet');
											var var12 = document.getElementById('txPhone1');
											var var13 = document.getElementById('txPhone2');
											var var14 = document.getElementById('txPhone3');
											var var15 = document.getElementById('txFax1');
											var var16 = document.getElementById('txFax2');
											var var17 = document.getElementById('txFax3');	
											var var18 = document.getElementById('ddlCategory');
											var var19 = document.getElementById('ddlSubcategory');	
											var var20 = document.getElementById('tareaCProfile');
											var var21 = document.getElementById('CodeNumberTextBox');
											
										
										if(var4.value == "" || !var4.value.match(/[^\s]/))
										{
											alert('Please specify your full name');
											return false;
										}
										
										if(var4.value != "")
										{
										var i= doValidateName(var4,'Name');
										if(i == 1) return false;
										}
										if(var5.selectedIndex < 1)
										{
											alert('Please specify your designation');
											return false;
										}
										if(var6.value != "")
										{
											var i = doValidateNumber(var6,'Mobile Number');
											if (i==1) return false;
										}
										if(var6.value != "")
										{
											if(var6.value.length < 10 || var6.value.length > 11)
											{											
												alert('Mobile No. should be between 10 to 11 digits.');
												var6.focus();
												return false;
											}
										}
										if(var7.value == "" || !var7.value.match(/[^\s]/))
										{
											alert('Please specify company name');
											return false;
										}
																				
										if(var8.value == "")
										{
											alert('Please specify email id');
											return false;
										}
									    
										var emailPat = /^.+@.+\..{2,3}$/;
										var reg = new RegExp(emailPat);
									    
										if(!reg.exec(var8.value))
										{
											alert("Please enter valid email id");
											return false;
										}
									    	    
										if(var9.selectedIndex < 1)
										{
											alert('Please select business type');
											return false;
										}
										if(var10.selectedIndex < 1)
										{
											alert('Please select Industry');
											return false;
										}
										var category = Form1.ddlcategory.selectedIndex;
										if(category < 1)
										{
											alert('Please specify your company category');
											return false;
										}
										var subcategory = Form1.ddlsubcategory.selectedIndex;
										if(subcategory < 1)
										{
											alert('Please select subcategory');
											return false;
										}
										if(var20.value == "" || !var20.value.match(/[^\s]/))
										{
											alert('Please specify your company profile');
											return false;
										}
										if(var20.value != "")
										{
											if(var20.value.length < 200)
											{
											alert('Min. 200 Characters are required in company profile');
											return false;
											}
										}
										
										if(var11.value == "" || !var11.value.match(/[^\s]/))
										{
											alert('Please specify your street address');
											return false;
										}
										if(var12.value == "" || var13.value == "" || var14.value == "" )
										{
											alert('You have not entered Complete Phone No.');
											return false;
										}
										if(var12.value != "")
										{
										var i=doValidateNumber(var12,'Phone: ');
										if(i == 1) return false;
										}
										if(var13.value != "")
										{
										var i=doValidateNumber(var13,'Phone: ');
										if(i == 1) return false;
										}
										if(var14.value != "")
										{
										var i=doValidateNumber(var14,'Phone: ');
										if(i == 1) return false;
										}
										if(var15.value != "")
										{
										var i=doValidateNumber(var15,'Fax: ');
										if(i == 1) return false;
										}
										if(var16.value != "")
										{
										var i=doValidateNumber(var16,'Fax: ');
										if(i == 1) return false;
										}
										if(var17.value != "")
										{
										var i=doValidateNumber(var17,'Fax: ');
										if(i == 1) return false;
										}
										if(var1.value == "")
										{
											alert('Please specify your member id');
											return false;
										}
										if(var1.value != "")
										{
											var i=doValidatememberMember(var1,'UserName');
											if(i==1)
											return false;
										}
										if (var1.value.length < 4)
										{
										alert('Member Id: Minimum 4 characters');
										var1.focus();
										var1.value="";
										return false;
										}
										if(var2.value == "")
										{
											alert('Please specify your password');
											return false;
										}
										if(var2.value.length < 6)
										{
										alert('Password: Minimum 6 characters');
										var2.focus();
										var2.value="";
										var3.value="";
										return false;
										}
																				
										if(var2.value.length > 12)
										{
										alert('Password: Maximun 12 characters');
										var2.focus();
										var2.value="";
										var3.value="";
										return false;
										}
										if(var2.value != "")
										{	
											var i= doValidateAlphaNumeric(var2,'PassWord.');
											if(i == 1) return false;
										}
										if(var3.value != var2.value)
										{
											alert('Please Re-Type your password as above');
											return false;
										}
									    if(var21.value == "")
										{
											alert('You have not entered the security code');
											var21.focus();
											return false;
										}  			   
									return true;
								}
		
								function doValidateCustomer()
								{
								var elm = document.Form1.elements;
								for(var i=0;i<elm.length;i++)
									{
										if(elm[i].type == "radio")
										{
											if(elm[i].checked)
											{
												return true;
											}
										}
									}
									alert('Please select Customer Type');
									return false;
								}
								function doValidateForgetpwd()
								{
									var var1=document.getElementById('txtEmail');
										
									var emailPat = /^.+@.+\..{2,3}$/;
									var reg = new RegExp(emailPat);
									if(var1.value == "")
									{
									alert("Please specify valid email id");
									return false;
									}
									if(!reg.exec(var1.value))
									{
										alert("Please enter valid email id");
										return false;
									}
									return true;
								}
								
								function getObject(obj)
								{
									var theObj;
									if(document.all)
									{
									if(typeof obj=="string")
									{
									return document.all(obj);
									}
									else
									{
									return obj.style;
									}
									}
									if(document.getElementById)
									{
									if(typeof obj=="string")
									{
									return document.getElementById(obj);
									}
									else
									{
									return obj.style;
									}
									}
									return null;
								}

								function Contar(entrada,salida,texto,caracteres)
								{
									var entradaObj=getObject(entrada);
									var salidaObj=getObject(salida);
									var longitud=caracteres - entradaObj.value.length;
									if(longitud <= 0)
									{
									longitud=0;
									texto='<span class="disable"> '+texto+' </span>';
									entradaObj.value=entradaObj.value.substr(0,caracteres);
									}
								salidaObj.innerHTML = texto.replace("{CHAR}",longitud);
								}