]> CyberLeo.Net >> Repos - Github/sugarcrm.git/blob - include/SubPanel/SubPanelTiles.js
Release 6.4.0
[Github/sugarcrm.git] / include / SubPanel / SubPanelTiles.js
1 /*********************************************************************************
2  * SugarCRM Community Edition is a customer relationship management program developed by
3  * SugarCRM, Inc. Copyright (C) 2004-2011 SugarCRM Inc.
4  *
5  * This program is free software; you can redistribute it and/or modify it under
6  * the terms of the GNU Affero General Public License version 3 as published by the
7  * Free Software Foundation with the addition of the following permission added
8  * to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK
9  * IN WHICH THE COPYRIGHT IS OWNED BY SUGARCRM, SUGARCRM DISCLAIMS THE WARRANTY
10  * OF NON INFRINGEMENT OF THIRD PARTY RIGHTS.
11  *
12  * This program is distributed in the hope that it will be useful, but WITHOUT
13  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
14  * FOR A PARTICULAR PURPOSE.  See the GNU Affero General Public License for more
15  * details.
16  *
17  * You should have received a copy of the GNU Affero General Public License along with
18  * this program; if not, see http://www.gnu.org/licenses or write to the Free
19  * Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
20  * 02110-1301 USA.
21  *
22  * You can contact SugarCRM, Inc. headquarters at 10050 North Wolfe Road,
23  * SW2-130, Cupertino, CA 95014, USA. or at email address contact@sugarcrm.com.
24  *
25  * The interactive user interfaces in modified source and object code versions
26  * of this program must display Appropriate Legal Notices, as required under
27  * Section 5 of the GNU Affero General Public License version 3.
28  *
29  * In accordance with Section 7(b) of the GNU Affero General Public License version 3,
30  * these Appropriate Legal Notices must retain the display of the "Powered by
31  * SugarCRM" logo. If the display of the logo is not reasonably feasible for
32  * technical reasons, the Appropriate Legal Notices must display the words
33  * "Powered by SugarCRM".
34  ********************************************************************************/
35 var request_id=0;var current_child_field='';var current_subpanel_url='';var child_field_loaded=new Object();var request_map=new Object();function get_module_name()
36 {if(typeof(window.document.forms['DetailView'])=='undefined'){return'';}else{if(typeof(window.document.forms['DetailView'].elements['subpanel_parent_module'])!='undefined'&&window.document.forms['DetailView'].elements['subpanel_parent_module'].value!=''){return window.document.forms['DetailView'].elements['subpanel_parent_module'].value;}
37 return window.document.forms['DetailView'].elements['module'].value;}}
38 function subp_nav(m,i,a,t,r){if(t.href.search(/#/)<0){return;}
39 if(a=='d'){a='DetailView';}else{a='EditView';}
40 url="index.php?module="+m+"&action="+a+"&record="+i+"&parent_module="+get_module_name()+"&parent_id="+get_record_id()+"&return_module="+get_module_name()+"&return_id="+get_record_id()+"&return_action=DetailView";if(r)
41 {url+="&return_relationship="+r;}
42 t.href=url;}
43 function sub_p_rem(sp,lf,li,rp){return_url="index.php?module="+get_module_name()+"&action=SubPanelViewer&subpanel="+sp+"&record="+get_record_id()+"&sugar_body_only=1&inline=1";remove_url="index.php?module="+get_module_name()
44 +"&action=DeleteRelationship"
45 +"&record="+get_record_id()
46 +"&linked_field="+lf
47 +"&linked_id="+li
48 +"&return_url="+escape(escape(return_url))
49 +"&refresh_page="+rp;showSubPanel(sp,remove_url,true);}
50 function sp_rem_conf(){return confirm(SUGAR.language.get('app_strings','NTC_REMOVE_CONFIRMATION'))}
51 function sub_p_del(sp,submod,subrec,rp){return_url="index.php?module="+get_module_name()+"&action=SubPanelViewer&subpanel="+sp+"&record="+get_record_id()+"&sugar_body_only=1&inline=1";remove_url="index.php?module="+submod
52 +"&action=delete"
53 +"&record="+subrec
54 +"&return_url="+escape(escape(return_url))
55 +"&refresh_page="+rp;showSubPanel(sp,remove_url,true);}
56 function sp_del_conf(){return confirm(SUGAR.language.get('app_strings','NTC_DELETE_CONFIRMATION'))}
57 function get_record_id()
58 {return window.document.forms['DetailView'].elements['record'].value;}
59 function get_layout_def_key()
60 {if(typeof(window.document.forms['DetailView'].elements['layout_def_key'])=='undefined')return'';return window.document.forms['DetailView'].elements['layout_def_key'].value;}
61 function save_finished(args)
62 {var child_field=request_map[args.request_id];delete(child_field_loaded[child_field]);showSubPanel(child_field);}
63 function set_return_and_save_background(popup_reply_data)
64 {var form_name=popup_reply_data.form_name;var name_to_value_array=popup_reply_data.name_to_value_array;var passthru_data=popup_reply_data.passthru_data;var select_entire_list=typeof(popup_reply_data.select_entire_list)=='undefined'?0:popup_reply_data.select_entire_list;var current_query_by_page=popup_reply_data.current_query_by_page;var query_array=new Array();if(name_to_value_array!='undefined'){for(var the_key in name_to_value_array)
65 {if(the_key=='toJSON')
66 {}
67 else
68 {query_array.push(the_key+"="+name_to_value_array[the_key]);}}}
69 var selection_list=popup_reply_data.selection_list;if(selection_list!='undefined'){for(var the_key in selection_list)
70 {query_array.push('subpanel_id[]='+selection_list[the_key])}}
71 var module=get_module_name();var id=get_record_id();query_array.push('value=DetailView');query_array.push('module='+module);query_array.push('http_method=get');query_array.push('return_module='+module);query_array.push('return_id='+id);query_array.push('record='+id);query_array.push('isDuplicate=false');query_array.push('action=Save2');query_array.push('inline=1');query_array.push('select_entire_list='+select_entire_list);if(select_entire_list==1){query_array.push('current_query_by_page='+current_query_by_page);}
72 var refresh_page=escape(passthru_data['refresh_page']);for(prop in passthru_data){if(prop=='link_field_name'){query_array.push('subpanel_field_name='+escape(passthru_data[prop]));}else{if(prop=='module_name'){query_array.push('subpanel_module_name='+escape(passthru_data[prop]));}else{query_array.push(prop+'='+escape(passthru_data[prop]));}}}
73 var query_string=query_array.join('&');request_map[request_id]=passthru_data['child_field'];var returnstuff=http_fetch_sync('index.php',query_string);request_id++;got_data(returnstuff,true);if(refresh_page==1){document.location.reload(true);}}
74 function got_data(args,inline)
75 {var list_subpanel=document.getElementById('list_subpanel_'+request_map[args.request_id].toLowerCase());if(list_subpanel!=null){var subpanel=document.getElementById('subpanel_'+request_map[args.request_id].toLowerCase());var child_field=request_map[args.request_id].toLowerCase();if(inline){buttonHTML='';trEls=list_subpanel.getElementsByTagName('tr');if(trEls&&trEls.length>0){for(x in trEls){if(trEls[x]&&trEls[x].className=='pagination'){tableEls=trEls[x].getElementsByTagName('table');tdEls=tableEls[0].getElementsByTagName('td');span=tdEls[0].getElementsByTagName('span');if(span){buttonHTML=span[0].innerHTML;}
76 break;}}}
77 child_field_loaded[child_field]=2;list_subpanel.innerHTML='';list_subpanel.innerHTML=args.responseText;if(buttonHTML!=''){list_subpanel=document.getElementById('list_subpanel_'+request_map[args.request_id].toLowerCase());trEls=list_subpanel.getElementsByTagName('tr');for(x in trEls){if(trEls[x]&&trEls[x].className=='pagination'){tableEls=trEls[x].getElementsByTagName('table');tdEls=tableEls[0].getElementsByTagName('td');span=tdEls[0].getElementsByTagName('span');span[0].innerHTML=buttonHTML;break;}}}}else{child_field_loaded[child_field]=1;subpanel.innerHTML='';subpanel.innerHTML=args.responseText;var inlineTable=subpanel.getElementsByTagName('table');inlineTable=inlineTable[1];inlineTable=subpanel.removeChild(inlineTable);var listDiv=document.createElement('div');listDiv.id='list_subpanel_'+request_map[args.request_id].toLowerCase();subpanel.appendChild(listDiv);listDiv.appendChild(inlineTable);}
78 subpanel.style.display='';set_div_cookie(subpanel.cookie_name,'');if(current_child_field!=''&&child_field!=current_child_field)
79 {}
80 current_child_field=child_field;}}
81 function showSubPanel(child_field,url,force_load,layout_def_key)
82 {var inline=1;if(typeof(force_load)=='undefined'||force_load==null)
83 {force_load=false;}
84 if(force_load||typeof(child_field_loaded[child_field])=='undefined')
85 {request_map[request_id]=child_field;if(typeof(url)=='undefined'||url==null)
86 {var module=get_module_name();var id=get_record_id();if(typeof(layout_def_key)=='undefined'||layout_def_key==null){layout_def_key=get_layout_def_key();}
87 url='index.php?sugar_body_only=1&module='+module+'&subpanel='+child_field+'&action=SubPanelViewer&inline='+inline+'&record='+id+'&layout_def_key='+layout_def_key;}
88 if(url.indexOf('http://')!=0&&url.indexOf('https://')!=0)
89 {url=''+url;}
90 current_subpanel_url=url;var returnstuff=http_fetch_sync(url+'&inline='+inline+'&ajaxSubpanel=true');request_id++;got_data(returnstuff,inline);}
91 else
92 {var subpanel=document.getElementById('subpanel_'+child_field);subpanel.style.display='';set_div_cookie(subpanel.cookie_name,'');if(current_child_field!=''&&child_field!=current_child_field)
93 {hideSubPanel(current_child_field);}
94 current_child_field=child_field;}
95 if(typeof(url)!='undefined'&&url!=null&&url.indexOf('refresh_page=1')>0){document.location.reload();}}
96 function markSubPanelLoaded(child_field){child_field_loaded[child_field]=2;}
97 function hideSubPanel(child_field)
98 {var subpanel=document.getElementById('subpanel_'+child_field);subpanel.style.display='none';set_div_cookie(subpanel.cookie_name,'none');}
99 var sub_cookie_name=get_module_name()+'_divs';var temp=Get_Cookie(sub_cookie_name);var div_cookies=new Array();if(temp&&typeof(temp)!='undefined'){div_cookies=get_sub_cookies(temp);}
100 function set_div_cookie(name,display){div_cookies[name]=display;Set_Cookie(sub_cookie_name,subs_to_cookie(div_cookies),3000,false,false,false);}
101 function local_open_popup(name,width,height,arg1,arg2,arg3,params)
102 {return open_popup(name,width,height,arg1,arg2,arg3,params);}
103 SUGAR.subpanelUtils=function(){var originalLayout=null,subpanelContents={},subpanelLocked={},currentPanelDiv;return{getLayout:function(asString,ignoreHidden){subpanels=document.getElementById('subpanel_list');subpanelIds=new Array();for(wp=0;wp<subpanels.childNodes.length;wp++){if(typeof subpanels.childNodes[wp].id!='undefined'&&subpanels.childNodes[wp].id.match(/whole_subpanel_[\w-]*/)&&(typeof ignoreHidden=='undefined'||subpanels.childNodes[wp].style.display!='none')){subpanelIds.push(subpanels.childNodes[wp].id.replace(/whole_subpanel_/,''));}}
104 if(asString)return subpanelIds.join(',');else return subpanelIds;},onDrag:function(e,id){originalLayout=SUGAR.subpanelUtils.getLayout(true,true);},onDrop:function(e,id){newLayout=SUGAR.subpanelUtils.getLayout(true,true);if(originalLayout!=newLayout){SUGAR.subpanelUtils.saveLayout(newLayout);}},saveLayout:function(order){ajaxStatus.showStatus(SUGAR.language.get('app_strings','LBL_SAVING_LAYOUT'));if(typeof SUGAR.subpanelUtils.currentSubpanelGroup!='undefined'){var orderList=SUGAR.subpanelUtils.getLayout(false,true);var currentGroup=SUGAR.subpanelUtils.currentSubpanelGroup;}
105 var success=function(data){ajaxStatus.showStatus(SUGAR.language.get('app_strings','LBL_SAVED_LAYOUT'));window.setTimeout('ajaxStatus.hideStatus()',2000);if(typeof SUGAR.subpanelUtils.currentSubpanelGroup!='undefined'){SUGAR.subpanelUtils.reorderSubpanelSubtabs(currentGroup,orderList);}}
106 url='index.php?module=Home&action=SaveSubpanelLayout&layout='+order+'&layoutModule='+currentModule;if(typeof SUGAR.subpanelUtils.currentSubpanelGroup!='undefined'){url=url+'&layoutGroup='+encodeURI(SUGAR.subpanelUtils.currentSubpanelGroup);}
107 var cObj=YAHOO.util.Connect.asyncRequest('GET',url,{success:success,failure:success});},inlineSave:function(theForm,buttonName){ajaxStatus.showStatus(SUGAR.language.get('app_strings','LBL_SAVING'));var success=function(data){var element=document.getElementById(buttonName);do{element=element.parentNode;}while(element.className!='quickcreate'&&element.parentNode);if(element.className=='quickcreate'){var subpanel=element.id.slice(9,-7);var module=get_module_name();var id=get_record_id();var layout_def_key=get_layout_def_key();try{eval('result = '+data.responseText);}catch(err){}
108 if(typeof(result)!='undefined'&&result!=null&&result['status']=='dupe'){document.location.href="index.php?"+result['get'].replace(/&amp;/gi,'&').replace(/&lt;/gi,'<').replace(/&gt;/gi,'>').replace(/&#039;/gi,'\'').replace(/&quot;/gi,'"').replace(/\r\n/gi,'\n');return;}else{SUGAR.subpanelUtils.cancelCreate(buttonName);showSubPanel(subpanel,null,true);ajaxStatus.showStatus(SUGAR.language.get('app_strings','LBL_SAVED'));window.setTimeout('ajaxStatus.hideStatus()',1000);if(reloadpage)window.location.reload(false);}}}
109 var reloadpage=false;if((buttonName=='Meetings_subpanel_save_button'||buttonName=='Calls_subpanel_save_button')&&typeof(theForm)!='undefined'&&typeof(document.getElementById(theForm))!='undefined'&&typeof(document.getElementById(theForm).status)!='undefined'&&document.getElementById(theForm).status[document.getElementById(theForm).status.selectedIndex].value=='Held'){reloadpage=true;}
110 YAHOO.util.Connect.setForm(theForm,true,true);var cObj=YAHOO.util.Connect.asyncRequest('POST','index.php',{success:success,failure:success,upload:success});return false;},sendAndRetrieve:function(theForm,theDiv,loadingStr){function success(data){var theDivObj=document.getElementById(theDiv),divName=theDiv+'_newDiv',form_el;SUGAR.subpanelUtils.dataToDOMAvail=false;SUGAR.subpanelUtils.removeSubPanel();subpanelContents[theDiv]={};subpanelContents[theDiv]['list']=theDivObj;subpanelContents[theDiv]['newDiv']=document.createElement('div');subpanelContents[theDiv]['newDiv'].innerHTML='<script type="text/javascript">SUGAR.subpanelUtils.dataToDOMAvail=true;</script>'+data.responseText;subpanelContents[theDiv]['newDiv'].id=divName;subpanelContents[theDiv]['newDiv'].className='quickcreate';var button_elements=YAHOO.util.Selector.query('td.buttons',theDiv,false);YAHOO.util.Dom.setStyle(button_elements,'display','none');theDivObj.parentNode.insertBefore(subpanelContents[theDiv]['newDiv'],theDivObj);currentPanelDiv=divName;if(!SUGAR.subpanelUtils.dataToDOMAvail){SUGAR.util.evalScript(data.responseText);}
111 form_el=YAHOO.util.Selector.query('form',divName,true);YAHOO.util.Dom.setStyle(form_el,'padding-bottom','10px');subpanelLocked[theDiv]=false;setTimeout("enableQS(false)",500);ajaxStatus.hideStatus();}
112 if(subpanelLocked[theDiv]===true){return false;}
113 subpanelLocked[theDiv]=true;loadingStr=loadingStr||SUGAR.language.get('app_strings','LBL_LOADING');ajaxStatus.showStatus(loadingStr);YAHOO.util.Connect.setForm(theForm);YAHOO.util.Connect.asyncRequest('POST','index.php',{success:success,failure:success});return false;},cancelCreate:function(buttonName){var element=document.getElementById(buttonName),theForm=element.form,confirmMsg=onUnloadEditView(theForm);do{element=element.parentNode;}while(element.className!='quickcreate'&&element.parentNode);var theDiv=element.id.substr(0,element.id.length-7);if(typeof(subpanelContents[theDiv])=='undefined')
114 return false;if(confirmMsg!=null){if(!confirm(confirmMsg)){return false;}else{disableOnUnloadEditView(theForm);}}
115 SUGAR.subpanelUtils.removeSubPanel();var button_elements=YAHOO.util.Selector.query('td.buttons',theDiv,false);YAHOO.util.Dom.setStyle(button_elements,'display','');return false;},loadSubpanelGroupFromMore:function(group){SUGAR.subpanelUtils.updateSubpanelMoreTab(group);SUGAR.subpanelUtils.loadSubpanelGroup(group);},updateSubpanelMoreTab:function(group){var moreTab=document.getElementById(SUGAR.subpanelUtils.subpanelMoreTab+'_sp_tab');moreTab.id=group+'_sp_tab';moreTab.getElementsByTagName('a')[0].innerHTML=group;moreTab.getElementsByTagName('a')[0].href="javascript:SUGAR.subpanelUtils.loadSubpanelGroup('"+group+"');";var menuLink=document.getElementById(group+'_sp_mm');menuLink.id=SUGAR.subpanelUtils.subpanelMoreTab+'_sp_mm';menuLink.href="javascript:SUGAR.subpanelUtils.loadSubpanelGroupFromMore('"+SUGAR.subpanelUtils.subpanelMoreTab+"');";menuLink.innerHTML=SUGAR.subpanelUtils.subpanelMoreTab;SUGAR.subpanelUtils.subpanelMoreTab=group;},removeSubPanel:function(){var currentPanelEl=null;if(typeof currentPanelDiv!='undefined'&&currentPanelDiv!=null){currentPanelEl=document.getElementById(currentPanelDiv);}
116 if(currentPanelEl!=null){currentPanelEl.parentNode.removeChild(currentPanelEl);SUGAR.ajaxUI.cleanGlobals();currentPanelDiv=null;}},loadSubpanelGroup:function(group){if(group==SUGAR.subpanelUtils.currentSubpanelGroup)return;if(SUGAR.subpanelUtils.loadedGroups[group]){SUGAR.subpanelUtils.updateSubpanel(group);}else{SUGAR.subpanelUtils.loadedGroups.push(group);var needed=Array();for(group_sp in SUGAR.subpanelUtils.subpanelGroups[group]){if(typeof(SUGAR.subpanelUtils.subpanelGroups[group][group_sp])=='string'&&!document.getElementById('whole_subpanel_'+SUGAR.subpanelUtils.subpanelGroups[group][group_sp])){needed.push(SUGAR.subpanelUtils.subpanelGroups[group][group_sp]);}}
117 var success=function(){SUGAR.subpanelUtils.updateSubpanelEventHandlers(needed);SUGAR.subpanelUtils.updateSubpanels(group);};if(needed.length){ajaxStatus.showStatus(SUGAR.language.get('app_strings','LBL_LOADING'));SUGAR.util.retrieveAndFill(SUGAR.subpanelUtils.requestUrl+needed.join(','),'subpanel_list',null,success,null,true);}else{SUGAR.subpanelUtils.updateSubpanels(group);}}
118 SUGAR.subpanelUtils.setGroupCookie(group);},updateSubpanels:function(group){var sp_list=document.getElementById('subpanel_list');for(sp in sp_list.childNodes){if(sp_list.childNodes[sp].id){sp_list.childNodes[sp].style.display='none';}}
119 for(group_sp in SUGAR.subpanelUtils.subpanelGroups[group]){if(typeof(SUGAR.subpanelUtils.subpanelGroups[group][group_sp])!='string')
120 {continue;}
121 var cur=document.getElementById('whole_subpanel_'+SUGAR.subpanelUtils.subpanelGroups[group][group_sp]);if(cur==null)
122 {continue;}
123 cur.style.display='block';try{YAHOO.util.DDM.swapNode(cur,sp_list.getElementsByTagName('LI')[group_sp]);}catch(e){}}
124 SUGAR.subpanelUtils.updateSubpanelTabs(group);},updateSubpanelTabs:function(group){if(SUGAR.subpanelUtils.showLinks){SUGAR.subpanelUtils.updateSubpanelSubtabs(group);document.getElementById('subpanelSubTabs').innerHTML=SUGAR.subpanelUtils.subpanelSubTabs[group];}
125 oldTab=document.getElementById(SUGAR.subpanelUtils.currentSubpanelGroup+'_sp_tab');if(oldTab){oldTab.className='';oldTab.getElementsByTagName('a')[0].className='';}
126 mainTab=document.getElementById(group+'_sp_tab');mainTab.className='active';mainTab.getElementsByTagName('a')[0].className='current';SUGAR.subpanelUtils.currentSubpanelGroup=group;ajaxStatus.hideStatus();},updateSubpanelEventHandlers:function(){if(SubpanelInitTabNames){SubpanelInitTabNames(SUGAR.subpanelUtils.getLayout(false));}},reorderSubpanelSubtabs:function(group,order){SUGAR.subpanelUtils.subpanelGroups[group]=order;if(SUGAR.subpanelUtils.showLinks==1){SUGAR.subpanelUtils.updateSubpanelSubtabs(group);if(SUGAR.subpanelUtils.currentSubpanelGroup==group){document.getElementById('subpanelSubTabs').innerHTML=SUGAR.subpanelUtils.subpanelSubTabs[group];}}},updateSubpanelSubtabs:function(group){var notFirst=0;var preMore=SUGAR.subpanelUtils.subpanelGroups[group].slice(0,SUGAR.subpanelUtils.subpanelMaxSubtabs);SUGAR.subpanelUtils.subpanelSubTabs[group]='<table border="0" cellpadding="0" cellspacing="0" height="20" width="100%" class="subTabs"><tr>';for(var sp_key=0;sp_key<preMore.length;sp_key++){if(notFirst!=0){SUGAR.subpanelUtils.subpanelSubTabs[group]+='<td width="1"> | </td>';}else{notFirst=1;}
127 SUGAR.subpanelUtils.subpanelSubTabs[group]+='<td nowrap="nowrap"><a href="#'+preMore[sp_key]+'" class="subTabLink">'+SUGAR.subpanelUtils.subpanelTitles[preMore[sp_key]]+'</a></td>';}
128 if(document.getElementById('MoreSub'+group+'PanelMenu')){SUGAR.subpanelUtils.subpanelSubTabs[group]+='<td nowrap="nowrap"> | &nbsp;<span class="subTabMore" id="MoreSub'+group+'PanelHandle" style="margin-left:2px; cursor: pointer; cursor: hand;" align="absmiddle" onmouseover="SUGAR.subpanelUtils.menu.tbspButtonMouseOver(this.id,\'\',\'\',0);">&gt;&gt;</span></td>';}
129 SUGAR.subpanelUtils.subpanelSubTabs[group]+='<td width="100%">&nbsp;</td></tr></table>';var postMore=SUGAR.subpanelUtils.subpanelGroups[group].slice(SUGAR.subpanelUtils.subpanelMaxSubtabs);var subpanelMenu=document.getElementById('MoreSub'+group+'PanelMenu');if(postMore&&subpanelMenu){subpanelMenu.innerHTML='';for(var sp_key=0;sp_key<postMore.length;sp_key++){subpanelMenu.innerHTML+='<a href="#'+postMore[sp_key]+'" class="menuItem" parentid="MoreSub'+group+'PanelMenu" onmouseover="hiliteItem(this,\'yes\'); closeSubMenus(this);" onmouseout="unhiliteItem(this);">'+SUGAR.subpanelUtils.subpanelTitles[postMore[sp_key]]+'</a>';}
130 subpanelMenu+='</div>';}},setGroupCookie:function(group){Set_Cookie(SUGAR.subpanelUtils.tabCookieName,group,3000,false,false,false);}};}();SUGAR.subpanelUtils.menu=function(){return{tbspButtonMouseOver:function(id,top,left,leftOffset){closeMenusDelay=eraseTimeout(closeMenusDelay);if(openMenusDelay==null){openMenusDelay=window.setTimeout("SUGAR.subpanelUtils.menu.spShowMenu('"+id+"','"+top+"','"+left+"','"+leftOffset+"')",delayTime);}},spShowMenu:function(id,top,left,leftOffset){openMenusDelay=eraseTimeout(openMenusDelay);var menuName=id.replace(/Handle/i,'Menu');var menu=getLayer(menuName);if(currentMenu){closeAllMenus();}
131 SUGAR.subpanelUtils.menu.spPopupMenu(id,menu,top,left,leftOffset);},spPopupMenu:function(handleID,menu,top,left,leftOffset){var bw=checkBrowserWidth();var menuName=handleID.replace(/Handle/i,'Menu');var menuWidth=120;var imgWidth=document.getElementById(handleID).width;if(menu){var menuHandle=getLayer(handleID);var p=menuHandle;if(left==""){var left=0;while(p&&p.tagName.toUpperCase()!='BODY'){left+=p.offsetLeft;p=p.offsetParent;}
132 left+=parseInt(leftOffset);}
133 if(top==""){var top=0;p=menuHandle;top+=p.offsetHeight;while(p&&p.tagName.toUpperCase()!='BODY'){top+=p.offsetTop;p=p.offsetParent;}}
134 if(left+menuWidth>bw){left=left-menuWidth+imgWidth;}
135 setMenuVisible(menu,left,top,false);}}};}();