var Pluit={};Pluit.Carousel=Class.create({initialize:function(){var b=$A(arguments);var a={};if(typeof b.last()==="object"){a=b.pop()}b.each(function(c){new Pluit.Carousel.Element(c,a)})}});Pluit.Carousel.Element=Class.create({initialize:function(b,a){this.initOptions(a);this.initElements(b);this.initViewport();this.initNavigation();if(this.options.autoPlay){this.play()}},initOptions:function(a){this.options={circular:false,hideAutoNav:false,animDuration:0.5,autoPlay:false,slideDuration:3,viewportClassName:"viewport",navClassName:"nav",prevClassName:"prev",nextClassName:"next",pagesClassName:"pages",pageClassNamePrefix:"page-",activeClassName:"active"};Object.extend(this.options,a||{})},initElements:function(b){if(Object.isString(b)){if(b.startsWith("#")){b=b.substring(1)}}this.elCarousel=$(b);this.elViewport=this.elCarousel.down("."+this.options.viewportClassName);this.elSlidesPanel=this.elViewport.firstDescendant();if($("resetBtn")){this.resetBtn=$("resetBtn")}if($("resetLnk")){this.resetLnk=$("resetLnk")}this.noticesCkJar=new CookieJar({expires:3600*24*365*10,path:"/"});this.dissmissedNotices=this.noticesCkJar.get("dissmissedNotices");if(this.dissmissedNotices){this.resetBtn.show();this.disNoticesArr=$A(this.dissmissedNotices);this.currentIDs=$$("a[id^=notice_]");this.currentIDsTags=this.currentIDs.invoke("identify");this.currentIDsTags=$A(this.currentIDsTags);var a=0;for(a=0;a<this.currentIDsTags.size();a++){if(this.disNoticesArr.indexOf(this.currentIDsTags[a])!=-1){var c=this.currentIDs[a].up("li");c.remove()}}}else{this.disNoticesArr=new Array();if(this.resetBtn){this.resetBtn.hide()}}this.elSlides=this.elSlidesPanel.childElements();if($$("a[id^=notice_]")){this.closeLinks=$$("a[id^=notice_]")}this.elNav=this.elCarousel.down("."+this.options.navClassName);this.maxPageNo=this.elSlides.length;if(this.maxPageNo<2){if($("prevNotice")){$("prevNotice").hide()}if($("nextNotice")){$("nextNotice").hide()}if($("controlBtn")){$("controlBtn").hide()}}this.prevPageNo=this.curPageNo=1;Event.observe(window,"resize",this.onViewportResize.bindAsEventListener(this))},initViewport:function(){if(this.resetBtn){this.resetBtn.observe("click",this.onResetLinksClick.bindAsEventListener(this))}if(this.elSlides.length===0){return}this.viewportDimension=this.getViewportDimension();this.elCarousel.setStyle({width:this.viewportDimension[0]+"px",height:this.viewportDimension[2]+"px"});this.elViewport.setStyle({width:this.viewportDimension[0]+"px",height:this.viewportDimension[1]+"px"});this.elSlides.invoke("setStyle",{width:this.viewportDimension[0]+"px"});this.elViewport.observe("click",this.onViewportClick.bindAsEventListener(this));this.elViewport.observe("mouseover",this.onViewportMouseOver.bindAsEventListener(this));this.elViewport.observe("mouseout",this.onViewportMouseOut.bindAsEventListener(this));if(this.closeLinks){this.closeLinks.invoke("observe","click",this.onCloseLinksClick.bindAsEventListener(this))}if($("controlBtn")){$("controlBtn").observe("click",this.onControlBtnClick.bindAsEventListener(this))}},initNavigation:function(){this.elNav=this.elCarousel.down(".nav");if((!this.elNav)&&(!this.options.hideAutoNav)){this.elNav=this.buildNavigation();this.elNav=$(this.elNav)}if(!this.elNav){return}this.elNav.observe("click",this.onNavClick.bindAsEventListener(this))},buildNavigation:function(){var a=document.createElement("ul");a.className="nav";var c="";c+='<li class="'+this.options.prevClassName+'"><a href="#">Prev</a></li>';if(this.maxPageNo>0){c+='<li class="'+this.options.pagesClassName+'"><ul>';for(var b=0;b<this.maxPageNo;b++){c+='<li class="';if(b===0){c+=this.options.activeClassName+" "}c+=this.options.pageClassNamePrefix+(b+1)+'"><a href="#">'+(b+1)+"</a></li>"}c+="</ul></li>"}c+='<li class="'+this.options.nextClassName+'"><a href="#">Next</a></li>';a.innerHTML=c;this.elCarousel.insert(a);return a},getViewportDimension:function(){var c=this.elCarousel.up();var d=c.getWidth()-this.options.offSetWidth;return[d.round(),this.elViewport.getHeight(),this.elCarousel.getHeight()]},onNavClick:function(d){var b=d.findElement("li");if(!b){return}var c=b.className;if(c.match(this.options.prevClassName)){this.movePrevious()}else{if(c.match(this.options.nextClassName)){this.moveNext()}else{if(c.match(this.options.pageClassNamePrefix)){var a=parseInt(c.split("-")[1],10);this.movePage(a)}}}d.preventDefault()},onViewportClick:function(b){var a=b.element().parentNode;if((b.element().tagName!=="A")&&(a.tagName!=="A")&&(a.tagName==="LI")){this.moveNext()}},onViewportMouseOver:function(){this.options.autoPlay=false;if($("controlLnk")){this.controlLnkContents=$("controlLnk").innerHTML}if($("controlLnk")){$("controlLnk").update(this.options.pauseWord)}},onViewportMouseOut:function(){this.options.autoPlay=true;if($("controlLnk")){$("controlLnk").update(this.controlLnkContents)}},onControlBtnClick:function(){this.options.autoPlay=!this.options.autoPlay;if($("controlLnk")){if($("controlLnk").innerHTML==this.options.playWord){$("controlLnk").update(this.options.stopWord)}else{$("controlLnk").update(this.options.playWord)}}},onViewportResize:function(){this.onTheMove=true;this.viewportDimensionOld=this.viewportDimension[0];this.viewportDimension=this.getViewportDimension();this.elCarousel.setStyle({width:this.viewportDimension[0]+"px",height:this.viewportDimension[2]+"px"});this.elViewport.setStyle({width:this.viewportDimension[0]+"px",height:this.viewportDimension[2]+"px"});this.elSlides.invoke("setStyle",{width:this.viewportDimension[0]+"px"});this.elSlidesPanel.setStyle({left:"0"});this.prevPageNo=this.curPageNo=1;this.onTheMove=false},onCloseLinksClick:function(){var a=this.closeLinks[this.curPageNo-1].up("li");a.remove();this.disNoticesArr.push(this.closeLinks[this.curPageNo-1].id);this.noticesCkJar.put("dissmissedNotices",this.disNoticesArr);this.elSlides=this.elSlidesPanel.childElements();this.closeLinks=$$("a[id^=notice_]");this.elNav=this.elCarousel.down("."+this.options.navClassName);this.maxPageNo=this.elSlides.length;this.resetBtn.show();$("controlLnk").update(this.controlLnkContents);if(this.maxPageNo<2){$("prevNotice").hide();$("nextNotice").hide();$("controlBtn").hide()}if(this.maxPageNo==0){new Effect.SlideUp(this.elCarousel,{duration:1})}else{this.moveNext()}},onResetLinksClick:function(){this.noticesCkJar.empty();window.location.reload()},moveNext:function(){this.movePage(this.curPageNo+1)},movePrevious:function(){this.movePage(this.curPageNo-1)},movePage:function(a){if(this.onTheMove){return}if(a===this.curPageNo){return}a=this.checkPageNo(a,this.curPageNo);var c=this.getMoveDistance(a,this.curPageNo);this.onTheMove=true;this.activatePageNav(a);if(this.options.effect==="fade"){var b=this.options.animDuration/2;new Effect.Fade(this.elSlidesPanel,{duration:b,afterFinish:function(){new Effect.Move(this.elSlidesPanel,{x:c,duration:0,afterFinish:function(){this.onTheMove=false;new Effect.Appear(this.elSlidesPanel,{duration:b})}.bind(this)})}.bind(this)})}else{new Effect.Move(this.elSlidesPanel,{x:c,duration:this.options.animDuration,afterFinish:function(){this.onTheMove=false}.bind(this)})}this.curPageNo=a},play:function(){setTimeout(function(){if(this.options.autoPlay){this.moveNext()}this.play()}.bind(this),this.options.slideDuration*1000)},isMovePrevious:function(b,a){if(b<a){return true}},getMoveDistance:function(b,a){var d=0;if(b===a){return d}var c=this.isMovePrevious(b,a);if(c){while(b<a){d+=this.elSlides[b-1].getWidth();b+=1}return d}else{while(b>a){d+=this.elSlides[b-2].getWidth();b-=1}return -d}},activatePageNav:function(b){if(!this.elNav){return}var a=this.elNav.down(".page-"+b);var c=this.elNav.down(".page-"+this.curPageNo);if(!a&&!c){return}c.removeClassName(this.options.activeClassName);a.addClassName(this.options.activeClassName)},checkPageNo:function(b,a){var c=this.isMovePrevious(b,a);if(c){if(b<1){if(this.options.circular){return this.maxPageNo}else{return 1}}}else{if(b>this.maxPageNo){if(this.options.circular){return 1}else{return this.maxPageNo}}}return b}});Object.extend(Pluit.Carousel,{Version:"1.2.0",init:function(){var b=$A(arguments);var a=null;if(typeof b.last()==="object"){a=b.pop()}if(b.length===0){b=[".pluit-carousel"]}document.observe("dom:loaded",function(){$A(b).each(function(c){$$(c).each(function(d){new Pluit.Carousel(d,a)}.bind(this))})})}});var CookieJar=Class.create();CookieJar.prototype={appendString:"__CJ_",initialize:function(b){this.options={expires:3600,path:"",domain:"",secure:""};Object.extend(this.options,b||{});if(this.options.expires!=""){var a=new Date();a=new Date(a.getTime()+(this.options.expires*1000));this.options.expires="; expires="+a.toGMTString()}if(this.options.path!=""){this.options.path="; path="+escape(this.options.path)}if(this.options.domain!=""){this.options.domain="; domain="+escape(this.options.domain)}if(this.options.secure=="secure"){this.options.secure="; secure"}else{this.options.secure=""}},put:function(a,c){a=this.appendString+a;cookie=this.options;var b=typeof c;switch(b){case"undefined":case"function":case"unknown":return false;case"boolean":case"string":case"number":c=String(c.toString())}var f=a+"="+escape(Object.toJSON(c));try{document.cookie=f+cookie.expires+cookie.path+cookie.domain+cookie.secure}catch(d){return false}return true},remove:function(c){c=this.appendString+c;cookie=this.options;try{var b=new Date();b.setTime(b.getTime()-(3600*1000));var a="; expires="+b.toGMTString();document.cookie=c+"="+a+cookie.path+cookie.domain+cookie.secure}catch(d){return false}return true},get:function(a){a=this.appendString+a;var b=document.cookie.match(a+"=(.*?)(;|$)");if(b){return(unescape(b[1])).evalJSON()}else{return null}},empty:function(){keys=this.getKeys();size=keys.size();var a=0;for(a=0;a<size;a++){this.remove(keys[a])}},getPack:function(){pack={};keys=this.getKeys();size=keys.size();var a=0;for(a=0;a<size;a++){pack[keys[a]]=this.get(keys[a])}return pack},getKeys:function(){keys=$A();keyRe=/[^=; ]+(?=\=)/g;str=document.cookie;CJRe=new RegExp("^"+this.appendString);while((match=keyRe.exec(str))!=undefined){if(CJRe.test(match[0].strip())){keys.push(match[0].strip().gsub("^"+this.appendString,""))}}return keys}};
// pluit-carousel.js v1.0.0

// Copyright (c) 2010 Herryanto Siatono (http://www.pluitsolutions.com)
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
/**
 * Javascript code to store data as JSON strings in cookies. 
 * It uses prototype.js 1.5.1 (http://www.prototypejs.org)
 * 
 * Author : Lalit Patel
 * Website: http://www.lalit.org/lab/jsoncookies
 * License: Apache Software License 2
 *          http://www.apache.org/licenses/LICENSE-2.0
 * Version: 0.5
 * Updated: Jan 26, 2009 
 * 
 * Chnage Log:
 *   v 0.5
 *   -  Changed License from CC to Apache 2
 *   v 0.4
 *   -  Removed a extra comma in options (was breaking in IE and Opera). (Thanks Jason)
 *   -  Removed the parameter name from the initialize function
 *   -  Changed the way expires date was being calculated. (Thanks David)
 *   v 0.3
 *   -  Removed dependancy on json.js (http://www.json.org/json.js)
 *   -  empty() function only deletes the cookies set by CookieJar
 */
