/* k2.js */

var $K2=jQuery.noConflict();$K2(document).ready(function(){$K2('#comment-form').submit(function(event){event.preventDefault();$K2('#formLog').empty().addClass('formLogLoading');$K2.ajax({url:$K2('#comment-form').attr('action'),type:'post',dataType:'json',data:$K2('#comment-form').serialize(),success:function(response){$K2('#formLog').removeClass('formLogLoading').html(response.message);if(typeof(Recaptcha)!="undefined"){Recaptcha.reload();}
if(response.refresh){window.location.reload();}}});});$K2('.commentRemoveLink').click(function(event){event.preventDefault();var element=$K2(this);$K2(element).parent().addClass('commentToolbarLoading');$K2.ajax({url:$K2(element).attr('href'),type:'post',data:$K2('#comment-form input:last').serialize(),success:function(response){$K2(element).parent().removeClass('commentToolbarLoading');if(response=='true'){$K2(element).parent().parent().remove();}}});});$K2('.commentApproveLink').click(function(event){event.preventDefault();var element=$K2(this);$K2(element).parent().addClass('commentToolbarLoading');$K2.ajax({url:$K2(element).attr('href'),type:'post',data:$K2('#comment-form input:last').serialize(),success:function(response){$K2(element).parent().removeClass('commentToolbarLoading');if(response=='true'){$K2(element).parent().parent().removeClass('unpublishedComment');}}});});$K2('#k2ReportCommentForm').submit(function(event){event.preventDefault();$K2('#formLog').empty().addClass('formLogLoading');$K2.ajax({url:$K2('#k2ReportCommentForm').attr('action'),type:'post',data:$K2('#k2ReportCommentForm').serialize(),success:function(response){$K2('#formLog').removeClass('formLogLoading').html(response);if(typeof(Recaptcha)!="undefined"){Recaptcha.reload();}}});});$K2('#fontDecrease').click(function(event){event.preventDefault();$K2('.itemFullText').removeClass('largerFontSize');$K2('.itemFullText').addClass('smallerFontSize');});$K2('#fontIncrease').click(function(event){event.preventDefault();$K2('.itemFullText').removeClass('smallerFontSize');$K2('.itemFullText').addClass('largerFontSize');});$K2('.k2Anchor').click(function(event){event.preventDefault();var target=this.hash;$K2('html, body').stop().animate({scrollTop:$K2(target).offset().top},500);});$K2('.itemRatingForm a').click(function(event){event.preventDefault();var itemID=$K2(this).attr('rel');var log=$K2('#itemRatingLog'+itemID).empty().addClass('formLogLoading');var rating=$K2(this).html();$K2.ajax({url:K2SitePath+"index.php?option=com_k2&view=item&task=vote&user_rating="+rating+"&itemID="+itemID,type:'get',success:function(response){log.removeClass('formLogLoading');log.html(response);$K2.ajax({url:K2SitePath+"index.php?option=com_k2&view=item&task=getVotesPercentage&itemID="+itemID,type:'get',success:function(percentage){$K2('#itemCurrentRating'+itemID).css('width',percentage+"%");setTimeout(function(){$K2.ajax({url:K2SitePath+"index.php?option=com_k2&view=item&task=getVotesNum&itemID="+itemID,type:'get',success:function(response){log.html(response);}});},2000);}});}});});$K2('.classicPopup').click(function(event){event.preventDefault();if($K2(this).attr('rel')){var json=$K2(this).attr('rel');json=json.replace(/'/g,'"');var options=$K2.parseJSON(json);}else{var options={x:900,y:600};}
window.open($K2(this).attr('href'),'K2PopUpWindow','width='+options.x+',height='+options.y+',menubar=yes,resizable=yes');});$K2('div.k2LiveSearchBlock form input[name=searchword]').keyup(function(event){var parentElement=$K2(this).parent().parent();if($K2(this).val().length>3&&event.key!='enter'){$K2(this).addClass('k2SearchLoading');parentElement.find('.k2LiveSearchResults').css('display','none').empty();parentElement.find('input[name=t]').val($K2.now());parentElement.find('input[name=format]').val('raw');var url='index.php?option=com_k2&view=itemlist&task=search&'+parentElement.find('form').serialize();parentElement.find('input[name=format]').val('html');$K2.ajax({url:url,type:'get',success:function(response){parentElement.find('.k2LiveSearchResults').html(response);parentElement.find('input[name=searchword]').removeClass('k2SearchLoading');parentElement.find('.k2LiveSearchResults').css('display','block');}});}else{parentElement.find('.k2LiveSearchResults').css('display','none').empty();}});$K2('a.calendarNavLink').live('click',function(event){event.preventDefault();var parentElement=$K2(this).parent().parent().parent().parent();var url=$K2(this).attr('href');parentElement.empty().addClass('k2CalendarLoader');$K2.ajax({url:url,type:'post',success:function(response){parentElement.html(response);parentElement.removeClass('k2CalendarLoader');}});});});$K2(window).load(function(){var blocks=$K2('.subCategory');var maxHeight=0;blocks.each(function(){maxHeight=Math.max(maxHeight,parseInt($K2(this).css('height')));});blocks.css('height',maxHeight);});

/* core.js */

function switchFontSize(ckname,val){var bd=document.getElementsByTagName('body');if(!bd||!bd.length)return;bd=bd[0];var oldclass='fs'+CurrentFontSize;switch(val){case'inc':if(CurrentFontSize+1<7){CurrentFontSize++;}
break;case'dec':if(CurrentFontSize-1>0){CurrentFontSize--;}
break;case'reset':default:CurrentFontSize=DefaultFontSize;}
var newclass='fs'+CurrentFontSize;bd.className=bd.className.replace(new RegExp('fs.?','g'),'');bd.className=trim(bd.className);bd.className+=(bd.className?' ':'')+newclass;createCookie(ckname,CurrentFontSize,365);}
function switchTool(ckname,val){createCookie(ckname,val,365);window.location.reload();}
function cpanel_reset(){var matches=document.cookie.match(new RegExp('(?:^|;)\\s*'+tmpl_name.escapeRegExp()+'_([^=]*)=([^;]*)','g'));if(!matches)return;for(i=0;i<matches.length;i++){var ck=matches[i].match(new RegExp('(?:^|;)\\s*'+tmpl_name.escapeRegExp()+'_([^=]*)=([^;]*)'));if(ck){createCookie(tmpl_name+'_'+ck[1],'',-1);}}
if(window.location.href.indexOf('?')>-1)window.location.href=window.location.href.substr(0,window.location.href.indexOf('?'));else window.location.reload();}
function cpanel_apply(){var elems=document.getElementById('ja-cpanel-main').getElementsByTagName('*');var usersetting={};for(i=0;i<elems.length;i++){var el=elems[i];if(el.name&&(match=el.name.match(/^user_(.*)$/))){var name=match[1];var value='';if(el.tagName.toLowerCase()=='input'&&(el.type.toLowerCase()=='radio'||el.type.toLowerCase()=='checkbox')){if(el.checked)value=el.value;}else{value=el.value;}
if(usersetting[name]){if(value)usersetting[name]=value+','+usersetting[name];}else{usersetting[name]=value;}}}
for(var k in usersetting){name=tmpl_name+'_'+k;value=usersetting[k];createCookie(name,value,365);}
if(window.location.href.indexOf('?')>-1)window.location.href=window.location.href.substr(0,window.location.href.indexOf('?'));else window.location.reload();}
function createCookie(name,value,days){if(days){var date=new Date();date.setTime(date.getTime()+(days*24*60*60*1000));var expires="; expires="+date.toGMTString();}
else expires="";document.cookie=name+"="+value+expires+"; path=/";}
function trim(str,chars){return ltrim(rtrim(str,chars),chars);}
function ltrim(str,chars){chars=chars||"\\s";return str.replace(new RegExp("^["+chars+"]+","g"),"");}
function rtrim(str,chars){chars=chars||"\\s";return str.replace(new RegExp("["+chars+"]+$","g"),"");}
function getScreenWidth(){var x=0;if(self.innerHeight){x=self.innerWidth;}else if(document.documentElement&&document.documentElement.clientHeight){x=document.documentElement.clientWidth;}else if(document.body){x=document.body.clientWidth;}
return x;}
function equalHeight(els){els=$$_(els);if(!els||els.length<2)return;var maxh=0;var els_=[];els.each(function(el,i){if(!el)return;els_[i]=el;var ch=els_[i].getCoordinates().height;maxh=(maxh<ch)?ch:maxh;},this);els_.each(function(el,i){if(!el)return;if(maxh-el.getStyle('padding-top').toInt()-el.getStyle('padding-bottom').toInt()>0)el.setStyle('min-height',maxh-el.getStyle('padding-top').toInt()-el.getStyle('padding-bottom').toInt());},this);}
function getDeepestWrapper(el){while(el.getChildren().length==1)
{el=el.getChildren()[0];}
return el;}
function fixHeight(els,group1,group2){els=$$_(els);group1=$$_(group1);group2=$$_(group2);if(!els||!group1)return;var height=0;group1.each(function(el){if(!el)return;height+=el.getCoordinates().height;});if(group2){group2.each(function(el){if(!el)return;height-=el.getCoordinates().height;});}
els.each(function(el,i){if(!el)return;if(height-el.getStyle('padding-top').toInt()-el.getStyle('padding-bottom').toInt()>0)el.setStyle('min-height',height-el.getStyle('padding-top').toInt()-el.getStyle('padding-bottom').toInt());});}
function addFirstLastItem(el){el=$(el);if(!el||!el.getChildren()||!el.getChildren().length)return;el.getChildren()[0].addClass('first-item');el.getChildren()[el.getChildren().length-1].addClass('last-item');}
function $$_(els){if($type(els)=='string')return $$(els);var els_=[];els.each(function(el){el=$(el);if(el)els_.push(el);});return els_;}

/* mega.js */

var jaMegaMenuMoo=new Class({initialize:function(menu,options){this.options=$extend({slide:true,duration:300,fading:false,bgopacity:0.9,delayHide:500,direction:'down',action:'mouseenter',hidestyle:'normal'},options||{});if(!this.options.slide&&!this.options.fading)this.options.delayHide=10;this.menu=menu;this.childopen=new Array();this.imageloaded=false;this.loaded=false;this.start();},start:function(){if(this.loaded)return;this.menu=$(this.menu);var images=this.menu.getElements('img');if(images&&images.length&&!this.imageloaded){var imgs=[];images.each(function(image){imgs.push(image.src)});if(imgs.length){new Asset.images(imgs,{onComplete:function(){this.start();}.bind(this)});this.imageloaded=true;this.start.delay(3000,this);return;}}
this.loaded=true;p=this.menu;while(p=p.getParent()){if(p.hasClass('main')||p.hasClass('wrap')){this.wrapper=p;break;}}
this.items=this.menu.getElements('li.mega');this.items.each(function(li){if((a=li.getElement('a.mega'))&&this.isChild(a,li))li.a=a;else li.a=null;li._parent=this.getParent(li);if((childcontent=li.getElement('.childcontent'))&&this.isChild(childcontent,li)){li.childcontent=childcontent;li.childcontent_inner=li.childcontent.getElement('.childcontent-inner-wrap');var coor=li.childcontent_inner.getCoordinates();li._w=li.getElement('.childcontent-inner').offsetWidth;li._h=li.getElement('.childcontent-inner').offsetHeight;li.level0=li.getParent().hasClass('level0');li.childcontent.setStyles({'width':li._w+10,'height':li._h});li.childcontent_inner.setStyles({'width':li._w});li.childcontent_inner1=li.childcontent.getElement('.childcontent-inner');li.childcontent_inner1.ol=false;if(li.childcontent_inner1.getStyle('overflow')=='auto'||li.childcontent_inner1.getStyle('overflow')=='scroll'){li.childcontent_inner1.ol=true;if(window.ie6||window.ie7){li.childcontent_inner1.setStyle('position','relative');}
if(window.ie6){li.childcontent_inner1.setStyle('height',li.childcontent_inner1.getStyle('max-height')||400);}}
if(this.options.direction=='up'){if(li.level0){li.childcontent.setStyle('top',-li.childcontent.offsetHeight);}else{li.childcontent.setStyle('bottom',0);}}}
else li.childcontent=null;if(li.childcontent&&this.options.bgopacity){var bg=new Element('div',{'class':'childcontent-bg'});bg.injectTop(li.childcontent_inner);bg.setStyles({'width':'100%','height':li._h,'opacity':this.options.bgopacity,'position':'absolute','top':0,'left':0,'z-index':1});if(li.childcontent.getStyle('background'))bg.setStyle('background',li.childcontent.getStyle('background'));if(li.childcontent.getStyle('background-image'))bg.setStyle('background-image',li.childcontent.getStyle('background-image'));if(li.childcontent.getStyle('background-repeat'))bg.setStyle('background-repeat',li.childcontent.getStyle('background-repeat'));if(li.childcontent.getStyle('background-color'))bg.setStyle('background-color',li.childcontent.getStyle('background-color'));li.childcontent.setStyle('background','none');li.childcontent_inner.setStyles({'position':'relative','z-index':2});}
if(li.childcontent&&(this.options.slide||this.options.fading)){li.childcontent.setStyles({'left':'auto'});if(li.childcontent.hasClass('right'))li.childcontent.setStyle('right',0);if(this.options.slide){li.childcontent.setStyles({'left':'auto','overflow':'hidden'});if(li.level0){if(this.options.direction=='up'){li.childcontent_inner.setStyle('bottom',-li._h-20);}else{li.childcontent_inner.setStyle('margin-top',-li._h-20);}}else{li.childcontent_inner.setStyle('margin-left',-li._w-20);}}
if(this.options.fading){li.childcontent_inner.setStyle('opacity',0);}
li.fx=new Fx.Styles(li.childcontent_inner,{duration:this.options.duration,transition:Fx.Transitions.linear,onComplete:this.itemAnimDone.bind(this,li)});li.eff_on={};li.eff_off={};if(this.options.slide){if(li.level0){if(this.options.direction=='up'){li.eff_on['bottom']=0;li.eff_off['bottom']=-li._h;}else{li.eff_on['margin-top']=0;li.eff_off['margin-top']=-li._h;}}else{li.eff_on['margin-left']=0;li.eff_off['margin-left']=-li._w;}}
if(this.options.fading){li.eff_on['opacity']=1;li.eff_off['opacity']=0;}}
if(this.options.action=='click'&&li.childcontent){li.addEvent('click',function(e){var event=new Event(e);if(li.hasClass('group'))return;if(li.childcontent){if(li.status=='open'){if(this.cursorIn(li,event)){this.itemHide(li);}else{this.itemHideOthers(li);}}else{this.itemShow(li);}}else{if(li.a)location.href=li.a.href;}
event.stopPropagation();}.bind(this));}
if(this.options.action=='mouseover'||this.options.action=='mouseenter'){li.addEvent('mouseenter',function(e){if(li.hasClass('group'))return;$clear(li.timer);this.itemShow(li);e.stopPropagation();}.bind(this));li.addEvent('mouseleave',function(e){if(li.hasClass('group'))return;$clear(li.timer);if(li.childcontent)li.timer=this.itemHide.delay(this.options.delayHide,this,[li,e]);else this.itemHide(li,e);if(!e.stopped){e.stopPropagation();e.stopped=true;}}.bind(this));if(li.a&&li.childcontent){li.clickable=false;li.a.addEvent('click',function(e){if(!li.clickable){new Event(e).stop();}}.bind(this));}
li.addEvent('click',function(e){new Event(e).stopPropagation()});}
if(li.a&&!li.childcontent){li.a.addEvent('click',function(e){this.itemHideOthers(null);this.menu.getElements('.active').removeClass('active');var p=li;while(p){p.addClass('active');p.a.addClass('active');p=p._parent;}
new Event(e).stopPropagation();}.bind(this));}
if(li.childcontent)this.positionSubmenu(li);},this);var container=$('ja-wrapper');if(!container)container=document.body;container.addEvent('click',function(e){this.itemHideOthers(null);}.bind(this));this.menu.addEvent('click',function(e){new Event(e).stopPropagation()});if(this.options.slide||this.options.fading){this.menu.getElements('.childcontent').setStyle('display','none');}},getParent:function(li){var p=li;while((p=p.getParent())){if(this.items.contains(p)&&!p.hasClass('group'))return p;if(!p||p==this.menu)return null;}},cursorIn:function(el,event){if(!el||!event)return false;var pos=$merge(el.getPosition(),{'w':el.offsetWidth,'h':el.offsetHeight});;var cursor={'x':event.page.x,'y':event.page.y};if(cursor.x>pos.x&&cursor.x<pos.x+el.offsetWidth&&cursor.y>pos.y&&cursor.y<pos.y+el.offsetHeight)return true;return false;},isChild:function(child,parent){return!!parent.getChildren().contains(child);},itemOver:function(li){if(li.hasClass('haschild'))
li.removeClass('haschild').addClass('haschild-over');li.addClass('over');if(li.a){li.a.addClass('over');}},itemOut:function(li){if(li.hasClass('haschild-over'))
li.removeClass('haschild-over').addClass('haschild');li.removeClass('over');if(li.a){li.a.removeClass('over');}},itemShow:function(li){clearTimeout(li.timer);if(li.status=='open')return;this.itemOver(li);li.status='open';this.enableclick.delay(100,this,li);this.childopen.push(li);this.itemHideOthers(li);if(li.childcontent){this.positionSubmenu(li);}
if(!$defined(li.fx)||!$defined(li.childcontent))return;li.childcontent.setStyle('display','block');li.childcontent.setStyles({'overflow':'hidden'});if(li.childcontent_inner1.ol)li.childcontent_inner1.setStyles({'overflow':'hidden'});li.fx.stop();li.fx.start(li.eff_on);},itemHide:function(li,e){if(e&&e.page){if(this.cursorIn(li,e)||this.cursorIn(li.childcontent,e)){return;}
var p=li._parent;if(p&&!this.cursorIn(p,e)&&!this.cursorIn(p.childcontent,e)){p.fireEvent('mouseleave',e);}}
clearTimeout(li.timer);this.itemOut(li);li.status='close';this.childopen.remove(li);if(!$defined(li.fx)||!$defined(li.childcontent))return;if(li.childcontent.getStyle('opacity')==0)return;li.childcontent.setStyles({'overflow':'hidden'});if(li.childcontent_inner1.ol)li.childcontent_inner1.setStyles({'overflow':'hidden'});li.fx.stop();switch(this.options.hidestyle){case'fast':li.fx.options.duration=100;li.fx.start($merge(li.eff_off,{'opacity':0}));break;case'fastwhenshow':if(!e){li.fx.start($merge(li.eff_off,{'opacity':0}));}else{li.fx.start(li.eff_off);}
break;case'normal':default:li.fx.start(li.eff_off);break;}},itemAnimDone:function(li){if(li.status=='close'){if(this.options.hidestyle.test(/fast/)){li.fx.options.duration=this.options.duration;if(!this.options.fading)li.childcontent_inner.setStyle('opacity',1);}
li.childcontent.setStyles({'display':'none'});this.disableclick.delay(100,this,li);}
if(li.status=='open'){li.childcontent.setStyles({'overflow':''});if(li.childcontent_inner1.ol)li.childcontent_inner1.setStyles({'overflow-y':'auto'});li.childcontent_inner.setStyle('opacity',1);li.childcontent.setStyles({'display':'block'});}},itemHideOthers:function(el){var fakeevent=null
if(el&&!el.childcontent)fakeevent={};var curopen=this.childopen.copy();curopen.each(function(li){if(li&&typeof(li.status)!='undefined'&&(!el||(li!=el&&!li.hasChild(el)))){this.itemHide(li,fakeevent);}},this);},enableclick:function(li){if(li.a&&li.childcontent)li.clickable=true;},disableclick:function(li){if(li.a&&li.childcontent)li.clickable=false;},positionSubmenu:function(li){if(li.level0){if(!window.isRTL){var lcor=li.getCoordinates();var ccor=li.childcontent.getCoordinates();if(!ccor.width)
{li.childcontent.setStyle('display','block');ccor=li.childcontent.getCoordinates();li.childcontent.setStyle('display','none');}
var ml=0;var l=lcor.left;var r=l+ccor.width;if(this.wrapper){var wcor=this.wrapper.getCoordinates();l=l-wcor.left;r=wcor.right-r+10;}else{r=window.getWidth()-r+10;}
if(l<0||l+r<0){ml=-l;}else if(r<0){ml=r;}
if(ml!=0)li.childcontent.setStyle('margin-left',ml);}else{var lcor=li.getCoordinates();var ccor=li.childcontent.getCoordinates();if(!ccor.width)
{li.childcontent.setStyle('display','block');ccor=li.childcontent.getCoordinates();li.childcontent.setStyle('display','none');}
var mr=0;var r=lcor.right;var l=r-ccor.width;if(this.wrapper){var wcor=this.wrapper.getCoordinates();l=l-wcor.left;r=wcor.right-r+10;}else{r=window.getWidth()-r+10;}
if(r<0||l+r<0){mr=-r;}else if(l<0){mr=l;}
if(mr!=0)li.childcontent.setStyle('margin-right',mr);}}else{var lcor=li.getCoordinates();var ccor=li.childcontent.getCoordinates();if(!ccor.width)
{li.childcontent.setStyle('display','block');ccor=li.childcontent.getCoordinates();li.childcontent.setStyle('display','none');}
var ml=0;var l=ccor.left;var r=l+ccor.width;if(this.wrapper){var wcor=this.wrapper.getCoordinates();l=l-wcor.left;r=wcor.right-r+10;}else{r=window.getWidth()-r+10;}
if(r<0){li.childcontent.setStyle('margin-left',-ccor.width+20);if(li.eff_on)li.eff_on['margin-left']=0;if(li.eff_off){li.eff_off['margin-left']=li._w+20;li.childcontent_inner.setStyle('margin-left',li.eff_off['margin-left']);}}}}});

/* caption.js */

var JCaption=new Class({initialize:function(selector)
{this.selector=selector;var images=$$(selector);images.each(function(image){this.createCaption(image);},this);},createCaption:function(element)
{var caption=document.createTextNode(element.title);var container=document.createElement("div");var text=document.createElement("p");var width=element.getAttribute("width");var align=element.getAttribute("align");if(!width){width=element.width;}
if(!align)
align=element.getStyle("float");if(!align)
align=element.style.styleFloat;if(align==""){align="none";}
text.appendChild(caption);text.className=this.selector.replace('.','_');element.parentNode.insertBefore(container,element);container.appendChild(element);if(element.title!=""){container.appendChild(text);}
container.className=this.selector.replace('.','_');container.className=container.className+" "+align;container.setAttribute("style","float:"+align);container.style.width=width+"px";}});document.caption=null;window.addEvent('load',function(){var caption=new JCaption('img.caption')
document.caption=caption});

/* ja.tabs.js */

var wrap_W=0;var JATabs=new Class({initialize:function(element,options){this.options=$extend({position:'top',width:'100%',height:'auto',skipAnim:false,animType:'animMoveHor',mouseType:'mouseover',changeTransition:Fx.Transitions.Pow.easeIn,duration:1000,mouseOverClass:'hover',activateOnLoad:'first',useAjax:false,ajaxUrl:'',ajaxOptions:'get',ajaxLoadingText:'Loading...',fixheight:1,fixwidth:1,colors:''},options||{});this.el=$(element);this.elid=element;this._W=this.el.offsetWidth.toInt();wrap_W=this._W;if(this.options.height=='auto'){this.options.fixheight=0;}
if($type(this.options.colors)=='string'){regex=/(\d*):([^,]*)/gi;var colors=[];while((result=regex.exec(this.options.colors)))
colors[result[1]]=result[2];this.options.colors=colors;}
this._H=this.el.getParent().offsetHeight.toInt();this.panels=$$('#'+this.elid+' .ja-tab-content');this.panelwrap=this.el.getElement('.ja-tab-panels-'+this.options.position);this.divtitles=$$('#'+this.elid+' .ja-tabs-title-'+this.options.position);this.titles=$$('#'+this.elid+' div.ja-tabs-title-'+this.options.position+' ul li');this.boxTab_H=this.el.getElement('ul.ja-tabs-title').offsetHeight+this.el.getElement('ul.ja-tabs-title').offsetTop;if(this.panels.length<=1)
{this.panels.setStyle('position','relative');return;}
this.titles.each(function(item,i){var color=item.getElement('h3').className;if(!color)color=this.options.colors[i];item._color='';if(color){item.addClass(color);item._color=color;}
item.addEvent(this.options.mouseType,function(){if(item.className.indexOf('active')!=-1)return;item.removeClass(this.options.mouseOverClass);this.activate(item,this.options.skipAnim);}.bind(this));item.addEvent('mouseover',function(){if(item!=this.activeTitle)
{item.addClass(this.options.mouseOverClass);}}.bind(this));item.addEvent('mouseout',function(){if(item!=this.activeTitle)
{item.removeClass(this.options.mouseOverClass);}}.bind(this));}.bind(this));this.titles[0].addClass('first');this.titles[this.titles.length-1].addClass('last');this.titles[0].addClass('active');this.tabHeight=this.el.getElement('.ja-tabs-title-'+this.options.position);this.minHeight=0;if(!this.options.fixheight)
{this.panelwrap.setStyle('height',this.minHeight);}
else if((this.options.position!='left')&&(this.options.position!='right')){this.panelwrap.setStyle('height',this._H-this.titles[0].offsetHeight.toInt());}
if((this.options.position=='left')||(this.options.position=='right')){var maxw=eval(this._W-this.divtitles[0].offsetWidth.toInt()-10);this.panelwrap.setStyle('width',maxw);}
this.titles.each(function(el,i){el.panel=this.panels[i];el.panel._idx=i;},this);if(this.options.skipAnim)this.options.animType='animNone';if((eval('typeof '+this.options.animType)=='undefined')||(eval('$type ('+this.options.animType+')')!='class')){this.options.animType='animFade';}
this.anim=eval('new '+this.options.animType+'(this)');if(this.options.activateOnLoad!='none')
{if(this.options.activateOnLoad=='first')
{this.activate(this.titles[0],true);}
else
{this.activate(this.options.activateOnLoad,true);}}
if(window.ie)this.firstload=true;window.addEvent('resize',this.resize.bind(this));},resize:function(){this._W=this.el.offsetWidth;maxW=this._W;if((this.options.position=='left')||(this.options.position=='right')){this.minHeight=this.boxTab_H;if(!this.options.fixheight){}
maxW=this._W-this.divtitles[0].offsetWidth.toInt()-10;this.panelwrap.setStyle('width',maxW);}
else{this.panelwrap.setStyle('height',Math.max(this.minHeight,this.activeTitle.panel.offsetHeight+10));}
if(wrap_W!=this._W){this.anim.reposition();};},activate:function(tab,skipAnim){if($type(tab)=='string')
{myTab=$$('#'+this.elid+' ul li').filterByAttribute('title','=',tab)[0];tab=myTab;}else if($type(tab)=='number'){if(tab<0||tab>=this.titles.length)tab=0;tab=this.titles[parseInt(tab)];}
if(!tab)tab=this.titles[0];if(this.options.useAjax)this.cancelAjax();if(this.options.useAjax&&!tab.loaded){this._getContent(tab);this.activeTitle=tab;return;}
if(!$defined(skipAnim))
{skipAnim=false;}
if($type(tab)=='element')
{var newTab=tab.panel;var curTab=this.activePanel;this.activePanel=newTab;this.anim.move(curTab,newTab,skipAnim);this.titles.removeClass('active');tab.addClass('active');if(this.activeTitle&&this.activeTitle._color)this.panelwrap.removeClass(this.activeTitle._color);if(tab._color)this.panelwrap.addClass(tab._color);this.activeTitle=tab;if(!this.options.fixheight){if(skipAnim){this.panelwrap.setStyle('height',Math.max(this.minHeight,this.activePanel.offsetHeight+10));if((this.options.position=='left')||(this.options.position=='right')){this.tabHeight.setStyle('height',Math.max(this.minHeight,this.panelwrap.offsetHeight,this.boxTab_H));}}else{if(!this.mainfx)this.mainfx=new Fx.Style(this.panelwrap,'height',{duration:this.options.duration});this.mainfx.stop();this.mainfx.start(Math.max(this.minHeight,this.activePanel.offsetHeight));if((this.options.position=='left')||(this.options.position=='right')){if(!this.changeEffectTitle)this.changeEffectTitle=new Fx.Style(this.tabHeight,'height',{duration:this.options.duration});this.changeEffectTitle.start(Math.max(this.activePanel.offsetHeight,this.boxTab_H));}}}
else{this.panelwrap.setStyle('height',this.options.height);if((this.options.position=='left')||(this.options.position=='right')){this.tabHeight.setStyle('height',this.options.height+10);}}}},cancelAjax:function(){if(this.loadingTab){this.tabRequest.cancel();this.loadingTab.imgLoading.remove();this.tabRequest=null;this.loadingTab=null;}},_getContent:function(tab){this.loadingTab=tab;var ids=this.options.ids.split(',');if(!ids.length||ids[tab.panel._idx]==undefined)return'';var h3=$(this.loadingTab.getElementsByTagName('H3')[0]);var imgloading=new Element('img',{'src':'plugins/content/ja_tabs/loading.gif','width':13});if(this.options.position=='right')imgloading.inject(h3,'top');else imgloading.inject(h3);this.loadingTab.imgLoading=imgloading;this.tabRequest=new Ajax(this.options.ajaxUrl+'&tab='+ids[tab.panel._idx],{method:this.options.ajaxOptions,onComplete:this.update.bind(this)});this.tabRequest.request();},update:function(text){if(!this.loadingTab)return;this.loadingTab.panel.subpanel=this.loadingTab.panel.getElement('.ja-tab-subcontent');this.loadingTab.panel.subpanel.innerHTML=text;this.loadingTab.loaded=true;this.tabRequest=null;var tab=this.loadingTab;this.loadingTab=null;var images=tab.panel.subpanel.getElements('img');tab.switched=false;if(images&&images.length&&!tab.imgLoaded){var imgs=[];images.each(function(image){imgs.push(image.src)});if(imgs.length){new Asset.images(imgs,{onComplete:function(){this.switchTab(tab);}.bind(this)});tab.imgLoaded=true;return;}}
this.switchTab(tab);},switchTab:function(tab){if(tab.switched)return;tab.switched=true;tab.imgLoading.remove();this.anim.reposition();this.activate(tab);}});var animNone=new Class({initialize:function(tabwrap){this.options=tabwrap.options||{};this.tabwrap=tabwrap;this.tabwrap.panels.setStyle('position','absolute');this.tabwrap.panels.setStyle('left',0);},move:function(curTab,newTab,skipAnim){this.tabwrap.panels.setStyle('display','none');newTab.setStyle('display','block');},reposition:function(){}});var animFade=new Class({initialize:function(tabwrap){this.options=tabwrap.options||{};this.tabwrap=tabwrap;this.changeEffect=new Fx.Elements(this.tabwrap.panels,{duration:this.options.duration});this.tabwrap.panels.setStyles({'opacity':0,'width':'100%'});},move:function(curTab,newTab,skipAnim){if(this.options.changeTransition!='none'&&skipAnim==false)
{if(curTab)
{curOpac=curTab.getStyle('opacity');var changeEffect=new Fx.Style(curTab,'opacity',{duration:this.options.duration,transition:this.options.changeTransition});changeEffect.stop();changeEffect.start(curOpac,0);}
curOpac=newTab.getStyle('opacity');var changeEffect=new Fx.Style(newTab,'opacity',{duration:this.options.duration,transition:this.options.changeTransition});changeEffect.stop();changeEffect.start(curOpac,1);}else{if(curTab)curTab.setStyle('opacity',0);newTab.setStyle('opacity',1);}},reposition:function(){if(this.tabwrap.activePanel){this.changeEffect.stop();for(var i=this.tabwrap.activePanel._idx-1;i>=0;i--){this.tabwrap.panels[i].setStyle('opacity',0);}
for(i=this.tabwrap.activePanel._idx+1;i<this.tabwrap.panels.length;i++){this.tabwrap.panels[i].setStyle('opacity',0);}}}});var animMoveHor=new Class({initialize:function(tabwrap){this.options=tabwrap.options||{};this.tabwrap=tabwrap;this.changeEffect=new Fx.Elements(this.tabwrap.panels,{duration:this.options.duration});var left=0;this.tabwrap.panels.each(function(panel){panel.setStyle('left',left);left+=panel.offsetWidth;});this.tabwrap.panels.setStyle('top',0);},move:function(curTab,newTab,skipAnim){if(this.options.changeTransition!='none'&&!skipAnim)
{this.changeEffect.stop();var obj={};var offset=newTab.offsetLeft.toInt();i=0;this.tabwrap.panels.each(function(panel){obj[i++]={'left':[panel.offsetLeft.toInt(),panel.offsetLeft.toInt()-offset]};});this.changeEffect.start(obj);}},reposition:function(){if(this.tabwrap.activePanel){this.changeEffect.stop();var left=this.tabwrap.activePanel.offsetLeft;for(var i=this.tabwrap.activePanel._idx-1;i>=0;i--){left-=this.tabwrap.panels[i].offsetWidth;this.tabwrap.panels[i].setStyle('left',left);}
var left=this.tabwrap.activePanel.offsetLeft;for(i=this.tabwrap.activePanel._idx+1;i<this.tabwrap.panels.length;i++){left+=this.tabwrap.panels[i-1].offsetWidth;this.tabwrap.panels[i].setStyle('left',left);}}}});var animMoveVir=new Class({initialize:function(tabwrap){this.options=tabwrap.options||{};this.tabwrap=tabwrap;this.changeEffect=new Fx.Elements(this.tabwrap.panels,{duration:this.options.duration});var top=0;this.tabwrap.panels.each(function(panel){panel.setStyle('top',top);top+=Math.max(panel.offsetHeight,panel.getParent().getParent().offsetHeight);});this.tabwrap.panels.setStyle('left',0);},move:function(curTab,newTab,skipAnim){if(this.options.changeTransition!='none'&&skipAnim==false)
{this.changeEffect.stop();var obj={};var offset=newTab.offsetTop.toInt();i=0;this.tabwrap.panels.each(function(panel){obj[i++]={'top':[panel.offsetTop.toInt(),panel.offsetTop.toInt()-offset]};});this.changeEffect.start(obj);}},reposition:function(){if(this.tabwrap.activePanel){this.changeEffect.stop();var top=this.tabwrap.activePanel.offsetTop;for(var i=this.tabwrap.activePanel._idx-1;i>=0;i--){top-=this.tabwrap.panels[i].offsetHeight;this.tabwrap.panels[i].setStyle('top',top);}
var top=this.tabwrap.activePanel.offsetTop;for(i=this.tabwrap.activePanel._idx+1;i<this.tabwrap.panels.length;i++){top+=this.tabwrap.panels[i-1].offsetHeight;this.tabwrap.panels[i].setStyle('top',top);}}}});

/* ja_contentslider2.js */

var JS_ContentSlider2=new Class({initialize:function(options)
{this.options=$extend({w:100,h:200,num_elem:4,total:0,url:'',mode:'horizontal',direction:'right',wrapper:'ja-slide-wrapper',duration:1000,interval:3000,auto:1},options||{});if(this.options.total){if(this.options.total<this.options.num_elem)this.options.num_elem=this.options.total;this.elements=new Array(this.options.total);}else
this.elements=new Array();this.current=0;this.options.wrapper.setStyle('position','relative');this.options.wrapper.setStyle('overflow','hidden');if(this.options.mode=='vertical'){this.options.wrapper.setStyle('width',this.options.w);this.options.wrapper.setStyle('height',this.options.h*this.options.num_elem);}else{this.options.wrapper.setStyle('width',this.options.w*this.options.num_elem);this.options.wrapper.setStyle('height',this.options.h);}
elems=this.options.wrapper.getElementsByClassName('content_element');for(i=0;i<elems.length;i++){elems[i].setStyle('width',this.options.w);elems[i].setStyle('height',this.options.h);elems[i].setStyle('display','none');}
this.ef_u={};this.ef_d={};this.ef_l={};this.ef_r={};for(i=0;i<=this.options.num_elem;i++){this.ef_u[i]={'top':[i*this.options.h,(i-1)*this.options.h]};this.ef_d[i]={'top':[(i-1)*this.options.h,i*this.options.h]};this.ef_l[i]={'left':[i*this.options.w,(i-1)*this.options.w]};this.ef_r[i]={'left':[(i-1)*this.options.w,i*this.options.w]};}},getFx:function(){if(this.options.mode=='vertical'){if(this.options.direction=='left'||this.options.direction=='up'){return this.ef_u;}else{return this.ef_d;}}else{if(this.options.direction=='left'||this.options.direction=='up'){return this.ef_l;}else{return this.ef_r;}}},add:function(text){var divobj=new Element('DIV',{'id':'jsslide_'+this.elements.length,'class':'jsslide','styles':{'position':'absolute','width':this.options.w,'height':this.options.h}});divobj.innerHTML=text;if(this.elements.length>1){divobj.injectAfter(this.elements[this.elements.length-2]);}else{divobj.inject(this.options.wrapper);}
this.hide(divobj);this.elements.push(divobj);},update:function(text,ind){var divobj=new Element('DIV',{'id':'jsslide_'+ind,'class':'jsslide','rel':this.options.modid,'styles':{'position':'absolute','z-index':'1','width':this.options.w,'height':this.options.h}});divobj.innerHTML=text;divobj.inject(this.options.wrapper);this.hide(divobj);this.elements[ind]=divobj;},hide:function(el){if(this.options.mode=='vertical'){el.setStyle('top','-999px');el.setStyle('left','0');}else{el.setStyle('top','0');el.setStyle('left','-999em');}},setPos:function(elems){if(!elems)elems=this.getRunElems();var posT;var posL;var display;for(var i=0;i<elems.length;i++){var el=elems[i];if(el){if(this.options.mode=='vertical'){if(this.options.direction=='left'||this.options.direction=='up'){posT=this.options.h*i;}else{posT=this.options.h*(i-1);}
el.setStyle('top',posT);if(posT>=0){this.loadImage(el);}}else{if(this.options.direction=='left'||this.options.direction=='up'){posL=this.options.w*i;}else{posL=this.options.w*(i-1);}
el.setStyle('left',posL);this.loadImage(el);}}}},loadImage:function(el){var holder=el.getElement(".ja-image");if(holder){var image=holder.getProperty('rel');if(image!=''&&image!=null){holder.setHTML(image);holder.setProperty('rel','')}}},getRunElems:function(){var objs=new Array();if(this.options.direction=='left'||this.options.direction=='up'){adj=0;}else{adj=this.elements.length-1;}
for(var i=0;i<=this.options.num_elem;i++){objs[i]=this.elements[(this.current+i+adj)%this.elements.length];}
if(this.options.total<=this.options.num_elem){if(this.options.direction=='left'||this.options.direction=='up'){objs[this.options.num_elem]=null;}else{objs[0]=null;}}
return objs;},start:function(){this.clearTimeOut();if(!this.elements[this.next()]){this.nextRun();return;}
if(this.elements[this.next()]=='fetching'){this.nextRun();return;}
if(this.running)return;this.running=1;var objs=this.getRunElems();this.setPos(objs);this.x=new Fx.Elements(objs,{duration:this.options.duration,onComplete:this.end.bind(this)});this.x.start(this.getFx());this.current=this.nextCurr();},end:function(){this.running=0;this.nextRun();},clearTimeOut:function(){if(this.timeOut){clearTimeout(this.timeOut);this.timeOut=0;}},nextRun:function(){this.clearTimeOut();if(this.options.total<=this.options.num_elem)return;if(this.options.auto){this.timeOut=setTimeout(this.start.bind(this),this.options.interval);this.fetchNext();}},nextCurr:function(){var next=0;if(this.options.direction=='left'||this.options.direction=='up'){next=(this.current+1)%this.elements.length;}else{next=(this.current+this.elements.length-1)%this.elements.length;}
return next;},next:function(){var next=0;if(this.options.direction=='left'||this.options.direction=='up'){next=(this.current+this.options.num_elem)%this.elements.length;}else{next=(this.current+this.elements.length-1)%this.elements.length;}
return next;},fetchNext:function(){var next=this.next();if(!this.elements[next]){this.elements[next]='fetching';url=this.options.url+'?total='+this.options.total+'&news='+next+'&loadajax=1&modid='+this.options.modid;new Ajax(url,{method:'get',onComplete:function(request){this.update(request,next)}.bind(this)}).request();return;}},fetchUpdate:function(text,next){this.update(text,next);},setDirection:function(direction){this.options.direction=direction;}});

/* script.js */

var hide_k2_filter=false;function load_jak2_filter(html,inline_label){var areas=$$('input[name^=areas] ');var other_group=[];var ja_group=[];var jak2_input=null;var eja_group=new Element('div',{id:'ja_group'});var eother_group=new Element('div',{id:'other_options'});var plg_ja_filterform=new Element('div',{id:'plg_ja_filterform'});areas.each(function(input){if(input.type=='checkbox'){if(input.value=='jak2_filter'){jak2_input=input;var area_jak2=new Element('input');area_jak2.setProperty('type','radio');area_jak2.setProperty('checked',jak2_input.checked);area_jak2.setProperty('id','area_jak2');area_jak2.setProperty('name','filter_group');area_jak2.setProperty('value','jagroup');area_jak2.addEvent('click',function(){change_group(this.value);});ja_group.push(area_jak2);var textField=new Element('input');textField.setProperty('type','hidden');textField.setProperty('id','jaarea');textField.setProperty('name','areas[]');textField.setProperty('value','jak2_filter');ja_group.push(textField);var label=input.getNext('label');label.htmlFor='area_jak2';ja_group.push(label);var other_radio=new Element('input');other_radio.setProperty('type','radio');other_radio.setProperty('checked',!jak2_input.checked);other_radio.setProperty('id','other_group');other_radio.setProperty('name','filter_group');other_radio.setProperty('value','other_group');other_radio.addEvent('click',function(){change_group(this.value);});ja_group.push(other_radio);var label=new Element('label',{'for':'other_group'});label.innerHTML='Other group';ja_group.push(label);eja_group.inject(input,'before');eother_group.inject(input,'before');plg_ja_filterform.inject(input,'before');input.remove();}else{other_group.push(input);other_group.push(input.getNext('label'));}}});if(jak2_input!=null){eja_group.adopt(ja_group);eother_group.adopt(other_group);plg_ja_filterform.innerHTML=html;$('area_jak2').checked=jak2_input.checked;$('other_group').checked=!jak2_input.checked;show_jafilterform($('area_jak2').checked,html,inline_label)}
if(hide_k2_filter){$('plg_ja_filterform').setStyle('display','none');}}
function change_group(group){if(group=='other_group'){$('jaarea').value='';$('other_options').setStyle('display','');$('plg_ja_filterform').setStyle('display','none');}else{$('jaarea').value='jak2_filter';$('other_options').setStyle('display','none');$('plg_ja_filterform').setStyle('display','block');}}
function show_jafilterform(ischeck,html,inline_label){if(ischeck){var plg_ja_filterform=$('plg_ja_filterform');if(plg_ja_filterform){$('plg_ja_filterform').setStyle('display','');}else{var plg_ja_filterform=new Element('div',{id:'plg_ja_filterform'});plg_ja_filterform.inject($('ja_group'),'before');plg_ja_filterform.innerHTML=html;}
if($('other_options')){$('other_options').setStyle('display','none');}
label_sliding(inline_label,'plg_ja_filterform');}else{var plg_ja_filterform=$('plg_ja_filterform');if(plg_ja_filterform){$('plg_ja_filterform').setStyle('display','none');}
if($('other_options')){$('other_options').setStyle('display','');}}
if($('search_searchword').value=='custom search'){$('search_searchword').value='';}}
function build_jafilter(div_parent_id,group_tag){if(!$(div_parent_id)){return false;}
var ja_filter={};var extra_fields_groups=$(div_parent_id).getElementById(group_tag+'efgroups');if(extra_fields_groups){ja_filter['extra_fields_groups']=extra_fields_groups.value;}
var catitem=$(div_parent_id).getElementById(group_tag+'catid');var group='';if(catitem){ja_filter['catid']=catitem.value;var tmpl=catitem.value.split('_');if($(group_tag+tmpl[0])){group=' #'+group_tag+tmpl[0];}}
var created_by=$(div_parent_id).getElementById(group_tag+'created_by');if(created_by){ja_filter['created_by']=created_by.value;}
inputs=$$('#'+div_parent_id+group+' input')
if(inputs.length>0){inputs.each(function(input){if(input.type=='text'){v_label=($$('label[for='+input.id+']')[0].innerHTML)+'...';if((input.value!='')&&(input.value!=v_label)){if(ja_filter[input.name]==undefined){ja_filter[input.name]=input.value;}else
ja_filter[input.name]+='-'+input.value;}}else if(input.type=='radio'){if(input.checked){ja_filter[input.name]=input.value;}}else if(input.type=='checkbox'){if(input.checked){if(ja_filter[input.name]==undefined){ja_filter[input.name]=input.value;}else
ja_filter[input.name]+=','+input.value;}}});}
selects=$$('#'+div_parent_id+group+'  select');selects.each(function(selectitem){if(selectitem.id==group_tag+'catid'){ja_filter['catid']=selectitem.value;}else if(selectitem.value!=''){ja_filter[selectitem.name]=selectitem.value;}});if($('area_jak2')&&($('area_jak2').checked)){areas=$$('input[name^=areas] ');areas.each(function(input){if(input.type=='checkbox'){if(input.checked)
input.checked=false;}});if($('search_searchword').value!=''){$('ja_searchword').value=$('search_searchword').value;}}else{if($('jaarea')){$('jaarea').value='';}}
var cookie=Cookie.get("jak2_filter");if(cookie){Cookie.remove("jak2_filter");}
Cookie.set("jak2_filter",Json.toString(ja_filter),{duration:1,path:"/"});}
function label_sliding(inline_label,div_parent_id){if(inline_label=='1')
return true;inputs=$$('#'+div_parent_id+' input[type=text]')
if(inputs.length>0){inputs.each(function(input){label=$$('label[for='+input.id+']')[0];v_input=label.innerHTML+'...';label.setStyle('display','none');if(input.value==''){input.value=v_input;}
input.addEvents({focus:function(){if(input.value==$$('label[for='+this.id+']')[0].innerHTML+'...'){input.focus();input.value='';}},keypress:function(){if(this.value==$$('label[for='+this.id+']')[0].innerHTML+'...'){this.value='';this.removeClass("focus").addClass("typing");}},blur:function(){this.removeClass("focus").removeClass("typing");if(this.value==''){this.value=$$('label[for='+this.id+']')[0].innerHTML+'...';}}});});}
selects=$$('#'+div_parent_id+'  select');selects.each(function(selectitem){if($$('label[for='+selectitem.id+']')[0]){$$('label[for='+selectitem.id+']')[0].setStyle('display','none');}});}
function load_categories(value,groupname){catid=$(groupname+'catid');if(catid){categories=catid.getElements('option');categories.each(function(category){if(value>0)
category.setStyle('display','none');else
category.setStyle('display','');});categories=catid.getElements('option[value^='+value+']');categories.each(function(category){category.setStyle('display','');});if(categories.length>0){categories[0].selected=1;load_extrafields(catid.value,groupname);}}else{load_extrafields(value+'_0',groupname);}}
function load_extrafields(value,groupname){var tmpl=value.split('_');if(tmpl.length==2){var groups=$$('div[id^='+groupname+'] ');if(groups){groups.setStyle('display','none');}
if($(groupname+tmpl[0])){$(groupname+tmpl[0]).setStyle('display','');}}}
function expand_catoptions(groupname){var ua=navigator.userAgent.toLowerCase();var UA=ua.match(/(opera|ie|firefox|chrome|version)[\s\/:]([\w\d\.]+)?.*?(safari|version[\s\/:]([\w\d\.]+)|$)/)||[null,'unknown',0];var browser=(UA[1]=='version')?UA[3]:UA[1];if(browser=='ie'&&$(groupname+'catid')){$(groupname+'catid').addEvents({focus:function(){this.setStyle("origWidth",this.getStyle("width"));this.setStyle("width","auto");},blur:function(){this.setStyle("width",this.getStyle("origWidth"));}});}}

/* script.js */

Element.Events.extend({'wheelup':{type:Element.Events.mousewheel.type,map:function(event){event=new Event(event);if(event.wheel>=0)this.fireEvent('wheelup',event)}},'wheeldown':{type:Element.Events.mousewheel.type,map:function(event){event=new Event(event);if(event.wheel<=0)this.fireEvent('wheeldown',event)}}});var JASlideshowThree=new Class({initialize:function(options){this.options=$extend({buttons:{},interval:5000,handle_event:'click',button_event:'click',box:{},size:240,mode:'horizontal',items:[],handles:[],onWalk:{},handlerBox:null,animation:'fade',animationRepeat:'true',autoPlay:false,languageDirection:null},options||{});this.items=this.options.items;if(this.options.languageDirection=='rtl'){this.modes={horizontal:['right','width'],vertical:['top','height']};}else{this.modes={horizontal:['left','width'],vertical:['top','height']};}
this.box=$(this.options.box);this.buttons={previous:[],next:[],play:[],playback:[],stop:[]};this.allbuttons=[];if(this.options.buttons){for(var action in this.options.buttons){this.addActionButtons(action,$type(this.options.buttons[action])=='array'?this.options.buttons[action]:[this.options.buttons[action]]);}}
this.handles=this.options.handles;if(this.handles){this.addHandleButtons(this.handles);}
if(this.options.handlerBox!=null){this.options.handlerBox.addEvents({'wheelup':function(e){e=new Event(e).stop();this.previous(true);}.bind(this),'wheeldown':function(e){e=new Event(e).stop();this.next(true);}.bind(this)});}
this.allbuttons.each(function(button){button.addEvent('mouseover',function(){this.addClass('hover');});button.addEvent('mouseout',function(){this.removeClass('hover');});});this.currentIndex=this.options.startItem||0;this.previousIndex=null;this.nextIndex=null;this._auto=null;this.initFx();if(this.options.autoPlay)this.play(this.options.interval,'next',true);this.walk(this.currentIndex);},previous:function(manual){this.lastIndex=this.currentIndex;this.currentIndex+=this.currentIndex>0?-1:this.items.length-1;this.walk(null,manual);},next:function(manual){this.lastIndex=this.currentIndex;this.currentIndex+=this.currentIndex<this.items.length-1?1:1-this.items.length;this.walk(null,manual);},play:function(delay,direction,wait){this.stop();if(!wait){this[direction](false);}
this._auto=this[direction].periodical(delay,this,false);},stop:function(){$clear(this._auto);},walk:function(item,manual){if($defined(item)){this.lastIndex=this.currentIndex;this.currentIndex=parseInt(item);}
this.previousIndex=this.currentIndex+(this.currentIndex>0?-1:this.items.length-1);this.nextIndex=this.currentIndex+(this.currentIndex<this.items.length-1?1:1-this.items.length);if(manual||(this.nextIndex==0&&this.options.animationRepeat=='false')){this.stop();}
if(this.options.onWalk){this.options.onWalk(this.currentIndex,(this.handles?this.handles[this.currentIndex]:null));}
this.animate();if(manual&&this.options.autoPlay){this.play(this.options.interval,'next',true);}},initFx:function(){if(this.options.animation.test(/move/)){this.box.setStyle(this.modes[this.options.mode][1],(this.options.size*this.options.items.length)+'px');this.box.setStyle(this.modes[this.options.mode][0],(-this.currentIndex*this.options.size)+this.options.offset+'px');this.fx=new Fx.Style(this.box,this.modes[this.options.mode][0],this.options.fxOptions||{duration:500,wait:false});return;}
this.items.setStyles({'position':'absolute','top':0,'display':'none'});this.items.setStyle(this.modes[this.options.mode][0],0);this.items[this.currentIndex].setStyle('display','block');if(this.options.animation.test(/fade/)){for(var i=0;i<this.items.length;i++){this.items[i].fx=new Fx.Style(this.items[i],'opacity',this.options.fxOptions||{duration:500,wait:false});}}},animate:function(){if(this.options.animation.test(/move/)){this.fx.start(-this.currentIndex*this.options.size+this.options.offset);return;}
var others=[];for(var i=0;i<this.items.length;i++){this.items[i].fx.stop();if(i!=this.currentIndex&&i!=this.lastIndex)others.push(this.items[i]);}
this.currentIndex=parseInt(this.currentIndex);$$(others).setStyle('display','none');if(this.lastIndex==this.currentIndex){this.items[this.currentIndex].setStyles({'display':'block','opacity':1});}else{this.items[this.currentIndex].setStyles({'display':'block','opacity':0,'z-index':10});this.items[this.lastIndex].setStyles({'z-index':9});}
if(this.options.animation.test(/fade/)){this.items[this.lastIndex].fx.start(0);this.items[this.currentIndex].fx.start(1);return;}},addHandleButtons:function(handles){for(var i=0;i<handles.length;i++){handles[i].addEvent(this.options.handle_event,this.walk.bind(this,[i,true]));this.allbuttons.push(handles[i]);}},addActionButtons:function(action,buttons){for(var i=0;i<buttons.length;i++){switch(action){case'previous':buttons[i].addEvent(this.options.button_event,this.previous.bind(this,true));break;case'next':buttons[i].addEvent(this.options.button_event,this.next.bind(this,true));break;case'play':buttons[i].addEvent(this.options.button_event,this.play.bind(this,[this.options.interval,'next',false]));break;case'playback':buttons[i].addEvent(this.options.button_event,this.play.bind(this,[this.options.interval,'previous',false]));break;case'stop':buttons[i].addEvent(this.options.button_event,this.stop.bind(this));break;}
this.buttons[action].push(buttons[i]);buttons[i].addEvent(this.options.button_event,function(){this.blur();});this.allbuttons.push(buttons[i]);}}});var JASlideshow2=new Class({initialize:function(element,options){this.options=$extend({startItem:0,showItem:4,mainWidth:360,mainHeight:240,itemWidth:160,itemHeight:160,duration:400,interval:5000,transition:Fx.Transitions.Back.easeOut,thumbOpacity:'0.8',maskDesc:'maskDesc',maskWidth:360,maskHeigth:50,but_prev:'ja-slide-prev',but_next:'ja-slide-next',maskOpacity:'0.8',buttonOpacity:'0.4',overlap:1,navigation:'',animation:'fade',animationRepeat:'true',thumbSpaces:[3,3],autoPlay:false,maskAlignment:'bottom',showbtncontrol:false,urls:'',maskerTransStyle:'opacity',maskerTrans:Fx.Transitions.linear,navePos:'horizontal',languageDirection:null},options||{});if(!this.options.animation.test(/move/))this.options.overlap=0;this.el=$(element);this.fxOptions={duration:this.options.duration,transition:this.options.transition,wait:false}
this.elmain=this.el.getElement('.ja-slide-main-wrap');var conWidth=this.options.overlap?'100%':this.options.mainWidth;this.elmain.setStyles({'width':conWidth,'height':this.options.mainHeight});this.els=this.el.getElements('.ja-slide-item');this.els.setStyles({'width':this.options.mainWidth,'height':this.options.mainHeight});this.options.rearWidth=0;this.options.mainSpace=0;if(this.options.overlap){this.options.mainSpace=10;this.options.rearWidth=Math.ceil((this.elmain.offsetWidth-this.options.mainWidth)/2)-this.options.mainSpace;this.but_prev=this.el.getElement('.'+this.options.but_prev);this.but_next=this.el.getElement('.'+this.options.but_next);if(/MSIE (\d+\.\d+);/.test(navigator.userAgent)&&this.options.rearWidth<0){this.options.rearWidth=0;}
this.but_prev.setStyles({'opacity':this.options.buttonOpacity,'width':this.options.rearWidth,'height':this.options.mainHeight});this.but_next.setStyles({'opacity':this.options.buttonOpacity,'width':this.options.rearWidth,'height':this.options.mainHeight});this.but_prev.addEvents({'mouseover':function(){this.but_prev.setStyle('opacity',this.options.buttonOpacity/2);}.bind(this),'mouseout':function(){this.but_prev.setStyle('opacity',this.options.buttonOpacity);}.bind(this)});this.but_next.addEvents({'mouseenter':function(){this.but_next.setStyle('opacity',this.options.buttonOpacity/2);}.bind(this),'mouseleave':function(){this.but_next.setStyle('opacity',this.options.buttonOpacity);}.bind(this)});this.els.setStyle('margin-right',this.options.mainSpace);}
var navWrap=this.el.getElement('.ja-slide-thumbs-wrap');if(this.options.navigation&&navWrap!=null){if(this.options.languageDirection=='rtl'){var modes={horizontal:['right','width'],vertical_left:['top','height'],vertical_right:['top','height']};}else{var modes={horizontal:['left','width'],vertical_left:['top','height'],vertical_right:['top','height']};}
if(this.options.navePos=='vertical_left'||this.options.navePos=='vertical_right'){navWrap.setStyles({'width':this.options.itemWidth,'height':this.options.itemHeight*this.options.showItem});}else{navWrap.setStyles({'width':this.options.itemWidth*this.options.showItem,'height':this.options.itemHeight});}
var thumbs_thumbs=this.el.getElement('.ja-slide-thumbs');thumbs_thumbs.setStyle('left',0);thumbs_thumbs.getChildren().setStyles({'width':this.options.itemWidth,'height':this.options.itemHeight});var thumbs_handles=this.el.getElement('.ja-slide-thumbs-handles');thumbs_handles.setStyle('left',0);thumbs_handles.getChildren().setStyles({'width':this.options.itemWidth,'height':this.options.itemHeight});var thumbsFx_thumbs=new Fx.Style(thumbs_thumbs,modes[this.options.navePos][0],this.fxOptions);var thumbsFx_handles=new Fx.Style(thumbs_handles,modes[this.options.navePos][0],this.fxOptions);this.el.getElement('.ja-slide-thumbs-mask-left').setStyles({'height':this.options.itemHeight,'width':2000,'opacity':this.options.thumbOpacity});this.el.getElement('.ja-slide-thumbs-mask-right').setStyles({'height':this.options.itemHeight,'width':2000,'opacity':this.options.thumbOpacity});this.el.getElement('.ja-slide-thumbs-mask-center').setStyles({'height':this.options.itemHeight,'width':this.options.itemWidth,'opacity':this.options.thumbOpacity});var tmp=this.el.getElement('.ja-slide-thumbs-mask');var thumbs_mask=tmp.setStyles({'width':5000});tmp.setStyle(modes[this.options.navePos][0],this.options.startItem*this.options.itemHeight-2000);var thumbsFx_mask=new Fx.Style(thumbs_mask,modes[this.options.navePos][0],this.fxOptions);}
var navItems=this.el.getElements('.ja-slide-thumb');this.onWalk=function(currentIndex,hander){if(this.options.navigation&&thumbsFx_mask!=null){if(currentIndex<=this.options.startItem||currentIndex-this.options.startItem>=this.options.showItem-1){this.options.startItem=currentIndex-this.options.showItem+2;if(this.options.startItem<0)this.options.startItem=0;if(this.options.startItem>this.els.length-this.options.showItem)this.options.startItem=this.els.length-this.options.showItem;}
thumbsFx_mask.start((currentIndex-this.options.startItem)*this.options.itemHeight-2000);if(this.options.navePos=='horizontal'){thumbsFx_thumbs.start(-this.options.startItem*this.options.itemWidth);thumbsFx_handles.start(-this.options.startItem*this.options.itemWidth);}else{thumbsFx_thumbs.start(-this.options.startItem*this.options.itemHeight);thumbsFx_handles.start(-this.options.startItem*this.options.itemHeight);}
if($defined(hander)){thumbs_handles.getElements('span').removeClass('active');hander.addClass('active');navItems.removeClass('active');navItems[currentIndex].addClass('active');}}
if(this.options.descMode.test(/load/)&&this.options.showDesc){this.hideDesc();}}
this.maskDesc=this.el.getElement('.'+this.options.maskDesc);this.maskDesc.setStyles({'display':'block','position':'absolute','width':this.options.maskWidth,'height':this.options.maskHeigth});if(this.options.showDesc){if(this.options.animation.test(/move/)&&this.options.overlap){this.options.maskAlignment='left';this.options.maskerTransStyle='opacity';}
this.maskDesc.setStyle(this.options.maskAlignment,this.options.rearWidth+this.options.mainSpace);this.maskDesc.setStyle('opacity',0);if(this.options.maskerTransStyle=='opacity'){this.descFx=new Fx.Style(this.maskDesc,'opacity',{duration:400,transition:this.options.maskerTrans});this.descs=this.el.getElements('.ja-slide-desc');this.showDesc=function(){this.descFx.stop();this.descFx.start(this.options.maskOpacity);this.descFx.stop();};this.hideDesc=function(){this.descFx.stop();this.descFx.start(0.01);this.descFx.stop();};}else{sizeOff=this.options.maskAlignment=='top'||this.options.maskAlignment=='bottom'?this.options.maskHeigth:this.options.maskWidth;this.maskDesc.setStyle('opacity',this.options.maskOpacity);this.maskDesc.setStyle(this.options.maskAlignment,-this.options.mainWidth);this.descFx=new Fx.Style(this.maskDesc,this.options.maskAlignment,{duration:400,transition:this.options.maskerTrans});this.descs=this.el.getElements('.ja-slide-desc');this.showDesc=function(){this.descFx.stop();this.descFx.start(0);this.descFx.stop();};this.hideDesc=function(){this.descFx.stop();this.descFx.start(-sizeOff);this.descFx.stop();};}
this.swapDesc=function(currentIndex){if(this.maskDesc.currentIndex==currentIndex)return;if(this.maskDesc.desc){this.maskDesc.desc.remove();this.maskDesc.desc=null;if(!$defined(this.maskDesc.getElement('.inner .readon'))){this.maskDesc.setHTML('');}}
if(this.descs[currentIndex]&&this.descs[currentIndex].innerHTML)this.maskDesc.desc=this.descs[currentIndex].inject(this.maskDesc);this.maskDesc.currentIndex=currentIndex;}
if(this.options.descMode.test(/mouseover/)){var childs=this.el.getElements('.ja-slide-item');childs.each(function(itm,index){itm.addEvent('mouseover',this.showDesc.bind(this));itm.addEvent('mouseout',this.hideDesc.bind(this));}.bind(this))
this.maskDesc.addEvent('mouseover',this.showDesc.bind(this));this.maskDesc.addEvent('mouseout',this.hideDesc.bind(this));}else{this.maskDesc.setStyle('opacity',this.options.maskOpacity);}}else{this.maskDesc.setStyle('opacity',0);}
this.fxOptions.onComplete=function(){if(this.options.showDesc){this.swapDesc(this.hs.currentIndex);if(this.options.descMode.test(/load/)){this.showDesc();}}}.bind(this);if(this.options.urls){this.el.getElements('.ja-slide-main .ja-slide-item').each(function(item,idx){item.addEvent('click',function(){var url=this.options.urls[idx];if(url){var target=this.options.targets[this.hs.currentIndex];switch(target){case"_blank":{window.open(url,"newWindow");break;}
default:{window.location.href=url;break;}}}}.bind(this));}.bind(this));this.maskDesc.addEvent('click',function(){var url=this.options.urls[this.hs.currentIndex];if(url){var target=this.options.targets[this.hs.currentIndex];switch(target){case"_blank":{window.open(url,"newWindow");break;}
default:{window.location.href=url;break;}}}}.bind(this));}
this.hs=new JASlideshowThree({box:this.el.getElement('.ja-slide-main'),languageDirection:this.options.languageDirection,items:this.els,handlerBox:thumbs_handles,handles:thumbs_handles?thumbs_handles.getChildren():[],fxOptions:this.fxOptions,interval:this.options.interval,onWalk:this.onWalk.bind(this),size:this.options.mainWidth+this.options.mainSpace,animation:this.options.animation,animationRepeat:this.options.animationRepeat,buttons:{previous:this.el.getElements('.ja-slide-prev'),play:this.el.getElements('.ja-slide-play'),stop:this.el.getElements('.ja-slide-stop'),playback:this.el.getElements('.ja-slide-playback'),next:this.el.getElements('.ja-slide-next')},startItem:this.options.startItem,offset:this.options.overlap?this.options.rearWidth-this.options.mainWidth:0,autoPlay:this.options.autoPlay});if(this.options.overlap){var childs=this.hs.box.getChildren();childs[0].clone().inject(this.hs.box);childs[this.hs.items.length-1].clone().injectTop(this.hs.box);this.hs.box.setStyle(this.hs.modes[this.hs.options.mode][1],(this.hs.options.size*(this.hs.items.length+2)+200)+'px');}
this.el.setStyle('visibility','visible');},getFxObjectByMode:function(mode,start,end){switch(mode){case'sideright':return{'left':[start,-end]};break;case'sideleft':return{'left':[start,end]};break;case'sidetop':return{'top':[start,end]};break;case'sidedown':return{'top':[start,-end]};break;case'botleft':return{'top':start,'left':end};break;default:return{'height':[start,end]};break;}},controlMark:function(){}});


