| var url = document.URL; | 
|   | 
| String.prototype.endsWith = function(suffix) { | 
|     return this.indexOf(suffix, this.length - suffix.length) !== -1; | 
| }; | 
| // main.jsのなかのものをoverrideした。 | 
| DatePicker.prototype.position=function(){ | 
|     for(var a=0,c=0,b=this.myElement;null!=b&&b!=this.calendarDiv.offsetParent;) | 
|         a+=b.offsetLeft-b.scrollLeft, | 
|         c+=b.offsetTop-b.scrollTop, | 
|         b=b.offsetParent; | 
|     c=getObjY(this.myElement)+this.calendarDiv.offsetHeight>Sfdc.Window.getScrollY()+Sfdc.Window.getWindowHeight()?c-(this.calendarDiv.offsetHeight+1):c+(this.myElement.offsetHeight+1); | 
|     b="left"; | 
|     if (a + 225 > Sfdc.Window.getWindowWidth()) { | 
|         a = Sfdc.Window.getWindowWidth() - 225; | 
|     } | 
|     LC.isRtlPage()&&(b="right",a=this.calendarDiv.offsetParent.offsetWidth-a-this.myElement.offsetWidth); | 
|     this.shim.setStyle(b,a+"px"); | 
|     this.shim.setStyle("top",c+"px") | 
| }; | 
|   | 
| function markOpp(color){ | 
|     var fromDate = new Date(j$(escapeVfId('allPage:allForm:searchBlock:fromDateId')).value()); | 
|     var toDate = new Date(j$(escapeVfId('allPage:allForm:searchBlock:toDateId')).value()); | 
|      | 
|     var cnt = j$(escapeVfId('allPage:allForm:oppBlock:oppCount')).value(); | 
|     var editFlg = false; | 
|     var matchFlg = false; | 
|     var tempi = 0; | 
|      | 
|     for (var i = 1; i <= cnt; i++) { | 
|         for(var x in keyArray){ | 
|             setColor(x, i, ''); | 
|             var tempKeyStr; | 
|             //To get the value of the date. | 
|             //tempKeyStr = j$(escapeVfId('allPage:allForm:oppBlock:oppTable:' + i  + ':' + keyArray[x].keyOfOpp)).text(); | 
|             if (document.getElementsByClassName(i + "_" + keyArray[x].keyOfOpp)[0] != undefined) { | 
|                 tempKeyStr = document.getElementsByClassName(i + "_" + keyArray[x].keyOfOpp)[0].innerText; | 
|                 var tempKey = new Date(tempKeyStr); | 
|                  | 
|                 if(isValidDate(tempKey) == false){ | 
|                     //The key of Opp hasn't been edited, Edited Date is invalid. so, do not change the editFlg. | 
|                 } | 
|                 else{ | 
|                     editFlg = true; | 
|                     if((isValidDate(toDate)==true && isValidDate(fromDate) == false && tempKey <= toDate) | 
|                         ||(isValidDate(fromDate) == true && isValidDate(toDate)==false && tempKey >= fromDate) | 
|                         ||(isValidDate(fromDate) == true && isValidDate(toDate)==true && tempKey >= fromDate && tempKey <= toDate) | 
|                     ){ | 
|                         setColor(x, i, color); | 
|                         matchFlg = true; | 
|                     }else{ | 
|                         //The data is not matching, so that nothing to do | 
|                     } | 
|                 } | 
|             } | 
|         } | 
|     } | 
|     if(editFlg != true) alert("没有数据被更新过!"); | 
|     if(editFlg == true && matchFlg != true) alert('与检索日期匹配的数据不存在.'); | 
|     if(editFlg == true && matchFlg == true) alert('与检索日期匹配的数据已被标记.'); | 
| } | 
| function setColor(x, i, color){ | 
|     object = document.getElementsByClassName(i + "_" + keyArray[x].keyCol)[0]; | 
|     //object = j$(escapeVfId(i + ':' + keyArray[x].keyCol)) | 
|     if (object != undefined) { | 
|         //object.css("background-color",color); | 
|         object.style.backgroundColor = color; | 
|     } | 
| } | 
|   | 
| function isValidDate(d) { | 
|   if ( Object.prototype.toString.call(d) !== "[object Date]" ) | 
|     return false; | 
|   return !isNaN(d.getTime()); | 
| } | 
|   | 
| function searchOppJs_Account_copy() { | 
|     blockme(); | 
|     var cnt = document.getElementById('allPage:allForm:oppBlock:oppCount').value; | 
|     var isChanged = false; | 
|     for (var i = 0; i < cnt; i++) { | 
|         if (document.getElementById('allPage:allForm:oppBlock:oppTable:' + i + ':changeFlg').value == 1) { | 
|             isChanged = true; | 
|             break; | 
|         } | 
|         if (document.getElementById('allPage:allForm:oppBlock:oppTable:' + i + ':changeFlgRt').value == 1) { | 
|             isChanged = true; | 
|             break; | 
|         } | 
|     } | 
|     if (isChanged) { | 
|         if (window.confirm('画面上的数据有变化,要保存所做的变更吗?\n点击 [确定] 保存并检索\n点击 [取消] 只检索,放弃保存')) { | 
|             saveAndSearch(); | 
|         } else { | 
|             searchOpp(); | 
|         } | 
|     } else { | 
|         searchOpp(); | 
|     } | 
| } | 
|   | 
|   | 
| function sortTableJs_Account(key) { | 
|     if (typeof event.stopPropagation != "undefined") { | 
|         event.stopPropagation(); | 
|     } else { | 
|         event.cancelBubble = true; | 
|     } | 
|     blockme(); | 
|     var cnt = document.getElementById('allPage:allForm:oppBlock:oppCount').value; | 
|     var isChanged = false; | 
|      | 
|     for (var i = 0; i < cnt; i++) { | 
|         if (document.getElementById('allPage:allForm:oppBlock:oppTable:' + i + ':changeFlg').value == 1) { | 
|             isChanged = true; | 
|             break; | 
|         } | 
|         if (document.getElementById('allPage:allForm:oppBlock:oppTable:' + i + ':changeFlgRt').value == 1) { | 
|             isChanged = true; | 
|             break; | 
|         } | 
|     } | 
|      | 
|     if (isChanged) { | 
|         if (window.confirm('画面上的数据有变化,要保存所做的变更吗?\n点击 [确定] 保存并排序\n点击 [取消] 只排序,放弃保存')) { | 
|             saveAndSort(2, key); | 
|         } else { | 
|             sortTable(key); | 
|         } | 
|     } else { | 
|         sortTable(key); | 
|     } | 
| } | 
| // 編集チェック | 
| function setChangeFlg(cnt) { | 
|      | 
|     document.getElementById('allPage:allForm:oppBlock:oppTable:' + cnt + ':changeFlg').value = 1; | 
| } | 
| // list の headerRow の tdに toggleWidth() を追加 | 
| function bindTdToggleWidth() { | 
|     var i = 0; | 
|     j$('body .pbBody table#tableHeader tr.headerRow td').each(function() { | 
|         var colClass = getColClassName(this); | 
|         if (colClass != 'col_Scroll') { | 
|             listColClassWidthMap[colClass] = j$('body .pbBody table.list tr.headerRow td.' + colClass).width(); | 
|             if (colClass in listColClassMap) { | 
|                 j$(this).addClass("colViewing"); | 
|                 j$(this).addClass(listColClassMap[colClass]); | 
|             } else { | 
|                 j$(this).addClass("colViewing"); | 
|             } | 
|             rerenderColWidth(colClass, true); | 
|             j$(this).click(function() { | 
|                 j$(this).toggleClass("colUnHideIcon"); | 
|                 rerenderColWidth(colClass, false); | 
|             }); | 
|         } | 
|     }); | 
|     windowResize(); | 
|     // スクロール連動 | 
|     j$('div#in_Div').scroll(function() { | 
|         j$('div#out_Div').scrollLeft(j$(this).scrollLeft()); | 
|         j$('div#in_Div_L').scrollTop(j$(this).scrollTop()); | 
|     }); | 
|     j$('div#out_Div').scroll(function() { | 
|         j$('div#in_Div').scrollLeft(j$(this).scrollLeft()); | 
|     }); | 
|     j$('div#in_Div_L').scroll(function() { | 
|         j$('div#out_Div_L').scrollLeft(j$(this).scrollLeft()); | 
|         j$('div#in_Div').scrollTop(j$(this).scrollTop()); | 
|     }); | 
| } | 
| function windowResize() { | 
|     blockHeight = j$(window).innerHeight() - j$(escapeVfId('allPage:allForm:searchBlock')).height() - heightAjustment; | 
|     sbwidth = scrollbarWidth(); | 
|     blockWidth = j$(escapeVfId('allPage:allForm:searchBlock')).width() - j$('div#in_Div_L').width() - widthAjustment - sbwidth; | 
|     j$(escapeVfId('allPage:allForm:oppBlock')).css('height', blockHeight + 78 + 'px'); | 
|   | 
|   | 
|     j$('div#in_Div').css('height', blockHeight + 'px'); | 
|     j$('div#in_Div_L').css('height', blockHeight + 'px'); | 
|   | 
|     // Table tr の height をあわせる | 
|     var tbl = document.getElementById('tableData_L'); | 
|     var tbl2 = document.getElementById('tableData'); | 
|     for (var i = 0; i < tbl2.rows.length; i++) { | 
|         var ht1 = j$(tbl.rows[i]).height(); | 
|         var ht2 = j$(tbl2.rows[i]).height(); | 
|         if (ht2 < ht1) { | 
|             j$(tbl2.rows[i]).css('height', ht1 + 'px'); | 
|         } else { | 
|             j$(tbl.rows[i]).css('height', ht2 + 'px'); | 
|         } | 
|     } | 
|   | 
|     if (j$('table#tableData').height() > j$('div#in_Div').height()) { | 
|         j$('div#in_Div').css('width', (blockWidth + sbwidth) + 'px'); | 
|     } else { | 
|        j$('div#out_Div').css('width', (blockWidth + sbwidth) + 'px'); | 
|         j$('div#in_Div').css('width', (blockWidth + sbwidth) + 'px'); | 
|     } | 
|     if (j$('table#tableData').width() > j$('div#in_Div').width()) { | 
|         //j$('div#in_Div').css('height', (blockHeight + sbwidth) +'px'); | 
|     } | 
| } | 
|   | 
| function expandAll(){ | 
|     // list の headerRow の tdに toggleWidth() を追加 | 
|     var i = 0; | 
|     j$('body .pbBody table.list tr.headerRow td').each(function() { | 
|         var colClass = getColClassName(this); | 
|         if(j$(this).hasClass("colUnHideIcon")){ | 
|             j$(this).toggleClass("colUnHideIcon"); | 
|             rerenderColWidth(colClass, false); | 
|         } | 
|     }); | 
|     windowResize(); | 
| } | 
| // 見た目用の classレベル 変数 | 
| var listColClassMap = {};          // colclass ==> colUnHideIcon or colViewing | 
| var listColClassWidthMap = {};     // colclass ==> classのwidth | 
| var blockHeight = 0; | 
| var sbwidth = 0; | 
| window.onresize = windowResize; | 
|   | 
| function rerenderColWidth(colClass, isFirst) { | 
|     var tableWidth = j$('body .pbBody table#tableHeader').width(); | 
|     var headerCol = j$('body .pbBody table.list tr.headerRow td.' + colClass); | 
|     if (headerCol.hasClass("colUnHideIcon")) { | 
|         listColClassMap[colClass] = "colUnHideIcon"; | 
|         tableWidth -= headerCol.width(); | 
|         // 全部最小化する | 
|         j$('body .pbBody table.list td.' + colClass).children().hide(); | 
|         j$('body .pbBody table.list td.' + colClass).width(7).css("font-size", "0"); | 
|     } else { | 
|         listColClassMap[colClass] = "colViewing"; | 
|         if (isFirst == false) { | 
|             var hiddenWidth = headerCol.width(); | 
|             j$('body .pbBody table.list td.' + colClass).width("").css("font-size", ""); | 
|             j$('body .pbBody table.list td.' + colClass).children().show(); | 
|             tableWidth += listColClassWidthMap[colClass] + 2 - hiddenWidth;    // 2 is border | 
|         } | 
|     } | 
|      | 
|     j$('table#tableData').css('width', (tableWidth + 2) + 'px'); | 
|     j$('table#tableHeader').css('width', (tableWidth + 2) + 'px'); | 
| } | 
| function getColClassName(pObj) { | 
|     var classList = j$(pObj).attr("class").split(' '); | 
|     var rtn = ""; | 
|     if (classList.length > 0) { | 
|         for (var i = 0; i < classList.length; i++) { | 
|             if (classList[i].indexOf("col_") >= 0) { | 
|                 rtn = classList[i]; | 
|                 break; | 
|             } | 
|         } | 
|     } | 
|     return rtn; | 
| } |