function isBlank(d,b){if(d==null){return true}for(var c=0;c<d.length;c++){if((d.charAt(c)!=" ")&&(d.charAt(c)!="\t")&&(d.charAt(c)!="\n")&&(d.charAt(c)!="\r")){return false}}if(b!=null){alert(b)}return true}function checkemail(b){fieldValue=b;fieldLength=b.length;var c="Please enter a valid Email address.";if(fieldLength<=8){alert(c);return false}else{if(/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/.test(fieldValue)){return true}else{alert(c);return false}}}function checkuseremail(b){fieldValue=b;fieldLength=b.length;var c="Please enter valid email.\n User name is your email address.";if(fieldLength<=8){alert(c);return false}else{if(/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,4})+$/.test(fieldValue)){return true}else{alert(c);return false}}}function inString(d,f,c){var e=true;var b;for(i=0;i<d.length&&e==true;i++){b=d.charAt(i);if(f.indexOf(b)==-1){if(c!=null){alert(c)}e=false}}return e}function LimitAttach(c,d){if(d=="image"){extArray=new Array(".jpg",".jpeg",".gif")}else{if(d=="pdf"){extArray=new Array(".pdf")}}allowSubmit=false;if(!c){return}while(c.indexOf("\\")!=-1){c=c.slice(c.indexOf("\\")+1)}ext_arr=c.split(".");ext="."+ext_arr[ext_arr.length-1].toLowerCase();for(var b=0;b<extArray.length;b++){if(extArray[b]==ext){allowSubmit=true;break}}if(allowSubmit){allowSubmit=true}else{alert("Please only upload files that end in types:  "+(extArray.join("  "))+"\nPlease select a new file to upload and submit again.");allowSubmit=false}return allowSubmit}var dtCh="/";var minYear=1900;var maxYear=2100;function daysInFebruary(b){return(((b%4==0)&&((!(b%100==0))||(b%400==0)))?29:28)}function DaysArray(c){for(var b=1;b<=c;b++){this[b]=31;if(b==4||b==6||b==9||b==11){this[b]=30}if(b==2){this[b]=29}}return this}function isDate(e){var b=DaysArray(12);var f=e.indexOf(dtCh);var d=e.indexOf(dtCh,f+1);var h=e.substring(0,f);var j=e.substring(f+1,d);var g=e.substring(d+1);strYr=g;if(h.charAt(0)=="0"&&h.length>1){h=h.substring(1)}if(j.charAt(0)=="0"&&j.length>1){j=j.substring(1)}for(var c=1;c<=3;c++){if(strYr.charAt(0)=="0"&&strYr.length>1){strYr=strYr.substring(1)}}month=parseInt(j);day=parseInt(h);year=parseInt(strYr);if((month==2&&day>daysInFebruary(year))||day>b[month]){alert("Please enter a valid day");return false}return true}function Trim(b){while((b.substring(0,1)==" ")||(b.substring(0,1)=="\n")||(b.substring(0,1)=="\r")){b=b.substring(1,b.length)}while((b.substring(b.length-1,b.length)==" ")||(b.substring(b.length-1,b.length)=="\n")||(b.substring(b.length-1,b.length)=="\r")){b=b.substring(0,b.length-1)}return b}function MM_openBrWindow(d,b,c){window.open(d,b,c)}function fnConfirm(b,c){var d=confirm(b);if(d==true){window.location.href=c}}function isInteger(d){var b="0123456789.- ()[]+";var e;var c=true;if(d.length==0){return false}for(i=0;i<d.length&&c==true;i++){e=d.charAt(i);if(b.indexOf(e)==-1){c=false}}return c}function CheckAll(d,b){for(var c=0;c<document.forms[d].elements.length;c++){var f=document.forms[d].elements[c];if(f.type=="checkbox"){f.checked=b.checked}}}function CheckAllTopics(g,c){var h=document.getElementById(c.value);var d=document.getElementsByName("cats[]");var f=d.length;var b=false;for(var e=0;e<f;e++){if(h.checked==true){d[e].checked=true}else{d[e].checked=false}}}function unCheckAll(f,c){var g=document.getElementById(c);var d=document.getElementsByName("cats[]");var e=d.length;var b=false;for(i=0;i<e;i++){if(d[i].checked==true){b=true;continue}else{b=false;break}}if(b==true){g.checked=true}else{g.checked=false}}function isNumeric(d,b){var c=/^[0-9]+$/;if(d.value.match(c)){return true}else{alert(b);d.focus();return false}}function isAlphabet(d,c){var b=/^[a-zA-Z]+$/;if(d.value.match(b)){isValid=true}else{alert(c);isValid=false}return isValid}function showStatus(b){window.status=b;return true}function cnt_words(c,b){var e=c.value;var d=0;a=e.replace(/\s/g," ");a=a.split(" ");for(z=0;z<a.length;z++){if(a[z].length>0){d++}}b.value=d}function chk_limit(c,b){if(c>b){alert("You are exceeding the word limit")}return}function CountWords(g){var e=g;var b=Trim(e);var c=b.replace(/\s+/g," ");var d=c.split(" ");var f=d.length;return f}function isValidLength(d,c,b){var e=Trim(d);if(e.length<c){alert(b);return false}else{return true}}function chk_search(){var b=document.searchform.keyword;if(isBlank(b.value,"Enter keyword for search.")==true){b.value="";b.focus();return false}else{document.searchform.submit()}return true}function redirpage(b){if(b!=""){window.location.href=b}else{return false}};
