// Prototype Lite

var Class = {create: function() {return function() {this.initialize.apply(this, arguments);}}}

Object.extend = function(destination, source) {

for (property in source) destination[property] = source[property];

return destination;

}

Function.prototype.bind = function(object) {

var __method = this;

return function() {return __method.apply(object, arguments);}

}

Function.prototype.bindAsEventListener = function(object) {

var __method = this;

return function(event) {__method.call(object, event || window.event);}

}

function jw() {

if (arguments.length == 1) return getjw(arguments[0]);

var elements = [];

jwc(arguments).each(function(el){elements.push(getjw(el));});

return elements;

function getjw(el){if (typeof el == 'string') el = document.getElementById(el);return el;}}

if (!window.Element) {var Element = new Object();}

Object.extend(Element, {

remove: function(element) {

element = jw(element);

element.parentNode.removeChild(element);

},

hasClassName: function(element, className) {

element = jw(element);

if (!element) return;

var hasClass = false;

element.className.split(' ').each(function(cn){

if (cn == className) hasClass = true;

});

return hasClass;

},

addClassName: function(element, className) {

element = jw(element);

Element.removeClassName(element, className);

element.className += ' ' + className;

},

removeClassName: function(element, className) {

element = jw(element);

if (!element) return;

var newClassName = '';

element.className.split(' ').each(function(cn, i){

if (cn != className){

if (i > 0) newClassName += ' ';

newClassName += cn;

}

});

element.className = newClassName;

},

cleanWhitespace: function(element) {

element = jw(element);

jwc(element.childNodes).each(function(node){

if (node.nodeType == 3 && !/\S/.test(node.nodeValue)) Element.remove(node);

});

},

find: function(element, what) {

element = jw(element)[what];

while (element.nodeType != 1) element = element[what];

return element;

}

});

var Position = {

cumulativeOffset: function(element) {

var valueT = 0, valueL = 0;

do {

valueT += element.offsetTop  || 0;

valueL += element.offsetLeft || 0;

element = element.offsetParent;

} while (element);

return [valueL, valueT];

}

};

document.getElementsByClassName = function(className) {

var children = document.getElementsByTagName('*') || document.all;

var elements = [];

jwc(children).each(function(child){

if (Element.hasClassName(child, className)) elements.push(child);

});  

return elements;

}

Array.prototype.iterate = function(func){

for(var i=0;i<this.length;i++) func(this[i], i);

}

if (!Array.prototype.each) Array.prototype.each = Array.prototype.iterate;

function jwc(array){

var nArray = [];

for (var i=0;i<array.length;i++) nArray.push(array[i]);

return nArray;

}



// moo.fx

var jwfx = new Object();

jwfx.Base = function(){};

jwfx.Base.prototype = {

setOptions: function(options) {

this.options = {

duration: 500,

onComplete: '',

transition: jwfx.sinoidal

}

Object.extend(this.options, options || {});

},

step: function() {

var time  = (new Date).getTime();

if (time >= this.options.duration+this.startTime) {

this.now = this.to;

clearInterval (this.timer);

this.timer = null;

if (this.options.onComplete) setTimeout(this.options.onComplete.bind(this), 10);

}

else {

var Tpos = (time - this.startTime) / (this.options.duration);

this.now = this.options.transition(Tpos) * (this.to-this.from) + this.from;

}

this.increase();

},

custom: function(from, to) {

if (this.timer != null) return;

this.from = from;

this.to = to;

this.startTime = (new Date).getTime();

this.timer = setInterval (this.step.bind(this), 13);

},

hide: function() {

this.now = 0;

this.increase();

},

clearTimer: function() {

clearInterval(this.timer);

this.timer = null;

}

}

jwfx.Layout = Class.create();

jwfx.Layout.prototype = Object.extend(new jwfx.Base(), {

initialize: function(el, options) {

this.el = jw(el);

this.el.style.overflow = "hidden";

this.iniWidth = this.el.offsetWidth;

this.iniHeight = this.el.offsetHeight;

this.setOptions(options);

}

});

jwfx.Height = Class.create();

Object.extend(Object.extend(jwfx.Height.prototype, jwfx.Layout.prototype), {	

increase: function() {

this.el.style.height = this.now + "px";

},

toggle: function() {

if (this.el.offsetHeight > 0) this.custom(this.el.offsetHeight, 0);

else this.custom(0, this.el.scrollHeight);

}

});

jwfx.Width = Class.create();

Object.extend(Object.extend(jwfx.Width.prototype, jwfx.Layout.prototype), {	

increase: function() {

this.el.style.width = this.now + "px";

},

toggle: function(){

if (this.el.offsetWidth > 0) this.custom(this.el.offsetWidth, 0);

else this.custom(0, this.iniWidth);

}

});

jwfx.Opacity = Class.create();

jwfx.Opacity.prototype = Object.extend(new jwfx.Base(), {

initialize: function(el, options) {

this.el = jw(el);

this.now = 1;

this.increase();

this.setOptions(options);

},

increase: function() {

if (this.now == 1 && (/Firefox/.test(navigator.userAgent))) this.now = 0.9999;

this.setOpacity(this.now);

},

setOpacity: function(opacity) {

if (opacity == 0 && this.el.style.visibility != "hidden") this.el.style.visibility = "hidden";

else if (this.el.style.visibility != "visible") this.el.style.visibility = "visible";

if (window.ActiveXObject) this.el.style.filter = "alpha(opacity=" + opacity*100 + ")";

this.el.style.opacity = opacity;

},

toggle: function() {

if (this.now > 0) this.custom(1, 0);

else this.custom(0, 1);

}

});

jwfx.sinoidal = function(pos){return ((-Math.cos(pos*Math.PI)/2) + 0.5);}

jwfx.linear = function(pos){return pos;}

jwfx.cubic = function(pos){return Math.pow(pos, 3);}

jwfx.circ = function(pos){return Math.sqrt(pos);}



// moo.fx pack

jwfx.Combo = Class.create();

jwfx.Combo.prototype = {

setOptions: function(options) {

this.options = {

opacity: true,

height: true,

width: false

}

Object.extend(this.options, options || {});

},

initialize: function(el, options) {

this.el = jw(el);

this.setOptions(options);

if (this.options.opacity) {

this.o = new jwfx.Opacity(el, options);

options.onComplete = null;

}

if (this.options.height) {

this.h = new jwfx.Height(el, options);

options.onComplete = null;

}

if (this.options.width) this.w = new jwfx.Width(el, options);

},

toggle: function() { this.checkExec('toggle'); },

hide: function(){ this.checkExec('hide'); },

clearTimer: function(){ this.checkExec('clearTimer'); },

checkExec: function(func){

if (this.o) this.o[func]();

if (this.h) this.h[func]();

if (this.w) this.w[func]();

},

resizeTo: function(hto, wto) {

if (this.h && this.w) {

this.h.custom(this.el.offsetHeight, this.el.offsetHeight + hto);

this.w.custom(this.el.offsetWidth, this.el.offsetWidth + wto);

}},

customSize: function(hto, wto) {

if (this.h && this.w) {

this.h.custom(this.el.offsetHeight, hto);

this.w.custom(this.el.offsetWidth, wto);

}}}



/*

// "Frontpage Slideshow" for Joomla! 1.0.x - Version 1.6

// Copyright (c) 2006 - 2007 JoomlaWorks.gr - http://www.joomlaworks.gr

// This code cannot be redistributed without permission from http://www.joomlaworks.gr/

// More info at: http://www.joomlaworks.gr/

// Developers: Fotis Evangelou - George Chouliaras

// ***Last update: May 16th, 2007***

*/

var autoslide = true;var slideOuter = "slide-wrapper";var slideLoading = "slide-loading";var slideClass = "slide";var naviClass = "navi";var activeSuffix = "-active";var isShowing = 0;var slides;var navis;var fx1 = new Array();var firstDelay = false;var pauseFlag = false;var timer;var playButton;

function initFrontpageSlideshow() {

displayloading = document.getElementById(slideLoading);

if (displayloading) displayloading.style.display = "none";else return;

displayslide = document.getElementById(slideOuter);

if (displayslide) displayslide.style.display = "block";

if (readCookie("com_jw_fpss") == "true") autoslide = true;

else if (readCookie("com_jw_fpss") == "false") autoslide = false;	

playButton = document.getElementById('playButton');

if (autoslide) { showPauseButton(); }

else { showPlayButton(); }

slides = document.getElementsByClassName(slideClass);

navis = document.getElementsByClassName(naviClass);

if (slides.length == 0 || navis.length == 0) return;

for (i = 0; i < slides.length; ++i) {

fx1[i] = new jwfx.Combo(slides[i], {opacity:true,width:false,duration:slide_speed,height:false,toggle:false});

navis[i].onclick = function() {

current = null;

for (j = 0; j < navis.length; ++j) {if (this == navis[j]) current = j;}

if (current != isShowing) {

fx1[isShowing].clearTimer();

if (fx1[isShowing].el.offsetHeight) fx1[isShowing].hide();

fx1[current].toggle();

navis[isShowing].className = naviClass;

navis[current].className = naviClass + activeSuffix;

isShowing = current;

clearSlide();}

return false;}

if (i != 0) {fx1[i].hide();} else {navis[i].className = naviClass + activeSuffix;}}}function showPauseButton() {createCookie("com_jw_fpss", "true");playButton.innerHTML = FPSSpause;playButton.title = FPSSpausetitle;pauseFlag = false;autoSlide();}function showPlayButton() {createCookie("com_jw_fpss", "false");playButton.innerHTML = FPSSplay;playButton.title = FPSSplaytitle;pauseFlag = true;clearTimeout(timer);firstDelay = false;}function showNext() {if (slides.length <= 1) return;fx1[isShowing].clearTimer();if (fx1[isShowing].el.offsetHeight) fx1[isShowing].hide();navis[isShowing].className = naviClass;if (isShowing == slides.length - 1) {fx1[0].toggle();isShowing = 0;} else {fx1[++isShowing].toggle();}navis[isShowing].className = naviClass + activeSuffix;}function showPrev() {if (slides.length <= 1) return;fx1[isShowing].clearTimer();if (fx1[isShowing].el.offsetHeight) fx1[isShowing].hide();navis[isShowing].className = naviClass;if (isShowing == 0) {fx1[slides.length - 1].toggle();isShowing = slides.length - 1;} else {fx1[--isShowing].toggle();}navis[isShowing].className = naviClass + activeSuffix;}function autoSlide() {if (!pauseFlag) {timer = setTimeout('autoSlide()', speed_delay);if (!firstDelay) firstDelay = true;else showNext();}}function clearSlide() {if (!pauseFlag) {clearTimeout(timer);firstDelay = false;autoSlide();}}function playButtonClicked() {if (pauseFlag) showPauseButton();else showPlayButton();}

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 readCookie(name) {var nameEQ = name + "=";var ca = document.cookie.split(';');for(var i=0;i < ca.length;i++) {var c = ca[i];while (c.charAt(0)==' ') c = c.substring(1,c.length);if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length,c.length);}return null;}function fpssinit() {if (arguments.callee.done) return;arguments.callee.done = true;if (_timer) clearInterval(_timer);initFrontpageSlideshow();};



// Loader

if (document.addEventListener) {document.addEventListener("DOMContentLoaded", fpssinit, false);}

/*@cc_on @*/

/*@if (@_win32)

document.write("<script id=__ie_onload_fpss defer src=javascript:void(0)><\/script>");

var scriptFPSS = document.getElementById("__ie_onload_fpss");

scriptFPSS.onreadystatechange = function() {if (this.readyState == "complete") {fpssinit();}};

/*@end @*/

if (/WebKit/i.test(navigator.userAgent)) {var _timer = setInterval(function() {if (/loaded|complete/.test(document.readyState)) {fpssinit();}}, 10);}

window.onload = fpssinit;
