function loginform_validate()
{
	if(document.loginform.user_name.value=="")
	{
		alert("Please enter user name");
		document.loginform.user_name.focus();
		return false;
	}
	else if(document.loginform.password.value=="")
	{
		alert("Please enter password");
		document.loginform.password.focus();
		return false;
	}
	else
	{
		document.loginform.action="login_process.php";
		document.loginform.submit();
	}
}

function alphanumeric_id(fldname,minlength,maxlength,msg,required)

	{

	str = fldname.value;

	if(str.length == 0){

		alert("please enter "+msg+".");

		fldname.focus();

		return false;

	}



	if(str.length < minlength){

		alert(msg+" must be at least "+minlength+" characters.");

		fldname.focus();

		return false;

	}



	if(str.length > maxlength){

		alert(msg+" allowed maximum "+maxlength+" characters.");

		fldname.focus();

		return false;

	}



/*	if(str.indexOf(" ") >= 0){

		alert("invalid "+msg+".");

		fldname.focus();

		fldname.value = "";

		return false;

	}*/



	if(str.indexOf('&') >= 0){

		alert("invalid "+msg+".");

		fldname.focus();

		fldname.value = "";

		return false;

	}



	if(str.indexOf("'") >= 0){

		alert("invalid "+msg+".");

		fldname.focus();

		fldname.value = "";

		return false;

	}



	if(str.indexOf('"') >= 0){

		alert("invalid "+msg+".");

		fldname.focus();

		fldname.value = "";

		return false;

	}



	if(str.indexOf('`') >= 0){

		alert("invalid "+msg+".");

		fldname.focus();

		fldname.value = "";

		return false;

	}

	if(str.indexOf(';') >= 0){

		alert("invalid "+msg+".");

		fldname.focus();

		fldname.value = "";

		return false;

	}



	return true;

}



function numerical_id(fldname,minlength,maxlength,minvalue,msg,required)

	{

	indx = "0123456789";

	str = fldname.value;

	if(required == 'Y')

		{

		if(str.length == 0)

			{

			alert("please enter "+msg+".");

			fldname.focus();

			return false;

		}

	}



	if((str.length > 0) && (str.length < minlength || str.length > maxlength)){

		alert(msg+" must be "+maxlength+" characters long.");

		fldname.focus();

		return false;

	}



	if(str.length > 0){

		for(i=0;i<str.length;i++){

			if(indx.indexOf(str.charAt(i)) < 0){

				alert("invalid "+msg+".");

				fldname.focus();

				return false;

			}

		}



		if(parseInt(str) < minvalue){

			alert(msg+" must be more than "+minvalue+".");

			fldname.focus();

			return false;

		}

	}

	return true;

}



function string_value(fldname,minlength,maxlength,msg,required){

	//indx = "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ.-_*!()[]{}:+,/\&# ";

	indx = "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ.-_:/,() \n";

	str = fldname.value;

	if(required == 'Y'){

		if(str.length == 0){

			alert("please enter "+msg+".");

			fldname.focus();

			return false;

		}

	}



	if((str.length >0) && (str.length < minlength)){

		alert(msg+" must not be less than "+minlength+" characters.");

		fldname.focus();

		return false;

	}



	if(str.length > maxlength){

		alert(msg+" allowed only "+maxlength+" characters.");

		fldname.focus();

		return false;

	}



	if(str.length > 0){

		for(i=0;i<str.length;i++){

			if(indx.indexOf(str.charAt(i)) < 0){

				alert("invalid "+msg+".\nSpecial Characters(! ~ @ # $ % @ ^ & * [] {} +) Not Allowed");

				fldname.focus();

				return false;

			}

		}



		/* to check whether any character exists or not*/

		flag = 0;

		for(i=0;i<str.length;i++){

			if(str.charAt(i) != " "){

				flag = 1;

				break;

			}

		}



		if(flag == 0){

			alert("please enter "+msg+".");

			fldname.focus();

			fldname.value = "";

			return false;

		}

	}

	return true;

}



function phone_fax(fldname,minlength,maxlength,msg,required)

	{

	indx = "0123456789-[](),";



	str = fldname.value;



	

	

	if(required == 'Y'){

		if(str.length == 0){

			alert("please enter "+msg+".");

			fldname.focus();

			return false;

		}

	}



if((str.length >0) && (str.length < minlength))

	{

		alert(msg+" allowed minimum "+minlength+" characters.");

		fldname.focus();

		return false;

	}





	if(str.length > maxlength){

		alert(msg+" allowed maximum "+maxlength+" characters.");

		fldname.focus();

		return false;

	}



	if(str.length > 0){

		

			/*

			if(indx.indexOf(str.charAt(0)) <= 0)

				{

				alert("invalid "+msg+".\n must start with '1-9'");

				fldname.focus();

				return false;

			}

			

			*/

			for(i=0;i<str.length;i++){

			if(indx.indexOf(str.charAt(i)) < 0){

				alert("invalid "+msg+".");

				fldname.focus();

				return false;

			}

		}

	}

	return true;

}













function email(fldname,minlength,maxlength,msg,required){

	indx = "0123456789abcdefghijklmnopqrstuvwxyz_@.";

	str = fldname.value;



	if(required == 'Y'){

		if(str.length == 0){

			alert("please enter "+msg+".");

			fldname.focus();

			return false;

		}

	}



	if(str.length > maxlength){

		alert(msg+" allowed maximum "+maxlength+" characters.");

		fldname.focus();

		return false;

	}



	if(str.length > 0){

		for(i=0;i<str.length;i++){

			if(indx.indexOf(str.charAt(i)) < 0){

				alert("invalid "+msg+".");

				fldname.focus();

				return false;

			}

		}



		if((str.indexOf('@') < 0) || (str.indexOf('.') < 0)){

			alert("invalid "+msg+".");

			fldname.focus();

			return false;			

		}



		if((str.charAt(0) == '@') || (str.charAt(0) == '.')){

			alert("invalid "+msg+".");

			fldname.focus();

			return false;

		}



		if((str.charAt(str.length-1) == '@') || (str.charAt(str.length-1) == '.')){

			alert("invalid "+msg+".");

			fldname.focus();

			return false;

		}



		if((str.indexOf('@@') >= 0) || (str.indexOf('..') >= 0)){

			alert("invalid "+msg+".");

			fldname.focus();

			return false;

		}



		if((str.indexOf('@.') >= 0) || (str.indexOf('.@') >= 0)){

			alert("invalid "+msg+".");

			fldname.focus();

			return false;

		}



		flag = 0;

		for(i=0;i<str.length;i++){

			if(str.charAt(i) == '@')

				flag++;

		}



		if(flag > 1){

			alert("invalid "+msg+".");

			fldname.focus();

			return false;

		}

	}

	return true;

}



function number(fldname,minlength,maxlength,minvalue,maxvalue,msg,required){

	indx = "0123456789";

	str = fldname.value;



	if(required == 'Y'){

		if(str.length == 0){

			alert("please enter "+msg+".");

			fldname.focus();

			return false;

		}

	}



	if(str.length < minlength){

		//alert(msg+" must not be less than "+minlength+" characters.");

		alert(msg+" must  be "+minlength+" characters.");

		fldname.focus();

		return false;

	}

	

	if(str.length > maxlength){

		alert(msg+" allowed maximum "+maxlength+" characters.");

		fldname.focus();

		return false;

	}



	if(str.length > 0){

		for(i=0;i<str.length;i++){

			if(indx.indexOf(str.charAt(i)) < 0){

				alert("invalid "+msg+".");

				fldname.focus();

				return false;

			}

		}



		if(parseInt(str) < minvalue){

			alert("invalid "+msg+".");

			fldname.focus();

			return false;

		}



		if(parseInt(str) > maxvalue){

			alert("invalid "+msg+".");

			fldname.focus();

			return false;

		}

	}

	return true;

}



function alpha_numeric_value(fldname,minlength,maxlength,msg,required){

	indx = "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ.-_ ";

	str = fldname.value;



	if(required == 'Y'){

		if(str.length == 0){

			alert("please enter "+msg+".");

			fldname.focus();

			return false;

		}

	}

    if(str.length > 0){

	if(str.length < minlength){

		alert(msg+" must be more than "+minlength+" characters.");

		fldname.focus();

		return false;

	}



	if(str.length > maxlength){

		alert(msg+" allowed maximum "+maxlength+" characters.");

		fldname.focus();

		return false;

	}

	}

	if(str.length > 0){

		for(i=0;i<str.length;i++){

			if(indx.indexOf(str.charAt(i)) < 0){

				alert("invalid "+msg+".");

				fldname.focus();

				return false;

			}

		}



		flag = 0;

		for(i=0;i<str.length;i++){

			if(str.charAt(i) != " ")

				flag++;

		}



		if(flag == 0){

			alert("please enter "+msg+".");

			fldname.focus();

			fldname.value = "";

			return false;

		}

	}

	return true;

}



function selectItem(fldname,msg){

	str = fldname.value;

	/*if(parseInt(str) == 0){

		alert(parseInt(str)+"please select "+msg+".");

		fldname.focus();

		return false;

	}*/

	if(fldname.selectedIndex == 0){

		alert("please select "+msg+".");

		fldname.focus();

		return false;

	}

	return true;

}



// not more than current date

function date_validation(fldname_yy,fldname_mm,fldname_dd,month,day,year,current_dd,current_mm,current_yy,msg){

	/*thisdate = new Date();

	mm = thisdate.getMonth()+1;

	dd = thisdate.getDate();

	yy = thisdate.getFullYear*/;



	var mm = current_mm;

	var dd = current_dd;

	var yy = current_yy;



	if(parseInt(year) > yy){

		alert("invalid "+msg+".");

		fldname_yy.focus();

		return false;

	}else if(parseInt(year) == yy){

		if(parseInt(month) > mm){

			alert("invalid "+msg+".");

			fldname_mm.focus();

			return false;

		}else if(parseInt(month) == mm){

			if(parseInt(day) > dd){

				alert("invalid "+msg+".");

				fldname_dd.focus();

				return false;

			}

		}

	}

	return true;

}



function string_value_textarea(fldname,minlength,maxlength,msg,required){

	str = fldname.value;

	if(required == 'Y'){

		if(str.length == 0){

			alert("please enter "+msg+".");

			fldname.focus();

			return false;

		}

	}



	if(str.length < minlength){

		alert(msg+" must not be less than "+minlength+" characters.");

		fldname.focus();

		return false;

	}



	if(str.length > maxlength){

		alert(msg+" allowed only "+maxlength+" characters.");

		fldname.focus();

		return false;

	}



	if(str.length > 0){

		/* to check whether any character exists or not*/

		flag = 0;

		for(i=0;i<str.length;i++){

			if(str.charAt(i) != " "){

				flag = 1;

				break;

			}

		}



		if(flag == 0){

			alert("please enter "+msg+".");

			fldname.focus();

			fldname.value = "";

			return false;

		}

	}

	return true;

}





function birthyear(fldname,minlength,maxlength,minvalue,maxvalue,msg,required){

	indx = "0123456789";

	str = fldname.value;



	if(required == 'Y'){

		if(str.length == 0){

			alert("please enter "+msg+".");

			fldname.focus();

			return false;

		}

	}



	if(str.length < minlength){

		alert(msg+" must not be less than "+minlength+" characters.");

		fldname.focus();

		return false;

	}

	

	if(str.length > maxlength){

		alert(msg+" allowed maximum "+maxlength+" characters.");

		fldname.focus();

		return false;

	}



	if(str.length > 0){

		for(i=0;i<str.length;i++){

			if(indx.indexOf(str.charAt(i)) < 0){

				alert("invalid value.");

				fldname.focus();

				return false;

			}

		}



		if(parseInt(str) < minvalue){

			alert("birth year must not be less than "+minvalue+".");

			fldname.focus();

			return false;

		}



		if(parseInt(str) > maxvalue){

			alert("below 18 years of age not allowed.");

			fldname.focus();

			return false;

		}

	}

	return true;

}



function uname_string_validation(fldname,minlength,maxlength,msg,required){

	indx = "0123456789_abcdefghijklmnopqrstuvwxyz";

	str = fldname.value;

	if(str.length == 0){

		alert("please enter "+msg+".");

		fldname.focus();

		return false;

	}



	if(str.length < minlength){

		alert(msg+" must be more than "+minlength+" characters.");

		fldname.focus();

		return false;

	}



	if(str.length > maxlength){

		alert(msg+" allowed maximum "+maxlength+" characters.");

		fldname.focus();

		return false;

	}



	if(indx.indexOf(str.charAt(0)) < 11){

				alert("Invalid "+msg+". \ Username must start with small alphabets 'a-z'.");

				fldname.focus();

				return false;

			}	



	



	if(str.length > 0){

		

		if(str.indexOf(" ") >= 0){

		alert("Invalid "+msg+". Username can not have Blank space.");

		fldname.focus();

		fldname.value = "";

		return false;

	}

		

	

		for(i=0;i<str.length;i++){

			if(indx.indexOf(str.charAt(i)) < 0){

				alert("\tInvalid "+msg+"."+"\n"+"Only letters, numbers and _ are allowed");

//				alert("invalid "+msg+". \ Username can not have blank \& special Characters.");

				fldname.focus();

				return false;

			}

		}

	}



	/*if(str.indexOf('&') >= 0){

		alert("invalid "+msg+".");

		fldname.focus();

		fldname.value = "";

		return false;

	}*/

	return true; 

}

function pan_val(fldname,minlength,maxlength,required)

{

	//indx = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ";

	indx = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";

	indx1="0123456789";

	str = fldname.value;

//alert(str.length);

	if(required == 'Y'){

		if(str.length == 0){

			alert("please enter PAN.");

			fldname.focus();

			return false;

		}

	}



	if(str.length > maxlength){

		alert(" allowed maximum "+maxlength+" characters.");

		fldname.focus();

		return false;

	}

	if(str.length < minlength){

		alert(" allowed ,minimum "+minlength+" characters.");

		fldname.focus();

		return false;

	}



      if(str.length > 0){

		for(i=0;i<5;i++){

			if(indx.indexOf(str.charAt(i)) < 0){

				alert("Please enter Your valid PAN No"+"\n eg. AAAAA4444A");

				//alert("invalid PAN"+"\n PAN must start with capital 'A-Z'.");

				//alert("Invalid "+msg+". \ Username must start with small alphabets 'a-z'.");

				fldname.focus();

				return false;

			}

		}

	  }



	  if(str.length > 0){

		for(i=5;i<9;i++){

			if(indx1.indexOf(str.charAt(i)) < 0){

				//alert("invalid PAN");

				alert("Please enter Your valid PAN No"+"\n eg. AAAAA4444A");

				//alert("invalid PAN"+"\n PAN must start with numeric '0-9'.");

				fldname.focus();

				return false;

			}

		}

	  }



	  if(str.length > 0){

		m=9;

			if(indx.indexOf(str.charAt(m)) < 0){

				//alert("invalid PAN");

				alert("Please enter Your valid PAN No"+"\n eg. AAAAA4444A");

				//alert("invalid PAN"+"\n PAN must end with capital 'A-Z'.");

				fldname.focus();

				return false;

			}

		

	  }

	return true;

}

function ifsc_val(fldname,minlength,maxlength,required){



	indx = "0123456789";

	indx1="ABCDEFGHIJKLMNOPQRSTUVWXYZ";

	str = fldname.value;



	if(required == 'Y'){

		if(str.length == 0){

			alert("please enter valid ifsc code.");

			fldname.focus();

			return false;

		}

	}



	if((str.length < minlength) || (str.length > maxlength)){

		alert("Ifsc code must be 11 characters long.");

		//fldname.focus();

		str=" ";

		return false;

	}



	if(str.length > 0){

		for(i=0;i<4;i++){

			if(indx1.indexOf(str.charAt(i)) < 0){

				alert("invalid ifsc code"+"\n Ifsc code must start with capital 'A-Z'.");

				//fldname.focus();

				str=" ";

				return false;

			}

		}

	  }

return true;

	

}





function checkboxvalidation(formName,fieldName,link1,link2,link3,required)

{

if(required == 'Y' || required == 'y')

	{



			var docformName=eval(formName)

			if(fieldName[0].checked == true)

				{

					

					docformName.action = link1;

					docformName.submit();

				}

			if(fieldName[1].checked == true)

				{

		

					docformName.action = link2;

					docformName.submit();

				}

			if(fieldName[2].checked == true)

				{

	

					docformName.action = link3;

					docformName.submit();

				}

		}

	else

	{

	return true;

	}

	

}



function onloadFocus(fieldName)

{

fieldName.focus();

}



function goback(formName,url)

{

formName.action = url;

formName.submit();

}



//checkallval('document.form1','Check_All',document.form1.scripts,'hiddenfieldname')

//checkbox name must be same and take one hidden field to post selected checkbox 

//values(that valus will go with comma),

//but u must trim that hidden value and thus u will got all checkbox values.

// in php trim(hiddenFieldsname,",")

function checkall(formname,fieldValue,form,hiddenFieldsname)

{

	var docformfield=eval(formname+"."+fieldValue)

	var dochiddenfield=eval(formname+"."+hiddenFieldsname)

	var str="";

	if(docformfield.value=='checkall')

		{

	for(i=0;i<form.length;i++)

	{

	form[i].checked=true;

	docformfield.value='uncheckall'

	str=str+","+form[i].value;

	}

	dochiddenfield.value=""+str;

	

}

else

	{

for(i=0;i<form.length;i++)

	{

	form[i].checked=false;

	docformfield.value='checkall'

	dochiddenfield.value=" ";

	}

}

}









function zipcode(fldname,minlength,maxlength,minvalue,msg,required)

	{

	indx = "0123456789";

	str = fldname.value;

	if(required == 'Y')

		{

		if(str.length == 0)

			{

			alert("please enter "+msg+".");

			fldname.focus();

			return false;

		}

	}



	if((str.length > 0) && (str.length < minlength || str.length > maxlength)){

		alert(msg+" must be "+maxlength+" characters long.");

		fldname.focus();

		return false;

	}



	if(str.length > 0){

		for(i=1;i<str.length;i++){

			if(indx.indexOf(str.charAt(0))==0){

				alert("invalid "+msg+".\n ZIP Code must start by '1-9'.");

				fldname.focus();

				return false;

			}

		

			if(indx.indexOf(str.charAt(i)) < 0){

				alert("invalid "+msg+".\n ZIP Code must be '1-9'.");

				fldname.focus();

				return false;

			}



		}



		if(parseInt(str) < minvalue){

			alert(msg+" must be more than "+minvalue+".");

			fldname.focus();

			return false;

		}

	}

	return true;

}





function bankbranch(fldname,minlength,maxlength,msg,required){

	//indx = "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ.-_*!()[]{}:+,/\&# ";

	indx = "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ|()-_:/, ";

	str = fldname.value;

	if(required == 'Y'){

		if(str.length == 0){

			alert("please enter "+msg+".");

			fldname.focus();

			return false;

		}

	}

    if(str.length > 0){

	if(str.length < minlength){

		alert(msg+" must not be less than "+minlength+" characters.");

		fldname.focus();

		return false;

	}



	if(str.length > maxlength){

		alert(msg+" allowed only "+maxlength+" characters.");

		fldname.focus();

		return false;

	}

	}

	if(str.length > 0){

		for(i=0;i<str.length;i++){

			if(indx.indexOf(str.charAt(i)) < 0){

				alert("invalid "+msg+".\nSpecial Characters(! ~ @ # $ % @ ^ & * [] {} +) Not Allowed)");

				fldname.focus();

				return false;

			}

		}



		/* to check whether any character exists or not*/

		flag = 0;

		for(i=0;i<str.length;i++){

			if(str.charAt(i) != " "){

				flag = 1;

				break;

			}

		}



		if(flag == 0){

			alert("please enter "+msg+".");

			fldname.focus();

			fldname.value = "";

			return false;

		}

	}

	return true;

}



function alphanumeric_id1(fldname,minlength,maxlength,msg,required)

	{

	str = fldname.value;

	if(str.length == 0){

		alert("please enter "+msg+".");

		fldname.focus();

		return false;

	}



	if(str.length < minlength){

		alert(msg+" must be at least "+minlength+" characters.");

		fldname.focus();

		return false;

	}



	if(str.length > maxlength){

		alert(msg+" allowed maximum "+maxlength+" characters.");

		fldname.focus();

		return false;

	}



	/*

	

	if(str.indexOf(" ") >= 0){

		alert("invalid "+msg+".");

		fldname.focus();

		fldname.value = "";

		return false;

	}

	*/



	if(str.indexOf('&') >= 0){

		alert("invalid "+msg+".");

		fldname.focus();

		fldname.value = "";

		return false;

	}



	if(str.indexOf("'") >= 0){

		alert("invalid "+msg+".");

		fldname.focus();

		fldname.value = "";

		return false;

	}



	if(str.indexOf('"') >= 0){

		alert("invalid "+msg+".");

		fldname.focus();

		fldname.value = "";

		return false;

	}



	if(str.indexOf('`') >= 0){

		alert("invalid "+msg+".");

		fldname.focus();

		fldname.value = "";

		return false;

	}

	if(str.indexOf(';') >= 0){

		alert("invalid "+msg+".");

		fldname.focus();

		fldname.value = "";

		return false;

	}



	return true;

}



function uname_string_validation_site(fldname,minlength,maxlength,msg,required)

	{

//indx = "0123456789_abcdefghijklmnopqrstuvwxyz-";//=======commented on march_05

	indx = "0123456789_abcdefghijklmnopqrstuvwxyz-.";

	str = fldname.value;

	if(str.length == 0){

		alert("please enter "+msg+".");

		fldname.focus();

		return false;

	}



	if(str.length < minlength){

		alert(msg+" must be more than "+minlength+" characters.");

		fldname.focus();

		return false;

	}



	if(str.length > maxlength){

		alert(msg+" allowed maximum "+maxlength+" characters.");

		fldname.focus();

		return false;

	}



	if(indx.indexOf(str.charAt(0)) < 11){

				alert("Invalid "+msg+". \ Username must start with small alphabets 'a-z'.");

				fldname.focus();

				return false;

			}	



	



	if(str.length > 0){

		

		if(str.indexOf(" ") >= 0){

		alert("Invalid "+msg+". Username can not have Blank space.");

		fldname.focus();

		fldname.value = "";

		return false;

	}

		

	

		for(i=0;i<str.length;i++){

			if(indx.indexOf(str.charAt(i)) < 0){

				alert("\tInvalid "+msg+"."+"\n"+"Only letters, numbers , - and _ are allowed");

//				alert("invalid "+msg+". \ Username can not have blank \& special Characters.");

				fldname.focus();

				return false;

			}

		}

	}



	/*if(str.indexOf('&') >= 0){

		alert("invalid "+msg+".");

		fldname.focus();

		fldname.value = "";

		return false;

	}*/

	return true; 

}

	

function trim(str)

{

    return str.replace(/^\s+|\s+$/g,'');

} 





function checkboxvalidation1(docformName,fieldName,link1,link2,link3,required)

{

if(required == 'Y' || required == 'y')

	{



			//var docformName=eval(formName)

			if(fieldName[0].checked == true)

				{

					

					docformName.action = link1;

					docformName.submit();

				}

			if(fieldName[1].checked == true)

				{

		

					docformName.action = link2;

					docformName.submit();

				}

			if(fieldName[2].checked == true)

				{

	

					docformName.action = link3;

					docformName.submit();

				}

		}

	else

	{

	return false;

	}

	

}



function pricevalidation(fldname,minlength,maxlength,msg,required){

	indx = "0123456789.";

	str = fldname.value;



	if(required == 'Y'){

		if(str.length == 0){

			alert("please enter "+msg+".");

			fldname.focus();

			return false;

		}

	}

	if(str.length > 0)

		{

			if(isNaN(str) == true)

			{

				alert("please enter "+msg+" in 00.00 format");

				fldname.focus();

				return false;

			}

		}



	if(str.length < minlength){

		//alert(msg+" must not be less than "+minlength+" characters.");

		alert(msg+" must  be "+minlength+" characters.");

		fldname.focus();

		return false;

	}

	

	if(str.length > maxlength){

		alert(msg+" allowed maximum "+maxlength+" characters.");

		fldname.focus();

		return false;

	}



	if(str.length > 0){

		for(i=0;i<str.length;i++){

			if(indx.indexOf(str.charAt(i)) < 0){

				alert("invalid "+msg+".");

				fldname.focus();

				return false;

			}

		}

	}

	return true;

}

function charOnly(fieldValue,field,minlength,maxlength,message)

{

  var length = fieldValue.length;

  var ch = "";

  if(length == 0){

			alert("please enter "+message+".");

			field.focus();

			return false;

		}

		if(length < minlength){

		//alert(msg+" must not be less than "+minlength+" characters.");

		alert(message+" must  be "+minlength+" characters.");

		field.focus();

		return false;

	}

	

	if(length > maxlength){

		alert(message+" allowed maximum "+maxlength+" characters.");

		field.focus();

		return false;

	}



  for (var i = 0; i < length; i++)

  {

     ch = fieldValue.substring(i, i + 1);

     if ( ((ch < "a" || "z" < ch) && (ch < "A" || "Z" < ch)) && ch != " " )

     {

       alert(message  +" "+ "accepts letters(a-z),(A-Z) and spaces.Please re-enter the value");

       field.focus();

       return (false);

     }

  }

  return (true);

}	



/*date of birth validation*/

function checkdate(d,m,y)

{

var yl=1900; // least year to consider

var ym=2012; // most year to consider

if (m<1 || m>12) return(false);

if (d<1 || d>31) return(false);

if (y<yl || y>ym) return(false);

if (m==4 || m==6 || m==9 || m==11)

if (d==31) return(false);

if (m==2)

{

var b=parseInt(y/4);

if (isNaN(b)) return(false);

if (d>29) return(false);

if (d==29 && ((y/4)!=parseInt(y/4))) return(false);

}

return(true);

}

function tid_validate()
{
	if(document.form1.tracking_id.value=="")
	{
		alert('Please enter the Distributor Id');
		document.form1.tracking_id.focus();
		return false;
	}
	if(isNaN(document.form1.tracking_id.value))
	{
		alert('The Distributor Id must be numeric');
		document.form1.tracking_id.focus();
		return false;
	}
	if(document.form1.tracking_id.value.charAt(0)!="6")
	{
		alert('Distributor Id must start with 6');
		document.form1.tracking_id.focus();
		return false;	
	}
	document.form1.submit();
}

function associate(value)
{
	var did=value;
	window.open('associate_detail.php?qs='+did,'','scrollbars=yes,width=575,height=200,screenX=0,screenY=0');
}
