/*
Author: COCO Communication Company GmbH (www.cocowerbung.at)
Operator(s): Daniel Haring
*/
$(document).ready(function(){gallery.init()});var gallery={init:function(){if($.type(ssiArray)=="undefined"){return false}if(ssiArray.length<2){return false}$("#header > div.content > span.slideshow > img:first").remove();this.count=getRandom(0,ssiArray.length-1);this.repeat=false;$("#header > div.content > span.slideshow").append('<img src="'+ssiArray[this.count].src+'" width="'+ssiArray[this.count].width+'" height="'+ssiArray[this.count].height+'" alt="'+ssiArray[this.count].alt+'" />');this.count++;if(this.count>=ssiArray.length){this.count=0}this.elem={core:{node:$("#header > div.content > span.slideshow > img:first"),loaded:false}};this.elem.core.node.css({"z-index":5,position:"absolute",top:"0px",left:"0px",display:"block"});$('<img src="'+ssiArray[1].src+'" width="'+ssiArray[1].width+'" height="'+ssiArray[1].height+'" alt="'+ssiArray[1].alt+'" style="display:none" />').insertAfter(this.elem.core.node);this.elem.plane={node:$("#header > div.content > span.slideshow > img:last"),loaded:false};this.elem.plane.node.css({"z-index":4,position:"absolute",top:"0px",left:"0px",display:"block"});this.elem.core.node.load(function(){gallery.elem.core.loaded=true;gallery.readyCheck()});this.elem.plane.node.load(function(){gallery.elem.plane.loaded=true;gallery.readyCheck()});return true},readyCheck:function(){if(!this.elem.core.loaded||!this.elem.plane.loaded){return}this.repeat=true;this.elem.core.node.unbind();this.elem.plane.node.unbind();this.run()},run:function(a){this.elem.core.node.delay(4000).fadeOut(2000,function(){gallery.count++;if(gallery.count>=ssiArray.length){gallery.count=0}gallery.elem.core.node.attr({src:ssiArray[gallery.count].src,width:ssiArray[gallery.count].width,height:ssiArray[gallery.count].height,alt:ssiArray[gallery.count].alt});gallery.elem.core.node.delay(4000).fadeIn(2000,function(){gallery.count++;if(gallery.count>=ssiArray.length){gallery.count=0}gallery.elem.plane.node.attr({src:ssiArray[gallery.count].src,width:ssiArray[gallery.count].width,height:ssiArray[gallery.count].heihgt,alt:ssiArray[gallery.count].alt});gallery.count--;if(gallery.count<0){gallery.count=ssiArray.length-1}if(gallery.repeat){gallery.run()}})})},hold:function(){this.repeat=false}},getRandom=function(b,a){if(b>a){return -1}if(b==a){return b}return(b+parseInt(Math.random()*(a-b+1)))};
