
function isMandatoryStrField(fieldValue){
	if(TrimString(fieldValue)==''){
		return true;
	}
}
function TrimString(sInString) {
  sInString = sInString.replace( /^\s+/g, "" );// strip leading
  return sInString.replace( /\s+$/g, "" );// strip trailing
}

function isMandatoryNumericField(numericfieldValue){
	if(numericfieldValue==0){
		return true;
	}
}

function isDigit(theDigit){

   var digitArray = new Array('0','1','2','3','4','5','6','7','8','9'),j;
   for (j = 0; j < digitArray.length; j++)
   {
     if (theDigit == digitArray[j])
     return true
   }
    return false

}

function isUnsignedInteger(s) {
return (s.toString().search(/^[0-9]+$/) == 0);
}

function isPositiveInteger(theString){
	
       var theData = new String(theString)
       if (!isDigit(theData.charAt(0)))
       if (!(theData.charAt(0)== '+'))
       return false
       for (var i = 1; i < theData.length; i++)
      	 if (!isDigit(theData.charAt(i)))
       		return false
       return true
}

function isAfterCurrentFinYear(monthValue, yearValue){

	
	var currentTime = new Date();
	var monValue = parseInt(monthValue);
	var year = currentTime.getFullYear();
	
	if(yearValue==year){
		
		if(monthValue < 4)
		 	return false;
	}
	return true;
}

function isAfterCurrentDate(monthValue, yearValue){
	var currentTime = new Date();
	var month = currentTime.getMonth() + 1;
	var year = currentTime.getFullYear();
	if(yearValue==year){
		if(monthValue<month)
		 return false;
	}
	return true;
}

function onlyIntegers(){
   if (window.event.keyCode < 48 || window.event.keyCode > 57) 
      window.event.keyCode = 0;
}
   // for disable context menu
   var message="";
   
   function clickIE() {if (document.all) {(message);return false;}}
   function clickNS(e) {if (document.layers||(document.getElementById&&!document.all)) {
     if (e.which==2||e.which==3) {(message); return false;}     
     }
   }
    if (document.layers) 
           {document.captureEvents(Event.MOUSEDOWN);document.onmousedown=clickNS;}
    else{document.onmouseup=clickNS;document.oncontextmenu=clickIE;}

     document.oncontextmenu=new Function("return false");
     //end  disable context menu
   
   document.onkeydown = mykeyhandler;

    function mykeyhandler() 
    {
      if (window.event && window.event.srcElement.tagName !='INPUT' && window.event.srcElement.tagName !='TEXTAREA' && window.event.keyCode== 8)
      {
         //Cancel the backspace
         window.event.keyCode = 0;
      }
            
      if ( (window.event.srcElement.tagName =='INPUT' || window.event.srcElement.tagName =='TEXTAREA' || window.event.srcElement.tagName =='SELECT' ) && window.event.keyCode== 8)
      {
          
          if (window.event.srcElement.readOnly!=false) //Cancel the backspace
           { 
              window.event.keyCode = 0; 
           }
           //Checkbox differs from INPUT  holds true or false value but tagName is INPUT
           if ( window.event.srcElement.type=='checkbox' && window.event.srcElement.readOnly == false ) //Cancel the backspace
           { 
                 window.event.keyCode = 0; 
           }
                          
      }
             
      if ((event.keyCode == 78) && (event.ctrlKey))
      {
              event.cancelBubble = true;
              event.returnValue = false;
              event.keyCode = false;
        }
      
   }
