function distributor()
{
			var i=0;
			
			var alrt="";
			if (joindistributor.username.value=="")
			{
			alert("Please choose username ")
			joindistributor.username.focus()
			return false
			}
			if (joindistributor.username.value!="")
			{
				if(joindistributor.username.value.indexOf("@")==-1)
				{
				alert("Please enter your vaild email address")
				joindistributor.username.focus()
				return false
				}
			}
			if (joindistributor.pwd.value=="")
			{
			alert("Please choose password")
			joindistributor.pwd.focus()
			return false
			}
			if ((joindistributor.pwd.value.length<3 )|| (joindistributor.pwd.value.length>12))
			{
			alert("Password contain only 3 to 12 character")
			joindistributor.pwd.focus()
			return false
			}
			if (joindistributor.conusername.value=="")
			{
			alert("Please confirm your username")
			joindistributor.conusername.focus()
			return false
			}
			if(joindistributor.username.value!=joindistributor.conusername.value)
			{
			alert("The confirmation username is not same")
			joindistributor.conusername.focus()
			return false
			}
			if (joindistributor.conpwd.value=="")
			{
			alert("Please confirm your password")
			joindistributor.conpwd.focus()
			return false
			}
			
			if (joindistributor.pwd.value!=joindistributor.conpwd.value)
			{
			alert("The confirmation password is not same")
			joindistributor.conpwd.focus()
			return false
			}
			if (joindistributor.fname.value=="")
			{
			alert("Please enter your first name")
			joindistributor.fname.focus()
			return false
			}
			if (joindistributor.lname.value=="")
			{
			alert("Please enter your last name")
			joindistributor.lname.focus()
			return false
			}
			if (joindistributor.workphone.value=="")
			{
			alert("Please enter your work phone naumber")
			joindistributor.workphone.focus()
			return false
			}
			if (joindistributor.company.value=="")
			{
			alert("Please enter your company name")
			joindistributor.company.focus()
			return false
			}
			if (joindistributor.workaddress1.value=="")
			{
			alert("Please enter your workaddress")
			joindistributor.workaddress1.focus()
			return false
			}
			if (joindistributor.workcity.value=="")
			{
			alert("Please enter your work city")
			joindistributor.workcity.focus()
			return false
			}
			if (joindistributor.workstate.value=="")
			{
			alert("Please select your work state")
			joindistributor.workstate.focus()
			return false
			}
			if (joindistributor.workzip.value=="")
			{
			alert("Please enter your work zip")
			joindistributor.workzip.focus()
			return false
			}
			if (joindistributor.workcountry.value=="")
			{
			alert("Please select your work country")
			joindistributor.workcountry.focus()
			return false
			}
			
			return true

}


function edit()
{
		var i=0;
		
		var alrt="";
		/*
		if (joindistributor.username.value==""){
		alert("Please choose username ")
		joindistributor.username.focus()
		return false
		
		}
		if (joindistributor.username.value!=""){
		if(joindistributor.username.value.indexOf("@")==-1){
		alert("Please enter your vaild email address")
		joindistributor.username.focus()
		return false
		
		}
		}
		if (joindistributor.pwd.value==""){
		alert("Please choose password")
		joindistributor.pwd.focus()
		return false
		
		}
		if ((joindistributor.pwd.value.length<6 )|| (joindistributor.pwd.value.length>8)){
		alert("Password contain only 6 to 8 character")
		joindistributor.pwd.focus()
		return false
		}
		
		if (joindistributor.conusername.value==""){
		alert("Please confirm your username")
		joindistributor.conusername.focus()
		return false
		
		}
		if(joindistributor.username.value!=joindistributor.conusername.value){
		alert("Please confirmation username is not same")
		joindistributor.conusername.focus()
		return false
		
		}
		if (joindistributor.conpwd.value==""){
		alert("Please confirm your password")
		joindistributor.conpwd.focus()
		return false
		}
		
		if (joindistributor.pwd.value!=joindistributor.conpwd.value){
		alert("Please confirmation username is not same")
		joindistributor.conpwd.focus()
		return false
		}
		*/
		if (joindistributor.fname.value==""){
		alert("Please enter your first name")
		joindistributor.fname.focus()
		return false
		
		}if (joindistributor.lname.value==""){
		alert("Please enter your last name")
		joindistributor.lname.focus()
		return false
		
		}if (joindistributor.workphone.value==""){
		alert("Please enter your work phone naumber")
		joindistributor.workphone.focus()
		return false
		
		}if (joindistributor.company.value==""){
		alert("Please enter your company name")
		joindistributor.company.focus()
		return false
		
		}if (joindistributor.workaddress1.value==""){
		alert("Please enter your workaddress")
		joindistributor.workaddress1.focus()
		return false
		
		}if (joindistributor.workcity.value==""){
		alert("Please enter your work city")
		joindistributor.workcity.focus()
		return false
		
		}
		if (joindistributor.workstate.value==""){
		alert("Please select your work state")
		joindistributor.workstate.focus()
		return false
		
		}
		if (joindistributor.workzip.value==""){
		alert("Please enter your work zip")
		joindistributor.workzip.focus()
		return false
		
		}if (joindistributor.workcountry.value==""){
		alert("Please select your work country")
		joindistributor.workcountry.focus()
		return false
		
		}
		
		
		return true
		
}

  function chkform()
   {
	  var i=0;
	  var alrt="";    
      if(document.frmchangepass.oldpwd.value =="")
	   {
		   alrt +=(++i)+" : "+"Please enter the old \"Password\" ."+"\n";
	     
	   }
	  
 
     
	 
	   if(document.frmchangepass.newpwd.value =='')
	   {
	     alrt +=(++i)+" : "+"Please enter the new \"Password\" ."+"\n";
		 
	   }
	   
	   if(document.frmchangepass.cnfnewpwd.value =='')
	   {
	     alrt +=(++i)+" : "+"Please confirm new \"Password\" ."+"\n";
		 
	   }
	   
	   a = document.frmchangepass.newpwd.value;
	   b = document.frmchangepass.cnfnewpwd.value;
	   if(a !="" && b !="")
	   {
		   if(a != b )
		   {
			 alrt +=(++i)+" : "+"Confirm password is not same."+"\n";
			 
		   }
	   }
	  if(alrt !="")
			{
			//alert(alrt.length);
			 if(i==1)
		   alrt=alrt.replace(/1:/, "");
			alert(alrt);
			return false;
			}
	
return true;
	   
   }



 function pwdrecovery()
   {
	 if(document.frmchangepass.fpwdloginid.value =="")
	   {
	     alert('Please enter login id.');
		 document.frmchangepass.fpwdloginid.focus();
		 return false;
	   }
     

   }
   
   function echeck(str) {

		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 E-mail ID")
		   return false
		}

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

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

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

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

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

 		 return true					
	}

   
    function checkconf()
   {
	    if(document.conf_email.name.value =="")
	   {
	     alert('Please enter name.');
		 document.conf_email.name.focus();
		 return false;
	   }
	    if(document.conf_email.phone.value =="")
	   {
	     alert('Please enter phone number.');
		 document.conf_email.phone.focus();
		 return false;
	   }
	 if(document.conf_email.email.value =="")
	   {
	     alert('Please enter email id.');
		 document.conf_email.email.focus();
		 return false;
	   }
    
		if (document.conf_email.email.value!="")
		{
			return echeck(document.conf_email.email.value);
			
				/*
				if(document.conf_email.email.value.indexOf("@")==-1 || document.conf_email.email.value.indexOf(".")==-1)
				{
				alert("Please enter your vaild email id.")
				document.conf_email.email.focus()
				return false
				
				}
				*/
		}

return true;
   }
   
function default_fpwd()
{
if(document.frmchangepass.fpwdloginid.value == "E-mail address")
document.frmchangepass.fpwdloginid.value="";

}

function checkMailId(mailids)
{
var arr = new Array('.com','.net','.org','.biz','.coop','.info','.museum','.name','.pro'
,'.edu','.gov','.int','.mil','.ac','.ad','.ae','.af','.ag','.ai','.al',
'.am','.an','.ao','.aq','.ar','.as','.at','.au','.aw','.az','.ba','.bb',
'.bd','.be','.bf','.bg','.bh','.bi','.bj','.bm','.bn','.bo','.br','.bs',
'.bt','.bv','.bw','.by','.bz','.ca','.cc','.cd','.cf','.cg','.ch','.ci',
'.ck','.cl','.cm','.cn','.co','.cr','.cu','.cv','.cx','.cy','.cz','.de',
'.dj','.dk','.dm','.do','.dz','.ec','.ee','.eg','.eh','.er','.es','.et',
'.fi','.fj','.fk','.fm','.fo','.fr','.ga','.gd','.ge','.gf','.gg','.gh',
'.gi','.gl','.gm','.gn','.gp','.gq','.gr','.gs','.gt','.gu','.gv','.gy',
'.hk','.hm','.hn','.hr','.ht','.hu','.id','.ie','.il','.im','.in','.io',
'.iq','.ir','.is','.it','.je','.jm','.jo','.jp','.ke','.kg','.kh','.ki',
'.km','.kn','.kp','.kr','.kw','.ky','.kz','.la','.lb','.lc','.li','.lk',
'.lr','.ls','.lt','.lu','.lv','.ly','.ma','.mc','.md','.mg','.mh','.mk',
'.ml','.mm','.mn','.mo','.mp','.mq','.mr','.ms','.mt','.mu','.mv','.mw',
'.mx','.my','.mz','.na','.nc','.ne','.nf','.ng','.ni','.nl','.no','.np',
'.nr','.nu','.nz','.om','.pa','.pe','.pf','.pg','.ph','.pk','.pl','.pm',
'.pn','.pr','.ps','.pt','.pw','.py','.qa','.re','.ro','.rw','.ru','.sa',
'.sb','.sc','.sd','.se','.sg','.sh','.si','.sj','.sk','.sl','.sm','.sn',
'.so','.sr','.st','.sv','.sy','.sz','.tc','.td','.tf','.tg','.th','.tj',
'.tk','.tm','.tn','.to','.tp','.tr','.tt','.tv','.tw','.tz','.ua','.ug',
'.uk','.um','.us','.uy','.uz','.va','.vc','.ve','.vg','.vi','.vn','.vu',
'.ws','.wf','.ye','.yt','.yu','.za','.zm','.zw'); 
var mai = mailids;
var val = true;

var dot = mai.lastIndexOf(".");
var ext = mai.substring(dot,mai.length);
//alert(ext);
var at = mai.indexOf("@");

if(dot > 5 && at >1)
	{
		for(var i=0; i<arr.length; i++)
		{
			if(ext == arr[i])
			{
			val = true;
			break;
			} 
			else
			{
			val = false;
			}
		}
		if(val == false)
		{
		alert("Your maild "+mai+" is not corrrrect");
		return false;
		}
	}
	else
	{
	alert("Your maild "+mai+" is not correct");
	return false;
	}

return true;
}

function validate_news()
{
		var i=0;
		var alrt="";

		  if(frmnews.title.value == "")
		  {
			 alrt +=(++i)+" : "+"Please enter the \"Title\" for news."+"\n";
		  }
		  
			  
		  if(frmnews.des_long.value == "")
		  {
			 alrt +=(++i)+" : "+"Please enter the \"Description\" for news."+"\n";
		  }

  		  if(alrt !="")
			{
			//alert(alrt.length);
			 if(i==1)
		   alrt=alrt.replace(/1:/, "");
			alert(alrt);
			return false;
			}
	
return true;
}//function

function validate_login()
{
		var i=0;
		var alrt="";

		  if(frmlogin.login.value == "")
		  {
			 alrt +=(++i)+" : "+"Please enter the \"Login Id\" ."+"\n";
		  }
		  
			  
		  if(frmlogin.pass.value == "")
		  {
			 alrt +=(++i)+" : "+"Please enter the \"Password\" ."+"\n";
		  }

  		  if(alrt !="")
			{
			//alert(alrt.length);
			 if(i==1)
		   alrt=alrt.replace(/1:/, "");
			alert(alrt);
			return false;
			}
	
return true;
}//function

function validate_login1()
{
		var i=0;
		var alrt="";

		  if(frmlogin1.login.value == "")
		  {
			 alrt +=(++i)+" : "+"Please enter the \"Login Id\" ."+"\n";
		  }
		  
			  
		  if(frmlogin1.pass.value == "")
		  {
			 alrt +=(++i)+" : "+"Please enter the \"Password\" ."+"\n";
		  }

  		  if(alrt !="")
			{
			//alert(alrt.length);
			 if(i==1)
		   alrt=alrt.replace(/1:/, "");
			alert(alrt);
			return false;
			}
	
return true;
}//function

function validate_search()
{
		var i=0;
		var alrt="";

		  if(memsearch.qsearch.value == "" && memsearch.shbycity.value == "" && memsearch.shbycom.value == "")
		  {
			 alrt +=(++i)+" : "+"Please enter text to search ."+"\n";
		  }
		  
			  
		 

  		  if(alrt !="")
			{
			//alert(alrt.length);
			 if(i==1)
		   alrt=alrt.replace(/1:/, "");
			alert(alrt);
			return false;
			}
	
return true;
}//function

function validate_pwd()
{
		var i=0;
		var alrt="";

		  			  
		  if(frmpwd.pwd.value == "")
		  {
			 alrt +=(++i)+" : "+"Please enter the \"Password\" ."+"\n";
		  }

  		  if(alrt !="")
			{
			//alert(alrt.length);
			 if(i==1)
		   alrt=alrt.replace(/1:/, "");
			alert(alrt);
			return false;
			}
	
return true;
}//function

///If Enter Is Pressed then presses button containing id=buttonid
    function clickButton(e, buttonid)
    { 
    try
    {
          var bt = document.getElementById(buttonid); 
          if (typeof bt == 'object')
          { 
                if(navigator.appName.indexOf("Netscape")>(-1))
                { 
                      if (e.keyCode == 13)
                      { 
                            bt.click(); 
                            return false; 
                      } 
                } 
                if (navigator.appName.indexOf("Microsoft Internet Explorer")>(-1))
                { 
                      if (event.keyCode == 13)
                      { 
                            bt.click(); 
                            return false; 
                      } 
                } 
          } 
        }catch(e){}
    } 

function checkblank(nm)
{
if(document.getElementById(nm).value=="")
	{
		alert("Please enter the value.");
		document.getElementById(nm).focus();
		return false;
	}else 
	{
		if(isNaN((document.getElementById(nm).value)))
		{
			alert("Please enter the numeric value.");
			document.getElementById(nm).focus();
		return false;
		}else if(document.getElementById(nm).value==0){
														alert("Please enter amount greter than 0.");
														document.getElementById(nm).focus();
														return false;
													   }
	}
	return true;
}

