
Array.prototype.in_array=function(p_val){for(var i=0,l=this.length;i<l;i++){if(this[i]==p_val){return true;}}
return false;};function getActivePage(){p=gup('p');if(p!=''){current_page=p;}else{for(var i=0;i<site_content.length;i++){if(site_content[i][1]=="1"){current_page=site_content[i][2];break;}}}}
function storePage(){$$('.pageid').each(function(el){var pageId=el.getProperty('rel');var parentDiv=el.getParent();if(parentDiv){parentDiv.store('pageid',pageId);}});}
function readXML(){if(XMLFile!=""){var myRequest=new Request({method:'get',url:XMLFile,async:false,autoCancel:false,onSuccess:function(text,xml){buildContent(xml)},onFailure:function(){alert('ERROR:\nThe content XML file could not be read.')}}).send();}}
function buildContent(xml){var x=xml.getElementsByTagName('item');var c=0;for(var i=0;i<x.length;i++){site_content[c]=new Array();var el=x[i];var nameEl=el.getElementsByTagName('name')[0];if(nameEl&&nameEl.childNodes.length>0)site_content[c][0]=nameEl.childNodes[0].nodeValue;var defEl=el.getElementsByTagName('def')[0];if(defEl&&defEl.childNodes.length>0)site_content[c][1]=defEl.childNodes[0].nodeValue;var idEl=el.getElementsByTagName('id')[0];if(idEl&&idEl.childNodes.length>0)site_content[c][2]=idEl.childNodes[0].nodeValue;var locEl=el.getElementsByTagName('loc')[0];if(locEl&&locEl.childNodes.length>0)site_content[c][3]=locEl.childNodes[0].nodeValue;var editEl=el.getElementsByTagName('edit')[0];if(editEl&&editEl.childNodes.length>0)site_content[c][4]=editEl.childNodes[0].nodeValue;var showEl=el.getElementsByTagName('show')[0];if(showEl&&showEl.childNodes.length>0)site_content[c][5]=showEl.childNodes[0].nodeValue;var descEl=el.getElementsByTagName('description')[0];if(descEl&&descEl.childNodes.length>0)site_content[c][6]=descEl.childNodes[0].nodeValue;var keywordsEl=el.getElementsByTagName('keywords')[0];if(keywordsEl&&keywordsEl.childNodes.length>0)site_content[c][7]=keywordsEl.childNodes[0].nodeValue;var keywordsEl=el.getElementsByTagName('parent')[0];if(keywordsEl&&keywordsEl.childNodes.length>0)site_content[c][8]=keywordsEl.childNodes[0].nodeValue;var keywordsEl=el.getElementsByTagName('tags')[0];if(keywordsEl&&keywordsEl.childNodes.length>0)site_content[c][9]=keywordsEl.childNodes[0].nodeValue;var dataEl=el.getElementsByTagName('data')[0];if(dataEl&&dataEl.childNodes.length>0)site_content[c][10]=dataEl.childNodes[0].nodeValue;c++;}}
function putContent(p,loc,field,effect,refreshpage,justreturn){var checkDiv=(loc)?$(loc):null;if(checkDiv&&!justreturn&&checkDiv.retrieve('pageid')==p)return;if(!checkDiv)loc='thisisdummytext';var divId=null;var parentId=null;var newClass=null;if(loc.search(/:/)!=-1){var tmpLoc=loc.split(':');loc=tmpLoc[0];newClass=tmpLoc[1];}
allDivs.each(function(eachDiv){if(eachDiv[0]==loc){divId=eachDiv[1];parentId=eachDiv[2];}});var foundpage=false;var foundloc=false;for(var i=0;i<site_content.length;i++){if(p==site_content[i][2]||p==""){foundpage=true;var tmpLoc=site_content[i][3].split(',');if(tmpLoc.in_array(loc)||justreturn){foundloc=true;var pagesToShow=(!$chk(site_content[i][5]))?new Array():site_content[i][5].split(",");if(!$chk(site_content[i][5])||site_content[i][5]=="all"||pagesToShow.in_array(current_page)){var tmpHtml="";switch(field){case"name":tmpHtml=site_content[i][0];break;case"def":tmpHtml=site_content[i][1];break;case"id":tmpHtml=site_content[i][2];break;case"loc":tmpHtml=site_content[i][3];break;case"edit":tmpHtml=site_content[i][4];break;case"show":tmpHtml=site_content[i][5];break;case"description":tmpHtml=site_content[i][6];break;case"keywords":tmpHtml=site_content[i][7];break;case"parent":tmpHtml=site_content[i][8];break;case"tags":tmpHtml=site_content[i][9];break;case"data":tmpHtml=site_content[i][10];break;}}}}}
if(divId)var divExists=checkDiv;if(!divExists&&parentId){divId=parentId;divExists=$(divId);}
if(justreturn)divExists=true;if(divExists){if(!foundpage){if(loc=='content'){tmpHtml='<h1>Error</h1><p class="error_text">The page <u>'+p+'</u> does not exist. This could be caused by a incorrect referring URL or menu link.</p><p class="error_text">Please click <a href="'+home_page+'">here</a> to return to the front page.</p>';}else{tmpHtml='<p class="error_text"><b>Error:</b> Content <u>'+p+'</u> does not exist.</p>';}}else if(foundpage&&!foundloc&&!justreturn){if(loc=='content'){tmpHtml='<h1>Error</h1><p class="error_text">The page <u>'+p+'</u> has not been configured to appear in this location.</p><p class="error_text">Please click <a href="'+home_page+'">here</a> to return to the front page.</p>';}else{tmpHtml='<p class="error_text"><b>Error:</b> Content <u>'+p+'</u> has not been configured to appear in this location.</p>';}}
if(!justreturn){checkDiv.store('pageid',p);if(effect){var effectId=divId;if(Browser.Engine.trident)parentBG(effectId);if(parentId){var checkParentId=$(parentId);if(!tmpHtml&&checkParentId)checkParentId.setStyle('visibility','hidden');if(tmpHtml&&checkParentId)effectId=checkParentId;}
$(effectId).set('tween',{duration:fadeDuration,onComplete:function(){$(divId).empty();$(divId).set('html',tmpHtml);if(newClass){$(divId).addClass(newClass);}else{}
$(effectId).set('tween',{duration:fadeDuration,onComplete:function(){if(refreshpage){newPage(p);}else{changeContent(p);fixLinks();}}});$(effectId).fade('in');}});$(effectId).fade('out');}else{if(parentId){var checkParentId=$(parentId);if(!tmpHtml&&checkParentId)checkParentId.setStyle('visibility','hidden');if(tmpHtml&&checkParentId)checkParentId.setStyle('visibility','visible');}
$(divId).set('html',tmpHtml);if(newClass){$(divId).addClass(newClass);}else{$(divId).removeProperty('class');}
if(refreshpage){newPage(p);}else{changeContent(p);fixLinks();}}}}else{alert('ERROR:\nCould inject content for \''+p+'\' because location \''+divId+'\' does not exist!');}
if(usingSlimBox)Slimbox.scanPage();if(justreturn)return(tmpHtml);}
function parentBG(el){if($(el).getStyle('background-color')){return;}
var parentId=$(el).getParent();var c=1;while(parentId){if(parentId.getStyle('background-color')){$(el).setStyle('background-color',parentId.getStyle('background-color'));return;}
parentId=parentId.getParent();c++;}
return;}
function gup(name,url){name=name.replace(/[\[]/,"\\\[").replace(/[\]]/,"\\\]");if(!url)url=window.location.href;var regexS="[\\?&]"+name+"=([^&#]*)";var regex=new RegExp(regexS);var results=regex.exec(url);if(results==null){return"";}else{return results[1];}}
function swapHoverImage(){$$('.swaphoverimage').each(function(el){el.removeClass('swapimage');if(el.get('tag')=='img'||el.get('tag')=='a'){if(el.get('tag')=='a'){el=el.getElement('img');}
if(el){var imgProps=el.getProperties('src','rel','alt','height','width');var imgOutUrl=imgProps['src'];var imgInUrl=imgProps['src'].replace('_out','_in');var imgClickUrl=imgProps['src'].replace('_out','_click');el.addEvents({'mouseenter':function(){el.setProperty('src',imgInUrl);},'mouseleave':function(){el.setProperty('src',imgOutUrl);},'click':function(){if(el.get('rel')=='click')el.setProperty('src',imgClickUrl)}});}}});}
function changeLinks(linkText){if(!linkText){$$('a').each(function(tag){var tagUrl=tag.getProperty('href');if(tagUrl&&tagUrl!="#"&&tagUrl!="javascript:void(0)"&&tagUrl.indexOf('/')==-1){if(sef){tag.setProperty('href',sitePath+'/'+tagUrl);}else{tag.setProperty('href',sitePath+'/'+thisScript+'?p='+tagUrl);}}});}else{if(linkText!="#"&&linkText!="javascript:void(0)"&&linkText.indexOf('/')==-1){if(sef){linkText=sitePath+'/'+linkText;}else{linkText=sitePath+'/'+thisScript+'?p='+linkText;}
return linkText;}else{return linkText;}}}
function checkParent(rels,els){if(rels.indexOf('parent|')!=-1){alert('found parent')
var eachParams=rels.split('||');eachParams.each(function(eachParam){var thisParam=eachParam.split('|');switch(thisParam[0]){case"parent":alert(thisParam[1]);return($(thisParam[1]));break;}});return(null);}else{return(els);}}
function fixPopup(popupWrapper,popupContentParent,popupContent){if($('popscroll_content')){popupContentParent.grab(popupContent)
popupContent.setStyle('height','auto');popupWrapper.setStyle('height','auto');popupContentParent.setStyle('height','auto');$('popscroll_content').destroy();$('popscrollbarv').destroy();$('pophandlev').destroy();}
var marginOuter=10;var winSize=window.getSize();var popupSize=popupWrapper.getSize();var contentSize=popupContent.getSize();var parentSize=popupContentParent.getSize();var topHeight=$('popup_top').getSize().y;var bottomHeight=$('popup_bottom').getSize().y;var doHeight=true;var doWidth=false;var fromTop=(winSize.y>popupSize.y)?((winSize.y-popupSize.y)/2).toInt()+(window.getScroll().y):window.getScroll().y;var fromLeft=(winSize.x>popupSize.x)?((winSize.x-popupSize.x)/2).toInt()+(window.getScroll().x):window.getScroll().x;popupWrapper.setStyles({visibility:'visible',top:fromTop+'px',left:fromLeft+'px'});}
function fixLinks(){$$('.void').each(function(el){var backEl=(el.hasClass('voidback'))?el.getPrevious():false;var forwardEl=(el.hasClass('voidforward'))?el.getNext():false;if(el.get('tag')=='td'){el.getChildren('a').each(function(match){if(match.hasClass('dummy')){relParams=match.getProperty('rel');}});}else{relParams=el.getProperty('rel');}
if(el.get('tag')=='a'){if(el.getProperty('href').indexOf('?p=')!=-1){var linkPage=gup('p',el.getProperty('href'));el.setProperty('href','javascript:void(0)');}else if(el.getProperty('href')=="#"){el.setProperty('href','javascript:void(0)');var linkPage=false;}else if(el.getProperty('href')=="javascript:void(0)"){var linkPage=false;}else if(el.getProperty('href').indexOf(sitePath)!=-1){var splitUrl=el.getProperty('href').split('/');var linkPage=splitUrl[splitUrl.length-1];}else if(el.getProperty('href').indexOf('/')==-1){var linkPage=el.getProperty('href');}else{var linkPage=false;}}else{var linkPage=false;}
el.removeClass('void');var elArray=[el];if(backEl){elArray[elArray.length]=backEl;backEl.removeClass('voidback');}
if(forwardEl){elArray[elArray.length]=forwardEl;forwardEl.removeClass('voidforward');}
elItem=el;if(relParams!=null){var eachParams=relParams.split('||');eachParams.each(function(eachParam){var thisParam=eachParam.split('|');switch(thisParam[0]){case"clickclass":el.addEvent('click',function(){if(thisParam[3])el.removeClass(thisParam[3]);el.addClass(thisParam[1]);classTimer=(thisParam[2])?thisParam[2]:1000;var removeClass=function(){el.removeClass(thisParam[1]);if(thisParam[3])el.addClass(thisParam[3]);}
timerResult=removeClass.delay(classTimer);});break;case"hoverclass":var removeHClass=function(){el.removeClass(thisParam[1]);}
el.addEvents({'mouseenter':function(){el.addClass(thisParam[1]);},'mouseleave':function(){var removeDelay=(thisParam[3])?parseInt(thisParam[3]):0;var removeResult=removeHClass.delay(removeDelay);},'click':function(){if(thisParam[2]||(thisParam[2]&&thisParam[2]!="null")){if(thisParam[2]=='0'){el.removeClass(thisParam[1]);}else{el.addClass(thisParam[2]);}}}});break;case"otherhoverclass":var removeHClass=function(){$(thisParam[1]).removeClass(thisParam[2]);}
elItem.addEvents({'mouseenter':function(){$(thisParam[1]).addClass(thisParam[2]);},'mouseleave':function(){var removeDelay=(thisParam[4])?parseInt(thisParam[4]):0;var removeResult=removeHClass.delay(removeDelay);},'click':function(){if(thisParam[3]){if(thisParam[3]=='null'){}else{$(thisParam[1]).addClass(thisParam[3]);}}}});break;case"injectdiv":var effect=true;if(Browser.Engine.trident){}
var revertDiv=function(){if(effect){$(thisParam[1]).fade('out');}else{$(thisParam[1]).set('html','');}}
if(thisParam[2]=="click"){elItem.addEvent('click',function(){if(effect)$(thisParam[1]).fade('hide');$(thisParam[1]).set('html',thisParam[4]);if(effect)$(thisParam[1]).fade('in');});}else if(thisParam[2]=="hover"){elItem.addEvents({'mouseenter':function(){if(effect)$(thisParam[1]).fade('hide');$(thisParam[1]).set('html',thisParam[4]);fixImg(thisParam[1]);if(effect)$(thisParam[1]).fade('in');},'mouseleave':function(){if(thisParam[3]!="null")var removeResult=revertDiv.delay(parseInt(thisParam[3]));}});}
break;case"click":if(thisParam[1])el.setProperty('href',changeLinks(thisParam[1]));break;case"dest":if(elItem.get('tag')=="a")elItem.setProperty('href','javascript:void(0)');if(thisParam[1]!="all"){elItem.addEvent('click',function(){allDivs.each(function(eachDiv){if(eachDiv[0]==thisParam[1])putContent(linkPage,eachDiv[0],'data',eachDiv[3],eachDiv[4]);});});}else{elItem.addEvent('click',function(){current_page=linkPage;allDivs.each(function(eachDiv){var tmpPage='';if(eachDiv[0]=='content')tmpPage=linkPage;putContent(tmpPage,eachDiv[0],'data',eachDiv[3],eachDiv[4]);});});}
break;case"autoclick":if(thisParam[1]){var clickTimer=thisParam[1]*1000;var autoClick=function(){elItem.fireEvent('click');}
clickResult=autoClick.delay(clickTimer);}
break;case"popupclose":var popupOverlay=$('popup_overlay');var popupWrapper=$(thisParam[1]);var popupContent=$(thisParam[2]);if(popupWrapper&&popupOverlay&&popupContent){if(elItem.get('tag')=='a')elItem.setProperty('href','javascript:void(0)');elItem.addEvent('click',function(){popupContent.store('active',0);popupWrapper.fade('out');});}
break;case"popup":var popped=false;if((linkPage||thisParam[5])&&thisParam[1]&&thisParam[2]){if(elItem.get('tag')=="a")elItem.setProperty('href','javascript:void(0)');var popupTimer=(thisParam[4])?thisParam[4]:0;var clickPopup=function(){popped=true;var popupWrapper=$(thisParam[1]);var popupContent=$(thisParam[2]);var popupContentParent=popupContent.getParent();if(popupWrapper&&popupContent&&(popupContent.retrieve('active')==0||!popupContent.retrieve('active'))){if(thisParam[5])linkPage=thisParam[5];var popupOverlay=new Element('div').setProperty('id','popup_overlay');popupOverlay.setStyles({top:Window.getScrollTop()+'px',height:Window.getScrollHeight()+'px'});popupOverlay.setStyle('opacity','.9').inject(popupWrapper,'before');if(popupOverlay.getStyle('cursor')=="pointer"){popupOverlay.addEvent('click',function(){popupContent.store('active',0);popupWrapper.fade('out');});}
if(thisParam[3]&&thisParam[3]!='auto'){popupContentParent.setStyle('height',thisParam[3]+'px');}else{}
popupWrapper.set('tween',{onComplete:function(){if(popupContent.retrieve('active')==0){window.removeEvent('resize');if(thisParam[3])popupContentParent.setStyle('height','auto');popupContent.empty();popupContent.store('pageid','');popupWrapper.setStyle('visibility','hidden');popupOverlay.destroy();}else{}}});popupWrapper.fade('hide');popupContent.store('active',1);if(useJSLinks){putContent(linkPage,thisParam[2],'data',false,true);fixPopup(popupWrapper,popupContentParent,popupContent);popupContent.store('active',1);popupWrapper.fade('in');}else{var req=new Request.HTML({url:sitePath+'/popup.php',onSuccess:function(rTree,rElements,rHTML,rJScript){$(thisParam[2]).set('html','');$(thisParam[2]).set('html',rHTML);newPage('');fixPopup(popupWrapper,popupContentParent,popupContent);popupContent.store('active',1);popupWrapper.fade('in');},onFailure:function(){$(thisParam[2]).set('html','The request failed.');}}).get({'p':linkPage});if(!popped)req.send();}
closeButton=$('popup_close');if(closeButton){closeButton.addEvent('click',function(){popupContent.store('active',0);popupWrapper.fade('out');popped=false;});}
clearingDiv=new Element('div',{'style':'clear:both'}).inject(popupContent);window.addEvent('resize',function(){popupWrapper.setStyle('height','auto');popupContentParent.setStyle('height','auto');fixPopup(popupWrapper,popupContentParent,popupContent);});}}
el.addEvent('click',function(){popped=($(thisParam[2]).get('active')==1)?true:false;if(!popped)popResult=clickPopup.delay(popupTimer);});}
break;case"hover":if(thisParam[1]!="all"){elItem.addEvent('mouseenter',function(){allDivs.each(function(eachDiv){if(eachDiv[0]==thisParam[1])putContent(thisParam[2],eachDiv[0],'data',eachDiv[3],eachDiv[4]);});});}else{elItem.addEvent('mouseenter',function(){current_page=linkPage;allDivs.each(function(eachDiv){var tmpPage='';if(eachDiv[0]=='content')tmpPage=thisParam[2];putContent(tmpPage,eachDiv[0],'data',eachDiv[3],eachDiv[4]);});});}
if(thisParam[3]){if(thisParam[3]=="last"){}else{if(thisParam[1]!="all"){elItem.addEvent('mouseleave',function(){allDivs.each(function(eachDiv){if(eachDiv[0]==thisParam[1])putContent(thisParam[3],eachDiv[0],'data',eachDiv[3],eachDiv[4]);});});}else{elItem.addEvent('mouseleave',function(){current_page=thisParam[3];allDivs.each(function(eachDiv){var tmpPage='';if(eachDiv[0]=='content')tmpPage=thisParam[3];putContent(tmpPage,eachDiv[0],'data',eachDiv[3],eachDiv[4]);});});}}}
break;case"bgmove":var bgParams=thisParam[1].split('|');var moveDuration=3000;var moveTransition=Fx.Transitions.Expo.easeInOut;elItem.addEvent('click',function(e){if(bgMove[bgParams[0]])bgMove[bgParams[0]].cancel();bgMove[bgParams[0]]=new Fx.Tween(bgParams[0],{duration:moveDuration,transition:moveTransition,onStart:function(){},onComplete:function(){}});bgMove[bgParams[0]].start('background-position',bgParams[1]+'px'+' '+bgParams[2]+'px');e.stop();});break;case"page":if(elItem.get('tag')=="a")elItem.setProperty('href','javascript:void(0)');var pageParams=thisParam[1].split('|');linkPage=pageParams[0];elItem.addEvent('click',function(){if(pageParams[1]!="all"){elItem.addEvent('click',function(){allDivs.each(function(eachDiv){if(eachDiv[0]==pageParams[1])putContent(linkPage,eachDiv[0],'data',eachDiv[3],eachDiv[4]);});});}else{elItem.addEvent('click',function(){current_page=linkPage;allDivs.each(function(eachDiv){var tmpPage='';if(eachDiv[0]=='content')tmpPage=linkPage;putContent(tmpPage,eachDiv[0],'data',eachDiv[3],eachDiv[4]);});});}});break;}});}});}
function adjustToScreen(el,what,adj,min){if(!adj)adj=0;var winSize=window.getSize();var winscrollSize=window.getScrollSize();var winWidth=winSize.x;var winHeight=winSize.y;if(Browser.Engine.webkit)winHeight-=10;if(Browser.Engine.gecko)winHeight-=10;if(min){if(winWidth<(min+adj))winWidth=(min+adj);if(winHeight<(min+adj))winHeight=(min+adj);}
if(what=="width"||what=="both")$(el).setStyle('width',(winWidth-adj)+'px');if(what=="height"||what=="both")$(el).setStyle('height',(winHeight-adj)+'px');}
function fireEvents(){$$('.fireclick').each(function(el){el.fireEvent('click');});$$('.firehover').each(function(el){el.fireEvent('mouseenter');});}
function fixImg(what){if(Browser.Engine.trident){if(what&&what!=""){what='#'+what+' ';}else{var what='';}
$$(what+'img').each(function(img){if(!img.hasClass('nopngfix')){var imgProps=img.getProperties('id','src','title','alt','align');if(imgProps.src.test('.png','i')){var imgStyles=img.getStyles();var imgDisplay='inline-block';if(imgProps.align=='left')var imgFloat='left';if(imgProps.align=='right')var imgFloat='right';if(img.getParent().getProperty('href'))var imgCursor='hand';var replacement=new Element('span',{'id':(imgProps.id)?imgProps.id:'','class':(img.className)?img.className:'','title':(imgProps.title)?imgProps.title:(imgProps.alt)?imgProps.alt:'','styles':{'display':imgDisplay,'width':img.getWidth()+'px','height':img.getHeight()+'px','cursor':imgCursor,'float':(imgFloat)?imgFloat:'','-ms-filter':"\"progid:DXImageTransform.Microsoft.AlphaImageLoader (src='"+imgProps.src+"', sizingMethod='scale')\";",'filter':"progid:DXImageTransform.Microsoft.AlphaImageLoader (src='"+imgProps.src+"', sizingMethod='scale');"},'src':imgProps.src}).setStyles(imgStyles).cloneEvents(img).replaces(img);}}});if(Browser.Engine.version<5){var actionEls=[];var c=0;$$('div').each(function(el){actionEls[c]=el;c++;});$$('a').each(function(el){actionEls[c]=el;c++;});actionEls.each(function(el){if(!el.hasClass('nopngfix')){var elBG=el.getStyle('background-image');if(elBG&&elBG.test('.png','i')){elBG=elBG.substr(5,elBG.lastIndexOf('")')-5);el.setStyles({'position':'static','background':'none','-ms-filter':"\"progid:DXImageTransform.Microsoft.AlphaImageLoader (src='"+elBG+"', sizingMethod='scale')\";",'filter':"progid:DXImageTransform.Microsoft.AlphaImageLoader (src='"+elBG+"', sizingMethod='scale');"});if(el.get('tag')=='a'&&el.hasClass('iehover')){var hoverEl=el;var classes=el.getProperty('class').split(' ');if(classes.length>0){var pos=classes.length-2;var oldClass=classes[pos]
var newClass=classes[pos]+'_hover';el.addEvents({'mouseenter':function(){hoverEl.addClass(newClass);},'mouseleave':function(){hoverEl.removeClass(newClass);}});}
el.removeClass('iehover');}
el.getChildren().each(function(child){child.setStyle('position','relative');});}}});}}}
function slidePanels(){if(allPanels.length>0){var togglePanel=function(){this.toggle();};var changePanel=function(tmpPage,tmpLoc){putContent(tmpPage,tmpLoc,'data',false,true);};var openPanel=function(){this.slideIn();};var closePanel=function(){this.slideOut();};allPanels.each(function(eachPanel){var slideTimer=false;var slideInstant=false;var eachPanelToggleEl=$(eachPanel[0]);var eachPanelWrapperEl=$(eachPanel[1]);if(eachPanelToggleEl&&eachPanelWrapperEl){var slidePanel=new Fx.SlideNew(eachPanel[1],{mode:eachPanel[4],size:500,duration:eachPanel[6],transition:eachPanel[7]});slidePanel.hide();eachPanelToggleEl.addEvent('click',function(e){e.stop();slidePanel.cancel();if(eachPanel[8]>0)slideTimer=closePanel.delay(eachPanel[8],slidePanel);slideInstant=togglePanel.delay(0,slidePanel);});if(eachPanel[3]){var eachPanelCloseEl=$(eachPanel[3]);if(eachPanelCloseEl){eachPanelCloseEl.addEvent('click',function(e){e.stop();slidePanel.cancel();slideInstant=closePanel.delay(0,slidePanel);});}}
if(eachPanel[5]){eachPanelToggleEl.addEvent('mouseenter',function(e){e.stop();slidePanel.cancel();if(eachPanel[8]>0)slideTimer=closePanel.delay(eachPanel[8],slidePanel);slideInstant=openPanel.delay(0,slidePanel);});eachPanelWrapperEl.addEvent('mouseleave',function(e){e.stop();slidePanel.cancel();slideInstant=closePanel.delay(0,slidePanel);});}
eachPanelWrapperEl.addEvent('mouseenter',function(e){if(eachPanel[8]>0){e.stop();$clear(slideTimer);slideTimer=closePanel.delay(eachPanel[8],slidePanel);}});eachPanelWrapperEl.addEvent('click',function(e,slideOpen){if(eachPanel[8]>0){e.stop();slidePanel.cancel();$clear(slideTimer);slideTimer=closePanel.delay(eachPanel[8],slidePanel);}});eachPanelWrapperEl.setStyles({visibility:'visible'});if(eachPanel[2]>0){$$('#'+eachPanel[1]+' a').each(function(el){if(!el.hasClass('slidervoid')){el.addEvent('click',function(e){e.stop();slidePanel.cancel();$clear(slideTimer);if(el.getProperty('rel')!='navigation'){slideTimer=closePanel.delay(eachPanel[2],slidePanel);}else{if(eachPanel[8]>0){slideTimer=closePanel.delay(eachPanel[8],slidePanel);}else{slideTimer=null;}}});}else if(el.hasClass('slidervoid')){if(el.getProperty('href').indexOf('?p=')!=-1){var linkPage=gup('p',el.getProperty('href'));el.setProperty('href','javascript:void(0)');}else if(el.getProperty('href')=="#"){el.setProperty('href','javascript:void(0)');var linkPage=false;}else if(el.getProperty('href')=="javascript:void(0)"){var linkPage=false;}else if(el.getProperty('href').indexOf(sitePath)!=-1){var splitUrl=el.getProperty('href').split('/');var linkPage=splitUrl[splitUrl.length-1];el.setProperty('href','javascript:void(0)');}else if(el.getProperty('href').indexOf('/')==-1){var linkPage=el.getProperty('href');el.setProperty('href','javascript:void(0)');}else{var linkPage=false;}
el.removeClass('slidervoid');var linkLoc=el.getProperty('rel');if(linkLoc!="all"){el.addEvent('click',function(e){e.stop();$clear(slideTimer);slidePanel.cancel();slideInstant=closePanel.delay(0,slidePanel);slideContent=changePanel.delay(eachPanel[6],slidePanel,[linkPage,linkLoc]);slideInstant=openPanel.delay(eachPanel[6]+50,slidePanel);if(eachPanel[8]>0)slideTimer=closePanel.delay(eachPanel[8],slidePanel);});}}});slidePanel.hide();}}});}}
function pixelToInt(px){return eval(px.substring(0,px.length-2));}
function setOpacity(element,value){element.style.MozOpacity=value;element.style.filter="alpha(opacity="+(value*100)+")";}
Fx.SlideNew=new Class({Extends:Fx,options:{mode:'verticaltop'},initialize:function(element,options){this.addEvent('complete',function(){this.open=(this.wrapper['offset'+this.layout.capitalize()]!=0);if(this.open&&Browser.Engine.webkit419)this.element.dispose().inject(this.wrapper);},true);this.element=this.subject=$(element);this.parent(options);var wrapper=this.element.retrieve('wrapper');this.wrapper=wrapper||new Element('div',{styles:$extend(this.element.getStyles('margin','position'),{'overflow':'hidden'})}).wraps(this.element);this.element.store('wrapper',this.wrapper).setStyle('margin',0);this.now=[];this.open=true;},verticaltop:function(){this.margin='margin-top';this.layout='height';this.offset=this.element.offsetHeight;},verticalbottom:function(){this.margin='margin-bottom';this.layout='height';this.offset=this.element.offsetHeight;},horizontalleft:function(){this.margin='margin-left';this.layout='width';this.offset=this.element.offsetWidth;},horizontalright:function(){this.margin='margin-right';this.layout='width';this.offset=this.element.offsetWidth;},set:function(now){this.element.setStyle(this.margin,now[0]);this.wrapper.setStyle(this.layout,now[1]);return this;},compute:function(from,to,delta){var now=[];var x=2;x.times(function(i){now[i]=Fx.compute(from[i],to[i],delta);});return now;},start:function(how,mode){if(!this.check(arguments.callee,how,mode))return this;this[mode||this.options.mode]();var margin=this.element.getStyle(this.margin).toInt();var layout=this.wrapper.getStyle(this.layout).toInt();var caseIn=[[margin,layout],[0,this.offset]];var caseOut=[[margin,layout],[-this.offset,0]];var start;switch(how){case'in':start=caseIn;break;case'out':start=caseOut;break;case'toggle':start=(this.wrapper['offset'+this.layout.capitalize()]==0)?caseIn:caseOut;}
return this.parent(start[0],start[1]);},slideIn:function(mode){return this.start('in',mode);},slideOut:function(mode){return this.start('out',mode);},hide:function(mode){this[mode||this.options.mode]();this.open=false;return this.set([-this.offset,0]);},show:function(mode){this[mode||this.options.mode]();this.open=true;return this.set([0,this.offset]);},toggle:function(mode){return this.start('toggle',mode);},status:function(){return(this.wrapper['offset'+this.layout.capitalize()]==0)?'closed':'open';}});Element.Properties.slide={set:function(options){var slide=this.retrieve('slide');if(slide)slide.cancel();return this.eliminate('slide').store('slide:options',$extend({link:'cancel'},options));},get:function(options){if(options||!this.retrieve('slide')){if(options||!this.retrieve('slide:options'))this.set('slide',options);this.store('slide',new Fx.Slide(this,this.retrieve('slide:options')));}
return this.retrieve('slide');}};Element.implement({slide:function(how,mode){how=how||'toggle';var slide=this.get('slide'),toggle;switch(how){case'hide':slide.hide(mode);break;case'show':slide.show(mode);break;case'toggle':var flag=this.retrieve('slide:flag',slide.open);slide[(flag)?'slideOut':'slideIn'](mode);this.store('slide:flag',!flag);toggle=true;break;default:slide.start(how,mode);}
if(!toggle)this.eliminate('slide:flag');return this;}});var Bouncer=new Class({Implements:[Options],options:{speed:500,effect:Fx.Transitions.Expo.easeInOut,stopClick:true},initialize:function(el,options){this.setOptions(options);el=$(el);if(el!=null){var defPadding=el.getStyle('padding-top');el.addEvents({'mouseenter':function(){this.bouncing=true;if(!this.fx)this.bounce(el,defPadding);}.bind(this),'mouseleave':function(){this.bouncing=false;}.bind(this),'click':function(){if(!this.options.stopClick)this.bouncing=false;}.bind(this)});}},bounce:function(el,startPadding){if(this.bouncing){this.fx=new Fx.Tween(el,{duration:this.options.speed,onComplete:function(){this.fx=new Fx.Tween(el,{duration:this.options.speed,onComplete:function(){this.bounce(el,startPadding);}.bind(this)}).start('padding-top',startPadding);}.bind(this)}).start('padding-top','0px');}else{this.fx=false;}},stop:function(el,startPadding){this.fx.cancel();}});var newTips=new Class({Implements:[Events,Options],options:{onShow:function(tip){tip.setStyle('visibility','visible');},onHide:function(tip){tip.setStyle('visibility','hidden');},showDelay:100,hideDelay:100,className:null,tlClass:null,trClass:null,blClass:null,brClass:null,offsets:{x:16,y:16},fixed:false,fadeDuration:250,closeClick:false},initialize:function(){var params=Array.link(arguments,{options:Object.type,elements:$defined});this.setOptions(params.options||null);this.tip=new Element('div').inject(document.body);if(this.options.className)this.tip.addClass(this.options.className);if(this.options.fadeDuration>0){this.tip.set('tween',{duration:this.options.fadeDuration});this.tip.fade('hide');}
this.top=new Element('div',{'class':'tip-top'}).inject(this.tip);this.container=new Element('div',{'class':'tip-middle'}).inject(this.tip);this.bottom=new Element('div',{'class':'tip-bottom'}).inject(this.tip);this.tip.setStyles({position:'absolute',top:0,left:0,visibility:'hidden'});if(params.elements)this.attach(params.elements);},attach:function(elements){$$(elements).each(function(element){var title=null;var text="test";var enter=element.retrieve('tip:enter',this.elementEnter.bindWithEvent(this,element));var leave=element.retrieve('tip:leave',this.elementLeave.bindWithEvent(this,element));element.addEvents({mouseenter:enter,mouseleave:leave});if(!this.options.fixed){var move=element.retrieve('tip:move',this.elementMove.bindWithEvent(this,element));element.addEvent('mousemove',move);}
if(this.options.closeClick)element.addEvent('click',this.elementLeave.bindWithEvent(this,element));},this);return this;},detach:function(elements){$$(elements).each(function(element){element.removeEvent('mouseenter',element.retrieve('tip:enter')||$empty);element.removeEvent('mouseleave',element.retrieve('tip:leave')||$empty);element.removeEvent('mousemove',element.retrieve('tip:move')||$empty);element.eliminate('tip:enter').eliminate('tip:leave').eliminate('tip:move');});return this;},elementEnter:function(event,element){$A(this.container.childNodes).each(Element.dispose);var title=null;if(title){this.titleElement=new Element('div',{'class':'tip-title'}).inject(this.container);this.fill(this.titleElement,title);}
var relParams=element.getProperty('rel');var text="No page defined";if(relParams!=""){var eachParams=relParams.split('||');eachParams.each(function(eachParam){var thisParam=eachParam.split('|');if(thisParam[0]=='tip')text=putContent(thisParam[1],null,'data',false,false,true);if(thisParam[0]=='tiptext')text=thisParam[1];});}
if(text){this.textElement=new Element('div',{'class':'tip-text'}).inject(this.container);this.fill(this.textElement,text);}
this.timer=$clear(this.timer);this.timer=this.show.delay(this.options.showDelay,this);this.position((!this.options.fixed)?event:{page:element.getPosition()});},elementLeave:function(event){if(this.options.fadeDuration>0)this.tip.fade('out');$clear(this.timer);this.timer=this.hide.delay(this.options.hideDelay+this.options.fadeDuration,this);},elementMove:function(event){this.position(event);},position:function(event){var size=window.getSize(),scroll=window.getScroll();var tip={x:this.tip.offsetWidth,y:this.tip.offsetHeight};var props={x:'left',y:'top'};for(var z in props){var pos=event.page[z]+this.options.offsets[z];if((pos+tip[z]-scroll[z])>size[z])pos=event.page[z]-this.options.offsets[z]-tip[z];this.tip.setStyle(props[z],pos);}
var tipStats=this.tip.getStyles('top','left');if(parseInt(tipStats.left)<(event.page.x+this.options.offsets.x)){if(parseInt(tipStats.top)>event.page.y){if(this.options.tlClass)this.top.removeClass(this.options.tlClass);if(this.options.trClass)this.top.removeClass(this.options.trClass);if(this.options.blClass)this.bottom.removeClass(this.options.blClass);if(this.options.brClass)this.bottom.removeClass(this.options.brClass);if(this.options.trClass)this.top.addClass(this.options.trClass);}else{if(this.options.tlClass)this.top.removeClass(this.options.tlClass);if(this.options.trClass)this.top.removeClass(this.options.trClass);if(this.options.blClass)this.bottom.removeClass(this.options.blClass);if(this.options.brClass)this.bottom.removeClass(this.options.brClass);if(this.options.brClass)this.bottom.addClass(this.options.brClass);}}else{if(parseInt(tipStats.top)>event.page.y){if(this.options.tlClass)this.top.removeClass(this.options.tlClass);if(this.options.trClass)this.top.removeClass(this.options.trClass);if(this.options.blClass)this.bottom.removeClass(this.options.blClass);if(this.options.brClass)this.bottom.removeClass(this.options.brClass);if(this.options.tlClass)this.top.addClass(this.options.tlClass);}else{if(this.options.tlClass)this.top.removeClass(this.options.tlClass);if(this.options.trClass)this.top.removeClass(this.options.trClass);if(this.options.blClass)this.bottom.removeClass(this.options.blClass);if(this.options.brClass)this.bottom.removeClass(this.options.brClass);if(this.options.blClass)this.bottom.addClass(this.options.blClass);}}},fill:function(element,contents){(typeof contents=='string')?element.set('html',contents):element.adopt(contents);},show:function(){this.fireEvent('show',this.tip);if(this.options.fadeDuration>0)this.tip.fade('in');},hide:function(){if(this.options.fadeDuration>0)this.tip.fade('out');this.fireEvent('hide',this.tip);}});function makeScrollbar(content,scrollbar,handle,horizontal,ignoreMouse){var steps=(horizontal?(content.getScrollSize().x-content.getSize().x):(content.getScrollSize().y-content.getSize().y))
var slider=new Slider(scrollbar,handle,{steps:steps,mode:(horizontal?'horizontal':'vertical'),onChange:function(step){var x=(horizontal?step:0);var y=(horizontal?0:step);content.scrollTo(x,y);}}).set(0);if(!(ignoreMouse)){$$(content,scrollbar).addEvent('mousewheel',function(e){e=new Event(e).stop();var step=slider.step-e.wheel*30;slider.set(step);});}
$(document.body).addEvent('mouseleave',function(){slider.drag.stop()});}