function changeCheckBox(checkBox,elementName,valueChecked,valueUnchecked){ if (checkBox.checked){ document.getElementById(elementName).value= valueChecked; }else{ document.getElementById(elementName).value= valueUnchecked; } } function popUpWindow(URLStr, left, top, width, height, windowName){ window.open(URLStr, windowName, 'toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=yes,copyhistory=yes,width='+width+',height='+height+',left='+left+', top='+top+',screenX='+left+',screenY='+top+''); } function getToolTip(action,boName,jsp,objID,displayText){ if(action!='' && boName!='' && objID!=''){ if (window.XMLHttpRequest) { ajaxReq = new XMLHttpRequest(); } else if (window.ActiveXObject) { ajaxReq = new ActiveXObject("Microsoft.XMLHTTP"); } ajaxReq.open("POST", "servlet/ServletDispatcher", true); ajaxReq.onreadystatechange = function (){ if (ajaxReq.readyState == 4) { if (ajaxReq.status == 200) { //alert(ajaxReq.responseText); t1 = [displayText,ajaxReq.responseText]; t2 = ["black","#003366","","","",,"black","#D6E4F1","","","",,260,,2,"#003366",2,,,,,"",,,,]; stm(t1,t2); } } }; ajaxReq.setRequestHeader("Content-Type", "application/x-www-form-urlencoded"); ajaxReq.send("CALL=GETLOOKUPINFO&action="+action+"&business_object_name="+boName+"&BO_PARAMETER_NAME="+boName+"&object_id="+objID+"&redirect_url=../lookUpInfo.jsp?editable=false&BO_PARAMETER_NAME="+boName); } } function refreshPage(name){ try{ onLoadRefresh(); }catch(e){ // Exception handled to avoid error on the ListGrid , // since the onLoadRefresh function was in the FormGrid page. } } function newWindow(url, name, w, h) { window.open(url, name, "width=" + w + ",height=" + h + ",status=yes,scrollbars=yes,toolbar=no,location=no"); } function nw(url) { newWindow(url,'','1080','675'); } function getTabLinkHTML(link){ var linkLength = link.length; var orgLinkStartPosition = link.indexOf('?'); var actualLength = linkLength - orgLinkStartPosition; var orgLink = link.substr(orgLinkStartPosition+1,actualLength); if (window.XMLHttpRequest) { ajaxReq = new XMLHttpRequest(); } else if (window.ActiveXObject) { ajaxReq = new ActiveXObject("Microsoft.XMLHTTP"); } ajaxReq.open("POST", "servlet/ServletDispatcher", true); ajaxReq.onreadystatechange = function (){if (ajaxReq.readyState == 4) { if (ajaxReq.status == 200) { var dot = document.getElementById('GridFormContainer'); dot.innerHTML = ajaxReq.responseText; } } }; ajaxReq.setRequestHeader("Content-Type", "application/x-www-form-urlencoded"); ajaxReq.send(orgLink); } function showHideLayers(name, vis) { //v6.0 obj=findObj(name); obj.style.visibility = vis; } // updateSelect(this.form, 'MATERIAL', 'ID_COLOR', 'COLOR') function updateSelect(form, parent, child, array){ var idParent = form.elements[parent].selectedIndex; idParent = form.elements[parent].options[idParent].value; var arrayName = array + '_' + idParent; var childOptions; if(idParent > 0){ var size = form.elements[child].length; var j=0; if (typeof eval("window." + arrayName) != 'undefined') { childOptions = eval(arrayName); } else { childOptions = new Array(); } for(var i = 0; i <= childOptions.length; i++){ if(i==0){ form.elements[child][j] = new Option('Select one',0, false, false); j++; } if (!(typeof childOptions[i] == 'undefined')) { form.elements[child][j] = new Option(childOptions[i][1], childOptions[i][0], false, false); j++; } } for (var foo = size-1; foo >= j; foo--){ form.elements[child].remove(foo); } } } function validate_field(form, validate,validated){ if(form.elements[validate]) { // if(!(typeof form.elements[validate] == 'undefined')){ if(form.elements[validate].value==''){ alert('Material must be selected before color and unit of measure, please choose one'); form.elements[validated].value=''; } } } function clearSelect(form, selectName){ form.elements[selectName].options[0].selected = true; } function newWindow(url, name, w, h) { window.open(url, name, "width=" + w + ",height=" + h + ",status=yes,scrollbars=yes,toolbar=no,location=no"); } // Check for indicated values on Input Fields (Only Numbers) function checkNumeric(objName){ var numberfield = objName; var value = objName.value; objName.value = ''; if (chkNumericValue(value) == false){ setTimeout(function(){numberfield.focus();},0); return false; }else{ numberfield.value = value; return true; } }//checkNumeric(objName) function chkNumeric(objName){ return chkNumericValue(objName.value); } function chkNumericValue(objValue){ var checkOK = "0123456789.,-"; //Valores permitidos // var checkStr = objName; var allValid = true; var decPoints = 0; var noPoint = true; // for(i = 0; i < checkStr.value.length;i++){ // ch = checkStr.value.charAt(i); for(i = 0; i < objValue.length;i++){ ch = objValue.charAt(i); for(j = 0; j < checkOK.length; j++) if(ch == checkOK.charAt(j)){ if((ch == "," || ch == ".") && noPoint == true){ noPoint = false; break; } else if(ch != "," && ch != ".") break; } if(j == checkOK.length){ allValid = false; break; }//if }//for if (!allValid){ alertsay = "Only numeric values are allowed in this field"; alert(alertsay); // checkStr.value = ""; return (false); }//if }//chkNumericValue(objName) ///////////////////////////////////// // Check for indicated values on Input Fields (Alphanumerics) function checkAlphaNumeric(objName){ var numberfield = objName; if (chkAlphaNumeric(objName) == false){ numberfield.select(); setTimeout(function(){numberfield.focus();},0); return false; }else{ return true; } }//checkAlphaNumeric(objName) function chkAlphaNumeric(objName){ var checkOK = "abcdefghijklmnñopqrstuvwxyzABCDEFGHIJKLMNÑOPQRSTUVWXYZ0123456789-_ "; //Valores permitidos var checkStr = objName; var allValid = true; var decPoints = 0; var allNum = ""; for (i = 0; i < checkStr.value.length; i++){ ch = checkStr.value.charAt(i); for (j = 0; j < checkOK.length; j++) if (ch == checkOK.charAt(j)) break; if (j == checkOK.length){ allValid = false; break; }//if if (ch != ",") allNum += ch; }//for if (!allValid){ alertsay = "The values: \"*',;:/\|<>~+()=@&%$#{}[]^} not allowed in this field" alert(alertsay); return (false); }//if }//chkAlphaNumeric(objName) // Check for indicated values on Input Fields (Only Letters) function checkAlpha(objName){ var numberfield = objName; if (chkAlpha(objName) == false){ numberfield.select(); setTimeout(function(){numberfield.focus();},0); return false; }else{ return true; } }//checkAlpha(objName) function chkAlpha(objName){ var checkOK = "abcdefghijklmnñopqrstuvwxyzABCDEFGHIJKLMNÑOPQRSTUVWXYZ-_. "; //Valores permitidos var checkStr = objName; var allValid = true; var decPoints = 0; var allNum = ""; for (i = 0; i < checkStr.value.length; i++){ ch = checkStr.value.charAt(i); for (j = 0; j < checkOK.length; j++) if (ch == checkOK.charAt(j)) break; if (j == checkOK.length){ allValid = false; break; }//if if (ch != ",") allNum += ch; }//for if (!allValid){ alertsay = "The values: \"*',;:/\|<>~+()=@&%$#{}[]^} not allowed in this field" alert(alertsay); return (false); }//if }//chkAlpha(objName) function toTrim(objName){ var checkStr = objName; var newString = new Array(); for (i = 0; i < checkStr.value.length; i++){ ch = checkStr.value.charAt(i); if(ch != ''){ newString = checkStr.value.substring(i,checkStr.value.length); break; } } for(f = newString.length - 1;f > 0;f++){ ch = newString.charAt(f); if(ch != ''){ newString = newString.substring(0,f); break; } } objName.value = newString; }//toTrim(objName) function confirmEventGrid(eventType, event,message,formName,refreshList) { if(confirm('Confirm to proceed following action:' + message)){ document.forms[formName].elements['event'].value=eventType; document.forms[formName].submit(); } } function confirmEventAndClose(eventType, event,message,formName,refreshList) { if(confirm('Confirm to proceed following action:' + message)){ document.form.elements['event'].value=eventType; document.form.submit(); if (window.opener){ window.opener.location.reload(); } self.close(); } } function confirmEvent(eventType, event, message, enable) { var wasOk = true; //This is used to validate that the required field were fulfilled var SELECT_ONE_TYPE = "select-one"; var TEXT_TYPE = "text"; var PASSWORD_TYPE = "password"; var hasParameters = false; if ((confirmEvent.arguments.length == 5 || confirmEvent.arguments.length == 6) && eventType != "close"){ FieldName = confirmEvent.arguments[3]; FieldTitle = confirmEvent.arguments[4]; if(FieldName != null && FieldTitle != null) { if(FieldName.indexOf(",")!=-1 || FieldName.length > 0) { hasParameters = true; } if(hasParameters) { var FieldsArray = FieldName.split(","); var TitleArray = FieldTitle.split(","); alertsay = 'Following fields are required:' + " \n\n"; var wasEmpty; var elementType; var wasOneSelected; var element; if(FieldsArray.length == null){ var arrayFields = new Array(); arrayFields[0] = FieldsArray; FieldsArray = arrayFields; } //for(field = 0; field < document.form.elements.length; field++) //{ //alert(document.form.elements[field].name + ' - ' + document.form.elements[field].type + ' - ' + document.form.elements[field].value); //} for(field = 0; field < FieldsArray.length; field++) { wasEmpty = false; // alert('Field'+FieldsArray[field]); element = document.form.elements.namedItem(FieldsArray[field]); elementType = element.type; wasOneSelected = false; if(elementType == undefined) { var radioOptions = document.form.elementsByName[FieldsArray[field]]; for(options = 0; options < radioOptions.length; options++) { if(radioOptions[options].checked == true) { wasOneSelected = true; } } } if(element.value == undefined && !wasOneSelected) { wasEmpty = true; } else if(((elementType == TEXT_TYPE || elementType == PASSWORD_TYPE) && element.value.length == 0) || (elementType == SELECT_ONE_TYPE && ((element.size>0 && element.selectedIndex == -1) || (element.size==0 && element.selectedIndex == 0) ))) { wasEmpty = true; } else if(elementType == TEXT_TYPE && element.value.length > 0){ var blanks = true; var i=0; if(element.value.length > 0){ for(i=0; i < element.value.length; i++){ if(element.value.charAt(i) != ' '){ blanks = false; } } } wasEmpty = blanks; } else if (elementType == 'textarea'){ //mbatis a simple validation for mandadatory TextArea if (element.value==''){ wasEmpty=true; } } else if (elementType == 'checkbox'){ //mbatis a simple validation for mandadatory TextArea if (element.checked!= true){ element.value='0'; element.checked=true; } } if(wasEmpty) { if(!wasOk) { alertsay = alertsay + "\n\t-- " + TitleArray[field]; } else { alertsay = alertsay + "\t-- " + TitleArray[field]; } wasOk = false; } } alertsay = alertsay + "\n\n" + 'Please validate data'; if(!wasOk) { alert(alertsay); } } } } if(wasOk) { var closeFlag = false; //if(confirm('Confirm to proceed following action:' + message)){ if (self['confirmEvent_InsteadSubmit']){ confirmEvent_InsteadSubmit(eventType,event); }else{ if (self['confirmEvent_BeforeSubmit']){ wasOk = confirmEvent_BeforeSubmit(eventType,event); } if (wasOk){ document.form.elements['event'].value=eventType; if(document.form.elements['WASAJAX']==undefined) { if(window.opener){ document.form.elements['redirect_url'].value=location.href; closeFlag = true; document.form.submit(); }else{ if(eventType == 'saveNoClose') { document.form.elements['redirect_url'].value=location.href; } document.form.submit(); } }else{ performAjaxEvent(); } } } if(window.opener){ window.opener.location.reload(); self.close(); } } //} } function encodeURIString(varData) { if(varData.indexOf("&")>-1) { var returnWhere = ""; var whereString = new Array(); whereString = varData.split("&"); for(var i=0; i < whereString.length; i++){ if(i==0) returnWhere = whereString[i]; else returnWhere = returnWhere + "%26" + whereString[i]; } return returnWhere; }else return varData; } function performAjaxEvent() { var submitString = ""; var displayString = ""; var ajaxReq; for (e=0; e < document.form.elements.length; e++) { var theElement = document.form.elements[e]; if(theElement.type != "button"){ if(theElement.type!='checkbox' && theElement.type!='radio'){ if(e==0){ submitString = theElement.name + "="+ encodeURIString(theElement.value); displayString = theElement.name + "="+ encodeURIString(theElement.value); }else{ submitString = submitString + "&" + theElement.name + "="+ encodeURIString(theElement.value); displayString = displayString + "\n"+ theElement.name + "="+ encodeURIString(theElement.value); } }else { if(theElement.checked==true){ if(e==0){ submitString = theElement.name + "="+ theElement.value; displayString = theElement.name + "="+ theElement.value; }else{ submitString = submitString + "&" + theElement.name + "="+ theElement.value; displayString = displayString + "\n"+ theElement.name + "="+ theElement.value; } } } } } if (window.XMLHttpRequest) { ajaxReq = new XMLHttpRequest(); } else if (window.ActiveXObject) { ajaxReq = new ActiveXObject("Microsoft.XMLHTTP"); } ajaxReq.open("POST", "servlet/ServletDispatcher", true); ajaxReq.onreadystatechange = function (){if (ajaxReq.readyState == 4) { if (ajaxReq.status == 200) { window.status = "Saved !!"; //var boFormDiv = document.getElementById("boForm"); //var strJsp = ajaxReq.responseText; //document.getElementById("boForm").innerHTML = strJsp; //window.alert(boFormDiv.innerHTML); } } }; ajaxReq.setRequestHeader("Content-Type", "application/x-www-form-urlencoded"); ajaxReq.send(submitString); } function findObj(n, d) { //v4.01 var p,i,x; if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) { d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p); } if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i < d.forms.length;i++) x=d.forms[i][n]; for(i=0; !x&&d.layers&&i < d.layers.length;i++) x=findObj(n,d.layers[i].document); if(!x && d.getElementById) x=d.getElementById(n); return x; } function validateMaxLength(field, size) { if (field.value.length > size - 1) { field.blur(); } } function getSelectMultipleValue(selectName,inputName){ var options = document.getElementsByName(selectName)[0].options; var i ; var value =''; for(i = 0;i < options.length;i++){ if(options[i].selected){ value+= options[i].value + ','; } } document.getElementsByName(inputName)[0].value = value; } function applyLimit(element, limit, elementName) { if (element.value.length > limit) { element.value = element.value.substring(0, limit); alert("Maxlength of "+elementName+" is "+limit ); } } function validateDateFormat(format, input){ if(input.value != null && input.value != ''){ var dateParts = new Array(); var firstSpliterCharPos; var spliterChar; if(contains(input.value,'/')){ spliterChar = '/'; firstSpliterCharPos = input.value.indexOf(spliterChar); } if(firstSpliterCharPos == -1 && contains(input.value,'-')){ spliterChar = '-'; firstSpliterCharPos = input.value.indexOf(spliterChar); } if(firstSpliterCharPos == -1){ alert('Invalid date format:\n -Expected date format: '+ format); setTimeout(function(){input.focus();},0); return false; } dateParts[0] = input.value.substring(0,firstSpliterCharPos); var secondSpliterCharPos = input.value.indexOf(spliterChar, firstSpliterCharPos+1); if(secondSpliterCharPos == -1){ alert('Invalid date format:\n -Expected date format: '+ format); setTimeout(function(){input.focus();},0); return false; } dateParts[1] = input.value.substring(firstSpliterCharPos+1,secondSpliterCharPos); dateParts[2] = input.value.substring(secondSpliterCharPos+1,input.value.length); var day; var month; var year; switch (format){ case 'MM/dd/yyyy': case 'MM-dd-yyyy': day = dateParts[1]; month = dateParts[0]; year= dateParts[2]; break; case 'dd/MM/yyyy': case 'dd-MM-yyyy': day = dateParts[0]; month = dateParts[1]; year= dateParts[2]; break; case 'yyyy/MM/dd': case 'yyyy-MM-dd': day = dateParts[2]; month = dateParts[1]; year= dateParts[0]; break; default: alert('Invalid date format:\n -Unsupported date format.'); setTimeout(function(){input.focus();},0); return false; break; } if(year.length < 4){ var currentYear = ''+(new Date().getYear()); year = '2000'.substring(0,4-year.length)+year; } var msg = validateDateRange(day,month,year); if(msg.length>0){ alert('Invalid date format:\n'+msg); setTimeout(function(){input.focus();},0); return false; } if(day.length < 2){ day ='0'+day; } if(month.length < 2){ month ='0'+month; } switch (format){ case 'MM/dd/yyyy': input.value=month+'/'+day+'/'+year; break; case 'MM-dd-yyyy': input.value=month+'-'+day+'-'+year; break; case 'dd/MM/yyyy': input.value=day+'/'+month+'/'+year; break; case 'dd-MM-yyyy': input.value=day+'-'+month+'-'+year; break; case 'yyyy/MM/dd': input.value=year+'/'+month+'/'+day; break; case 'yyyy-MM-dd': input.value=year+'-'+month+'-'+day; break; } } return true; } function validateDateRange(day,month,year){ var msg = ''; if(!onlyNumsValue(month)){ msg+=' -Month must be a number.\n'; } if(!onlyNumsValue(day)){ msg+=' -Day must be a number.\n'; } if(!onlyNumsValue(year)){ msg+=' -Year must be a number.\n'; } if(month<1 || month>12){ msg+=' -Month out of range.\n'; } var lastDayMonth = new Array(); lastDayMonth[0] = 31; lastDayMonth[1] = (((year % 4 == 0) && ((year % 100 != 0) || (year % 400 == 0)))? 29:28); lastDayMonth[2] = 31; lastDayMonth[3] = 30; lastDayMonth[4] = 31; lastDayMonth[5] = 30; lastDayMonth[6] = 31; lastDayMonth[7] = 31; lastDayMonth[8] = 30; lastDayMonth[9] = 31; lastDayMonth[10] = 30; lastDayMonth[11] = 31; if(day<1 || day>lastDayMonth[month-1]){ msg+=' -Day out of range.\n'; } if(year<1 || year > 9999){ msg+=' -Year out of range.\n'; } return msg; } function contains(value,the_char){ for (i=0;i < value.length;i++) { if(value.indexOf(the_char)!=-1){ return true; } } return false; } function onlyNumsValue(value){ var valid_char='0123456789'; for (i=0;i < value.length;i++) { var the_char=value.charAt(i) if(valid_char.indexOf(the_char)==-1){ return false; } } return true; } function biggerThanZero(field){ if (field.value <=0){ alert('The value must be a possitive number.'); field.value=''; } } function applyLimit(element, limit, elementName) { if (element.value.length > limit) { element.value = element.value.substring(0, limit); alert("Maxlength of "+elementName+" is "+limit ); } } //Ejemplo de uso: onKeyUp="javascript:onlyNums(this);" function onlyNums(field){ var valid_char='0123456789'; var num = field.value; for (i=0;i < num.length;i++) { var the_char=num.charAt(i) if(valid_char.indexOf(the_char)==-1){ num=num.substring(0,i); } } if(field.value!=num) field.value=num; } function onlyNumsAndSlash(field){ var valid_char='0123456789/'; var num = field.value; for (i=0;i < num.length;i++) { var the_char=num.charAt(i) if(valid_char.indexOf(the_char)==-1){ num=num.substring(0,i); } } if(field.value!=num) field.value=num; } function onlyNumsAndDot(field){ var valid_char='0123456789.'; var num = field.value; for (i=0;i < num.length;i++) { var the_char=num.charAt(i) if(valid_char.indexOf(the_char)==-1){ num=num.substring(0,i); } } if(field.value!=num) field.value=num; } function onlyNumsAndDotAndSign(field){ var valid_char='0123456789.-'; var num = field.value; for (i=0;i < num.length;i++) { var the_char=num.charAt(i) if(valid_char.indexOf(the_char)==-1){ num=num.substring(0,i); } } if(field.value!=num) field.value=num; } //Ejemplo de uso: onKeyUp="javascript:onlyAlpha(this);" function onlyAlpha(field){ var valid_char='abcdefghijklmnñopqrstuvwxyzABCDEFGHIJKLMNÑOPQRSTUVWXYZ '; var cad = field.value; for (i=0;i < cad.length;i++) { var the_char=cad.charAt(i) if(valid_char.indexOf(the_char)==-1){ cad=cad.substring(0,i); } } if(field.value!=cad) field.value=cad; } function setDivColsWidth(businessObjectName, sumFields,col,row, width,isIE){ if (!isIE){ width -= 23; } col = parseInt(col); document.getElementById(businessObjectName+'_tableHeader').rows.item(row).cells.item(col).width = width+'px'; document.getElementById(businessObjectName+'_tableData').rows.item(row).cells.item(col).width = width+'px'; if(sumFields == true){ document.getElementById(businessObjectName+'_tableFooter').rows.item(row).cells.item(col).width = width+'px'; } } function restrictSpecialCharacters(userField){ var iChars = "!@#$%^&*()+=-[]\\\';,./{}|\":<>?"; for (var i = 0; i < userField.value.length; i++) { if (iChars.indexOf(userField.value.charAt(i)) != -1) { alert ("Special Characters are Not allowed"); userField.value=""; userField.focus(); return false; } } } function validateAddress(userField){ var iChars = "@$%^*"; for (var i = 0; i < userField.value.length; i++) { if (iChars.indexOf(userField.value.charAt(i)) != -1) { alert ("Special Characters are Not allowed"); userField.value=""; userField.focus(); return false; } } } function AlignColumns(businessObjectName,columns,sumFields){ var deltaHeight = 19; var isIE = (navigator.userAgent.toLowerCase().indexOf('msie') != -1); divWidth = document.getElementById(businessObjectName+'_list').offsetWidth-10; if(document.getElementById(businessObjectName+'_tableData').rows.item(0)){ var hWidth,dWidth,i,j; var fWidth=0; var maxWidth = 0; var report=''; for(i=0;i < columns;i++){ hWidth = document.getElementById(businessObjectName+'_tableHeader').rows.item(0).cells.item(i).offsetWidth; dWidth = document.getElementById(businessObjectName+'_tableData').rows.item(0).cells.item(i).offsetWidth; if(sumFields == true){ fWidth = document.getElementById(businessObjectName+'_tableFooter').rows.item(0).cells.item(i).offsetWidth; } if(hWidth > dWidth){ maxTemp = hWidth; }else{ maxTemp = dWidth; } if(fWidth > maxTemp){ maxTemp = fWidth; } maxWidth += maxTemp; } document.getElementById(businessObjectName+'_tableHeaderWrap').width = 10*maxWidth; document.getElementById(businessObjectName+'_tableDataWrap').width = 10*maxWidth; if(sumFields == true){ document.getElementById(businessObjectName+'_tableFooterWrap').width = 10*maxWidth; } for(j=0;j < columns;j++){ hWidth = document.getElementById(businessObjectName+'_tableHeader').rows.item(0).cells.item(j).offsetWidth; dWidth = document.getElementById(businessObjectName+'_tableData').rows.item(0).cells.item(j).offsetWidth; if(sumFields == true){ fWidth = document.getElementById(businessObjectName+'_tableFooter').rows.item(0).cells.item(j).offsetWidth; } if(hWidth > dWidth){ maxTemp = hWidth; }else{ maxTemp = dWidth; } if(fWidth > maxTemp){ maxTemp = fWidth; } setDivColsWidth(businessObjectName, sumFields,j,0, maxTemp,isIE); } var difToDif=0; if (maxWidth < divWidth){ difToDiv = divWidth - maxWidth; if (isIE){ difToDiv = difToDiv - 10; // This number varies for list to list depending on the total columns }else{ difToDiv = difToDiv - 10; // This number varies for list to list depending on the total columns } setDivColsWidth(businessObjectName, sumFields, columns, 0, difToDiv, isIE); maxWidth+= difToDiv; }else{ setDivColsWidth(businessObjectName, sumFields,columns,0, 1,isIE); if(sumFields == true){ document.getElementById(businessObjectName+'_footer').style.height=document.getElementById(businessObjectName+'_footer').offsetHeight +17; } } document.getElementById(businessObjectName+'_tableHeaderWrap').style.width = document.getElementById(businessObjectName+'_tableHeader').offsetWidth+'px'; document.getElementById(businessObjectName+'_tableDataWrap').style.width = document.getElementById(businessObjectName+'_tableData').offsetWidth+'px'; if(sumFields == true){ document.getElementById(businessObjectName+'_tableFooterWrap').style.width = document.getElementById(businessObjectName+'_tableFooter').offsetWidth+'px'; } if(document.getElementById(businessObjectName+'_tableData').offsetWidth < document.getElementById(businessObjectName+'_bottom').offsetWidth-19){ deltaHeight = 0; } var pageDivHeight = 0, topHeight=0; if(document.getElementById(businessObjectName+'_PageDiv')){ pageDivHeight = document.getElementById(businessObjectName+'_top').offsetHeight } var pageFooterHeight = 0; if(sumFields == true){ document.getElementById(businessObjectName+'_footer').style.height=document.getElementById(businessObjectName+'_footer').offsetHeight; pageFooterHeight = document.getElementById(businessObjectName+'_footer').offsetHeight; } topHeight = document.getElementById(businessObjectName+'_top').offsetHeight document.getElementById(businessObjectName+'_bottom').style.height = document.getElementById(businessObjectName+'_list').offsetHeight - pageDivHeight - topHeight - pageFooterHeight-4; if(document.getElementById(businessObjectName+'_tableData').offsetHeight < document.getElementById(businessObjectName+'_bottom').offsetHeight-deltaHeight){ document.getElementById(businessObjectName+'_bottom').style.overflowY='hidden'; if (document.getElementById(businessObjectName+'_tableData').offsetWidth +2< divWidth){ innerDivsWidth = document.getElementById(businessObjectName+'_tableData').offsetWidth+2+'px'; }else{ innerDivsWidth = divWidth+2+'px'; } document.getElementById(businessObjectName+'_top').style.width = innerDivsWidth; document.getElementById(businessObjectName+'_bottom').style.width = innerDivsWidth; if(sumFields == true){ document.getElementById(businessObjectName+'_footer').style.width = innerDivsWidth; } }else{ lastColWidth = document.getElementById(businessObjectName+'_tableData').rows.item(0).cells.item(parseInt(columns)).offsetWidth; sizeToDecrease=0; if (lastColWidth > 0){ if (lastColWidth > 19){ sizeToDecrease = lastColWidth - 19; }else{ sizeToDecrease = lastColWidth; } if (!isIE){ sizeToDecrease= sizeToDecrease - 19; } setDivColsWidth(businessObjectName, sumFields,columns,0, sizeToDecrease,isIE); document.getElementById(businessObjectName+'_tableHeaderWrap').style.width = document.getElementById(businessObjectName+'_tableHeader').offsetWidth+'px'; document.getElementById(businessObjectName+'_tableDataWrap').style.width = document.getElementById(businessObjectName+'_tableData').offsetWidth+'px'; if(sumFields == true){ document.getElementById(businessObjectName+'_tableFooterWrap').style.width = document.getElementById(businessObjectName+'_tableFooter').offsetWidth+'px'; } } if (document.getElementById(businessObjectName+'_tableData').offsetWidth +19 < divWidth){ innerDivsWidth = document.getElementById(businessObjectName+'_tableData').offsetWidth+19+'px'; }else{ innerDivsWidth = divWidth+2+'px'; } document.getElementById(businessObjectName+'_top').style.width = innerDivsWidth; document.getElementById(businessObjectName+'_bottom').style.width = innerDivsWidth; if(sumFields == true){ document.getElementById(businessObjectName+'_footer').style.width = innerDivsWidth; } } }else{ document.getElementById(businessObjectName+'_bottom').style.display = 'none'; } } ////// Functions for MultiSelect function MoveOptions(object1, object2) { var option = 0; var len = 0; if(object1.options.length){ len = object2.options.length; while(option < object1.options.length){ if(object1.options[option].selected){ object2.options[object2.options.length] = new Option(object1.options[option].text, object1.options[option].value); object2.options[object2.options.length-1].selected = true; object1.options[option] = null; option = -1; } option++ } for(var x=0;x< len;x++){ object2.options[x].selected = false; } } } function MatchOptions(object1, object2){ var option = 0; var i = 0; while(option < object1.options.length){ i=0; if(object1.options[option]){ while(i < object2.options.length){ if(object2.options[i].value == object1.options[option].value){ object2.options[i] = null; i=-1; } i++; } object1.options[option].selected = false; } option++ } } function MoveUp(object) { var option = 0; if(object.options.length){ while(option < object.options.length){ if(object.options[option].selected){ if(option > 0){ object.options[object.options.length] = new Option(object.options[option-1].text, object.options[option-1].value); object.options[option-1].text = object.options[option].text; object.options[option-1].value = object.options[option].value; object.options[option].selected = false; object.options[option-1].selected = true; object.options[option].text = object.options[object.options.length-1].text; object.options[option].value = object.options[object.options.length-1].value; object.options[object.options.length-1] = null; }else{ break; } } option++ } } } function MoveDown(object) { if(object.options.length){ var option = object.options.length-1; while(option > -1){ if(object.options[option].selected){ if(option < object.options.length-1){ object.options[object.options.length] = new Option(object.options[option+1].text, object.options[option+1].value); object.options[option+1].text = object.options[option].text; object.options[option+1].value = object.options[option].value; object.options[option].selected = false; object.options[option+1].selected = true; object.options[option].text = object.options[object.options.length-1].text; object.options[option].value = object.options[object.options.length-1].value; object.options[object.options.length-1] = null; }else{ break; } } option--; } } } function CopyOptionsSelected(object1, object2) { var option = 0 var existe = 0 if (object1.options.length) while (option < object1.options.length) { if (object1.options[option].selected) { i = 0 while(i< object2.options.length){ if (object2.options[i].value == object1.options[option].value ) { alert("Ya esta listado: "+object2.options[i].text) existe = 1 } i++ } if(existe == 0){ object2.options[object2.options.length] = new Option(object1.options[option].text, object1.options[option].value) } } option++ } } //////////////////////// function mTrim(sString){ while (sString.substring(0,1) == ' '){ sString = sString.substring(1, sString.length); } while (sString.substring(sString.length-1, sString.length) == ' '){ sString = sString.substring(0,sString.length-1); } return sString; } function newCenteredResizableWindow(mypage,myname,w,h,scroll){ var winl = (screen.width-w)/2; var settings ="height="+h+","; settings +="width="+w+","; settings +="top=0,"; settings +="left="+winl+","; settings +="z-lock=yes, alwaysRaised=yes, toolbar=no,location=no, directories=no, status=yes, menubar=no, scrollbars="+scroll+", resizable=yes, copyhistory=no"; window.open(mypage,myname,settings); } function popUpWindow(URLStr, left, top, width, height, windowName){ window.open(URLStr, windowName, 'toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=yes,copyhistory=yes,width='+width+',height='+height+',left='+left+', top='+top+',screenX='+left+',screenY='+top+''); } if(!Array.indexOf){ Array.prototype.indexOf = function(obj){ for(var i=0; i< this.length; i++){ if(this[i]==obj){ return i; } } return -1; } } function getToday(){ var todayDate = new Date(); var month = (todayDate.getMonth()+1).toString(); if(month.length == 1){ month = '0'+month; } var day = (todayDate.getDate()).toString(); if(day.length == 1){ day = '0'+day; } return month+"/"+day+"/"+todayDate.getYear(); } function checkForValidPhone(field) { var value = mTrim(field.value); //alert(value); var valid_char='0123456789()- '; for(i=0;i?"; var mailres = true; var apos=value.indexOf("@",0); for (var i = 0; i < field.value.length; i++) { if (iChars.indexOf(field.value.charAt(i)) != -1) { alert("Special characters are not allowed in email"); field.value = ""; field.focus(); return false; mailres = false; }else{mailres = true;} } if(field.value != ""){ var len = parseInt(value.length); var dotpos= parseInt(value.lastIndexOf(".")); var resul = (len)-(dotpos); var resul2 = (resul)-(1); //alert("Numero: "+dotpos+" Long: "+len); //alert(resul2); if ((mailres == true)&& resul2>=2) { //alert("Correcto"); mailres = true; } else { field.value = ""; field.focus(); alert("Invalid Email Address"); mailres = false; } return mailres; } } }