// JavaScript Document
$(function(){
		var _alertColor="#FF3300"; //red
		var _noAlertColor=""; //nocolor
				
		$(':input').keyup(function () {  // (DON'T ALLOW SPECIAL CHARACTER (^,&) )
			if(this.value.search(/[&"'|]/g)>=0){
				alert("ERROR!!! Such Special Character is Not Allowed.");
				this.focus();
   			 	this.value = this.value.replace(/[&"'|]/g,'');
			}
			 });
		
//		$(":input").bind("keypress", function(e) { //START BIND FUNCTION       (DON'T ALLOW TO "ENTER key" IN INPUT TYPE FIELD )
//					if (e.which == 13 ) {
//					return false;
//					}
//					});
//				
//				$('input[numeric]').keypress(function(e){// DON'T ALLOW TO PUT ANY NON-NUMERIC
//					if((e.which >=48 && e.which <= 57) || (e.which == 46))
//						//Check the point (.) keycode is 9 or anything else.
//						{
//							return;
//						}
//						else event.keyCode = 0; //Block the key code.								  
//				 });
//				$('input[numeric]').keyup(function(){// DON'T ALLOW TO PUT ANY NON-NUMERIC
//												   
//				setformfieldsize($(this), 15, "");//VALIDATE THE MAXIMUM LENGTH 
//
//				var d=$(this).attr('numeric');
//				var value=$(this).val();
//				var orignalValue=value;
//				value=value.replace(/[0-9]*/g, "");
//				
//				var msg="Only Integer Values allowed."; 
//				
//				if (d=='decimal'){
//				  value=value.replace(/\./, "");
//				  msg="Only Numeric Values allowed.";
//				  }
//				
//				if (value!=''){
//				orignalValue=orignalValue.replace(/([^0-9].*)/g, "")
//				$(this).val(orignalValue);
//				alert(msg);
//				}
//				
//			});
//			$('input[numeric]').change(function(){//CHECK FOR MIN AND MAX LIMITATION
//			  // value is present
//			 var tval=$(this).val().trim();
//			   if (tval=='') return true;
//				 reg=/^0*/;
//				 tval=tval.replace(reg,'')
//			
//				 if (tval!='') 
//				   val=parseFloat(tval);
//				 else
//				   val=0.00;
//			//var min=parseInt($(this).attr('min'));
//			//var max=parseInt($(this).attr('max'));
//			var min='0'
//			var max='9999999999'
//			var msg="";
//			
//			if(min!='' && max!=''){
//			  msg='Input value should be in range of '+min + ' to ' + max + '.' ;
//			}
//			//else{
////			  if(min!=''){msg='Input value should be greter than or equal to'+min +'.';}
////			  
////			  else{
////				if(max!=''){msg='Input value should be less than or equal to '+ max +'.';}
////			  }
////			}
//			if(min!=''){
//			  if (min>val) {
//				alert(msg);
//				$(this).val('');
//				$(this).css('background',_alertColor);
//			  }
//			}
//			
//			if (max!=''){
//			  if (val>max) {
//			   alert(msg);
//				$(this).val('');
//				$(this).css('background',_alertColor);
//			  }
//			}
//			if (min!='' && max !=''){
//				if(min<val && val<max){
//					 $(this).css('background',_noAlertColor);
//				}
//			}
//		  });
//			
//		// Required field
//		$('input[require]').change(function () {  
//   			  str=($(this).val());
//			  if (str.trim()==''){
//				 alert('Field is Mandatory.');
//				$(this).css('background',_alertColor);
//				return false;
//			  }else{
//				  $(this).css('background',_noAlertColor);
//				  return true;
//			  }
//			  
//			 });
//		// Accept valid email ID only
//		
//		  $('input[email]').keyup(function(){
//			$(this).css('background',_noAlertColor);
//		  });
//			   
//		  $('input[email]').change(function(){
//			// value is numeric
//			str=($(this).val());        
//			var err=false;
//		
//			if (str.trim()=='') {
//				alert('Email Address Field is Mandatory.');
//				$(this).css('background',_alertColor);
//				return false;}
//			var filter=/^(("[\w-\s]+")|([\w-]+(?:\.[\w-]+)*)|("[\w-\s]+")([\w-]+(?:\.[\w-]+)*))(@((?:[\w-]+\.)*\w[\w-]{0,66})\.([a-z]{2,6}(?:\.[a-z]{2})?)$)|(@\[?((25[0-5]\.|2[0-4][0-9]\.|1[0-9]{2}\.|[0-9]{1,2}\.))((25[0-5]|2[0-4][0-9]|1[0-9]{2}|[0-9]{1,2})\.){2}(25[0-5]|2[0-4][0-9]|1[0-9]{2}|[0-9]{1,2})\]?$)/i; 
//			  
//			if ( filter.test(str) ) {
//			  err=false; }
//			else  {
//			  err=true; }
//			 
//			if(err){
//			  $(this).select();
//			  alert(str + ' is not a valid email address.');
//			  $(this).val('');
//			  $(this).css('background',_alertColor);
//			  }
//		  }); 
  });
