
(function($){var _rootUrl='/',_serverUrl=_rootUrl+'ezjscore/',_seperator='@SEPERATOR$';function _ez(callArgs,post,callBack)
{callArgs=callArgs.join!==undefined?callArgs.join(_seperator):callArgs;var url=_serverUrl+'call/';if(post)
{if(post.join!==undefined)
post.push({'name':'ezjscServer_function_arguments','value':callArgs});else
post['ezjscServer_function_arguments']=callArgs;return $.post(url,post,callBack,'json');}
return $.get(url+encodeURIComponent(callArgs),{},callBack,'json');};_ez.url=_serverUrl;_ez.root_url=_rootUrl;_ez.seperator=_seperator;$.ez=_ez;function _ezLoad(callArgs,post,selector,callBack)
{callArgs=callArgs.join!==undefined?callArgs.join(_seperator):callArgs;var url=_serverUrl+'call/';if(post)
post['ezjscServer_function_arguments']=callArgs;else
url+=encodeURIComponent(callArgs);return this.load(url+(selector?' '+selector:''),post,callBack);};$.fn.ez=_ezLoad;})(jQuery);function ezjs_toggleCheckboxes(formname,checkboxname)
{with(formname)
{for(var i=0,l=elements.length;i<l;i++)
{if(elements[i].type==='checkbox'&&elements[i].name==checkboxname&&elements[i].disabled==false)
{if(elements[i].checked==true)
{elements[i].checked=false;}
else
{elements[i].checked=true;}}}}}
function eZImagePreloader()
{this.setupEventHandlers(eZImagePreloader.prototype.onImageLoad,eZImagePreloader.prototype.onImageError,eZImagePreloader.prototype.onImageAbort);}
eZImagePreloader.prototype.preloadImageList=function(imageList)
{this.nImagesCount=imageList.length;this.nProcessedImagesCount=0;this.nLoadedImagesCount=0;this.bPreloadDone=false;for(var i in imageList)
{if(typeof imageList[i]!='function')
{this.preload(imageList[i]);}}}
eZImagePreloader.prototype.preload=function(imageFilePath)
{var image=new Image;image.onload=this.onImageLoadEvent;image.onerror=this.onImageErrorEvent;image.onabort=this.onImageAbortEvent;image.preloader=this;image.bLoaded=false;image.bError=false;image.bAbort=false;image.src=imageFilePath;}
eZImagePreloader.prototype.setupEventHandlers=function(onLoad,onError,onAbort)
{this.onImageLoadEvent=onLoad;this.onImageErrorEvent=onError;this.onImageAbortEvent=onAbort;}
eZImagePreloader.prototype.onImageLoad=function()
{this.bLoaded=true;this.preloader.nLoadedImagesCount++;this.preloader.onComplete();}
eZImagePreloader.prototype.onImageError=function()
{this.bError=true;this.preloader.onComplete();}
eZImagePreloader.prototype.onImageAbort=function()
{this.bAbort=true;this.preloader.onComplete();}
eZImagePreloader.prototype.onComplete=function(imageList)
{this.nProcessedImagesCount++;if(this.nProcessedImagesCount==this.nImagesCount)
{this.bPreloadDone=true;}}
function ezjslib_preloadImageList(filepathList)
{var preloader=new eZImagePreloader();preloader.preloadImageList(filepathList);}
var CurrentSubstituteValues=-1;(function()
{var EZPOPMENU_OFFSET=8,EZPOPMENU_SUBOFFSET=4,EZPOPMENU_SUBTOPOFFSET=4;var CurrentDisableIDList=[];var CurrentDisableMenuID=-1;var CurrentDisabledMenusItems={},DefaultDisabledMenuItemCSSClass='menu-item-disabled';;var VisibleMenus=[];function _initOffsets(offsetX,offsetY)
{EZPOPMENU_OFFSET=offsetX;EZPOPMENU_SUBTOPOFFSET=offsetY;}
function _setSubstituteValue(key,value)
{if(CurrentSubstituteValues!=-1)
{CurrentSubstituteValues[key]=value;}}
function _showTopLevel(event,menuID,substituteValues,menuHeader,disableIDList,disableMenuID)
{if(!document.getElementById(menuID))return;var mousePos=_mouseHandler(event);if(substituteValues!=-1)
{_hideAll();CurrentSubstituteValues=substituteValues;}
if(disableIDList&&disableIDList!=-1)
{CurrentDisableIDList=disableIDList.push!==undefined?disableIDList:[disableIDList];}
CurrentDisableMenuID=disableMenuID;_doItemSubstitution(menuID,menuHeader);_moveTopLevelOnScreen(menuID,mousePos);_makeVisible(menuID);}
function _showSubLevel(event,menuID,overItem)
{if(!document.getElementById(menuID))return;_doItemSubstitution(menuID);_hideHigher(menuArray[menuID]['depth']-1);_makeVisible(menuID);_moveSubLevelOnScreen(menuID,overItem);}
function _makeVisible(menuID)
{var el=document.getElementById(menuID);if(el)el.style.display='block';VisibleMenus[menuArray[menuID]['depth']]=menuID;document.getElementById(menuID).onmouseover=function(){document.onmousedown=null;}
document.getElementById(menuID).onmouseout=function(){document.onmousedown=_hideAll;}
document.onmousedown=_hideAll;}
function _doItemSubstitution(menuID,menuHeader)
{for(var i in menuArray[menuID]['elements'])
{var hrefElement=document.getElementById(i);if(!hrefElement)
{continue;}
var replaceString=menuArray[menuID]['elements'][i]['url'];if(replaceString)
{replaceString=_substituteString(replaceString,CurrentSubstituteValues);hrefElement.setAttribute("href",replaceString);}
var loopingVariable=menuArray[menuID]['elements'][i]['variable'];if(loopingVariable)
{var content='';for(var localVariableIndex in CurrentSubstituteValues[loopingVariable])
{var localVariable=CurrentSubstituteValues[loopingVariable][localVariableIndex];if(typeof localVariable!='object')
continue;var partialContent=menuArray[menuID]['elements'][i]['content'];for(var substItem in CurrentSubstituteValues)
{if(typeof CurrentSubstituteValues[substItem]!='object'&&typeof CurrentSubstituteValues[substItem]!='function')
{partialContent=partialContent.replace(substItem,CurrentSubstituteValues[substItem]);}}
for(var localItem in localVariable)
{partialContent=partialContent.replace('%'+localItem+'%',localVariable[localItem]);}
content+=partialContent;}
hrefElement.innerHTML=content;}
var disabledForElement=false;if(typeof(menuArray[menuID]['elements'][i]['disabled_for'])!='undefined'&&CurrentDisableIDList)
{for(var disI=0,disL=CurrentDisableIDList.length;disI<disL;disI++)
{if(disabledForElement=menuArray[menuID]['elements'][i]['disabled_for'][CurrentDisableIDList[disI]]==='yes')
break;}}
if(typeof(menuArray[menuID]['elements'][i]['disabled_class'])!='undefined'&&(disabledForElement||(CurrentDisableMenuID&&hrefElement.id==CurrentDisableMenuID)))
{CurrentDisabledMenusItems[hrefElement.id]=new Array();CurrentDisabledMenusItems[hrefElement.id]['className']=hrefElement.className;CurrentDisabledMenusItems[hrefElement.id]['href']=hrefElement.href;CurrentDisabledMenusItems[hrefElement.id]['onmouseover']=hrefElement.onmouseover;CurrentDisabledMenusItems[hrefElement.id]['onclick']=hrefElement.onclick;hrefElement.className=menuArray[menuID]['elements'][i]['disabled_class'];hrefElement.setAttribute("href",'#');hrefElement.onmouseover="";hrefElement.onclick="";}
else if(typeof(menuArray[menuID]['elements'][i]['disabled_class'])!='undefined'&&hrefElement.className==menuArray[menuID]['elements'][i]['disabled_class'])
{if(typeof(CurrentDisabledMenusItems[hrefElement.id])!='undefined')
{hrefElement.className=CurrentDisabledMenusItems[hrefElement.id]['className'];hrefElement.href=CurrentDisabledMenusItems[hrefElement.id]['href'];hrefElement.onmouseover=CurrentDisabledMenusItems[hrefElement.id]['onmouseover'];hrefElement.onclick=CurrentDisabledMenusItems[hrefElement.id]['onclick'];}}}
if(menuHeader&&typeof(menuArray[menuID]['headerID'])!='undefined')
{var header=document.getElementById(menuArray[menuID]['headerID']);if(header)header.innerHTML=menuHeader;}}
function _substituteString(replaceString,substituteValues)
{for(var substItem in substituteValues)
{if(typeof substituteValues[substItem]!='object'&&typeof substituteValues[substItem]!='function')
{replaceString=replaceString.replace(substItem,substituteValues[substItem]);}}
return replaceString;}
function _moveTopLevelOnScreen(menuID,mousePos)
{var menuElement=document.getElementById(menuID),screenData=_getScreenProperties();var newX=0;var newY=0;if((screenData.ScrollY+screenData.Height)<(mousePos.y+EZPOPMENU_OFFSET+menuElement.offsetHeight))
newY=mousePos.y-EZPOPMENU_OFFSET-menuElement.offsetHeight;else if(screenData.ScrollY>EZPOPMENU_OFFSET+mousePos.y)
newY=screenData.ScrollY;else
newY=mousePos.y+EZPOPMENU_OFFSET;if((screenData.ScrollX+screenData.Width)<(mousePos.x+EZPOPMENU_OFFSET+menuElement.offsetWidth))
newX=mousePos.x-EZPOPMENU_OFFSET-menuElement.offsetWidth;else if(screenData.ScrollX>EZPOPMENU_OFFSET+mousePos.x)
newX=screenData.ScrollX;else
newX=mousePos.x+EZPOPMENU_OFFSET;menuElement.style.left=newX+"px";menuElement.style.top=newY+"px";}
function _mouseHandler(e)
{if(!e)e=window.event;if(e.pageX||e.pageY)
return{'x':e.pageX,'y':e.pageY};else if(e.clientX||e.clientY)
return{'x':e.clientX+document.documentElement.scrollLeft,'y':e.clientY+document.documentElement.scrollTop};return{'x':0,'y':0};}
function _moveSubLevelOnScreen(menuID,alignItem)
{var menuElement=document.getElementById(menuID),screenData=_getScreenProperties();var newX=0;var newY=0;alignElement=document.getElementById(alignItem);parentElement=document.getElementById(VisibleMenus[menuArray[menuID]['depth']-1]);if(alignElement&&parentElement)
{newX=parseInt(parentElement.style.left)+menuElement.offsetWidth-EZPOPMENU_SUBOFFSET;newY=parseInt(parentElement.style.top)+alignElement.offsetTop+EZPOPMENU_SUBTOPOFFSET;}
if((screenData.ScrollY+screenData.Height)<(newY+menuElement.offsetHeight))
newY=screenData.ScrollY+screenData.Height-menuElement.offsetHeight;else if(screenData.ScrollY>newY)
newY=screenData.ScrollY;if((screenData.ScrollX+screenData.Width)<(newX+menuElement.offsetWidth))
{newX=parseInt(parentElement.style.left)+EZPOPMENU_SUBOFFSET-menuElement.offsetWidth;}
menuElement.style.left=newX+"px";menuElement.style.top=newY+"px";}
function _submitForm(formID,customSubstitute)
{var formElement=document.getElementById(formID);if(formElement)
{var children=formElement.childNodes;for(var i=0,l=children.length;i<l;i++)
{if(children[i].type=='hidden')
{for(var substItem in CurrentSubstituteValues)
{children[i].value=children[i].value.replace(substItem,CurrentSubstituteValues[substItem]);if(customSubstitute)
{for(var j=0,jl=customSubstitute.length;j<jl;j+=2)
{children[i].value=children[i].value.replace('%'+customSubstitute[j]+'%',customSubstitute[j+1]);}}}}}
formElement.submit();}}
function _hide(id)
{var level=menuArray[id]['depth'];_hideHigher(level-1);}
function _hideAll()
{document.onmousedown=null;_hideHigher(-1);}
function _hideHigher(level,el)
{for(var i=level+1,l=VisibleMenus.length;i<l&&VisibleMenus[i]!='none';i++)
{el=document.getElementById(VisibleMenus[i]);if(el)el.style.display='none';VisibleMenus[i]='none';}}
function _mouseOver(id)
{_hideHigher(menuArray[id]['depth']);}
function _createAArray(flat)
{var resultArray={};if(flat.length%2!=0)return resultArray;for(var i=0,l=flat.length;i<l;i+=2)
{resultArray[flat[i]]=flat[i+1];}
return resultArray;}
function _SubstituteAndRedirect(href)
{for(var substItem in CurrentSubstituteValues)
{href=href.replace(substItem,CurrentSubstituteValues[substItem]);}
location.href=href;}
function _getScreenProperties()
{var result={'ScrollX':0,'ScrollY':0,'Height':0,'Width':0};if(typeof(window.innerWidth)=='number')
{result.Width=window.innerWidth;result.Height=window.innerHeight;}
else if(document.documentElement&&(document.documentElement.clientWidth||document.documentElement.clientHeight))
{result.Width=document.documentElement.clientWidth;result.Height=document.documentElement.clientHeight;}
else if(document.body&&(document.body.clientWidth||document.body.clientHeight))
{result.Width=document.body.clientWidth;result.Height=document.body.clientHeight;}
if(document.body&&(document.body.scrollLeft||document.body.scrollTop))
{result.ScrollY=document.body.scrollTop;result.ScrollX=document.body.scrollLeft;}
else if(document.documentElement&&(document.documentElement.scrollLeft||document.documentElement.scrollTop))
{result.ScrollY=document.documentElement.scrollTop;result.ScrollX=document.documentElement.scrollLeft;}
else if(typeof(window.pageYOffset)=='number')
{result.ScrollY=window.pageYOffset;result.ScrollX=window.pageXOffset;}
return result;}
window.ezpopup_SubstituteAndRedirect=_SubstituteAndRedirect;window.ez_createAArray=_createAArray;window.ezpopmenu_mouseOver=_mouseOver;window.ezpopmenu_showTopLevel=_showTopLevel;window.ezpopmenu_hideAll=_hideAll;window.ezpopmenu_hide=_hide;window.ezpopmenu_submitForm=_submitForm;window.ezpopmenu_showSubLevel=_showSubLevel;if(window.menuArray===undefined)
{window.menuArray={};}})();var rightMenuWidthControl=function(contentInfo,uiContext)
{var link=jQuery('#rightmenu-showhide'),rightmenu=jQuery('#rightmenu'),timeout=null;link.attr('href','JavaScript:void(0);').html(rightmenu.width()<=22?'&laquo;':'&raquo;').click(function()
{if(timeout!==null)
{clearTimeout(timeout);timeout=null;}
var link=jQuery(this),rightmenu=jQuery('#rightmenu'),hidden=rightmenu.width()<22;var maincolumn=jQuery('#maincolumn');if(hidden)
{maincolumn.animate({marginRight:'180px'},300,'swing');if(jQuery('#rightmenu-design').html()=='')
{rightmenu.addClass('loading');rightmenu.animate({width:'181px'},300,'swing',function(){loadRightMenu(contentInfo,uiContext);});}
else
{rightmenu.animate({width:'181px'},300,'swing',function(){timeout=setTimeout(saveRightMenuStatus,500);});}}
else
{rightmenu.removeClass('loading');maincolumn.animate({marginRight:'17px'},300,'swing');rightmenu.animate({width:'18px'},300,'swing',function(){timeout=setTimeout(saveRightMenuStatus,500);});}
link.html(hidden?'&raquo;':'&laquo;');});function saveRightMenuStatus()
{var show=jQuery('#rightmenu').width()<22?'':'1';jQuery.post(jQuery.ez.url.replace('ezjscore/','user/preferences/set_and_exit/admin_right_menu_show/')+show);}
function loadRightMenu(contentInfo,uiContext)
{var rightmenuDesign=jQuery('#rightmenu-design'),rightmenu=jQuery('#rightmenu');jQuery.ez('admin2ppajax::rightmenu',{UIContext:uiContext,ContentInfo:contentInfo},function(data)
{if(data.content)
{rightmenu.removeClass('loading');rightmenuDesign.html(data.content);}});}};jQuery(function($)
{var leftMenuDrag={elements:false,timeout:null,down:function(e)
{leftMenuDrag.elements=[$('#leftmenu'),$('#maincontent')];if(leftMenuDrag.timeout!==null)
{clearTimeout(leftMenuDrag.timeout);leftMenuDrag.timeout=null;}},up:function(e)
{if(leftMenuDrag.elements)
{leftMenuDrag.elements=false;leftMenuDrag.timeout=setTimeout(leftMenuDrag.save,500);}},on:function(e)
{if(leftMenuDrag.elements)
{var els=leftMenuDrag.elements,offset=els[0].offset().left,pos=e.pageX,size=pos-offset;if(size<20)size=20;els[0].css('width',(size+3)+'px');els[1].css('marginLeft',(size)+'px');}},save:function()
{var px=$('#leftmenu').width();var url=$.ez.url.replace('ezjscore/','user/preferences/')+'set_and_exit/admin_left_menu_size/'+leftMenuDrag.em(px)+'em';$.post(url,{},function(){});},em:function(px)
{var test=jQuery('<div style="display: none; font-size: 1em; margin: 0; padding:0; height: auto; line-height: 1; border:0;">&nbsp;</div>').appendTo('#columns'),scale=test.height();test.remove();return(px/scale).toFixed(8);}};var wl=$('#widthcontrol-links'),wh=$('#widthcontrol-handler');if(wl&&wh)
{wl.addClass('hide');wh.removeClass('hide');wh.bind('mousedown',leftMenuDrag.down);$(document).bind('mouseup click',leftMenuDrag.up);$(document).bind('mousemove',leftMenuDrag.on);$('#leftmenu').addClass('widthcontroled');}});jQuery(function($)
{var NodeTab={timeout:null,click:function(e)
{NodeTab.open(e.target.parentNode.id,true);return false;},open:function(id,save)
{var li=$('#'+id);if(li.size()&&!li.hasClass('selected'))
{if(NodeTab.timeout!==null)
{clearTimeout(NodeTab.timeout);NodeTab.timeout=null;}
var block=$(li[0].parentNode.parentNode.parentNode);block.find("ul.tabs li.selected").removeClass('selected');block.find("div.tab-content.selected").addClass('hide').removeClass('selected');li.addClass('selected');$('#'+id+'-content').addClass('selected').removeClass('hide');if(save)NodeTab.timeout=setTimeout(function(){NodeTab.save(id)},400);}},save:function(id)
{if(id.indexOf('node-tab-')===0)
{expireDate=new Date();expireDate.setTime(expireDate.getTime()+365*86400000);NodeTab.setCookie('adminNavigationTab',id.split('tab-')[1],expireDate);}},setCookie:function(name,value,expires,path)
{document.cookie=name+'='+escape(value)+(expires?'; expires='+expires.toUTCString():'')+'; path='+(path?path:'/');},getCookie:function(name)
{var n=name+'=',c=document.cookie,start=c.indexOf(n),end=c.indexOf(";",start);if(start!==-1)
{return unescape(c.substring(start+n.length,(end===-1?c.length:end)));}
return null;}};$('div.tab-block ul.tabs li a').click(NodeTab.click);var openTab=NodeTab.getCookie('adminNavigationTab');if(openTab)
{NodeTab.open('node-tab-'+openTab);}});jQuery(function($)
{$('input.ezobject-relation-search-btn').click(_search).removeClass('hide');$('input.ezobject-relation-search-text').keypress(function(e){if(e.which==13)
{return _search.call(this,e);}}).removeClass('hide');function _search(e)
{e.preventDefault();var box=$(this.parentNode.parentNode.parentNode),text=box.find('input.ezobject-relation-search-text');if(text.val())
{var params={'CallbackID':box.attr('id'),'EncodingFetchSection':1};var node=box.find("*[name*='_for_object_start_node']"),classes=box.find("input[name*='_for_object_class_constraint_list']");if(node.size())params['SearchSubTreeArray']=node.val();if(classes.size())params['SearchContentClassIdentifier']=classes.val();$.ez('ezjsc::search::'+text.val(),params,_searchCallBack);}
return false;}
function _searchCallBack(data)
{if(data&&data.content!=='')
{var boxID='#'+data.content.CallbackID;if(data.content.SearchResultCount)
{var html='',arr=data.content.SearchResult,pub=$('#ezobjectrelation-search-published-text');for(var i=0,l=arr.length;i<l;i++)
{html+='<a onclick="return ezajaxrelationsSearchAddObject( this, \''+boxID+'\', '+arr[i].id+',\''+arr[i].name+'\',\''+arr[i].class_name+'\',\''+arr[i].section.name+'\',\''+pub.val()+'\'  );">'+arr[i].name+'<\/a><br \/>';}
$(boxID+' div.ezobject-relation-search-browse').html(html).show();}
else
{var html='<p class="ezobjectrelation-search-empty-result">'+$('#ezobjectrelation-search-empty-result-text').html().replace('--search-string--','<em>'+data.content.SearchString+'<\/em>')+'<\/p>';$(boxID+' div.ezobject-relation-search-browse').html(html).show();}}
else
{alert(data.content.error_text);}}
function _addObject(link,boxID,id,name,className,sectionName,publishedTxt)
{link.onclick=function(){return false;};link.className='disabled';var tr=$(boxID+' table tbody tr:last-child'),tds=tr.find('td'),listMode=tds.size()>4;if(listMode)
{if(tds[1].innerHTML!=='--name--')
{tr=tr.clone(true).insertAfter(tr);tds=tr.find('td').slice(1);}
else
{tds=tds.slice(1);}
tr[0].className=tr[0].className==='bgdark'?'bglight':'bgdark';var priority=tr.find('td:last-child input');priority.val(parseInt(priority.val())+1);tr.find('td:first-child input').val(id);}
else
{$(boxID+' input[name*=_data_object_relation_id_]').val(id)}
tds.eq(0).html(name);tds.eq(1).html(className);tds.eq(2).html(sectionName);tds.eq(3).html(publishedTxt);$(boxID+' table').removeClass('hide');$(boxID+' .ezobject-relation-remove-button').removeClass('button-disabled').addClass('button').attr('disabled',false);$(boxID+' .ezobject-relation-no-relation').addClass('hide');}
window.ezajaxrelationsSearchAddObject=_addObject;});function admin2ppDragNDropChildren()
{this.sortOrder=1;}
admin2ppDragNDropChildren.PRIORITY_OFFSET=2;admin2ppDragNDropChildren.TABLE_ID='ezasi-subitems-list';admin2ppDragNDropChildren.prototype={init:function()
{var instance=this;this.sortOrder=jQuery('#ezasi-sort-order').val()==='0'?-1:0;jQuery('#'+admin2ppDragNDropChildren.TABLE_ID+' tbody').sortable({placeholder:'ui-state-highlight',axis:'y',opacity:0.8,items:'tr',cursor:'move',forceHelperSize:true,forcePlaceholderSize:true,change:function(evt,ui)
{instance.fixPlaceHolder(ui);},stop:function(evt,ui)
{instance.fixBackgrounds();instance.setPriorities();instance.hightlightUpdateButton();}}).css('cursor','move');jQuery('#'+admin2ppDragNDropChildren.TABLE_ID+' tbody').disableSelection();jQuery('#'+admin2ppDragNDropChildren.TABLE_ID+' input.ezasi-priority-input').change(function()
{instance.hightlightUpdateButton();});},hightlightUpdateButton:function()
{jQuery('#ezasi-update-priority').addClass('defaultbutton');},setPriorities:function()
{var inputs=jQuery('#'+admin2ppDragNDropChildren.TABLE_ID+' input.ezasi-priority-input');var start=inputs.size()*this.sortOrder*admin2ppDragNDropChildren.PRIORITY_OFFSET;inputs.each(function()
{jQuery(this).val(start);start=start+admin2ppDragNDropChildren.PRIORITY_OFFSET;});},fixPlaceHolder:function(ui)
{var pl=ui.placeholder;pl.html('<td colspan="'+ui.item.children().size()+'">&nbsp;</td>');},fixBackgrounds:function()
{var cssClass='bglight';jQuery('#'+admin2ppDragNDropChildren.TABLE_ID+' tbody tr').each(function()
{jQuery(this).attr('class',cssClass);if(cssClass=='bglight')
{cssClass='bgdark';}
else
{cssClass='bglight';}});}}
function admin2ppAjaxSavePreference(name,value)
{var url=jQuery.ez.url.replace('ezjscore/','user/preferences/')+'set_and_exit/'+name+'/'+value;jQuery.post(url,{},function(){});}
function admin2ppPreviewDialog(selector)
{this.currentNodeID=0;this.dialogSelector=selector;this.defaultTitle='';this.defaultContent='';this.previewWidth=0;this.previewHeight=0;this.linkText='';this.editText='';this.removeText='';this.moveText='';this.copyText='';}
admin2ppPreviewDialog.removeNode=function(nodeID)
{jQuery('#menu-form-remove input[name="ContentObjectID"]').val(1);jQuery('#menu-form-remove input[name="ContentNodeID"]').val(nodeID);jQuery('#menu-form-remove').submit();return false;};admin2ppPreviewDialog.moveNode=function(nodeID)
{jQuery('#menu-form-move input[name="ContentNodeID"]').val(nodeID);jQuery('#menu-form-move').submit();return false;};admin2ppPreviewDialog.prototype={getTitleSelector:function()
{var result='#ui-dialog-title-'+this.dialogSelector.replace('#','');return result;},storeDefault:function()
{var d=jQuery(this.dialogSelector);var t=jQuery(this.getTitleSelector());this.defaultTitle=t.html();this.defaultContent=d.html();},restoreDefault:function()
{var d=jQuery(this.dialogSelector);var t=jQuery(this.getTitleSelector());t.html(this.defaultTitle);d.html(this.defaultContent);jQuery(this.getTitleSelector()).parent().find('a.admin2pp-action').remove();},addSimpleLink:function(url,text,type,callback)
{var nodeID=this.currentNodeID;var link='<a class="ui-dialog-titlebar-'+type+' ui-corner-all admin2pp-action" title="'+text+'" href="'+url+'"><span class="ui-icon ui-icon-'+type+'">'+text+'</span></a>';jQuery(this.getTitleSelector()).before(link);if(callback)
{jQuery(this.getTitleSelector()).parent().find('a.ui-dialog-titlebar-'+type).click(function()
{return callback(nodeID);});}},buildPreview:function(content)
{var d=jQuery(this.dialogSelector);var t=jQuery(this.getTitleSelector());t.html(content.title);if(content.edit)
{this.addSimpleLink(content.edit,this.editText,'pencil');}
if(content.remove)
{this.addSimpleLink('#',this.removeText,'trash',admin2ppPreviewDialog.removeNode);}
if(content.copy)
{this.addSimpleLink(content.copy,this.copyText,'copy');}
if(content.move)
{this.addSimpleLink('#',this.moveText,'transferthick-e-w',admin2ppPreviewDialog.moveNode);}
var actionButtons=jQuery(this.getTitleSelector()).parent().find('a.admin2pp-action');actionButtons.mouseover(function(evt)
{jQuery(this).addClass('ui-state-hover');});actionButtons.mouseout(function(evt)
{jQuery(this).removeClass('ui-state-hover');});d.html(content.preview);},init:function()
{var instance=this;jQuery(instance.dialogSelector).dialog({autoOpen:false,open:function(evt,ui)
{jQuery.ez('admin2ppajax::preview::'+instance.currentNodeID,false,function(data)
{if(data.content)
{var content=jQuery.parseJSON(data.content);instance.storeDefault();instance.buildPreview(content);}});},close:function(evt,ui)
{instance.restoreDefault();},resizeStop:function(evt,ui)
{var width=ui.size.width,height=ui.size.height;instance.previewWidth=width;instance.previewHeight=height;admin2ppAjaxSavePreference('admin2pp_preview_width',width);admin2ppAjaxSavePreference('admin2pp_preview_height',height);}});jQuery('#menu-view').click(function(evt)
{var p=jQuery(instance.dialogSelector),previewLink=jQuery(evt.target)
instance.currentNodeID=previewLink.attr('href').split("/").pop();var linkNode=jQuery('#n'+instance.currentNodeID+' a.image-text');instance.openDialogAt(linkNode,'right_of',[5,-8]);window.ezpopmenu_hideAll();return false;}).html(instance.linkText);jQuery('#child-menu-view').click(function(evt)
{var p=jQuery(instance.dialogSelector),previewLink=jQuery(evt.target)
instance.currentNodeID=previewLink.attr('href').split("/").pop();var menuNode=jQuery('#SubitemsContextMenu');instance.openDialogAt(menuNode,'left_of',[6,-20]);window.ezpopmenu_hideAll();return false;}).html(instance.linkText);jQuery('#bookmark-view').click(function(evt)
{var p=jQuery(instance.dialogSelector),previewLink=jQuery(evt.target)
instance.currentNodeID=previewLink.attr('href').split("/").pop();instance.openDialogAt(jQuery('#bookmarks'),'left_of',[-instance.previewWidth,0]);window.ezpopmenu_hideAll();return false;}).html(instance.linkText);},openDialogAt:function(positionElt,type,manualOffset)
{var instance=this;var p=jQuery(instance.dialogSelector);var offset=positionElt.offset();var topPos=offset.top+manualOffset[1]-jQuery(document).scrollTop();if((topPos+instance.previewHeight)>jQuery(window).height())
{topPos=topPos-((topPos+instance.previewHeight)-jQuery(window).height())-10;}
var leftPos=0;if(type=='right_of')
{leftPos=offset.left+positionElt.outerWidth()+manualOffset[0];}
else
{leftPos=offset.left+manualOffset[0];}
p.dialog('option','position',[leftPos,topPos]);p.dialog('option','width',instance.previewWidth);p.dialog('option','height',instance.previewHeight);p.dialog('open');}}
function admin2ppDashboardBlocks()
{}
admin2ppDashboardBlocks.ID_PREFIX="admin2pp_db_";admin2ppDashboardBlocks.REMOVED_CLASS="admin2pp_db_removed";admin2ppDashboardBlocks.getStateSide=function(selector)
{var items=jQuery(selector);var userPrefs=new Array();items.each(function()
{if(!jQuery(this).hasClass(admin2ppDashboardBlocks.REMOVED_CLASS))
{userPrefs.push(jQuery(this).attr('id').replace(admin2ppDashboardBlocks.ID_PREFIX,''));}});return userPrefs.join(',');};admin2ppDashboardBlocks.saveState=function()
{var stateLeft=admin2ppDashboardBlocks.getStateSide('div.block div.left div.dashboard-item');var stateRight=admin2ppDashboardBlocks.getStateSide('div.block div.right div.dashboard-item');admin2ppAjaxSavePreference('admin2pp_dashboard_blocks',stateLeft+'|'+stateRight);};admin2ppDashboardBlocks.prototype={init:function()
{jQuery('.left').sortable({connectWith:'.right',handle:'h2',update:function(){admin2ppDashboardBlocks.saveState();}});jQuery('.right').sortable({connectWith:'.left',handle:'h2',update:function(){admin2ppDashboardBlocks.saveState();}});jQuery('.dashboard-item').addClass('ui-widget ui-widget-content ui-helper-clearfix ui-corner-all').find('h2').addClass('ui-widget-header ui-corner-all').prepend('<a href="#" class="ui-dialog-titlebar-close ui-corner-all"><span class="ui-icon ui-icon-closethick">close</span></a>');jQuery('.column').disableSelection();var closeButtons=jQuery('div.dashboard-item h2 a.ui-dialog-titlebar-close');var actionButtons=jQuery('div.dashboard-item h2 a.ui-corner-all');closeButtons.click(function(evt)
{var item=jQuery(this).parents('div.dashboard-item')
var blockIdentifier=item.attr('id').replace(admin2ppDashboardBlocks.ID_PREFIX,'');item.addClass(admin2ppDashboardBlocks.REMOVED_CLASS);item.hide('highlight',{},200);admin2ppDashboardBlocks.saveState();jQuery('#admin2pp_all_choosen').hide();jQuery('#admin2pp_db_choice_'+blockIdentifier).show();jQuery('#admin2pp-db-window p.button-bar').show();jQuery('#admin2pp_db_choice_'+blockIdentifier+' input').removeAttr('disabled');});actionButtons.mouseover(function(evt)
{jQuery(this).addClass('ui-state-hover');});actionButtons.mouseout(function(evt)
{jQuery(this).removeClass('ui-state-hover');});},initSettings:function()
{jQuery('#admin2pp-db-settings').toggle();jQuery('#admin2pp-db-window').dialog({modal:true,height:400,autoOpen:false,width:500});jQuery('#admin2pp-db-load').click(function()
{jQuery('#admin2pp-db-window').dialog('open');return false;});jQuery('ul.settings-dashboard li input').change(function()
{if(this.checked)
{jQuery('#admin2pp-db-save-button').addClass('defaultbutton');}});jQuery('#admin2pp-db-window form').submit(function()
{var stateLeft=admin2ppDashboardBlocks.getStateSide('div.block div.left div.dashboard-item');var stateRight=admin2ppDashboardBlocks.getStateSide('div.block div.right div.dashboard-item');var form=jQuery(this);form.find('input:checkbox:checked').each(function()
{var checkbox=jQuery(this);var blockIdentifier=checkbox.val();if(checkbox.hasClass('multiple-block'))
{var now=new Date();blockIdentifier+="_iid-"+now.getFullYear()
+"-"+(parseInt(now.getMonth())+1)
+"-"+now.getDay()
+"_"+now.getHours()
+"-"+now.getMinutes()
+"-"+now.getSeconds();}
if(stateLeft=='')
{stateLeft=blockIdentifier;}
else
{stateLeft=blockIdentifier+","+stateLeft;}});var prefs=stateLeft+'|'+stateRight;form.attr('action',form.attr('action')+"/"+prefs);return true;});}};function admin2ppDashboardFeedReader(fullIdentifier,feedURL)
{this.fullIdentifier=fullIdentifier;this.feedURL=feedURL;}
admin2ppDashboardFeedReader.SETTINGS_WINDOW_ID="feed-reader-settings";admin2ppDashboardFeedReader.FEED_ID_INPUT_ID="fr-feed-id";admin2ppDashboardFeedReader.FEED_URL_INPUT_ID="fr-feed-url";admin2ppDashboardFeedReader.BLOCK_ID_PREFIX="admin2pp_db_";admin2ppDashboardFeedReader.prototype={init:function()
{var instance=this;var content=jQuery('#content_'+this.fullIdentifier);if(content.size()==1&&content.css('display')!='none')
{this.loadResult();}
jQuery('#'+admin2ppDashboardFeedReader.BLOCK_ID_PREFIX+this.fullIdentifier+' a.ui-dialog-titlebar-refresh').click(function()
{instance.wait();instance.loadResult(1);});},initSettings:function(initDialog)
{var instance=this;jQuery('#'+admin2ppDashboardFeedReader.BLOCK_ID_PREFIX+this.fullIdentifier+' a.ui-dialog-titlebar-wrench').click(function()
{instance.showSettings();});jQuery('#'+admin2ppDashboardFeedReader.BLOCK_ID_PREFIX+instance.fullIdentifier+' input.settings').click(function()
{instance.showSettings();});if(initDialog)
{jQuery('#'+admin2ppDashboardFeedReader.SETTINGS_WINDOW_ID).dialog({modal:true,height:150,autoOpen:false,width:400});jQuery('#'+admin2ppDashboardFeedReader.SETTINGS_WINDOW_ID+' form').submit(function()
{return instance.storeSettings();});jQuery('#'+admin2ppDashboardFeedReader.FEED_URL_INPUT_ID).blur(function()
{instance.highlightSettingsButton();});}},highlightSettingsButton:function()
{jQuery('#'+admin2ppDashboardFeedReader.SETTINGS_WINDOW_ID+' input[type=submit]').addClass('defaultbutton');},removeHighlightSettingsButton:function()
{jQuery('#'+admin2ppDashboardFeedReader.SETTINGS_WINDOW_ID+' input[type=submit]').removeClass('defaultbutton');},initSettingsForm:function()
{jQuery('#'+admin2ppDashboardFeedReader.FEED_ID_INPUT_ID).val(this.fullIdentifier);jQuery('#'+admin2ppDashboardFeedReader.FEED_URL_INPUT_ID).val(this.feedURL);},openSettings:function()
{jQuery('#'+admin2ppDashboardFeedReader.SETTINGS_WINDOW_ID).dialog('open');},closeSettings:function()
{jQuery('#'+admin2ppDashboardFeedReader.SETTINGS_WINDOW_ID).dialog('close');},showSettings:function()
{this.initSettingsForm();this.removeHighlightSettingsButton();this.openSettings();},storeSettings:function()
{var feedURL=jQuery('#'+admin2ppDashboardFeedReader.FEED_URL_INPUT_ID).val();this.feedURL=feedURL;this.storeParse();this.closeSettings();return false;},hideNotConfiguredMessage:function()
{jQuery('#'+admin2ppDashboardFeedReader.BLOCK_ID_PREFIX+this.fullIdentifier+' div.not-configured').hide();},showNotConfiguredMessage:function()
{jQuery('#'+admin2ppDashboardFeedReader.BLOCK_ID_PREFIX+this.fullIdentifier+' div.not-configured').show();},resetContent:function()
{jQuery('#content_'+this.fullIdentifier).html('');},showLoader:function()
{jQuery('#'+admin2ppDashboardFeedReader.BLOCK_ID_PREFIX+this.fullIdentifier+' p.waiting').show();},hideLoader:function()
{jQuery('#'+admin2ppDashboardFeedReader.BLOCK_ID_PREFIX+this.fullIdentifier+' p.waiting').hide();},wait:function()
{this.hideNotConfiguredMessage();this.resetContent();this.showLoader();},loadResult:function(force)
{var u='admin2ppajax::parse::'+this.fullIdentifier;var instance=this;if(force)
u+='::1';jQuery.ez(u,false,function(data)
{if(data.content)
{instance.displayResult(data.content);}});},displayResult:function(content)
{jQuery('#content_'+this.fullIdentifier).html(content).show();this.hideLoader();},storeParse:function()
{var instance=this;this.wait();jQuery.ez('admin2ppajax::storeparse::'+instance.fullIdentifier,{FeedURL:instance.feedURL},function(data)
{if(data.content)
{instance.displayResult(data.content);}});if(this.feedURL=='')
{this.hideLoader();jQuery('#'+admin2ppDashboardFeedReader.BLOCK_ID_PREFIX+this.fullIdentifier+' a.ui-dialog-titlebar-refresh').hide();this.showNotConfiguredMessage();}
else
{jQuery('#'+admin2ppDashboardFeedReader.BLOCK_ID_PREFIX+this.fullIdentifier+' a.ui-dialog-titlebar-refresh').show();}}}
function admin2ppObjectInfoResizable(prefName,height)
{var tmpArray=height.split(',');this.prefName=prefName;this.heightBox=parseInt(tmpArray[0]);this.heightTab=parseInt(tmpArray[1]);if(!this.heightTab||!this.heightBox)
{this.heightTab=0;this.heightBox=0;}
this.globalSelector='#fix .box-content:first';this.tabSelector='.tab-content';}
admin2ppObjectInfoResizable.prototype={init:function()
{var instance=this;var elt=jQuery(this.globalSelector)
if(this.heightBox!=0&&this.heightTab!=0)
{this.initSize();}
elt.resizable({handles:'s',alsoResize:instance.tabSelector,minHeight:30,stop:function(evt,ui)
{instance.heightBox=jQuery(instance.globalSelector).height();instance.heightTab=jQuery(instance.tabSelector).height();admin2ppAjaxSavePreference(instance.prefName,instance.heightBox+','+instance.heightTab);jQuery(instance.globalSelector).css('width','auto');jQuery(instance.tabSelector).css('width','auto');}});},initSize:function()
{jQuery(this.globalSelector).css('height',this.heightBox+'px');jQuery(this.tabSelector).css('height',this.heightTab+'px');}}