var gFormRows = false; var gDragger = false; var gPageScroll = 0; var gThis = false; var gTargOffsetW = false; var gTargOffsetH = false; var targ; var gDragX = 0; var gDragY = 0; var drag; var currentRow = false; var currentSpacer = false; //var RA; var gPO = false; // page object to hold global variables function LY_PageObject(){ this.trash = $x('trash'); this.holder = $x('itemholder'); this.spacer = $x('tiki'); this.page_id = $x('P5150_PAGE').value; this.MaxWidth; //methods this.init = init; this.SetWidth = SetWidth; return; function init(){ this.gPageScroll = html_GetPageScroll(); this.gFormRows = getElementsByClass('row',this.holder,'DIV'); this.RA = []; this.SetWidth(); for (var i=0;i lLength && this.gFormRows[i].id != 'trash'){ lLength = lItems.length; lItemWidth = lLength * (lItems[0].offsetWidth + 10); } } $x_Style(this.spacer,'width',lItemWidth); } } function ly_page_init(){ gPO = new LY_PageObject(); gPO.init(); var lItems = $dom_JoinNodeLists($x('itempallet').getElementsByTagName('DIV'),$x('itemholder').getElementsByTagName('DIV')); for(var i=0;i=5||Math.abs(lDragY-gDragY)>=5){ gDragX = lDragX; gDragY = lDragY; check_pos_drag(e); } supressSelect(); toolTip_disable(); return false; } function ly_MatchRow(pThis){ var lReturn=false,lReturn2=false; var l = findPos(pThis) var lX = l[0]; var lY = l[1]; for (var i=0;i'); currentSpacer.id = 'spacer'; } currentSpacer.className = targ.className; currentRow = ly_MatchRow(targ); if(currentRow){ $x_Show(currentSpacer) if(currentRow == gPO.trash){currentRow.appendChild(currentSpacer) }else if(targ.className == 'dragger_start_stop_html'){ currentRow.parentNode.insertBefore(currentSpacer,currentRow.nextSibling); }else if(targ.className == 'dragger_row'){ currentRow.parentNode.insertBefore(currentSpacer,currentRow.nextSibling); }else{ var lItems = currentRow.getElementsByTagName('DIV'); for(var ii=0;ii0 && lT){currentRow.insertBefore(currentSpacer,lT)} else{currentRow.appendChild(currentSpacer)} gPO.SetWidth(); } }else{ $x_Hide(currentSpacer) } } } function findPos(obj){ var curleft=0,curtop=0; if (obj.offsetParent){ curleft = obj.offsetLeft; curtop = obj.offsetTop; while(obj = obj.offsetParent){ curleft += obj.offsetLeft; curtop += obj.offsetTop; } } curtop += gPO.gPageScroll; return [curleft,curtop]; } function ly_AddRow(){ var lDag = $dom_AddTag(gPO.holder,'DIV'); lDag.className = 'row'; gPO.holder.insertBefore(lDag,gPO.trash); } function ly_f(pThis){pThis.className = 'focus';pThis.setAttribute('onblur','ly_b(this)')} function ly_b(pThis){pThis.className = ''} function check_pos(){ this._Drop = _Drop; this._Clean = _Clean; var lDelete = true; if(drag){ var l = ly_MatchRow(targ); if(l){ if(targ.className == 'dragger_row'){ var lDag = $dom_AddTag(gPO.holder,'DIV',targ.innerHTML); lDag.className = 'row'; lDag.innerHTML = ''; if(currentSpacer){ if(l==gPO.trash){l.replaceChild(lDag,currentSpacer);} else{gPO.holder.replaceChild(lDag,currentSpacer);} currentSpacer = false; } this._Clean(); }else if(targ.className == 'dragger_start_stop_html'){ var lDag = this._Drop() if(currentSpacer){ if(l==gPO.trash){currentSpacer.parentNode.replaceChild(lDag,currentSpacer);} else{gPO.holder.replaceChild(lDag,currentSpacer);} currentSpacer = false; } }else{ var lDag = this._Drop(); } if(lDag.className!='row'){ gThis = new ly_TempObject(lDag); gThis.init(); var lDelete = false; } }else{ currentSpacer = false; var lDag = this._Drop(); } if(l == gPO.trash && (lDag.className=='row' || lDag.getAttribute('apex:id')=='new')){$x_Remove(lDag)} if(lDelete){this._Drop();} } gPO.SetWidth(); return; function _Drop(){ var lEl = targ.cloneNode(true); var lOld = $x('oldholder'); lEl.id='last'; lEl.className = targ.className; lEl.style.position=''; lEl.style.top=''; lEl.style.left=''; ly_init_MouseDown(lEl); if(currentSpacer){ currentSpacer.parentNode.replaceChild(lEl,currentSpacer); currentSpacer = false; }else if(!currentSpacer && lOld){ lOld.parentNode.replaceChild(lEl,lOld); } this._Clean(); return lEl; } function _Clean(){ $x_Remove('oldholder'); $x('tempdrag').innerHTML=''; } } /* collect all values for submit */ function ly_Collect(){ $x(gItems).value = ''; var l_Real = []; var l = gPO.trash.getElementsByTagName('DIV'); /* collect trash */ for(var ii=0;ii