var agt=navigator.userAgent.toLowerCase();
var is_ie = ((agt.indexOf("msie") != -1) && (agt.indexOf("opera") == -1));

/*for firefox */
var errorStyleFF = "#FFFFCE;";
var noErrorStyleFF = "#FFFFFF";

/* for Ie browser */
var errorStyleIE = "Formfield_lightyellow"
var noErrorStyleIE = "Formfield";

/*for setting the bgcolor of the input fileds */
function changeFieldClass(obj,styleclass){
   if ( is_ie ) {
		obj.setAttribute('className',styleclass);
	}else{
		obj.style.backgroundColor = styleclass;
	}
}

function checkall(f)
 {
	 		alert("test");
	var checkname;
	checkname=document.getElementsByName('checkid[]');
	if(f==1)
	 {
		  for(var i=0; i<checkname.length; i++) 
			{
				checkname[i].checked=checkname[i].value;
			}
			
     }
	else if(f==0)
	 {
		  for(var i=0; i<checkname.length; i++) 
		     {
			    checkname[i].checked="";
		     }
	 }
	 return false;
 } 
    function checkDate(i){
			if(i==1){
				var frmvalidator  = new Validator("frmdateselect");
				frmvalidator.addValidation("txtsdate","req",ALERTS_08);
				frmvalidator.addValidation("txtedate","req",ALERTS_09);
			}
			if(i==2){
				
				return true
			}
		    if(i==2){
				alert("3")
				return true	
			}
		    
	}  
	function none(){
		/* Nothing */
	}
	function window_open(filename) {	
		window.open(filename,"test","height=150,width=400,status=no,toolbar=no,menubar=no,location=no");
	}
	
	function stopentering(objvalue){
		if (objvalue !="" ){
			objvalue = "";
			return false;
		}
	}

	function window_openimage(path){
		//alert(path);
		window.open("viewimage.php?img="+path,700,500);
	}

	function Trim(TRIM_VALUE) {

		if(TRIM_VALUE.length < 1) {

			return"";
		}

		TRIM_VALUE = RTrim(TRIM_VALUE);
		TRIM_VALUE = LTrim(TRIM_VALUE);

		if(TRIM_VALUE=="") {

			return "";
		}
		else {

			return TRIM_VALUE;
		}
	} //End Function


	function RTrim(VALUE) {

		var w_space = String.fromCharCode(32);
		var v_length = VALUE.length;
		var strTemp = "";

		if(v_length < 0) {

			return"";
		}

		var iTemp = v_length -1;

		while(iTemp > -1) {

			if(VALUE.charAt(iTemp) == w_space) {

			}
			else {

				strTemp = VALUE.substring(0,iTemp +1);
				break;
			}

			iTemp = iTemp-1;

		} //End While

		return strTemp;

	} //End Function


	function LTrim(VALUE) {

		var w_space = String.fromCharCode(32);

		if(v_length < 1) {

			return"";
		}

		var v_length = VALUE.length;
		var strTemp = "";

		var iTemp = 0;
		
		while(iTemp < v_length) {

			if(VALUE.charAt(iTemp) == w_space) {

			}
			else {

				strTemp = VALUE.substring(iTemp,v_length);
				break;
			}

			iTemp = iTemp + 1;
		} //End While
		
		return strTemp;
	} //End Function





/* function for focusing the cursor in the next text box format (111-111-1111)*/
	function tel3(ffldname,sfldname){
			if (ffldname.value.length > 2){		
			sfldname.focus();		
			}	
	}


	

 








function Validator(frmname)
{
//alert("form");
  this.formobj=document.forms[frmname];
	if(!this.formobj)
	{
	  alert("BUG: couldnot get form object "+frmname);
		return;
	}
	if(this.formobj.onsubmit)
	{
	 this.formobj.old_onsubmit = this.formobj.onsubmit;
	 this.formobj.onsubmit=null;
	}
	else
	{
	 this.formobj.old_onsubmit = null;
	}
	this.formobj.onsubmit=form_submit_handler;
	this.addValidation = add_validation;
	this.setAddnlValidationFunction=set_addnl_vfunction;
	this.clearAllValidations = clear_all_validations;
}
function set_addnl_vfunction(functionname)
{
  this.formobj.addnlvalidation = functionname;
}
function clear_all_validations()
{
	for(var itr=0;itr < this.formobj.elements.length;itr++)
	{
		this.formobj.elements[itr].validationset = null;
	}
}
function form_submit_handler()
{
	for(var itr=0;itr < this.elements.length;itr++)
	{
		if(this.elements[itr].validationset &&
	   !this.elements[itr].validationset.validate())
		{
		  return false;
		}
	}
	if(this.addnlvalidation)
	{
	  str =" var ret = "+this.addnlvalidation+"()";
	  eval(str);
    if(!ret) return ret;
	}
	return true;
}
function add_validation(itemname,descriptor,errstr)
{
  if(!this.formobj)
	{
	  alert("BUG: the form object is not set properly");
		return;
	}//if
	var itemobj = this.formobj[itemname];
  if(!itemobj)
	{
	  alert("BUG: Couldnot get the input object named: "+itemname);
		return;
	}
	if(!itemobj.validationset)
	{
	  itemobj.validationset = new ValidationSet(itemobj);
	}
  itemobj.validationset.add(descriptor,errstr);
}
function ValidationDesc(inputitem,desc,error)
{
  this.desc=desc;
	this.error=error;
	this.itemobj = inputitem;
	this.validate=vdesc_validate;
}
function vdesc_validate()
{
 if(!V2validateData(this.desc,this.itemobj,this.error))
 {
	if(this.desc!='telephone'){
		this.itemobj.focus();
		
	}
	return false;
 }
 return true;
}
function ValidationSet(inputitem)
{
    this.vSet=new Array();
	this.add= add_validationdesc;
	this.validate= vset_validate;
	this.itemobj = inputitem;
}
function add_validationdesc(desc,error)
{
  this.vSet[this.vSet.length]= 
	  new ValidationDesc(this.itemobj,desc,error);
}
function vset_validate()
{
   for(var itr=0;itr<this.vSet.length;itr++)
	 {
	   if(!this.vSet[itr].validate())
		 {
		   return false;
		 }
	 }
	 return true;
}

function validateEmailv2(email)
{
// a very simple email validation checking. 
// you can add more complex email checking if it helps 
    if(email.length <= 0)
	{
	  return true;
	}
    var splitted = email.match("^(.+)@(.+)$");
    if(splitted == null) return false;
    if(splitted[1] != null )
    {
      var regexp_user=/^\"?[\w-_\.]*\"?$/;
      if(splitted[1].match(regexp_user) == null) return false;
    }
    if(splitted[2] != null)
    {
      var regexp_domain=/^[\w-\.]*\.[A-Za-z]{2,4}$/;
      if(splitted[2].match(regexp_domain) == null) 
      {
	    var regexp_ip =/^\[\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}\]$/;
	    if(splitted[2].match(regexp_ip) == null) return false;
      }// if
      return true;
    }
return false;
}




function ValidateTime(time)
{
// a very simple time validation checking. 
	if(time.length <= 0)
	{
	  return true;
	}
    var splitted = time.match("^(.+):(.+)$");

    if(splitted == null) return false;
    if(splitted[1]>=0 && splitted[1]<24 && splitted[1].length==2){
	 	if(splitted[2]>=0 && splitted[2]<60 && splitted[2].length==2){
     	 	return true;
		}
    }
return false;
}







function V2validateData(strValidateStr,objValue,strError) 
{ 
    var epos = strValidateStr.search("="); 
    var  command  = ""; 
    var  cmdvalue = ""; 
    if(epos >= 0) 
    { 
     command  = strValidateStr.substring(0,epos); 
     cmdvalue = strValidateStr.substr(epos+1); 
    } 
    else 
    { 
     command = strValidateStr; 
    } 
    switch(command) 
    { 
        case "req": 
        case "required": 
         { 
			if(objValue.name == "txtphone"){
				var stateid = document.getElementById("hiddenstateid").value;
				var stateObj = document.getElementById("selstate");
				//alert(stateid);
				if(stateid == ""){
					    alert(ALERTS_138);
						  if(is_ie){
							  changeFieldClass(stateObj,errorStyleIE)	
						  }else{
							  changeFieldClass(stateObj,errorStyleFF)			
						  }		
						  
						return false;
				}else{
						  if(is_ie){
							  changeFieldClass(stateObj,noErrorStyleIE)	
						  }else{
							  changeFieldClass(stateObj,noErrorStyleFF)			
						  }
				}
			}
			if(objValue.name == "zip1"){
				var stateid = document.getElementById("hiddenstateid").value;
				var stateObj = document.getElementById("selstate");
				//alert(stateid);
				if(stateid == ""){
					    alert(ALERTS_138);
						  if(is_ie){
							  changeFieldClass(stateObj,errorStyleIE)	
						  }else{
							  changeFieldClass(stateObj,errorStyleFF)			
						  }		
						  
						return false;
				}else{
						  if(is_ie){
							  changeFieldClass(stateObj,noErrorStyleIE)	
						  }else{
							  changeFieldClass(stateObj,noErrorStyleFF)			
						  }
				}
			}
			if(objValue.name == "txtshipzip"){
				var stateid = document.getElementById("hiddenshipstateid").value;
				var stateObj = document.getElementById("txtshipstate");
				//alert(stateid);
				if(stateid == ""){
					    alert(ALERTS_138+ ALERTS_135);
						  if(is_ie){
							  changeFieldClass(stateObj,errorStyleIE)	
						  }else{
							  changeFieldClass(stateObj,errorStyleFF)			
						  }						
						return false;
				}else{
						  if(is_ie){
							  changeFieldClass(stateObj,noErrorStyleIE)	
						  }else{
							  changeFieldClass(stateObj,noErrorStyleFF)			
						  }
				}
			}
			if(objValue.name == "txtbillzip"){
				var stateid = document.getElementById("hiddenbillstateid").value;
				var stateObj = document.getElementById("txtbillstate");
				//alert(stateid);
				if(stateid == ""){
					    alert(ALERTS_138+ ALERTS_136);
						  if(is_ie){
							  changeFieldClass(stateObj,errorStyleIE)	
						  }else{
							  changeFieldClass(stateObj,errorStyleFF)			
						  }						
						return false;
				}else{
						  if(is_ie){
							  changeFieldClass(stateObj,noErrorStyleIE)	
						  }else{
							  changeFieldClass(stateObj,noErrorStyleFF)			
						  }
				}
			}			
			if(objValue.name == "txtstatetax"){
				var stateid = document.getElementById("hiddenpstateid").value;
				var stateObj = document.getElementById("selpstate");
				//alert(stateid);
				if(stateid == ""){
					    alert(ALERTS_138);
						  if(is_ie){
							  changeFieldClass(stateObj,errorStyleIE)	
						  }else{
							  changeFieldClass(stateObj,errorStyleFF)			
						  }						
						return false;
				}else{
						  if(is_ie){
							  changeFieldClass(stateObj,noErrorStyleIE)	
						  }else{
							  changeFieldClass(stateObj,noErrorStyleFF)			
						  }
				}
			}		
			var str = Trim(objValue.value);
			
           if( eval(str.length) == 0) 
           { 
              if(!strError || strError.length ==0) 
              { 
                strError = objValue.name + " : Required Field"; 
              }//if 
			  alert(strError);	
			 
			  if(is_ie){
				  changeFieldClass(objValue,errorStyleIE)	
			  }else{
				  changeFieldClass(objValue,errorStyleFF)			
			  }
              return false; 
           }//if 
		   else
		   {
			  if(is_ie){
 			    changeFieldClass(objValue,noErrorStyleIE)	
			  }else{
			    changeFieldClass(objValue,noErrorStyleFF)	
			  }
		   }

           break;             
         }//case required 
		 case "requiredforbrowse": 
         { 
			var str = Trim(document.frmcustquote1.file_artwork.value);
			var str1= Trim(document.frmcustquote1.hidfileart.value);
			var value1 = document.frmcustquote1.file_artwork;
             
			  if(str1==""){  //if hidden variable is null
				  document.frmcustquote1.file_artwork.focus();
				  if( eval(str.length) == 0) 
				   { 
					  if(!strError || strError.length ==0) 
					  { 
						strError = objValue.name + " : Required Field"; 
					  }//if 
					  alert(strError); 
					  if(is_ie){
				            changeFieldClass(value1,errorStyleIE)	
			           }else{
				             changeFieldClass(value1,errorStyleFF)			
			           }
					  return false; 
				   }//if 
			  }else if(str==""){ //if no file is uploaded
				  if(str1!=""){ //if edit screen with file already uploaded
					
					//var frmvalidator1  = new Validator("frmcustquote1");	
					//frmvalidator1.addValidation("file_artwork","checkCustomQuoteType",ALERTS_206);
					
					var flag
					var filename = document.frmcustquote1.hidfileart.value;

					var revString='';
					var ext = filename.split('.')
					var t = ext[1];
				    if(filename!=""){
						for(var i = filename.length; i >= 0; i--){
							revString = revString + filename.charAt(i);
						}
						var index = revString.indexOf('.');
						var test  = revString.substring(0,index+1);
						if((test=="FIT.")||(test=="FFIT.")||(test=="fit.")||(test=="ffit.")||(test=="spe.")||(test=="SPE.")||(test=="ia.")||(test=="IA.")||(test=="dsp.")||(test=="DSP.")||(test=="fdp.")||(test=="FDP.")||(test=="piz.")||(test=="PIZ.")||(test=="cod.")||(test=="COD.")||(test=="GPJ.")||(test=="GEPJ.")||(test=="gpj.")||(test=="gepj."))
						{
							flag=1
							
						}
						else
						{
							flag=0
						}
				    }
					if(flag==0){
						  alert(ALERTS_206); 
						  if(is_ie){
				            changeFieldClass(value1,errorStyleIE)	
			               }else{
				             changeFieldClass(value1,errorStyleFF)			
			               }
						   return false;
					}
					else
					{
						if(is_ie){
							changeFieldClass(value1,noErrorStyleIE)	
						}else{
							changeFieldClass(value1,noErrorStyleFF)	
						}
					}

				  }//End of if
			  }//End of else
               else
			 {
				   if(is_ie){
							changeFieldClass(value1,noErrorStyleIE)	
					}else{
							changeFieldClass(value1,noErrorStyleFF)	
					}
			 }
           break;             
         }//case required 

		 case "requiredforbrowsedocument": 
         { 
			var str = Trim(document.frmcustomer.upload_doc.value);
			var str1= Trim(document.frmcustomer.hidupload_doc.value);
			var value1 = document.frmcustomer.upload_doc;
             
			  if(str1=="")
			 {
				  document.frmcustomer.upload_doc.focus();
				  if( eval(str.length) == 0) 
				   { 
					  if(!strError || strError.length ==0) 
					  { 
						strError = objValue.name + " : Required Field"; 
					  }//if 
					  alert(strError); 
					  if(is_ie){
				            changeFieldClass(value1,errorStyleIE)	
			           }else{
				             changeFieldClass(value1,errorStyleFF)			
			           }
					  return false; 
				   }//if
				   else
				 {
					   if(is_ie){
							changeFieldClass(value1,noErrorStyleIE)	
					    }else{
							changeFieldClass(value1,noErrorStyleFF)	
					    }
				 }
			 }

           break;             
         }//case required 
		 //sampledesign
		  case "browsesampledesign": 
         { 
			var str = Trim(document.frmfeatures.upload_file.value);
			var str1= Trim(document.frmfeatures.hidupload_file.value);
			var value1 = document.frmfeatures.upload_file;
             
			  if(str1=="")
			 {
				  document.frmfeatures.upload_file.focus();
				  if( eval(str.length) == 0) 
				   { 
					  if(!strError || strError.length ==0) 
					  { 
						strError = objValue.name + " : Required Field"; 
					  }//if 
					  alert(strError); 
					  if(is_ie){
				            changeFieldClass(value1,errorStyleIE)	
			           }else{
				             changeFieldClass(value1,errorStyleFF)			
			           }
					  return false; 
				   }//if 
				   else
				 {
					   if(is_ie){
							changeFieldClass(value1,noErrorStyleIE)	
					    }else{
							changeFieldClass(value1,noErrorStyleFF)	
					    }
				 }
			 }

           break;             
         }//case required 
        case "passrequired": 
         { 
			var str = Trim(objValue.value);
			//alert(document.frmcustomer.addedit.value)
            if(document.frmcustomer.addedit.value ==1){             
				if(document.frmcustomer.c1.checked ==true) {
					
					if( eval(str.length) == 0) 
				   { 
					  if(!strError || strError.length ==0) 
					  { 
						strError = objValue.name + " : Required Field"; 
					  }//if 
					  alert(strError); 
					  if(is_ie){
						  changeFieldClass(objValue,errorStyleIE)	
					  }else{
						  changeFieldClass(objValue,errorStyleFF)			
					  }
					  return false; 
				   }
				   else
		           {
					   	if(is_ie){
							changeFieldClass(objValue,noErrorStyleIE)	
						  }else{
							changeFieldClass(objValue,noErrorStyleFF)	
						  }
			       }
				}			
				
           }//if 
		   else if( eval(str.length) == 0) 
              { 
				  if(!strError || strError.length ==0) 
				  { 
					strError = objValue.name + " : Required Field"; 
				  }//if 
              alert(strError); 
			  if(is_ie){
				 changeFieldClass(objValue,errorStyleIE)	
			  }else{
				  changeFieldClass(objValue,errorStyleFF)			
			  }
              return false; 
			}
			else
			{				
		      if(is_ie){
					changeFieldClass(objValue,noErrorStyleIE)	
			  }else{
					changeFieldClass(objValue,noErrorStyleFF)	
			  }		
			}
           break;             
        
		 }//case required 
		case "passminlen": 
           {  
			if(document.frmcustomer.addedit.value ==1){             
				if(document.frmcustomer.c1.checked ==true) {
					 if( eval(objValue.value.length) <  eval(cmdvalue)) 
					 { 
						 if(!strError || strError.length ==0) 
						 { 
							strError = objValue.name + " : " + cmdvalue + " characters minimum  "; 
						 }//if               
						 alert(strError + "\n[Current length = " + objValue.value.length + " ]"); 
						 if(is_ie){
							 changeFieldClass(objValue,errorStyleIE)	
						  }else{
							  changeFieldClass(objValue,errorStyleFF)			
						  }
						return false;                 
				   }
				   else
					{				
					  if(is_ie){
							changeFieldClass(objValue,noErrorStyleIE)	
					  }else{
							changeFieldClass(objValue,noErrorStyleFF)	
					  }		
					}
				}
			}//if 
				else if( eval(objValue.value.length) <  eval(cmdvalue)) 
					 { 
						 if(!strError || strError.length ==0) 
						 { 
							strError = objValue.name + " : " + cmdvalue + " characters minimum  "; 
						 }//if               
						 alert(strError + "\n[Current length = " + objValue.value.length + " ]"); 
						 if(is_ie){
							 changeFieldClass(objValue,errorStyleIE)	
						  }else{
							  changeFieldClass(objValue,errorStyleFF)			
						  }
						return false; 
				    }
					else
					{				
					  if(is_ie){
							changeFieldClass(objValue,noErrorStyleIE)	
					  }else{
							changeFieldClass(objValue,noErrorStyleFF)	
					  }		
					}
				
             break; 
            }//case minlen 
			case "passmaxlen": 
           {  
			if(document.frmcustomer.addedit.value ==1){             
				if(document.frmcustomer.c1.checked ==true) {
					 if( eval(objValue.value.length) >  eval(cmdvalue)) 
					 { 
						 if(!strError || strError.length ==0) 
						 { 
							strError = objValue.name + " : " + cmdvalue + " characters minimum  "; 
						 }//if               
						 alert(strError + "\n[Current length = " + objValue.value.length + " ]"); 
						 if(is_ie){
							 changeFieldClass(objValue,errorStyleIE)	
						  }else{
							  changeFieldClass(objValue,errorStyleFF)			
						  }
						return false;                 
				   }
				   else
					{				
					  if(is_ie){
							changeFieldClass(objValue,noErrorStyleIE)	
					  }else{
							changeFieldClass(objValue,noErrorStyleFF)	
					  }		
					}
				}
			}//if 
				else if( eval(objValue.value.length) > eval(cmdvalue)) 
				{ 
						 if(!strError || strError.length ==0) 
						 { 
							strError = objValue.name + " : " + cmdvalue + " characters minimum  "; 
						 }//if               
						 alert(strError + "\n[Current length = " + objValue.value.length + " ]"); 
						  if(is_ie){
							 changeFieldClass(objValue,errorStyleIE)	
						  }else{
							  changeFieldClass(objValue,errorStyleFF)			
						  }
						return false; 
				}
				else
				{				
					  if(is_ie){
							changeFieldClass(objValue,noErrorStyleIE)	
					  }else{
							changeFieldClass(objValue,noErrorStyleFF)	
					  }		
				}
				
             break; 
            }//case minlen 
		
		case "selectrequired": 
         { 
			var str = Trim(objValue.value);		
			 //alert(str); 

           if(str=="select") 
           {    
			   //strError = objValue.name + " : Required Field"; 
			    alert(strError); 
				if(is_ie){
				   changeFieldClass(objValue,errorStyleIE)	
		  	    }else{
				  changeFieldClass(objValue,errorStyleFF)			
				 }
                 return false;
		   } 
		   else
		   {				
			  if(is_ie){
					changeFieldClass(objValue,noErrorStyleIE)	
			  }else{
					changeFieldClass(objValue,noErrorStyleFF)	
			  }		
			}        
           break;             
         }//case required 

		 case "selectadminrequired": 
         {
			var str = Trim(objValue.value);		
			 if(document.frmcustomer.seladmin.value ==1){
				if(str=="select") 
				{    
			     alert(strError); 
				 if(is_ie){
				   changeFieldClass(objValue,errorStyleIE)	
		  	     }else{
				  changeFieldClass(objValue,errorStyleFF)			
				 }
                 return false;
				 }
				 else
				 {
					 if(is_ie){
					   changeFieldClass(objValue,noErrorStyleIE)	
			         }else{
					   changeFieldClass(objValue,noErrorStyleFF)	
			         }	
				 }
			 }
          
           break;             
         }//case required 
		 
		 case "selectpricereq": 
         {
		   var str = Trim(objValue.value);		
			 alert(str); 

           if(str=="") 
           {    
			    alert(strError); 
				if(is_ie){
				   changeFieldClass(objValue,errorStyleIE)	
		  	    }else{
				  changeFieldClass(objValue,errorStyleFF)			
				 }
                 return false;
		   } 
		   else
		   {				
			  if(is_ie){
					changeFieldClass(objValue,noErrorStyleIE)	
			  }else{
					changeFieldClass(objValue,noErrorStyleFF)	
			  }		
			}     
           break;             
         }//case required 
		  case "selectorderno": 
         {
			var str = Trim(objValue.value);		
			//alert(document.frmcustomer.mailorders[1].checked);
			 if(document.frmcustomer.mailorders[1].checked == true){
				if(str=="select") 
				{    
			     alert(strError); 
				 if(is_ie){
				   changeFieldClass(objValue,errorStyleIE)	
		  	     }else{
				  changeFieldClass(objValue,errorStyleFF)			
				 }
                 return false;
				 } 
				 else
				 {
					 if(is_ie){
					   changeFieldClass(objValue,noErrorStyleIE)	
			         }else{
					   changeFieldClass(objValue,noErrorStyleFF)	
			         }	
				 }
			 }
          
           break;             
         }//case required 
		 case "selectquestion": 
         {
			
			var str = Trim(objValue.value);				
	            if(str=="select") 
				{    
			     alert(strError); 
				 if(is_ie){
				   changeFieldClass(objValue,errorStyleIE)	
		  	     }else{
				  changeFieldClass(objValue,errorStyleFF)			
				 }
                 return false;
				 }         
	             else if(str=="other")
				{
					 value1=document.frmcustomer.other;
					 if(document.frmcustomer.other.value ==""){
						 alert("Enter Other");
						 if(is_ie){
						   changeFieldClass(value1,errorStyleIE)	
						 }else{
						  changeFieldClass(value1,errorStyleFF)			
						 }
						 return false;
					 }
					 else
					{
						 if(is_ie){
					        changeFieldClass(value1,noErrorStyleIE)	
			             }else{
					        changeFieldClass(value1,noErrorStyleFF)	
			             }	
					}
				}
				else
				 {
					if(is_ie){
					   changeFieldClass(objValue,noErrorStyleIE)	
			         }else{
					   changeFieldClass(objValue,noErrorStyleFF)	
			         }	
				 }
          
           break;             
         }//case required 
        case "maxlength": 
        case "maxlen": 
          {		
             if(eval(objValue.value.length) >  eval(cmdvalue)) 
             { 
               if(!strError || strError.length ==0) 
               { 
                 strError = objValue.name + " : "+cmdvalue+" characters maximum "; 
               }//if 
               alert(strError + "\n[Current length = " + objValue.value.length + " ]"); 
			   if(is_ie){
				   changeFieldClass(objValue,errorStyleIE)	
		  	    }else{
				  changeFieldClass(objValue,errorStyleFF)			
				}	
               return false; 
             }//if 
			 else
			 {
				 if(is_ie){
					   changeFieldClass(objValue,noErrorStyleIE)	
			      }else{
					   changeFieldClass(objValue,noErrorStyleFF)	
			      }	
			 }
             break; 
          }//case maxlen 
		  
        case "minlength": 
        case "minlen": 
           { 
             if( eval(objValue.value.length) <  eval(cmdvalue)) 
             { 
               if(!strError || strError.length ==0) 
               { 
                 strError = objValue.name + " : " + cmdvalue + " characters minimum  "; 
               }//if               
               alert(strError + "\n[Current length = " + objValue.value.length + " ]"); 
			   if(is_ie){
				   changeFieldClass(objValue,errorStyleIE)	
		  	    }else{
				  changeFieldClass(objValue,errorStyleFF)			
				}	
               return false;                 
             }//if 
			 else
			 {		
				if(is_ie){
				   changeFieldClass(objValue,noErrorStyleIE)	
				}else{
				   changeFieldClass(objValue,noErrorStyleFF)	
				}	
			 }
             break; 
            }//case minlen 
		
		case "maxvalue": 
        case "maxval": 
          { 
             if(eval(objValue.value.value) > eval(cmdvalue)) 
             { 
               if(!strError || strError.length ==0) 
               { 
                 strError = objValue.name + " : "+cmdvalue+" Value maximum "; 
               }//if 
               alert(strError + "\n[Current value = " + objValue.value.value + " ]"); 
			    changeFieldClass(objValue,'Formfield_lightyellow')		
               return false; 
             }//if 
			 else
			 {		
					changeFieldClass(objValue,'Formfield')	
			 }
             break; 
          }//case maxval
		
		case "check_format": //cahck for status active or deactive
			{
				var status = objValue.value.search('status')
				if( status > 0 )
				{
					
					if(document.frmsearch.txtsearch.value !=1 && document.frmsearch.txtsearch.value!=0 )
					{
						alert("Enter 1 for Active and 0 for Deactive");
						document.frmsearch.txtsearch.focus();
						
						return false;
					}
				}
				break;
              	
			}

		
		
		case "date_format":
			{
				var status = objValue.value.search('date')
				if( status > 0 )
				{ 
					var splitted = document.frmsearch.txtsearch.value.match("^(.+)-(.+)-(.+)$");
					if (splitted != null)
					{
						var d=new Date();
						var year=d.getYear();
						/*
						if(parseInt(splitted[1])>year || 
							splitted[1].length!=4 )   ||
							(parseInt(splitted[2])<0  ||
							parseInt(splitted[2])>12  || 
							splitted[2].length!=2 )   || 
							(parseInt(splitted[3])<0  || 
							parseInt(splitted[3])>30  || 
							splitted[3].length!=2 )) {
							alert('Enter the date as yyyy-mm-dd.');
							document.frmsearch.txtsearch.focus();
							return false;
						}
						*/
						
					}
					else {
							alert('Enter the date as yyyy-mm-dd.');
							document.frmsearch.txtsearch.focus();
							return false;
					} 
				} 
				break;
			}
	
        case "chars_set": 
           {  //alert(objValue.value);
              var charpos = objValue.value.search('[\\\\/:*?"<>|]'); 
              
              if(objValue.value != '') {
	              var splval =  objValue.value.split("..");
	              var splval2 =  objValue.value.split(".");
	              splval2len = splval2.length
	              if (splval.length == 0 || objValue.value=='.' || objValue.value=='..') {
	              	alert (strError+" has invalid punctuation mark(s) (.)");
	              	return false;
	              }
	              else if (splval.length > 1 ) {
	              	alert (strError+" has invalid punctuation mark(s) (.)");
	              	return false;
	              }
	              else if (splval2[0] == "" ) {
	              	alert (strError+" has invalid punctuation mark(s) (.)");
	              	return false;
	              }
	              else if (splval2[splval2len-1] == "" ) {
	              	alert (strError+" has invalid punctuation mark(s) (.)");
	              	return false;
	              }
				  break;
              }
              
              /*
              var charpo = objValue.value.search('[\.{2,}]'); 
              if(objValue.value.length > 0 &&  charpo >= 0) {
              	alert("yes");
              }
              */
              /*
              var regexp_ip =/^\[\.{2,}\]$/;
	    		if(objValue.value.match(regexp_ip) == null) { 
	    			alert(objValue.value);
	    			return false; 
	    		}
	    		*/
              
              if(objValue.value.length > 0 &&  charpos >= 0) 
              { 
                /*if(!strError || strError.length ==0) 
                { 
                  strError = objValue.name+"  \ | : ? \" < > | Characters not allowed"; 
                }//if               
                alert(strError + "\n [Error character position " + eval(charpos+1)+"]"); */
				alert(strError+' will not allow  \\ / : * ? " < > | characters');
                return false; 
              }//if 
              break;               
           }//char set
        case "alnum": 
        case "alphanumeric": 
           { 
              var charpos = objValue.value.search('[^A-Z-,"a-z0-9/ /(/)/./]'); 
              if(objValue.value.length > 0 &&  charpos >= 0) 
              { 
               if(!strError || strError.length ==0) 
                { 
                  strError = objValue.name+": Only alpha-numeric characters allowed "; 
                }//if 
                alert(strError + "\n [Error character position " + eval(charpos+1)+"]"); 
				if(is_ie){
				   changeFieldClass(objValue,errorStyleIE)	
		  	    }else{
				  changeFieldClass(objValue,errorStyleFF)			
				}	
                return false; 
              }//if 
			  else
			  {		
					if(is_ie){
				       changeFieldClass(objValue,noErrorStyleIE)	
				    }else{
				       changeFieldClass(objValue,noErrorStyleFF)	
				    }	
			 }
              break; 
           }//case alphanumeric 
	case "alphanumeric1": 
           { 
              var charpos = objValue.value.search('[^A-Z-,"a-z0-9/ /]'); 
              if(objValue.value.length > 0 &&  charpos >= 0) 
              { 
               if(!strError || strError.length ==0) 
                { 
                  strError = objValue.name+": Only alpha-numeric characters allowed "; 
                }//if 
                alert(strError + "\n [Error character position " + eval(charpos+1)+"]"); 
				if(is_ie){
				   changeFieldClass(objValue,errorStyleIE)	
		  	    }else{
				  changeFieldClass(objValue,errorStyleFF)			
				}	
                return false; 
              }//if 
			  else
			  {		
					if(is_ie){
				       changeFieldClass(objValue,noErrorStyleIE)	
				    }else{
				       changeFieldClass(objValue,noErrorStyleFF)	
				    }	
			 }
              break; 
           }//case alphanumeric 
	case "onlyalnum": 
        case "onlyalphanumeric": 
           { 
              var charpos = objValue.value.search("[^A-Za-z0-9]"); 
              if(objValue.value.length > 0 &&  charpos >= 0) 
              { 
               if(!strError || strError.length ==0) 
                { 
                  strError = objValue.name+": Only alpha-numeric characters allowed "; 
                }//if 
                alert(strError + "\n [Error character position " + eval(charpos+1)+"]"); 
				 if(is_ie){
				   changeFieldClass(objValue,errorStyleIE)	
		  	    }else{
				  changeFieldClass(objValue,errorStyleFF)			
				}		
                return false; 
              }//if 
			  else
			 {		
					if(is_ie){
				       changeFieldClass(objValue,noErrorStyleIE)	
				    }else{
				       changeFieldClass(objValue,noErrorStyleFF)	
				    }	
			 }
              break; 
           }//case alphanumeric
        case "compare_dates_case":
        {
		
		if ( document.add_case.filing_date.value=="00-00-0000" && document.add_case.final_disposition_date.value !="00-00-0000"){
			alert ("Case Filing Date should be enter when Final Disposition Date is entered");
			return false;
		}
		else if ( (document.add_case.filing_date.value > document.add_case.final_disposition_date.value) && document.add_case.final_disposition_date.value !="00-00-0000"){
			alert ("Case Final Disposition Date should be greater than Filing Date");
			return false;
		}
		
		
        }
        break;   
        case "onlynum": 
        case "onlynumeric": 
           { 
			
              var charpos = objValue.value.search("[^0-9]"); 
              if(objValue.value.length > 0 &&  charpos >= 0) 
              {
                if(!strError || strError.length ==0) 
                { 
                  strError = objValue.name+": Only digits allowed "; 
                }//if               
                alert(strError + "\n [Error character position " + eval(charpos+1)+"]"); 
				if(is_ie){
				   changeFieldClass(objValue,errorStyleIE)	
		  	    }else{
				  changeFieldClass(objValue,errorStyleFF)			
				}	
                return false; 
              }//if 
			else
			 {		
					if(is_ie){
				       changeFieldClass(objValue,noErrorStyleIE)	
				    }else{
				       changeFieldClass(objValue,noErrorStyleFF)	
				    }	
			 }
              break;               
           }//numeric 
		  case "onlyinteger": 
           { 
              var charpos = objValue.value.search("[^0-9]"); 			 
			
			 if(objValue.value.length > 0 &&  charpos >= 0 ) 
              { 

                if(!strError || strError.length ==0) 
                { 
                  strError = objValue.name+": Only digits allowed "; 
                }//if               
                alert(strError + "\n [Error character position " + eval(charpos+1)+"]"); 
				if(is_ie){
				   changeFieldClass(objValue,errorStyleIE)	
		  	    }else{
				  changeFieldClass(objValue,errorStyleFF)			
				}
                return false; 
              }//if 
			  else if(objValue.value==0){
			      alert("Enter value greater than zero");
 	  			  if(is_ie){
					   changeFieldClass(objValue,errorStyleIE)	
				  }else{
					  changeFieldClass(objValue,errorStyleFF)			
				  }	
				  return false;
			 }
			 else
			 {		
					if(is_ie){
				       changeFieldClass(objValue,noErrorStyleIE)	
				    }else{
				       changeFieldClass(objValue,noErrorStyleFF)	
				    }	
			 }		  
			 
              break;               
           }//numeric 
        case "onlyfloat": 
           { 
              var charpos = objValue.value.search("[^0-9.]"); 
			  var splitvalue2 = objValue.value.split(".");
			  var count= splitvalue2.length;
			  var str=objValue.value.length
              if(objValue.value.length > 0 &&  charpos >= 0) 
              { 
                if(!strError || strError.length ==0) 
                { 
                  strError = objValue.name+": Only digits allowed "; 
                }//if               
                alert(strError + "\n [Error character position " + eval(charpos+1)+"]"); 
				if(is_ie){
					   changeFieldClass(objValue,errorStyleIE)	
				  }else{
					  changeFieldClass(objValue,errorStyleFF)			
				  }		
                return false; 
              }//if 
			  else if(count>1){
				 var first= splitvalue2[0].length;
				 var second=splitvalue2[1].length;
				  if(count>2){
					  alert("Enter valid value");
	    			  if(is_ie){
					    changeFieldClass(objValue,errorStyleIE)	
					   }else{
						  changeFieldClass(objValue,errorStyleFF)			
					   }	
    			      return false;
				  }
				  
				  if(first>4 || second>2)
				   {
					  alert("Enter value in the format 0000.00");
   	  			      if(is_ie){
					   changeFieldClass(objValue,errorStyleIE)	
					  }else{
						  changeFieldClass(objValue,errorStyleFF)			
					  }		
					  return false;
				   }
				 }
				 else if(str>4)
					   {
						alert("Enter value in the format 0000.00");
					    if(is_ie){
							   changeFieldClass(objValue,errorStyleIE)	
						 }else{
						     changeFieldClass(objValue,errorStyleFF)			
						 }	
					     return false;
				}
				else
			    {		
					if(is_ie){
				       changeFieldClass(objValue,noErrorStyleIE)	
				    }else{
				       changeFieldClass(objValue,noErrorStyleFF)	
				    }	
			     }	
				  
			   
              break;               
           }//numeric 
	case "num": 
        case "numeric": 
           { 
              var charpos = objValue.value.search("[^0-9-./ /(/)]"); 
              if(objValue.value.length > 0 &&  charpos >= 0) 
              { 
                if(!strError || strError.length ==0) 
                { 
                  strError = objValue.name+": Only digits allowed "; 
                }//if               
                alert(strError + "\n [Error character position " + eval(charpos+1)+"]"); 
				if(is_ie){
				  changeFieldClass(objValue,errorStyleIE)	
				}else{
				  changeFieldClass(objValue,errorStyleFF)			
				}	
                return false; 
              }//if 
			  else
			  {		
				if(is_ie){
				      changeFieldClass(objValue,noErrorStyleIE)	
				 }else{
				     changeFieldClass(objValue,noErrorStyleFF)	
				 }
			  }	
              break;               
           }//numeric 
	case "uszip": 
           { 
              var charpos = objValue.value.search("[^0-9]"); 
              if(objValue.value.length > 0 &&  (charpos >= 0 || objValue.value.length!=5)) 
              { 
			alert(strError); 
			return false; 
              }//if 
              break;               
           }//numeric 
        case "time": 
          { 
               if(!ValidateTime(objValue.value)) 
               { 
                 if(!strError || strError.length ==0) 
                 { 
                    strError = objValue.name+": Enter a valid Time address "; 
                 }//if                                               
                 alert(strError); 
                 return false; 
               }//if 
           break; 
          }//case time 

		 case "checkwebsite":
			{
				var str = Trim(objValue.value);

			       if(!str.match("http:\/\/[^@ ]+\/"))
			       { 
					   alert(strError);
					   if(is_ie){
						  changeFieldClass(objValue,errorStyleIE)	
						}else{
						  changeFieldClass(objValue,errorStyleFF)			
						}	
					    return false; 
			       }
				   else
				   {
					   if(is_ie){
							  changeFieldClass(objValue,noErrorStyleIE)	
						 }else{
							 changeFieldClass(objValue,noErrorStyleFF)	
						 }
				   }
				   break;
			}
			
        case "timecompare": 
          { 
               if(document.appointment.start_time.value!='')
			    {
				   if(document.appointment.end_time.value=='' || document.appointment.end_time.value=='00:00')
					{		
							  alert("Please enter End Time");
							  document.appointment.end_time.focus();
							  return false;
					}
				}
				
				if(document.appointment.end_time.value!='')
			    {
				   if(document.appointment.start_time.value=='' || document.appointment.start_time.value=='00:00')
					{		
							  alert("Please enter Start Time");
							  document.appointment.end_time.focus();
							  return false;
					}
				}
					if(document.appointment.start_time.value!='' && document.appointment.end_time.value!='')
					{
					  if(document.appointment.start_time.value>=document.appointment.end_time.value) 
					   { 
						 if(!strError || strError.length ==0) 
						 { 
							strError = objValue.name+": Should less than End Time "; 
						 }//if                                               
						 alert(strError); 
						 return false; 
					   }//if
					}   
           break; 
          }//case time 	   

			//validation fro compulsory selection of image */
		   case "checkimagefile":
       {		 
			var uploadfld = objValue.value;
			if(uploadfld == '') {
				alert('File should be selected.');
				return false;
			}	
			var filename = objValue.value;		
			var file_array = filename.split('\\');
			var leng = file_array.length;
			var f_st1 = file_array[leng-1];	
			var f_st_array = f_st1.split('.');
			var f_st_leng = f_st_array.length;
			var com_p = f_st_array[f_st_leng-1];			
			var fla =0;			
			var com3 = "Please upload only the following formats .jpg,.gif,.jpeg,.png";	
			var charpos = f_st1.search('[\\\\/:*?"<>|]'); 
			if(uploadfld.length > 0 &&  charpos >= 0) 
			{ 
				alert('File Name should not contain \\ / : * ? " < > | characters');
				return false; 
			}	
			var quote1= new Array("jpg","gif","jpeg","png","JPG","GIF","JPEG","PNG"); 
			fla = 1;
			for (x=0; x<quote1.length; x++) 
			{ 
				if(quote1[x]===com_p)
				{
					fla=0;
				}
			}
			if(fla == 1) {
				alert(com3);
				return false;
			}
			 
			 break;
       }//case compselect

	   //validation fro compulsory selection of image */
		   case "checkimagefile_gifjpegjpg":
       {		 
			var uploadfld = objValue.value;

			if(uploadfld!="")
		   {
			
			var filename = objValue.value;		
			var file_array = filename.split('\\');
			var leng = file_array.length;
			var f_st1 = file_array[leng-1];	
			var f_st_array = f_st1.split('.');
			var f_st_leng = f_st_array.length;
			var com_p = f_st_array[f_st_leng-1];			
			var fla =0;			
			var com3 = "Please upload only the following formats .jpg,.gif,.jpeg";	
			var charpos = f_st1.search('[\\\\/:*?"<>|]'); 
			if(uploadfld.length > 0 &&  charpos >= 0) 
			{ 
				alert('File Name should not contain \\ / : * ? " < > | characters');
				return false; 
			}	
			var quote1= new Array("jpg","gif","jpeg","JPG","GIF","JPEG"); 
			fla = 1;
			for (x=0; x<quote1.length; x++) 
			{ 
				if(quote1[x]===com_p)
				{
					fla=0;
				}
			}
			if(fla == 1) {
				alert(com3);
				return false;
			}
		   }
			 
			 break;
       }//case compselect



		/* validation for video file format*/
		case "checkvideofile":
       {		 
			var uploadfld = objValue.value;
			if(uploadfld == '') {
				alert('Video File should be selected.');
				return false;
			}	
			var filename = objValue.value;		
			var file_array = filename.split('\\');
			var leng = file_array.length;
			var f_st1 = file_array[leng-1];	
			var f_st_array = f_st1.split('.');
			var f_st_leng = f_st_array.length;
			var com_p = f_st_array[f_st_leng-1];			
			var fla =0;			
			var com3 = "Please upload only the following video formats .MPG,.MPEG,.WAV,.WMV,.AAC,.AC3,.AIF,.AIFF,.ASF,.WMA,.M1V,.M2V,.M2P,.MP1,.MP2,.MP3,.MP4,.RM,.SWF,.MPV";	
			var charpos = f_st1.search('[\\\\/:*?"<>|]'); 
			if(uploadfld.length > 0 &&  charpos >= 0) 
			{ 
				alert('File Name should not contain \\ / : * ? " < > | characters');
				return false; 
			}	
			var quote1= new Array(
			'mpg', 'mpeg', 'wav','wmv','aac','ac3','aif','aiff','asf','wma','m1v','m2v','m2p',
			'mp1','mp2','mp3','mp4','rm','swf','mpv','MPG', 'MPEG', 'WAV','WMV','AAC','AC3','AIF','AIFF','ASF','WMA','M1V','M2V','M2P',
			'MP1','MP2','MP3','MP4','RM','SWF','MPV'); 
			fla = 1;
			for (x=0; x<quote1.length; x++) 
			{ 
				if(quote1[x]===com_p)
				{
					fla=0;
				}
			}
			if(fla == 1) {
				alert(com3);
				return false;
			}
			 
			 break;              
       }//case compselect

		/* validation for audio file format*/
	   case "checkaudiofile":
       {		 
			var uploadfld = objValue.value;
			if(uploadfld == '') {
				alert('Audio File should be selected.');
				return false;
			}	
			var filename = objValue.value;		
			var file_array = filename.split('\\');
			var leng = file_array.length;
			var f_st1 = file_array[leng-1];	
			var f_st_array = f_st1.split('.');
			var f_st_leng = f_st_array.length;
			var com_p = f_st_array[f_st_leng-1];			
			var fla =0;			
			var com3 = "Please upload only the following audio formats .mp3,.wma,.aiff,.au,.mp4,.ra";	
			var charpos = f_st1.search('[\\\\/:*?"<>|]'); 
			if(uploadfld.length > 0 &&  charpos >= 0) 
			{ 
				alert('File Name should not contain \\ / : * ? " < > | characters');
				return false; 
			}	
			var quote1= new Array("mp3","wma","aiff","au","mp4","ra","MP3","WMA","AIFF","AU","WAV","RA"); 
			fla = 1;
			for (x=0; x<quote1.length; x++) 
			{ 
				if(quote1[x]===com_p)
				{
					fla=0;
				}
			}
			if(fla == 1) {
				alert(com3);
				return false;
			}
			 
			 break;
       }//case compselect

	   		/* validation for PDF file format*/
	   case "checkPdffile":
       {		 
			var uploadfld = objValue.value;
			if(uploadfld == '') {
				alert('PDF File should be selected.');
				return false;
			}	
			var filename = objValue.value;		
			var file_array = filename.split('\\');
			var leng = file_array.length;
			var f_st1 = file_array[leng-1];	
			var f_st_array = f_st1.split('.');
			var f_st_leng = f_st_array.length;
			var com_p = f_st_array[f_st_leng-1];			
			var fla =0;			
			var com3 = "Please upload only the following formats .pdf,.tif";	
			var charpos = f_st1.search('[\\\\/:*?"<>|]'); 
			if(uploadfld.length > 0 &&  charpos >= 0) 
			{ 
				alert('File Name should not contain \\ / : * ? " < > | characters');
				return false; 
			}	
			var quote1= new Array("pdf","tif","PDF","TIF"); 
			fla = 1;
			for (x=0; x<quote1.length; x++) 
			{ 
				if(quote1[x]===com_p)
				{
					fla=0;
				}
			}
			if(fla == 1) {
				alert(com3);
				return false;
			}
			 
			 break;
       }//case compselect


	   

		   case "passcompare": 
          { 
			
				if(document.chng_pass.newpass.value != '' && document.chng_pass.confirmpass.value != '' )
				{
					if(document.chng_pass.newpass.value == document.chng_pass.confirmpass.value)
					{
						var pass_change = confirm("Are you sure you want to change the password?");
						if(pass_change == true)
						{
							return true;
						}else{
							return false;
						}

					}
					else
					{
						alert("The 'New Password' and 'Confirm Password' are not matching.");
						return false;
					}
				}
	
           break; 
          }//case Password 	  
		

		
		case "checkmembertype": 
			{

				alert("hhhhhhhhhhhhhhhhhhhh")
				
              	
			}	

	case "agreeTerms":
	{     
		
		if(document.frmcustomer.txtagreeterms.checked == false){

						alert('Click the Checkbox to agree to the Terms and Conditions.');
						return false;
					}
	
	break;
	}
		case "checkrelation":
		{
			alert("haiiiiiiiiiiiii")
			var reid=document.frmnewmember.selrelation.value
				if(reid==1)
				{
				var mid=	document.frmnewmember.selmember.value
				
					if(mid!=0)
					{
						alert("The sponsorid should not be selected when u select Relationship as Prinicipal")
						
						document.frmnewmember.selmember.focus()
						return false
					}
						
				}
				break;


		}

		 case "comparepass": 
          { 
			 var myformname = objValue.form.name;
			
				if(document.forms[myformname].txtpassword.value != '' && document.forms[myformname].txtnewpass.value != '' )
				{
					if(document.forms[myformname].txtpassword.value == document.forms[myformname].txtnewpass.value)
					{
						var pass_change = confirm("Are you sure you want to change the password?");
						if(pass_change == true)
						{
							return true;
						}else{
							return false;
						}

					}
					else
					{
						alert("The 'New Password' and 'Confirm Password' are not matching.");
						return false;
					}
				}
	
           break; 
          }//case Password 	  

        case "telephone": 
          { 
			var myformname = objValue.form.name;
			var myfieldname = objValue.name;
			
			myfieldparts = myfieldname.split('_');
			
			if(strError ==''){
				strError = 'telephone';
			}
			mytel_1 = document.forms[myformname].elements[myfieldparts[0]+'_1'].value;
			mytel_2 = document.forms[myformname].elements[myfieldparts[0]+'_2'].value;
			mytel_3 = document.forms[myformname].elements[myfieldparts[0]+'_3'].value;
			/*if(objValue.name == 'telephone1_1'){
				mytel_1 = document.forms[myformname].telephone1_1.value;
				mytel_2 = document.forms[myformname].telephone1_2.value;
				mytel_3 = document.forms[myformname].telephone1_3.value;
			}else if(objValue.name == 'telephone2_1'){
				mytel_1 = document.forms[myformname].telephone2_1.value;
				mytel_2 = document.forms[myformname].telephone2_2.value;
				mytel_3 = document.forms[myformname].telephone2_3.value;
			}else if(objValue.name == 'tel1_1'){
				mytel_1 = document.forms[myformname].tel1_1.value;
				mytel_2 = document.forms[myformname].tel1_2.value;
				mytel_3 = document.forms[myformname].tel1_3.value;
			}else if(objValue.name == 'tel2_1'){
				mytel_1 = document.forms[myformname].tel2_1.value;
				mytel_2 = document.forms[myformname].tel2_2.value;
				mytel_3 = document.forms[myformname].tel2_3.value;
			}*/



			if(mytel_1!='' || mytel_2!='' || mytel_3!=''){
				
				if(mytel_1==''){
					alert('Enter '+strError+' first field');
					document.forms[myformname].elements[myfieldparts[0]+'_1'].focus();
				}else if(isnotINT(mytel_1)){
					alert('Enter only digits in '+strError+' first field');
					document.forms[myformname].elements[myfieldparts[0]+'_1'].focus();
				}else if(mytel_1.length < 3){
					alert('Enter 3 digits in '+strError+' first field');
					document.forms[myformname].elements[myfieldparts[0]+'_1'].focus();
				}else if(mytel_2==''){
					alert('Enter '+strError+' second field');
					document.forms[myformname].elements[myfieldparts[0]+'_2'].focus();
				}else if(isnotINT(mytel_2)){
					alert('Enter only digits in '+strError+' second field');
					document.forms[myformname].elements[myfieldparts[0]+'_2'].focus();
				}else if(mytel_2.length < 3){
					alert('Enter 3 digits in '+strError+' second field');
					document.forms[myformname].elements[myfieldparts[0]+'_2'].focus();
				}else if(mytel_3==''){
					alert('Enter '+strError+' third field');
					document.forms[myformname].elements[myfieldparts[0]+'_3'].focus();
				}else if(isnotINT(mytel_3)){
					alert('Enter only digits in '+strError+' third field');
					document.forms[myformname].elements[myfieldparts[0]+'_3'].focus();
				}else if(mytel_3.length < 4){
					alert('Enter 4 digits in '+strError+' third field');
					document.forms[myformname].elements[myfieldparts[0]+'_3'].focus();
				}else{
					return true;
				}
			return false;
			}
			
			
           break; 
          }//case time 	
        case "alphabetic": 
        case "alpha": 
           { 
              var charpos = objValue.value.search("[^A-Z.a-z/ / ]"); 
              if(objValue.value.length > 0 &&  charpos >= 0) 
              { 
                  if(!strError || strError.length ==0) 
                { 
                  strError = objValue.name+": Only alphabetic characters allowed "; 
                }//if                             
                alert(strError + "\n [Error character position " + eval(charpos+1)+"]"); 
				if(is_ie){
					changeFieldClass(objValue,errorStyleIE)	
				}else{
					  changeFieldClass(objValue,errorStyleFF)			
				}	
                return false; 
              }//if 
			  else
			   {
				  if(is_ie){
					changeFieldClass(objValue,noErrorStyleIE)	
				  }else{
					changeFieldClass(objValue,noErrorStyleFF)	
				  }	
			   }
              break; 
           }//alpha 
		case "alnumhyphen":
			{
              var charpos = objValue.value.search("[^A-Za-z0-9\-_]"); 
              if(objValue.value.length > 0 &&  charpos >= 0) 
              { 
                  if(!strError || strError.length ==0) 
                { 
                  strError = objValue.name+": characters allowed are A-Z,a-z,0-9,- and _"; 
                }//if                             
                alert(strError + "\n [Error character position " + eval(charpos+1)+"]"); 
                return false; 
              }//if 			
			break;
			}
        case "email": 
          { 
               if(!validateEmailv2(objValue.value)) 
               { 
                 if(!strError || strError.length ==0) 
                 { 
                    strError = objValue.name+": Enter a valid Email address "; 
                 }//if                                               
                 alert(strError); 
				 if(is_ie){
					changeFieldClass(objValue,errorStyleIE)	
				 }else{
					  changeFieldClass(objValue,errorStyleFF)			
				 }	
                 return false; 
               }//if 
			   else
			  {
				   if(is_ie){
					changeFieldClass(objValue,noErrorStyleIE)	
				   }else{
					changeFieldClass(objValue,noErrorStyleFF)	
				   }	
			  }
           break; 
          }//case email 
        case "lt": 
        case "lessthan": 
         { 
            if(isNaN(objValue.value)) 
            { 
              alert(objValue.name+": should be a number "); 
			  if(is_ie){
				changeFieldClass(objValue,errorStyleIE)	
			  }else{
				  changeFieldClass(objValue,errorStyleFF)			
			  }	
              return false; 
            }//if 
            else if(eval(objValue.value) >=  eval(cmdvalue)) 
            { 
              if(!strError || strError.length ==0) 
              { 
                strError = objValue.name + " : value should be less than "+ cmdvalue; 
              }//if               
              alert(strError); 
			  if(is_ie){
				changeFieldClass(objValue,errorStyleIE)	
			  }else{
				  changeFieldClass(objValue,errorStyleFF)			
			  }	
              return false;                 
             }//if 
			 else
			 {
				 if(is_ie){
					changeFieldClass(objValue,noErrorStyleIE)	
				   }else{
					changeFieldClass(objValue,noErrorStyleFF)	
				   }
			 }
            break; 
         }//case lessthan 
        case "gt": 
        case "greaterthan": 
         { 
            if(isNaN(objValue.value)) 
            { 
              alert(objValue.name+" should be a number ");
			  if(is_ie){
				changeFieldClass(objValue,errorStyleIE)	
			  }else{
				  changeFieldClass(objValue,errorStyleFF)			
			  }	
              return false; 
            }//if 
             else if(eval(objValue.value) <=  eval(cmdvalue)) 
             { 
               if(!strError || strError.length ==0) 
               { 
                 strError = objValue.name + " value should be greater than "+ cmdvalue; 
               }//if               
               alert(strError); 
			   if(is_ie){
				changeFieldClass(objValue,errorStyleIE)	
			   }else{
				  changeFieldClass(objValue,errorStyleFF)			
			   }	
               return false;                 
             }//if  
			 else
			 {
				  if(is_ie){
					changeFieldClass(objValue,noErrorStyleIE)	
				   }else{
					changeFieldClass(objValue,noErrorStyleFF)	
				   }
			 }
            break; 
         }//case greaterthan 
		case "greaterthan1": 
         { 
            if(isNaN(objValue.value)) 
            { 
              alert(objValue.name+" should be a number ");
			  if(is_ie){
				changeFieldClass(objValue,errorStyleIE)	
			  }else{
				  changeFieldClass(objValue,errorStyleFF)			
			  }	
              return false; 
            }//if 
             else if(eval(objValue.value) <  eval(cmdvalue)) 
             { 
               if(!strError || strError.length ==0) 
               { 
                 strError = objValue.name + " value should be greater than or equal "+ cmdvalue; 
               }//if               
               alert(strError); 
			   if(is_ie){
				changeFieldClass(objValue,errorStyleIE)	
			   }else{
				  changeFieldClass(objValue,errorStyleFF)			
			   }	
               return false;                 
             }//if  
			 else
			 {
				  if(is_ie){
					changeFieldClass(objValue,noErrorStyleIE)	
				   }else{
					changeFieldClass(objValue,noErrorStyleFF)	
				   }
			 }
            break; 
         }//case greaterthan 
        case "regexp": 
         { 
		 	if(objValue.value.length > 0)
			{
	            if(!objValue.value.match(cmdvalue)) 
	            { 
	              if(!strError || strError.length ==0)
	              {
	                strError = objValue.name+": invalid characters found ";
	              }//if
	              alert(strError);
	              return false;
	            }//if
			}
           break;
         }//case regexp
        case "dontselect":
         {
		    if(objValue.selectedIndex == null)
            {
              alert("BUG: dontselect command for non-select Item");
              return false;
            }
            if(objValue.selectedIndex == eval(cmdvalue))
            {
             if(!strError || strError.length ==0)
              {
              strError = objValue.name+": Please select one option ";
              }//if
              alert(strError);
              return false;
             }
             break;
         }//case DAnotJuly
	 case "DAnotJuly":
         {

	    if(objValue.value == 'Jul' || document.f1.frommonth.value=='DA')
            {
             if(!strError || strError.length ==0)
              {
              strError = objValue.name+": July is not valid month for DA";
              }//if
              alert(strError);
              return false;
             }
             break;
         }//case DAnotJuly


	case "compselect":
       {
		 //alert("OK");
            if(objValue.value == 'Select')
            {

	    	if(!strError || strError.length ==0)
	              {
	                strError = "Please select one option";
	              }//if
	              alert(strError);
	              return false;
	   }
             break;
         }//case compselect

	
    case "checkgender":
		{

			var gender=document.frmnewmember.selgender.value
				if(gender==-1)
			{
				alert(ALERT_49)
				return false
			}
				break;

		}

	case "checkexpirydate":
			var expmonth=	eval(document.frmdisplay.selexpmonth.value);
			var expyear =	eval(document.frmdisplay.selexpyear.value);
			var str1	=	expmonth + '-' + expyear;

			var mydate	=	new Date()
			var tm		=	eval(mydate.getMonth());
			var mydate	=	new Date()
			var ty		=	eval(mydate.getFullYear());
			var str2	=	tm + '-' + ty

			//if exp date is less than current date
			if( eval(tm+1)>eval(expmonth) ){
				if( (eval(ty)>eval(expyear)) || (eval(ty)==eval(expyear)) ){ 
					alert(ALERTS_169)
					return false;
				}
			}
		break;

	case "checkdob":
		{
			/* dob Date*/
				 var splitvalue = objValue.value.split("-");
				 var td=	splitvalue[0];
				 var tm=	splitvalue[1];
				 var ty=	splitvalue[2];
				 var dob_date	=	ty+"/"+tm+"/"+td;		
				 var dobdate	=	new Date(dob_date);
				
				/* Current date */
				 Today = new Date();
				 var year = Today.getFullYear();
				 var month = Today.getMonth()+1;
				 var date = Today.getDate();
				 var curr_date	=	year+"/"+month+"/"+date;									 
				 var currdate = new Date(curr_date);
				
				if(dobdate > currdate)
				{
						objValue.value = ""
						alert(strError);
						//objValue.focus()	
						if(is_ie){
							changeFieldClass(objValue,errorStyleIE)	
						}else{
						  changeFieldClass(objValue,errorStyleFF)			
						}	
						return false
				}			
				else
				{
					if(is_ie){
						changeFieldClass(objValue,noErrorStyleIE)	
					}else{
						changeFieldClass(objValue,noErrorStyleFF)	
					}
				}
				break;

		}

case "checkstartdate":
		{
			var t1
			var sdate=document.frmnewmember.txtstartdate.value
			var mydate	=	new Date()
			var td=	mydate.getDate()
			var tm=	mydate.getMonth()
			var month	=	tm+1
			var ty=	mydate.getYear()
		
			if(td.length<2)
			{
				 t1	=	"0"+td;
			}
			else
			{
				t1	=	td;
			}
			if(month.length<2)
			{
				tm	=	"0"+month
			}
				else
			{
				tm	=	month	
			}
		var todaydate	=	ty+"-"+tm+"-"+"-"+td



			if(sdate<todaydate)
			{
				alert(ALERT_74)
				return false
			}
				break;

		}


  case "conditionselect":
       {
	     
		 if(document.appointment.remainder[0].checked==true)
			{
            if(objValue.value == 'Select')
            {

	    		if(!strError || strError.length ==0)
	              {
	                strError = "Please select one option";
	              }//if
	              alert(strError);
	              return false;
	   		}
			}
             break;
        }//case conditionselect
	
	case "checkActive1": 
       {
		 //alert("OK");
		 if (objValue.checked==true)
		 {
			if (document.frmCandidate.iname.value.length==0)
			{
				alert("Enter incharge name"); 
                return false; 
			}
			else if (document.frmCandidate.des.value.length==0)
			{
				alert("Enter incharge designation"); 
                return false; 
			}
			else if (document.frmCandidate.email.value.length==0)
			{
				alert("Enter incharge emailid"); 
                return false; 
			}
		 }                                                            
             break; 
    }// checkActive1

	 case "checkActive2": 
       {
		 //alert("OK");
		 if (objValue.checked==true)
		 {
			if (document.frmCandidate.h_name.value.length==0)
			{
				alert("Enter head of the institute name"); 
                return false; 
			}
			else if (document.frmCandidate.h_des.value.length==0)
			{
				alert("Enter head of the institute designation"); 
                return false; 
			}
			else if (document.frmCandidate.h_email.value.length==0)
			{
				alert("Enter head of the institute emailid"); 
                return false; 
			}
		 }                                                            
       break; 
    }// checkActive2
	 case "checkActive3": 
       {
		 //alert("OK");
		 if (objValue.checked==true)
		 {
			if (document.frmCandidate.r_iname.value.length==0)
			{
				alert("Enter incharge of NSS unit name"); 
                return false; 
			}
			else if (document.frmCandidate.r_des.value.length==0)
			{
				alert("Enter NSS incharge designation"); 
                return false; 
			}
			else if (document.frmCandidate.r_email.value.length==0)
			{
				alert("Enter NSS incharge emailid"); 
                return false; 
			}
		 }                                                            
             break; 
    }// checkActive3

	 case "checkActive4": 
       {
		 //alert("OK");
		 if (objValue.checked==true)
		 {
			if (document.frmCandidate.s_iname.value.length==0)
			{
				alert("Enter student secretary  name"); 
                return false; 
			}
			else if (document.frmCandidate.s_des.value.length==0)
			{
				alert("Enter student secretary  designation"); 
                return false; 
			}
			else if (document.frmCandidate.s_email.value.length==0)
			{
				alert("Enter student secretary  emailid"); 
                return false; 
			}
		 }                                                            
             break; 
    }// checkActive4
	case "checkcasename":
	{
		if(document.add_case.errorset.value == 1)
		{
				alert("Please enter another Case Name");
				return false;
		}
		break;
	}


	


	case "check_changepass":
       {
		 //alert("OK");
			if(document.user_reg.changepass.checked == true)
			{
				if (document.user_reg.email_username.value == "")
				{
				alert("Please enter your Email-Id/User Name");
				//document.user_reg.email_username.focus();
				return false;
				}
				else if (validateEmailv2(document.user_reg.email_username.value)== false){
					alert("Please enter valid Email-Id/User Name");
					//document.user_reg.email_username.focus();
					return false;							
				}
				else if (document.user_reg.pwd.value == ""){
					alert("Password cannot be empty");
					//document.user_reg.pwd.focus();
					return false;													
				}else if (document.user_reg.pwd.value.length < 4){
					alert("Password cannot be less than 4 characters in length");
					//document.user_reg.pwd.focus();
					return false;													
				}
				
			}
             break;
       }//case compselect
	case "checkcases":
	{
		//alert("OK");
		var CaseCheckedCount = 0;
		var CaseUncheckedCount = 0;
		for(i=0;i<document.disprecs.elements.length;i++)
		{
			if(document.frmnewclient.mod[i].checked==true)
			{
				CaseCheckedCount++;
			}
			else
			{
				CaseUncheckedCount++
			}
		}
		if(CaseCheckedCount == 0)
		{
			alert(ALERT_55);
			return false;
		}
		break;
	}

	case "checkdupemail":
	{
			if(document.user_reg.emailexists.value == 1)
			{
					alert("Email specified already exists.");
					return false;
			}
			break;
	}
	case "checkroleuserreg":
	   {
		   	var CheckedCount = 0;
			var UncheckedCount = 0;
			var pastatus = document.user_reg.checkpacases.value;
			if(pastatus == 1) {
				alert("Cannot change Power Administrator Role. Try deleting Cases created by this User!");
				return false;
			}
			for(i=0; i<=document.user_reg.elements.length-1; i++)
			{
	    	// Checking of text value should not be more then selected metadatas
				if (document.user_reg.elements[i].type == "radio" && document.user_reg.elements[i].checked == true)
				{
					//alert(1);
					CheckedCount++;
				}
				else if (document.user_reg.elements[i].type == "radio" && document.user_reg.elements[i].checked == false)
				{
					//alert(2);
					UncheckedCount++;
				}
			}
			if(CheckedCount == 0)
			{
				//alert(CheckedCount);
				//alert(UncheckedCount);
				alert("Should select atleast one Group-Role for the User");
				return false;
			}
			break;	
	   }	
	   
	case "checkpassword":
		{
		    var varpassword=document.frmcustomer.password.value
			var retypepassword=document.frmcustomer.repwd.value
			var retype=document.frmcustomer.repwd
			if(document.frmcustomer.addedit.value ==1){             
				if(document.frmcustomer.c1.checked ==true) {
					if(varpassword != retypepassword)
					{
					 alert("Password should be equal to retype password")
					 if(is_ie){
							changeFieldClass(retype,errorStyleIE)	
					 }else{
						  changeFieldClass(retype,errorStyleFF)			
					 }	
					 return false
					}
					 else
					{
						 if(is_ie){
							changeFieldClass(retype,noErrorStyleIE)	
						 }else{
							changeFieldClass(retype,noErrorStyleFF)	
						 }
					}
				}
			}else{
				if(varpassword != retypepassword)
				{
				 alert("Password should be equal to retype password")
				 if(is_ie){
						changeFieldClass(retype,errorStyleIE)	
				 }else{
					  changeFieldClass(retype,errorStyleFF)			
				 }	
				 return false
				}
				 else
				{
					 if(is_ie){
						changeFieldClass(retype,noErrorStyleIE)	
					 }else{
						changeFieldClass(retype,noErrorStyleFF)	
					 }
				}
			}
		  break;
		}


	case "checkstatus":
	{
		  var status=document.frmnewmember.selstatus.value
		var startdate=	document.frmnewmember.txtstartdate.value	
		if(startdate=="")
		{
		 if(status==1)
			{
			  alert(ALERT_50)
			  return false
			}
		return false
		}
		  break;
	}


	case "checkpassword1":
		{
		  var varpassword=document.frmnewprovider.txtpassword.value
		  var retypepassword=document.frmnewprovider.txtnewpass.value
			if(varpassword != retypepassword)
			{
			  alert(ALERT_17)
			  return false
			}
		  break;
		}
   	case "checkpublicnotice":
       {
			if(document.f1.publicnotice_media.checked == false && document.f1.publicnotice_datepub.checked==false)
			{
				alert("Check Public Notice");
				return false;
			}
			else if (document.f1.publicnotice_datepub.checked==true)
			{
				if (document.f1.publicnotice_begindate.value=='')
				{
					alert("Enter Public Notice Begin Date");
					return false;
				}
				else if (document.f1.publicnotice_enddate.value=='')
				{
					alert("Enter Public Notice End Date");
					return false;
				}
				else
				{
					if (document.f1.publicnotice_begindate.value > document.f1.publicnotice_enddate.value)
					{
						alert("Public Notice Begin Date should be less then End Date");
						return false;
					}
				}
			}
             break;
       }//case compselect
	case "checkCustomQuoteType":
				//Validating for the files of type .tif, .eps, .ai, .psd, .pdf, .zip, .doc, .jpg or .jpeg 
				var flag
				var filename = objValue.value;
				var revString='';
				var ext = filename.split('.')
				var t = ext[1];
               if(filename!=""){
					for(var i = filename.length; i >= 0; i--){
						revString = revString + filename.charAt(i);
					}
					var index = revString.indexOf('.');
					var test  = revString.substring(0,index+1);
					if((test=="FIT.")||(test=="FFIT.")||(test=="fit.")||(test=="ffit.")||(test=="spe.")||(test=="SPE.")||(test=="ia.")||(test=="IA.")||(test=="dsp.")||(test=="DSP.")||(test=="fdp.")||(test=="FDP.")||(test=="piz.")||(test=="PIZ.")||(test=="cod.")||(test=="COD.")||(test=="GPJ.")||(test=="GEPJ.")||(test=="gpj.")||(test=="gepj."))
					{
						flag=1
						
					}
					else
					{
						flag=0
					}
			   }
				if(flag==0)
				{
					  alert(strError); 
					  if(is_ie){
							changeFieldClass(objValue,errorStyleIE)
					  }else{
							changeFieldClass(objValue,errorStyleFF)			
					  }
					  return false;
				}
				else
		        {
					if(is_ie){
						changeFieldClass(objValue,noErrorStyleIE)	
					}else{
						changeFieldClass(objValue,noErrorStyleFF)	
					}
				}
				break;
	case "checkImgType":
			{
				//Validating the image types only jpeg,jpg,tiff,gif,eps,pdf,psd
				var flag
				var filename = objValue.value;
				var revString='';
				var ext = filename.split('.')
				var t = ext[1];
               if(filename!=""){
					for(var i = filename.length; i >= 0; i--){
						revString = revString + filename.charAt(i);
					}
					var index = revString.indexOf('.');
					var test  = revString.substring(0,index+1);
					if((test=="FIT.")||(test=="FFIT.")||(test=="fit.")||(test=="ffit.")||(test=="spe.")||(test=="SPE.")||(test=="ia.")||(test=="IA.")||(test=="dsp.")||(test=="DSP.")||(test=="fdp.")||(test=="FDP.")||(test=="piz.")||(test=="PIZ.")||(test=="cod.")||(test=="COD.")||(test=="GPJ.")||(test=="GEPJ.")||(test=="gpj.")||(test=="gepj."))
					{//||(test=="fig.")||(test=="GIF.")
						flag=1
						
					}
					else
					{
						flag=0
					}
			   }
				if(flag==0)
				{
					  alert(strError); 
					  if(is_ie){
						   changeFieldClass(objValue,errorStyleIE)
					   }else{
						   changeFieldClass(objValue,errorStyleFF)			
					   }		
					  return false;
				}
				else
				{
					 if(is_ie){
						changeFieldClass(objValue,noErrorStyleIE)	
					 }else{
						changeFieldClass(objValue,noErrorStyleFF)	
					 }
				}
			}
			break;
			case "checkAttachType":
			{
				//Validating for the files of type .tif, .eps, .ai, .psd, .pdf, .zip, .doc, .jpg or .jpeg 
				var flag;
				var filename;
				var noofatt =  document.getElementById("noofattachments").value
				if(noofatt == ""){ noofatt=1; }

				for(var k=1; k <= noofatt; k++){
					revString = filename = test ="";

					if(k==1){ 
						foc = document.getElementById("txttt_image_path");
						filename = document.getElementById("txttt_image_path").value
					}else{
						foc = document.getElementById("txttt_image_path"+k+"[]");
						filename = document.getElementById("txttt_image_path"+k+"[]").value
					}

					if(filename!=""){
						for(var i = filename.length; i >= 0; i--){
							revString = revString + filename.charAt(i);
						}
						var index = revString.indexOf('.');
						var test  = revString.substring(0,index+1);
						if((test=="FIT.")||(test=="FFIT.")||(test=="fit.")||(test=="ffit.")||(test=="spe.")||(test=="SPE.")||(test=="ia.")||(test=="IA.")||(test=="dsp.")||(test=="DSP.")||(test=="fdp.")||(test=="FDP.")||(test=="piz.")||(test=="PIZ.")||(test=="cod.")||(test=="COD.")||(test=="GPJ.")||(test=="GEPJ.")||(test=="gpj.")||(test=="gepj.")){
							flag=1
							
						}
						else
						{
							flag=0
							foc.focus();
							alert("Attachments-"+ k + " type is not allowed, " + strError); 
							 if(is_ie){
						         changeFieldClass(foc,errorStyleIE)
					         }else{
						          changeFieldClass(foc,errorStyleFF)			
					         }	
						    return false;
						}
					}
				}//End of for loop
				if(flag==0)
				{
					  alert(strError); 
					  if(is_ie){
						  changeFieldClass(foc,errorStyleIE)
					  }else{
					          changeFieldClass(foc,errorStyleFF)			
					   }	
					  return false;
				}
				else
				{
					if(is_ie){
						changeFieldClass(foc,noErrorStyleIE)	
					 }else{
						changeFieldClass(foc,noErrorStyleFF)	
					 }
				}
			}
			break;
		case "checkDocType":
			{
				//Validating for the files of type .tif, .eps, .ai, .psd, .pdf, .zip, .doc, .jpg or .jpeg 
				var flag
				var filename = objValue.value;
				var revString='';
				var ext = filename.split('.')
				var t = ext[1];
                if(filename!=""){
					for(var i = filename.length; i >= 0; i--){
						revString = revString + filename.charAt(i);
					}
					var index = revString.indexOf('.');
					var test  = revString.substring(0,index+1);

					if((test=="FIT.")||(test=="FFIT.")||(test=="fit.")||(test=="ffit.")||(test=="spe.")||(test=="SPE.")||(test=="ia.")||(test=="IA.")||(test=="dsp.")||(test=="DSP.")||(test=="fdp.")||(test=="FDP.")||(test=="piz.")||(test=="PIZ.")||(test=="cod.")||(test=="COD.")||(test=="GPJ.")||(test=="GEPJ.")||(test=="gpj.")||(test=="gepj."))
					{
							flag=1
							
					}
					else
					{
						flag=0
					}
			    }
				if(flag==0)
				{
					  alert(strError); 
					  if(is_ie){
						   changeFieldClass(objValue,errorStyleIE)
					  }else{
						   changeFieldClass(objValue,errorStyleFF)			
					  }
					  return false;
				}
				else
				{
					if(is_ie){
						changeFieldClass(objValue,noErrorStyleIE)	
                     }else{
                         changeFieldClass(objValue,noErrorStyleFF)	
                     }
				}
			}
			break;
	case "validatebillinginfo":
		{

				var frmvalidator  = new Validator("frmshipbill");

				if( "both" != document.getElementById("address_type").value ){		
					
					/*billing validations */
					frmvalidator.addValidation("txtbillfirstname","req",ALERTS_25 + ALERTS_136);
					frmvalidator.addValidation("txtbillfirstname","alpha",ALERTS_26 + ALERTS_136);	
					frmvalidator.addValidation("txtbilllastname","req",ALERTS_27 + ALERTS_136);
					frmvalidator.addValidation("txtbilllastname","alpha",ALERTS_28 + ALERTS_136);
					
					frmvalidator.addValidation("txtbillphone","req",ALERTS_33 + ALERTS_136);
					frmvalidator.addValidation("txtbillphone","validphone",ALERTS_203);
					
					frmvalidator.addValidation("txtbillfax","validfax",ALERTS_207);
					frmvalidator.addValidation("txtbillcountry","selectrequired",ALERTS_23 + ALERTS_136);	
					frmvalidator.addValidation("txtbilladdr1","req",ALERTS_14 +"1"+ ALERTS_136);

					frmvalidator.addValidation("txtbillcity","req",ALERTS_15 + ALERTS_136);
					frmvalidator.addValidation("txtbillcity","alpha",ALERTS_16 + ALERTS_136);

					frmvalidator.addValidation("txtbillstate","selectrequired",ALERTS_21 + ALERTS_136);

					frmvalidator.addValidation("txtbillzip","req",ALERTS_17 + ALERTS_136);
					frmvalidator.addValidation("txtbillzip","onlynum",ALERTS_18 + ALERTS_136);
					frmvalidator.addValidation("txtbillzip","minlength=5","Length should be minimum 5 digits" + ALERTS_136);
					frmvalidator.addValidation("txtbillzip","maxlength=6","Length should be maximum 6 digits" + ALERTS_136);

				}//End of if loop
		}
		break;
		case "validphone":
				var var1   = objValue.value;
				//var pieces = var1.match("^-");
				var phoneRE = /^\d{3}-\d{3}-\d{4}$/;
				var match1  = var1.match(phoneRE);
				var phoneRE2 = /^\d{3}\.\d{3}\.\d{4}$/;
				var match2  = var1.match(phoneRE2);
				var phoneRE3 = /^\d{3}\d{3}\d{4,}$/;
				var match3  = var1.match(phoneRE3);

				if(match3 != null){
					if(eval(objValue.value.length) >  eval(10) ) {
						alert(ALERTS_211);

						if(is_ie){
							   changeFieldClass(objValue,errorStyleIE)
						 }else{
							   changeFieldClass(objValue,errorStyleFF)			
						 }
						return false;
					}
				}else if(match1 == null && match2 == null && match3 == null){
					alert(ALERTS_203);
					if(is_ie){
						   changeFieldClass(objValue,errorStyleIE)
					 }else{
						   changeFieldClass(objValue,errorStyleFF)			
					 }
					return false;
				}else if(eval(objValue.value.length) <  eval(10)) {
					alert(ALERTS_205);
					if(is_ie){
						   changeFieldClass(objValue,errorStyleIE)
					 }else{
						   changeFieldClass(objValue,errorStyleFF)			
					 }
					return false;
				}else if(eval(objValue.value.length) >  eval(12)) {
						alert(ALERTS_204);
					if(is_ie){
						   changeFieldClass(objValue,errorStyleIE)
					 }else{
						   changeFieldClass(objValue,errorStyleFF)			
					 }
					return false;
				}
				else
		        {
					if(is_ie){
						changeFieldClass(objValue,noErrorStyleIE)	
					}else{
						changeFieldClass(objValue,noErrorStyleFF)	
					}
				}

			break;
		case "validfax":
				var var1   = objValue.value;
				//var pieces = var1.match("^-");
				var faxRE1 = /^\d{3}(-\d{3}){1}-\d{4}$/;
				var match1  = var1.match(faxRE1);
				var faxRE2 = /^\d{3}(\.\d{3}){1}\.\d{4}$/;
				var match2  = var1.match(faxRE2);
				var faxRE3 = /^\d{3}(\d{3}){1}\d{4}$/;
				var match3  = var1.match(faxRE3);

				if(var1!=""){
					if(match3 != null){
						if(eval(objValue.value.length) >  eval(10) ) {
							alert(ALERTS_210);
							if(is_ie){
								   changeFieldClass(objValue,errorStyleIE)
							 }else{
								   changeFieldClass(objValue,errorStyleFF)			
							 }
							return false;
						}
						if(is_ie){
						  changeFieldClass(objValue,noErrorStyleIE)	
					    }else{
						  changeFieldClass(objValue,noErrorStyleFF)	
					    }
					}else if(match1 == null && match2 == null && match3 == null){
						alert(ALERTS_207);
						if(is_ie){
						   changeFieldClass(objValue,errorStyleIE)
					    }else{
						   changeFieldClass(objValue,errorStyleFF)			
					    }	
						return false;
					}else if(eval(objValue.value.length) <  eval(10)) {
						alert(ALERTS_209);
						if(is_ie){
						   changeFieldClass(objValue,errorStyleIE)
					    }else{
						   changeFieldClass(objValue,errorStyleFF)			
					    }
						return false;
					}else if(eval(objValue.value.length) >  eval(12)) {
						 alert(ALERTS_208);
						 if(is_ie){
						   changeFieldClass(objValue,errorStyleIE)
					     }else{
						   changeFieldClass(objValue,errorStyleFF)			
					     }
						return false;
					}
					else
					{
						if(is_ie){
						  changeFieldClass(objValue,noErrorStyleIE)	
					    }else{
						  changeFieldClass(objValue,noErrorStyleFF)	
					     }
					}
				}
			break;
		case "validatejobtype":
				var jobtype =	'';
				jobtype  = objValue.value;
				
				if(jobtype=="select" ){
					alert(ALERTS_107);
					if(is_ie){
						changeFieldClass(objValue,errorStyleIE)
					}else{
						changeFieldClass(objValue,errorStyleFF)			
					}
					return false;
				}else if( jobtype==7 ||  jobtype==8 ){ //if Booklets or catalogs are selected

					var frmvalidator  = new Validator("frmcustquote1");	
					frmvalidator.addValidation("txtpages","req",ALERTS_85);
					frmvalidator.addValidation("txtpages","onlynum",ALERTS_34);
					frmvalidator.addValidation("txtpages","maxlength=4",ALERTS_133);

				}else if( "others"==jobtype ){ //if Others is selected
					var str1 = document.getElementById("txtothers")
					var str = Trim(str1.value);
					var charpos = str1.value.search("[^A-Z.a-z/ / ]"); 
				   
					if( eval(str.length) == 0){ 
						alert(ALERTS_196);
						if(is_ie){
							changeFieldClass(str1,errorStyleIE)
					    }else{
							changeFieldClass(str1,errorStyleFF)			
					     }
						document.getElementById("txtothers").focus();
						return false;
				    }else if(str1.value.length > 0 &&  charpos >= 0){ 
						alert( ALERTS_173+ " For Others Job Type" );
						if(is_ie){
							changeFieldClass(str1,errorStyleIE)
					    }else{
							changeFieldClass(str1,errorStyleFF)			
					     }
						document.getElementById("txtothers").focus();
						return false;
					}
					else
					{
						if(is_ie){
							changeFieldClass(str1,noErrorStyleIE)	
						}else{
							changeFieldClass(str1,noErrorStyleFF)	
						}
					}
					//frmvalidator.addValidation("txtothers","req",ALERTS_196);
					//frmvalidator.addValidation("txtothers","alpha",ALERTS_56);
				}
				else
		       {
					if(is_ie){
						changeFieldClass(objValue,noErrorStyleIE)	
					}else{
						changeFieldClass(objValue,noErrorStyleFF)	
					}
			   }
			break;
		case "validatepaperstock":
				var stocktype =	'';
				stocktype  = objValue.value;

				if( stocktype=="select" ){
					alert(ALERTS_109);
					if(is_ie){
					   changeFieldClass(objValue,errorStyleIE)
					}else{
					   changeFieldClass(objValue,errorStyleFF)			
					}
					return false;
				}else if( stocktype=="others" ){
					var str = document.getElementById("txtpaperstock").value;
					var str1 = Trim(str);
					var str2 = document.getElementById("txtpaperstock");
					var charpos = str.search("[^A-Z.a-z/ / ]"); 

					if( eval(str.length) == 0){ 
						alert(ALERTS_198);
						if(is_ie){
							changeFieldClass(str2,errorStyleIE)
						}else{
							changeFieldClass(str2,errorStyleFF)			
						}
						document.getElementById("txtpaperstock").focus();
						return false;
				    }else if(str.length > 0 &&  charpos >= 0){ 
						alert( ALERTS_173+ " For Others Paper Stock" );
						if(is_ie){
							changeFieldClass(str2,errorStyleIE)
						}else{
							changeFieldClass(str2,errorStyleFF)			
						}
						document.getElementById("txtpaperstock").focus();
						return false;
					}
					else
					{
						if(is_ie){
							changeFieldClass(str2,noErrorStyleIE)	
						}else{
							 changeFieldClass(str2,noErrorStyleFF)	
						}
					}
					//var frmvalidator  = new Validator("frmcustquote1");	
					//frmvalidator.addValidation("txtpaperstock","req",ALERTS_198);
				}
				else
		        {
					if(is_ie){
						changeFieldClass(objValue,noErrorStyleIE)	
					}else{
						changeFieldClass(objValue,noErrorStyleFF)	
					}
				}
			break;
		case "validatefolding":
				var foldingtype =	'';
				foldingtype  = objValue.value;

				if(foldingtype=="select" ){
					alert(ALERTS_46);
					if(is_ie){
					   changeFieldClass(objValue,errorStyleIE)
					}else{
					   changeFieldClass(objValue,errorStyleFF)			
					}
					return false;
				}else if( "others"==foldingtype ){
					var str = document.getElementById("txtfolder").value;
					var str1 = Trim(str);
					var str2 = document.getElementById("txtfolder");
					var charpos = str.search("[^A-Z.a-z/ / ]"); 

					if( eval(str.length) == 0){ 
						alert(ALERTS_199);
						if(is_ie){
							changeFieldClass(str2,errorStyleIE)
						}else{
							changeFieldClass(str2,errorStyleFF)			
						}
						document.getElementById("txtfolder").focus();
						return false;
				    }else if(str.length > 0 &&  charpos >= 0){ 
						alert( ALERTS_173+ " For Others Folding" );
						if(is_ie){
							changeFieldClass(str2,errorStyleIE)
						}else{
							changeFieldClass(str2,errorStyleFF)			
						}
						document.getElementById("txtfolder").focus();
						return false;
					}
					else
					{
						if(is_ie){
							changeFieldClass(str2,noErrorStyleIE)	
						}else{
							changeFieldClass(str2,noErrorStyleFF)}
						}
				    }
					else
					{
						if(is_ie){
							changeFieldClass(objValue,noErrorStyleIE)	
						}else{
							changeFieldClass(objValue,noErrorStyleFF)	
						}
					}
			break;
}//switch 


    return true; 
}

function isnotINT(val){
 	var charpos = val.search("[^0-9]");
	if(val.length > 0 &&  charpos >= 0) { 
		return true;
	}
return false;	
}
//not in use comment by MP
/*function timecompare(formname,start,end)
{
	if(!ValidateTime(document.forms[formname].elements[start].value)) {
		//NO Code
	}
	else if(!ValidateTime(document.forms[formname].elements[end].value)) {
		//NO Code
	}
	else if((document.forms[formname].elements[start].value >= document.forms[formname].elements[end].value) && document.forms[formname].elements[start].value!='' && document.forms[formname].elements[end].value!=''){
		alert('Start time Should be Less than End time');
		return false;
	}
 return true;
}*/


