var accord={showElm:0,toggle:null,init:function(){$$('.accordian').each(function(item,index){var headings=$(item).getElements('.accord_title');var bodys=$(item).getElements('.accord_body');headings.each(function(head,i){if(head.hasClass('show')){accord.showElm=i;}});var setAccordian=new Accordion(headings,bodys,{display:0,opacity:false,show:accord.showElm},$(item));headings.each(function(heading,index){heading.addEvent('mouseenter',function(){heading.removeClass("accord_title");heading.addClass("accord_titleOvr");});heading.addEvent('mouseleave',function(){heading.removeClass("accord_titleOvr");heading.addClass("accord_title");});});});}};window.addEvent('domready',accord.init);var displayPopUp={imagePreloader:null,imageLibrary:"",caption:null,URL:null,callType:null,width:300,height:200,contentTop:0,contentLeft:0,hideBG:null,bodyWidth:null,bodyHeight:null,content:null,popTop:null,popTopClose:null,theWindow:null,popImageNav:null,popImage:null,imageNum:null,direction:"next",fxMoveTop:null,fxMoveLeft:null,ajax:null,jsonResult:null,jsonFunction:null,reset:function(){$$('a.popInPage').each(function(item,index){$(item).removeEvents('click');});$$("a.simplePop").each(function(item,index){$(item).removeEvents('click');});},init:function(){var self=displayPopUp;self.reset();self.imagePreloader=Array();$$('a.popInPage').each(function(item,index){item.addEvent('click',function(event){event=new Event(event).stop();displayPopUp.showPopUp(item);});var tmp=item.rel.split(",");if(tmp[1]=="image"){var details=Array();details['image']=new Image();details['image'].src=item.href;details['obj']=item.rel;if(!$defined(displayPopUp.imagePreloader[tmp[2]])){displayPopUp.imagePreloader[tmp[2]]=Array();}displayPopUp.imagePreloader[tmp[2]].push(details);}});$$("a.simplePop").each(function(item,index){item.addEvent('click',function(event){event=new Event(event).stop();displayPopUp.simplePop(item);});});},showPopUp:function(obj){var self=displayPopUp;var objValues=obj.rel.split(",");self.URL=obj.href;self.caption=objValues[0]||"Window";self.callType=objValues[1]||"ajax";self.imageLibrary=objValues[2]||null;self.width=(objValues[3])?objValues[3]:self.width;self.height=(objValues[4])?objValues[4]:self.height;self.hideBackground();},simplePop:function(obj){var self=displayPopUp;var options=obj.rel.split(",");self.url=obj.href;var thisName=options[1]||"popup";var thisHeight=options[3]||300;var thisWidth=options[4]||550;if($defined(self.theWindow)){self.theWindow.close();self.theWindow=null;}try{self.theWindow=window.open(self.url,thisName,"status = 0, height = "+parseInt(thisHeight)+", width = "+parseInt(thisWidth)+", resizable = 0, scrollbars = 0");}catch(e){alert("Please Enable popups in your browser");if(options[2]=="ajax"||options[2]=="json"){self.showPopUp(obj);}}},getSize:function(){var self=displayPopUp;var windowSize=window.getSize();var bodySize=$E('body').getSize();self.contentLeft=((windowSize['size'].x)/2)-(self.width/2)+(windowSize['scroll'].x);self.contentTop=(((windowSize['size'].y)/2)-(self.height/2))+(getScrollTop());self.bodyWidth=(windowSize['size'].x<windowSize['scrollSize'].x)?windowSize['scrollSize'].x:windowSize['size'].x;self.bodyHeight=(windowSize['size'].y<bodySize['scrollSize'].y)?bodySize['scrollSize'].y:windowSize['size'].y;},hideBackground:function(){var self=displayPopUp;self.getSize();if(self.hideBG==null){self.hideBG=new Element('div',{'styles':{'top':"0px",'left':"0px",'height':self.bodyHeight+"px",'width':self.bodyWidth+"px"},'class':'hideBG','id':'hideBG'});self.hideBG.setOpacity(0.8);$(self.hideBG).injectInside($E('body'));window.addEvent('resize',displayPopUp.resize);window.addEvent('scroll',displayPopUp.resize);$$('select').each(function(item,index){item.setOpacity(0);});var myFx=new Fx.Style('hideBG','opacity',{onComplete:function(){displayPopUp.displayContent();}}).start(0.8);}else{if(self.callType=="ajax"||self.callType=="json"){self.closeContent();self.displayContent();}}},resize:function(){var self=displayPopUp;if(self.hideBG!=null){self.moveit();}},moveit:function(){var self=displayPopUp;if(self.fxMoveTop!=null){self.fxMoveTop.stop();self.fxMoveTop=null;}if(self.fxMoveLeft!=null){self.fxMoveLeft.stop();self.fxMoveLeft=null;}self.getSize();if(self.contentTop<0){self.contentTop=0;}if(self.contentLeft<0){self.contentLeft=0;}var bodyHeight=$E('body').getSize();self.hideBG.style.height=self.bodyHeight+"px";self.hideBG.style.width=self.bodyWidth+"px";if(self.height<self.bodyHeight){self.fxMoveTop=new Fx.Style(self.content,'top',{transition:Fx.Transitions.linear});self.fxMoveTop.start(self.contentTop);}if(self.width<self.bodyWidth){self.fxMoveLeft=new Fx.Style(self.content,'left',{transition:Fx.Transitions.linear});self.fxMoveLeft.start(self.contentLeft);}},closeContent:function(){var self=displayPopUp;if(self.callType=="image"){$(self.popImage).remove();$(self.popImageNav).remove();}else{$(self.popText).remove();}$(self.popTopClose).removeEvent('click',displayPopUp.popupClose);$(self.popTopClose).removeEvent('mouseover',function(){this.className="popOver";});$(self.popTopClose).removeEvent('mousedown',function(){this.className="popDown";});$(self.popTopClose).removeEvent('mouseout',function(){this.className="popClose";});$(self.popTopClose).remove();$(self.popTop).remove();$(self.content).remove();self.content=null;self.popImage=null;self.popText=null;self.popTop=null;self.popBtm=null;self.popTopClose=null;},displayContent:function(){var self=displayPopUp;var temp="";self.content=new Element('div',{'id':"popContent",'class':"popContent",'styles':{'position':"absolute",'top':self.contentTop+"px",'left':self.contentLeft+"px",'height':"0px",'width':"0px"}});self.popTop=new Element('div',{'id':"popTop",'class':"popTop"});var popInner=new Element('div',{'id':"popCaption",'class':"popCaption"});self.popTopClose=new Element('div',{'id':"popClose",'class':"popClose"});$(self.popTopClose).setText("x");$(popInner).setText(self.caption);$(popInner).injectInside(self.popTop);$(self.popTopClose).addEvent('click',displayPopUp.popupClose);$(self.popTopClose).addEvent('mouseover',function(){this.className="popOver";});$(self.popTopClose).addEvent('mousedown',function(){this.className="popDown";});$(self.popTopClose).addEvent('mouseout',function(){this.className="popClose";});$(self.content).setOpacity(0);$(self.content).injectInside($E('body'));$(self.popTop).injectInside(self.content);$(self.popTopClose).injectInside(self.popTop);if(self.callType=="image"){if($defined(self.imagePreloader[self.imageLibrary])){var tempArray=self.imagePreloader[self.imageLibrary];tempArray.each(function(item,index){if(item.image.src==self.URL){self.imageNum=index;}});}self.popImageNav=new Element('div',{'class':"popImageNavContainer",'id':"popImageNavContainer"});$(self.popImageNav).setHTML("<div id='popImageNum' class='popImageNum'>"+(self.imageNum+1)+"/"+self.imagePreloader[self.imageLibrary].length+"</div><div class='popImageNav' id='popImageNav'>"+"<a href='javascript: void(0)' id='popImageBack' class='popImageBack'"+" title='"+self.imageArrayName+"'>Back</a>"+" | <a href='javascript: void(0);' id='popImageNext' class='popImageNext' title='"+self.imageLibrary+"'>Next</a></div>");self.popImage=new Element('div',{'class':"popImage",'id':"popImage",'styles':{'height':parseInt(self.height)+"px",'width':parseInt(self.width)+"px",'text-align':'center'}});var imageCenterTrick="<table border='0' cellpadding='0' cellspacing='0' height='"+self.popImage.style.height+"' width='100%'>"+"<tr><td align='center' valign='middle'><img src='"+self.imagePreloader[self.imageLibrary][self.imageNum]['image'].src+"' alt='"+self.caption+"' border='0' class='thePopImage' id='thePopImage'/></td></tr>"+"</table>";$(self.popImage).setHTML(imageCenterTrick);$(self.popImageNav).injectInside(self.content);$(self.popImage).injectInside(self.content);$('popImageBack').addEvent('click',function(){displayPopUp.swapImage("back");});$('popImageNext').addEvent('click',function(){displayPopUp.swapImage("next");});self.width=parseInt(self.width)+14;self.height=parseInt(self.height)+self.popTop.offsetHeight+14+22;}else{self.popText=new Element('div',{'id':"popText",'class':"popText popAnimation",'styles':{'width':(self.width-14),'height':(self.height-self.popTop.offsetHeight-14)}});if(self.callType!="ajax"&&self.callType!="json"){if($defined($(self.callType).innerHTML)){$(self.popText).setHTML($(self.callType).innerHTML);}$(self.popText).className="popText";}else{if(self.callType=="json"){if(self.imageLibrary!=null){try{self.jsonFunction=eval(self.imageLibrary);}catch(e){}}self.Ajax=new Json.Remote(self.URL,{onSuccess:function(response){displayPopUp.showJsonResult(response);$(self.popText).className="popText";},onFailure:function(){displayPopUp.popupClose();alert("Json Call Failed");}});try{self.Ajax.send({math:Math.random()});}catch(e){alert(e);displayPopUp.popupClose();}}if(self.callType=='ajax'){if(self.imageLibrary=="eval"){self.Ajax=new Ajax(self.URL,{method:'get',onSuccess:function(response){displayPopUp.showAjaxResult(response);$(self.popText).className="popText";},evalScripts:true,onFailure:function(){displayPopUp.popupClose();alert("Ajax Call Failed");}});}else{self.Ajax=new Ajax(self.URL,{method:'get',onSuccess:function(response){displayPopUp.showAjaxResult(response);},onFailure:function(){displayPopUp.popupClose();alert("Ajax Call Failed");}});}try{self.Ajax.request({math:Math.random()});}catch(e){alert(e);displayPopUp.popupClose();}}}}self.getSize();self.moveit();var fxOpen=new Fx.Styles('popContent',{onComplete:function(){if($defined(self.popText)){$(self.popText).injectInside(self.content);}}});fxOpen.start({'height':[0,displayPopUp.height],'width':[0,displayPopUp.width],'opacity':[0,1]});},showJsonResult:function(response){var self=displayPopUp;$(self.popText).className="popText";self.jsonResult=Json.evaluate(response);if(self.jsonFunction!=null){self.jsonFunction(self.jsonResult);}displayPopUp.init();try{validate.init();}catch(e){}},showAjaxResult:function(response){var self=displayPopUp;$(self.popText).setHTML(response);$(self.popText).className="popText";displayPopUp.init();try{validate.init();}catch(e){}},swapImage:function(direction){var self=displayPopUp;var nextImage=(direction=="next")?self.imageNum+1:self.imageNum-1;if(!$defined(self.imagePreloader[self.imageLibrary][nextImage])){if(nextImage>0){nextImage=0;}else{nextImage=self.imagePreloader[self.imageLibrary].length-1;}}self.imageNum=nextImage;var values=self.imagePreloader[self.imageLibrary][self.imageNum]['obj'].split(",");self.width=(parseInt(values[3])>0)?parseInt(values[3]):self.width;self.height=(parseInt(values[4])>0)?parseInt(values[4]):self.height;self.width=self.width+14;self.height=self.height+self.popTop.offsetHeight+14+22;$('popCaption').setText(values[0]);self.fadeout();},fadeout:function(){var fx=new Fx.Style('popImage','opacity',{onComplete:displayPopUp.fadein}).start(0);},fadein:function(){var self=displayPopUp;$('popImageNum').setHTML((self.imageNum+1)+"/"+self.imagePreloader[self.imageLibrary].length);$('thePopImage').src=self.imagePreloader[self.imageLibrary][self.imageNum]['image'].src;self.content.style.width=(self.width)+"px";self.content.style.height=(self.height)+"px";self.popImage.style.width=(self.width-14)+"px";self.popImage.style.height=(self.height-self.popTop.offsetHeight-14-22)+"px";var fx=new Fx.Style('popImage','opacity').start(1);self.getSize();self.resize();},popupClose:function(){var self=displayPopUp;var fxContent=new Fx.Style($('popContent'),'opacity').start(0);var fxBG=new Fx.Style($('hideBG'),'opacity',{onComplete:displayPopUp.popupRemove}).start(0);},popupRemove:function(){var self=displayPopUp;$(self.hideBG).remove();$$('select').each(function(item,index){item.setOpacity(1);});self.closeContent();self.hideBG=null;}};window.addEvent('domready',displayPopUp.init);