// Imported code // function confdel(message){ var answer=confirm("Are you sure you want to "+message+"?") if (answer) return true; return false; } function flogout(){ var answer=confirm("Are you sure you want to Log Out?") if (answer) window.location="notlogged.asp" } function checkNum(Ctrl, namefield){ if(Ctrl.value == ""){ valialert(Ctrl, "Please enter value for "+namefield); return false; } var valid = '0123456789.'; // define valid characters if (!isValid(Ctrl.value, valid)) { valialert(Ctrl, "No spaces, characters, or negative numbers allowed in "+namefield); return false; } if(Ctrl.value >= 0 && Ctrl.value < 999999999999) return true; else { valialert(Ctrl, "Invalid number in "+namefield+". Value should be between 0 and 999,999,999,999"); return false; } return true; } function checkText(Ctrl, namefield){ if(Ctrl.value == ""){ valialert(Ctrl, "Missing Information. Please enter "+namefield+"."); return false; } if(!isInValid(Ctrl.value, "'")) { valialert(Ctrl, "Cannot use single quotes"); return false; } if(!isInValid(Ctrl.value, "#")) { valialert(Ctrl, "Cannot use the # sign"); return false; } return true; } function checkMaxDownTime(Ctrl, Var, namefield){ var j = Ctrl.value; j = j * 1; var i = Var.value; if(j>i) { valialert(Ctrl, "Downtime can not be greater than "+i+" minutes. Please adjust downtime value."); return false; } return true; } function checkMaxUnits(Ctrl, Var, Var1, Var2, namefield){ var j = Ctrl.value; j = j * 1; var i = Var.value*1; var m = Var1.value*1; var n = Var2.value*1; var p = i + m + n; if(p>j) { valialert(Ctrl, "Net Units entered is greater than the number of units that could be produced\r\nbased on the Units/Hour rate entered in the Machine Details setup. \r\n\r\nThis will have an effect on OEE calculations.\r\n\r\n") } return true; } function checkLength(Ctrl, namefield){ if(Ctrl.value.length > 20){ valialert(Ctrl, "The size of "+namefield+" is limited to 20 characters"); return false; } return true; } function checkVarLength(Ctrl, Var, namefield){ if(Ctrl.value.length >= Var){ valialert(Ctrl, "The size of "+namefield+" is limited to "+Var+" characters"); return false; } return true; } function isInValid(string,allowed) { for (var i=0; i< string.length; i++) { if (allowed.indexOf(string.charAt(i)) == -1) { // allowed text // } else { //alert("Cannot use the single quote");// return false; } } return true; } function isValid(string,allowed) { for (var i=0; i< string.length; i++) { if (allowed.indexOf(string.charAt(i)) == -1) { // alert('Invalid Number');// return false; } } return true; } function valialert(Ctrl, Message){ alert(Message); Ctrl.focus(); return; } function checkdate(Ctrl){ // window.onerror=null // for all other strange errors var err=0; var psj=0; a=Ctrl; if (a.length != 8) err=1 b = a.substring(0, 2)// month c = a.substring(2, 3)// '/' d = a.substring(3, 5)// day e = a.substring(5, 6)// '/' f = a.substring(6, 8)// year //basic error checking if (b<1 || b>12) err = 1 if (c != '/') err = 1 if (d<1 || d>31) err = 1 if (e != '/') err = 1 if (f<0 || f>99) err = 1 //advanced error checking // months with 30 days if (b==4 || b==6 || b==9 || b==11){ if (d==31) err=1 } // february, leap year if (b==2){ // feb var g=parseInt(f/4) if (isNaN(g)) { err=1 } if (d>29) err=1 if (d==29 && ((f/4)!=parseInt(f/4))) err=1 } if (err==1){ alert('The date entered '+a+' is invalid! Please use MM/DD/YY format.'); return false; } else{ return true; } } function OnChange(dropdown) { var myindex = dropdown.selectedIndex var baseURL= "?DTMcn2=" top.location.href = baseURL + dropdown.options[myindex].value; } // End of imported code //