/*check for null values */
function fn_nullCheck(value,field){
		 
		if(value =="")
	 	 {
	 	  var emailMsg = "Please Confirm your Email Address"	
	 	  var message="Please enter your "+field;
	 	 if(document.getElementById("myform_actionError")) {
				document.getElementById("myform_actionError").style.display = "none";
			}
	 	  document.getElementById("myform_errorloc").style.display = "block";
	 	  if(field =="ConfirmEmail"){
	 	   document.getElementById("myform_errorloc").innerHTML =emailMsg;
	 	  }
	 	  else{
	 	  document.getElementById("myform_errorloc").innerHTML =message;
	 	  }
	
	 		window.scrollTo(0,0);
	 	  return false;
	 	 }
	  	else{
	  	  	return true;
	 	 }
		
}
/*check for numeric values */

function fn_numericCheck(value,field,max){
			var phonenumber ="";
		
			if((field == "Primary Phone Number")||(field == "Alternate Phone Number")){
			phonenumber = "Phone";
			}
			
            var message= "The "+phonenumber+" number you entered as your "+field+ " is not a valid "+max+"-digit number. Please check your information and try again";
			var Extnmessage ="The number you have entered as "+field+" contains invalid characters. Please check your information and try again";
			a=value;
			for(i=0;i<(a.length);i++)
			{
				b=a.charCodeAt(i);
				if((b<48)||(b>57))
				{					
					{
						if(document.getElementById("myform_actionError")) {
							document.getElementById("myform_actionError").style.display = "none";
						}
						document.getElementById("myform_errorloc").style.display = "block";
						if((field == "Primary Phone Number")||(field == "Alternate Phone Number")){
                        document.getElementById("myform_errorloc").innerHTML =message;
                        }
                        else if((field == "Alternate Extension")||(field == "Primary Extention")){
                        document.getElementById("myform_errorloc").innerHTML =Extnmessage;
                        }
                        else{
                        document.getElementById("myform_errorloc").innerHTML =message;
                        }
                        window.scrollTo(0,0);
                        return false;
					}
				}
			}
		return true;
}
function fn_charCheck(value,field){
		
            var message=field+" cannot have numeric values.Please check your information and try again";
			a=value;
			for(i=0;i<(a.length);i++)
			{
				b=a.charCodeAt(i);
				if(((b<65)||(b>90))&&((b<97)||(b>122)))
				{
					if(b!=32)
					{
						if(document.getElementById("myform_actionError")) {
							document.getElementById("myform_actionError").style.display = "none";
						}
						document.getElementById("myform_errorloc").style.display = "block";
                        document.getElementById("myform_errorloc").innerHTML =message;
                        window.scrollTo(0,0);
						return false;
					}
				}
			}
		return true;
}

/*check for maximum number of digits */
function fn_maxdigits(value,field,max){
	var phonenumber ="";
		
	if((field == "Primary Phone Number")||(field == "Alternate Phone Number")){
		
		phonenumber = "Phone";
	}
	//var message= "The "+phonenumber+" number you entered as your "+field+ " is not a valid "+max+"-digit number. Please check your information and try again";
	if(value.length != max){
		var message="The "+phonenumber+ " number you entered as your "+ field +" is not a valid "+max+"-digit number.Please check your information and try again.";
		if(document.getElementById("myform_actionError")) {
			document.getElementById("myform_actionError").style.display = "none";
		}
		document.getElementById("myform_errorloc").style.display = "block";
		document.getElementById("myform_errorloc").innerHTML =message;
		window.scrollTo(0,0);
		return false;
	 }
	 else{
	
	 return true;
	 }
}
function fn_extension(value,field,max){

	if(value.length>max){
		var message="The number you entered as your "+ field +"is not a valid "+max+"-digit number.Please check your information and try again.";
		if(document.getElementById("myform_actionError")) {
			document.getElementById("myform_actionError").style.display = "none";
		}
		document.getElementById("myform_errorloc").style.display = "block";
		document.getElementById("myform_errorloc").innerHTML =message;
		window.scrollTo(0,0);
		return false;
	 }
	 else{
	
	 return true;
	 }
}

function fn_isequal(value1,value2,field){

		if(value1 != value2)
	    {
	      var message=field +" and confirm "+field+" do not match.";
	      if(document.getElementById("myform_actionError")) {
				document.getElementById("myform_actionError").style.display = "none";
			}
	      document.getElementById("myform_errorloc").style.display = "block";
		  document.getElementById("myform_errorloc").innerHTML =message;
		  window.scrollTo(0,0);
	  	  return false;
	    }
	    else{
	    return true;
	    }
}

/*Email Validation */
function fn_emailIdValidation(email,field){
				var message="The email address you entered is not valid. Please re-enter your email address";
				var at="@"
				var dot="."
				var lat=email.indexOf(at)
				var lstr=email.length
				var ldot=email.indexOf(dot)
				if(document.getElementById("myform_actionError")) {
				document.getElementById("myform_actionError").style.display = "none";
			}
				if (email.indexOf(at)==-1){
					
				 document.getElementById("myform_errorloc").style.display = "block";
				 document.getElementById("myform_errorloc").innerHTML =message;
				window.scrollTo(0,0);
				    return false;
				}

				if (email.indexOf(at)==-1 || email.indexOf(at)==0 || email.indexOf(at)==lstr){
				 document.getElementById("myform_errorloc").style.display = "block";
				 document.getElementById("myform_errorloc").innerHTML =message;
				window.scrollTo(0,0);
				    return false;
				}

				if (email.indexOf(dot)==-1 || email.indexOf(dot)==0 || email.indexOf(dot)==lstr){
				 document.getElementById("myform_errorloc").style.display = "block";
				 document.getElementById("myform_errorloc").innerHTML =message;
				window.scrollTo(0,0);
				      return false;
				}

				 if (email.indexOf(at,(lat+1))!=-1){
				  document.getElementById("myform_errorloc").style.display = "block";
				  document.getElementById("myform_errorloc").innerHTML =message;
				 window.scrollTo(0,0);
				       return false;
				 }

				 if (email.substring(lat-1,lat)==dot || email.substring(lat+1,lat+2)==dot){
				  document.getElementById("myform_errorloc").style.display = "block";
				  document.getElementById("myform_errorloc").innerHTML =message;
				window.scrollTo(0,0);
				      return false;
				 }

				 if (email.indexOf(dot,(lat+2))==-1){
				  document.getElementById("myform_errorloc").style.display = "block";
				  document.getElementById("myform_errorloc").innerHTML =message;
				 window.scrollTo(0,0);
				       return false;
				 }

				 if (email.indexOf(" ")!=-1){
				  document.getElementById("myform_errorloc").style.display = "block";
				  document.getElementById("myform_errorloc").innerHTML =message;
				window.scrollTo(0,0);
				   return false;
		 }
		 else{
		 return true;
		 }
		
}

function fn_atleastonefield(check,field){
		var description = "";
		if(field == "Program Type"){
		description =" and description";
		}
		if(check == 0){
		var message="Please enter at least one " +field+description;
		if(document.getElementById("myform_actionError")) {
			document.getElementById("myform_actionError").style.display = "none";
		}
		document.getElementById("myform_errorloc").style.display = "block";
		document.getElementById("myform_errorloc").innerHTML =message;
		window.scrollTo(0,0);
		return false;
		}
		else {
		return true;
		}
}
function fn_description(check){
		if(check != 0){
		var message="Please enter Program Type description.";
		if(document.getElementById("myform_actionError")) {
			document.getElementById("myform_actionError").style.display = "none";
		}
		document.getElementById("myform_errorloc").style.display = "block";
		document.getElementById("myform_errorloc").innerHTML =message;
		window.scrollTo(0,0);
		return false;
		}
		else {
		return true;
		}
}
function fn_alphanumericCheck(val,field){
	 	var re = /^[a-zA-Z_0-9]$/;
		if (! re.test(val))
		{ 
		var message="Please enter alphanumeric values";
		if(document.getElementById("myform_actionError")) {
			document.getElementById("myform_actionError").style.display = "none";
		}
		document.getElementById("myform_errorloc").style.display = "block";
		document.getElementById("myform_errorloc").innerHTML =message;
		window.scrollTo(0,0);
		return false;
		}
		else{
		return true;
		}
}
/*check for dropdown list */
	function fn_dropDownselected(value,field){
	if(value=="Please Specify"){
	var message="Please select "+field;
	if(document.getElementById("myform_actionError")) {
		document.getElementById("myform_actionError").style.display = "none";
	}
	document.getElementById("myform_errorloc").style.display = "block";
	document.getElementById("myform_errorloc").innerHTML =message;
	window.scrollTo(0,0);
	return false;
	}
	else{
	return true;
	}
}
function fn_mandatoryCheck(required,check,field){
		if(check != required){
		var message="Answer all questions under the "+field+" section";
		if(document.getElementById("myform_actionError")) {
			document.getElementById("myform_actionError").style.display = "none";
		}
		document.getElementById("myform_errorloc").style.display = "block";
		document.getElementById("myform_errorloc").innerHTML =message;
		window.scrollTo(0,0);
		return false;
		}
		else {
		return true;
		}
}
function fn_userEnteredFAQCheck(required,check){
		if(check != required){
		var message="Please enter both question and answer";
		if(document.getElementById("myform_actionError")) {
			document.getElementById("myform_actionError").style.display = "none";
		}
		document.getElementById("myform_errorloc").style.display = "block";
		document.getElementById("myform_errorloc").innerHTML =message;
		window.scrollTo(0,0);
		return false;
		}
		else {
		return true;
		}
}

/*check for dropdown list */
	function fn_dropDownselectedForProgram(value,field){
	if((value=="%")||(value=="0")){
	var message="Please select a program type";
	if(document.getElementById("myform_actionError")) {
		document.getElementById("myform_actionError").style.display = "none";
	}
	document.getElementById("myform_errorloc").style.display = "block";
	document.getElementById("myform_errorloc").innerHTML =message;
	window.scrollTo(0,0);
	return false;
	}
	else{
	return true;
	}
}

var dtCh= "/";
var minYear=1900;
var maxYear=3000;
function isInteger(s){
	var i;
    for (i = 0; i < s.length; i++){   
        // Check that current character is number.
        var c = s.charAt(i);
        if (((c < "0") || (c > "9"))) return false;
    }
    // All characters are numbers.
    return true;
}

function stripCharsInBag(s, bag){
	var i;
    var returnString = "";
    // Search through string's characters one by one.
    // If character is not in bag, append to returnString.
    for (i = 0; i < s.length; i++){   
        var c = s.charAt(i);
        if (bag.indexOf(c) == -1) returnString += c;
    }
    return returnString;
}

function daysInFebruary (year){
	// February has 29 days in any year evenly divisible by four,
    // EXCEPT for centurial years which are not also divisible by 400.
    return (((year % 4 == 0) && ( (!(year % 100 == 0)) || (year % 400 == 0))) ? 29 : 28 );
}
function DaysArray(n) {
	for (var i = 1; i <= n; i++) {
		this[i] = 31
		if (i==4 || i==6 || i==9 || i==11) {this[i] = 30}
		if (i==2) {this[i] = 29}
   } 
   return this
}

function fn_isDate(dtStr){
	var daysInMonth = DaysArray(12)
	var pos1=dtStr.indexOf(dtCh)
	var pos2=dtStr.indexOf(dtCh,pos1+1)
	var strMonth=dtStr.substring(0,pos1)
	var strDay=dtStr.substring(pos1+1,pos2)
	var strYear=dtStr.substring(pos2+1)
	strYr=strYear
	if (strDay.charAt(0)=="0" && strDay.length>1) strDay=strDay.substring(1)
	if (strMonth.charAt(0)=="0" && strMonth.length>1) strMonth=strMonth.substring(1)
	if(document.getElementById("myform_actionError")) {
				document.getElementById("myform_actionError").style.display = "none";
			}
	
	for (var i = 1; i <= 3; i++) {
		if (strYr.charAt(0)=="0" && strYr.length>1) strYr=strYr.substring(1)
	}
	month=parseInt(strMonth)
	day=parseInt(strDay)
	year=parseInt(strYr)
	if (pos1==-1 || pos2==-1){
		var message="The date format should be : mm/dd/yyyy";
		document.getElementById("myform_errorloc").style.display = "block";
		document.getElementById("myform_errorloc").innerHTML =message;	
		window.scrollTo(0,0);
		return false
	}
	if (strMonth.length<1 || month<1 || month>12){
		var message="Please enter a valid month";
		document.getElementById("myform_errorloc").style.display = "block";
		document.getElementById("myform_errorloc").innerHTML =message;	
		window.scrollTo(0,0);
		return false
	}
	if (strDay.length<1 || day<1 || day>31 || (month==2 && day>daysInFebruary(year)) || day > daysInMonth[month]){
		var message="Please enter a valid day";
		document.getElementById("myform_errorloc").style.display = "block";
		document.getElementById("myform_errorloc").innerHTML =message;
		window.scrollTo(0,0);
		return false
	}
	if (strYear.length != 4 || year==0 || year<minYear || year>maxYear){
	    var message ="Please enter a valid year";
		//var message="Please enter a valid 4 digit year between "+minYear+" and "+maxYear;
		document.getElementById("myform_errorloc").style.display = "block";
		document.getElementById("myform_errorloc").innerHTML =message;	
		window.scrollTo(0,0);
		return false
	}
	if (dtStr.indexOf(dtCh,pos2+1)!=-1 || isInteger(stripCharsInBag(dtStr, dtCh))==false){
		var message="Please enter a valid date";
		document.getElementById("myform_errorloc").style.display = "block";
		document.getElementById("myform_errorloc").innerHTML =message;
		window.scrollTo(0,0);
		return false
	}
return true
}
function trimAllSpace(str) 
{ 
    var str1 = ''; 
    var i = 0; 
    while(i != str.length) 
    { 
        if(str.charAt(i) != ' ') 
            str1 = str1 + str.charAt(i); i ++; 
    } 
    return str1; 
}
function fn_isTime(timeStr){

strval = trimAllSpace(timeStr); 
var timePat = /^(\d{1,2}):(\d{2})(:(\d{2}))?(\s?(AM|am|PM|pm))?$/;
var matchArray = strval.match(timePat);
if (matchArray == null) {
var message="Please enter time in the format - xx:xx am-xx:xx am ";
if(document.getElementById("myform_actionError")) {
	document.getElementById("myform_actionError").style.display = "none";
}
document.getElementById("myform_errorloc").style.display = "block";
document.getElementById("myform_errorloc").innerHTML =message;
window.scrollTo(0,0);
return false;
}
hour = matchArray[1];
minute = matchArray[2];
ampm = matchArray[6];

if (ampm=="") { ampm = null }

if (hour < 0  || hour > 12) {
var message="Hour must be between 1 and 12";
if(document.getElementById("myform_actionError")) {
	document.getElementById("myform_actionError").style.display = "none";
}
document.getElementById("myform_errorloc").style.display = "block";
document.getElementById("myform_errorloc").innerHTML =message;
window.scrollTo(0,0);
return false;
}
if (hour <= 12 && ampm == null) {
var message="You must specify AM or PM.";
if(document.getElementById("myform_actionError")) {
	document.getElementById("myform_actionError").style.display = "none";
}
document.getElementById("myform_errorloc").style.display = "block";
document.getElementById("myform_errorloc").innerHTML =message;
window.scrollTo(0,0);
return false;
  
}
if (minute<0 || minute > 59) {
var message="Minute must be between 0 and 59.";
if(document.getElementById("myform_actionError")) {
	document.getElementById("myform_actionError").style.display = "none";
}
document.getElementById("myform_errorloc").style.display = "block";
document.getElementById("myform_errorloc").innerHTML =message;
window.scrollTo(0,0);
return false;
}
return true;
}

function fn_isCost(costStr) {
a=costStr;
costStr1 = costStr.toString().replace(/[$,]/g, '')*1;
if(document.getElementById("myform_actionError")) {
	document.getElementById("myform_actionError").style.display = "none";
}
if(a.length==1 ){
var message="Please enter a valid cost for the course added";
document.getElementById("myform_errorloc").style.display = "block";
document.getElementById("myform_errorloc").innerHTML =message;
window.scrollTo(0,0);
return false;
}
			for(i=0;i<(a.length);i++)
			{
			if(i==0){
			b=a.charCodeAt(0);
			if(b!=36){
			var message="Please enter cost in the format $XXX.XX";
			document.getElementById("myform_errorloc").style.display = "block";
			document.getElementById("myform_errorloc").innerHTML =message;
			window.scrollTo(0,0);
				return false;		
			}
			}
			}
			if(isNaN(costStr1)){
			var message="Please enter a valid cost for the course added";
			document.getElementById("myform_errorloc").style.display = "block";
			document.getElementById("myform_errorloc").innerHTML =message;	
			window.scrollTo(0,0);
			return false;
			}
return true;
}
function fn_isDay(dayStr) {
	if(document.getElementById("myform_actionError")) {
		document.getElementById("myform_actionError").style.display = "none";
	}
var day = dayStr.split(",");
for(i=0;i<day.length;i++){
var  temp = day[i].toUpperCase();
switch (temp) {
    case 'M': break;   
    case 'T': break;
    case 'W': break;
    case 'TH':break ;
    case 'F': break;    
    case 'SAT':break ;
    case 'SUN': break;
    default:
  	var message="Day format is not valid. Enter M,T,W,TH,F,SAT,SUN for Monday,Tuesday,Wednesday,Thursday,Friday, Saturday and Sunday respectively";
	document.getElementById("myform_errorloc").style.display = "block";
	document.getElementById("myform_errorloc").innerHTML =message;	
	window.scrollTo(0,0);
    return false;
}
}
    return true;
}
function fn_endDate(enddate) { 

	var itemValue=enddate;
	var fieldArray = itemValue.split("/");
	var today = new Date();
	var sysdate=new Date(today.getFullYear(),today.getMonth(),today.getDate(),0,0,0);
	var inputdate=new Date(parseInt(fieldArray[2]),parseInt(fieldArray[0])-1,parseInt(fieldArray[1]),0,0,0);
	days=Math.round((inputdate.getTime()-sysdate.getTime())/1000/60.0/60.0/24.0);
	if(days<0){
	var message="End date cannot be a past date";
	if(document.getElementById("myform_actionError")) {
		document.getElementById("myform_actionError").style.display = "none";
	}
	document.getElementById("myform_errorloc").style.display = "block";
	document.getElementById("myform_errorloc").innerHTML =message;	
	window.scrollTo(0,0);
	return false;
}
return true;
}
function fn_compareDates(startdate,enddate) { 
var startdateArray = startdate.split("/");
var enddateArray = enddate.split("/");

var today = new Date();
var startDate=new Date(parseInt(startdateArray[2]),parseInt(startdateArray[0])-1,parseInt(startdateArray[1]),0,0,0);
var endDate=new Date(parseInt(enddateArray[2]),parseInt(enddateArray[0])-1,parseInt(enddateArray[1]),0,0,0);

days=Math.round((endDate.getTime()-startDate.getTime())/1000/60.0/60.0/24.0);
if(days<0){

var message="Start Date cannot be greater than End date";
if(document.getElementById("myform_actionError")) {
	document.getElementById("myform_actionError").style.display = "none";
}
	document.getElementById("myform_errorloc").style.display = "block";
	document.getElementById("myform_errorloc").innerHTML =message;	
	window.scrollTo(0,0);
return false;
}

return true;
}

function fn_compareTimes(startTime,endTime){
var starttime = trimAllSpace(startTime); 
var endtime = trimAllSpace(endTime); 

var timePat = /^(\d{1,2}):(\d{2})(:(\d{2}))?(\s?(AM|am|PM|pm))?$/;
var startmatchArray = starttime.match(timePat);
var endmatchArray = endtime.match(timePat);
var starthour = startmatchArray[1];
var startminute = startmatchArray[2];
var startampm = startmatchArray[6];
var endhour = endmatchArray[1];
var endminute = endmatchArray[2];
var endampm= endmatchArray[6];

if(startampm == endampm){
if(starthour==12){
starthour=0;
}

if(starthour > endhour ){
var message="End time should be greater than start time";
if(document.getElementById("myform_actionError")) {
	document.getElementById("myform_actionError").style.display = "none";
}
document.getElementById("myform_errorloc").style.display = "block";
document.getElementById("myform_errorloc").innerHTML =message;
window.scrollTo(0,0);
return false;
}
else if(starthour == endhour){
var diff = endminute - startminute;
if(diff < 15){
var message="A difference of at least 15 minutes should be present between start time and end time";
if(document.getElementById("myform_actionError")) {
	document.getElementById("myform_actionError").style.display = "none";
}
document.getElementById("myform_errorloc").style.display = "block";
document.getElementById("myform_errorloc").innerHTML =message;
window.scrollTo(0,0);
return false;
}
}
}
return true;
}
function fn_nullCheckRejectionRemark(value,field,context){
		if(value =="")
	 	{
	 		var errorMsg = "Section \""+field+"\" cannot be left blank. Please fill in the reasons for rejecting the "+context+" details."	
	 	 	if(document.getElementById("myform_actionError")) {
				document.getElementById("myform_actionError").style.display = "none";
			}
	 	  	document.getElementById("myform_errorloc").style.display = "block";
	 	 	document.getElementById("myform_errorloc").innerHTML =errorMsg;
	 	 	window.scrollTo(0,0);
	 	  	return false;
	 	 }
	  	 else{
	  	  	  	return true;
	 	 }
}
function fn_nullCheckRejRmrkRvwDelSchl(value,field,context){
		if(value =="")
	 	{
	 		var errorMsg = "Please fill in the reasons for rejecting the "+field+"  under \""+context+"\" section."	
	 	 	if(document.getElementById("myform_actionError")) {
				document.getElementById("myform_actionError").style.display = "none";
			}
	 	  	document.getElementById("myform_errorloc").style.display = "block";
	 	 	document.getElementById("myform_errorloc").innerHTML =errorMsg;
	 	 	window.scrollTo(0,0);
	 	  	return false;
	 	 }
	  	 else{
	  	  	  	return true;
	 	 }
}
function fn_formatTime(timeObj)
{		 
		 var time=timeObj.value;
		 var splittedTime = time.split("-");	  
		 var startTime = splittedTime[0];
		 var endTime = splittedTime[1];
    	 
    	 startTime = fn_fmtTime(startTime); 
		 endTime = fn_fmtTime(endTime);
		  
		 if (startTime != null && endTime != null)
		 {
		 		time = startTime + "-" + endTime;
		  		
		 }
		 timeObj.value = time;
		 return time;
}
function fn_fmtTime(time)
{
		  var trimmedTime = trimAllSpace(time); 
		  var timePat = /^(\d{1,2}):(\d{1,2})(:(\d{2}))?(\s?(AM|am|PM|pm))?$/;
          var timeMatchArray = trimmedTime.match(timePat);
          
          if (timeMatchArray == null)
          {
          		return null;
          }
          var hour = timeMatchArray[1];
          if ((hour != null) && (hour.length == 1 ))
          {
          		trimmedTime = "0" + trimmedTime;
          }
          var min = timeMatchArray[2];
          
          if ((min != null) && (min.length == 1 ))
          {
          		tempTime = trimmedTime.split(":");
          		
          		trimmedTime = tempTime[0] + ":0" + min + " "+ timeMatchArray[6];
          }
          
          return trimmedTime;
}
/* The following function fixes the issues of IE browser for the getElementsByName functionality */
function getElementsByName_iefix(tag, name) {
     
     var elem = document.getElementsByTagName(tag);
     var arr = new Array();
     for(i = 0,iarr = 0; i < elem.length; i++) {
          att = elem[i].getAttribute("name");
          if(att == name) {
               arr[iarr] = elem[i];
               iarr++;
           
          }
     }
     return arr;
}


function fn_phoneFormatCheck(value,field){
		var code; 
		var phone1;
		var phone2;
		var message="The number you have entered as your "+ field + " is not a valid 10-digit number.Please enter in the format xxx-xxx-xxxx or xxxxxxxxxx";
		
		if(value.length==12){
		
		fourthCharacter =value.charCodeAt(3);
		eighthCharacter =value.charCodeAt(7);
		
			if((fourthCharacter==45)&&(eighthCharacter==45)){
			code =value.substring(0,3);
			phone1 =value.substring(4,7);
			phone2 =value.substring(8,12);
			tempPhNumber1 =code+phone1+phone2;
				if(!(fn_numericCheck(tempPhNumber1,field,"10"))){
				return;
				}
			if(field=="Primary Phone Number"){
			primaryPhNumber = value;
			}
			if(field=="Alternate Phone Number"){
			alterPhNumber = value;
			}
			if(field=="Fax"){
			faxNo = value;
			}
			if(field=="Parent Phone Number"){
			parentPhNumber=value;
			}	
			return true;
			}
			else{
			var invalidCharmessage="The number you have entered as your "+ field + " is not a valid number.Please enter in the format xxx-xxx-xxxx or xxxxxxxxxx";
			fn_displayErrorMessage(invalidCharmessage);	
			return false;	
			}
			
		}
		else if(value.length==10){
			tempPhNumber2 =value;
			if(!(fn_numericCheck(tempPhNumber2,field,"10"))){
			return;
			}
			code =value.substring(0,3)+"-";
			phone1 =value.substring(3,6)+"-";
			phone2 =value.substring(6,10);
			tempPhNumber2 =code+phone1+phone2;
			if(field=="Primary Phone Number"){
			primaryPhNumber = tempPhNumber2;
			}
			if(field=="Alternate Phone Number"){
			alterPhNumber = tempPhNumber2;
			}
			if(field=="Fax"){
			faxNo = tempPhNumber2;
			}
			if(field=="Parent Phone Number"){
			parentPhNumber=tempPhNumber2;
			}
			return true;
		}
		else{
		fn_displayErrorMessage(message);
		return false;
		}
		

}


function fn_displayErrorMessage(message){
		if(document.getElementById("myform_actionError")) {
		document.getElementById("myform_actionError").style.display = "none";
		}
		document.getElementById("myform_errorloc").style.display = "block";
		document.getElementById("myform_errorloc").innerHTML =message;
		window.scrollTo(0,0);
		return;
}

