
var NOT_ANIMATED=0,FADE=1,SLIDE_LEFT=2,SLIDE_RIGHT=3,SLIDE_TOP=4,SLIDE_BOTTOM=5,SCROLL_LEFT=6,SCROLL_RIGHT=7,BLOCKS_SLIDE_TOP=8,BLOCKS_SLIDE_BOTTOM=9,BLOCKS_SLIDE_LEFT=10,BLOCKS_SLIDE_RIGHT=11,BLOCKS_SWIRL=12,BLOCKS_RANDOM=13;function Advert(a){this.name=a;this.list=new Array;this.index=-1;this.currentAd=null;this.nextAd=null;this.prevAd=null;this.timer=null;this.tiles=null;this.zindex=100;this.createTiles=function(g){var g=$("#"+g),e=g.width(),c=g.height(),f=parseInt(e/10),d=parseInt(c/7);this.tiles=new Array;this.sizeX=f;this.sizeY=d;for(var h=0;h<8;h++){this.tiles[h]=new Array;for(var b=0;b<11;b++){this.tiles[h][b]=0;g.parent().append('<div id="tilein_'+this.name+"-"+b+"-"+h+'" style="margin:0;padding:0;left:'+(b*f)+";top:"+(h*d)+";width:"+f+"px;height:"+d+"px;float:left;position:absolute;z-index:"+this.zindex+'"></div>');g.parent().append('<div id="tileout_'+this.name+"-"+b+"-"+h+'" style="margin:0;padding:0;left:'+(b*f)+";top:"+(h*d)+";width:"+f+"px;height:"+d+"px;float:left;position:absolute;z-index:"+this.zindex+'"></div>')}}};this.add=function(b){switch(b.type){case NOT_ANIMATED:b.transition=this.notAnimated;b.opposite=this.notAnimated;break;case FADE:b.transition=this.fade;b.opposite=this.fade;break;case SLIDE_LEFT:b.transition=this.slideLeft;b.opposite=this.slideRight;break;case SLIDE_RIGHT:b.transition=this.slideRight;b.opposite=this.slideLeft;break;case SLIDE_TOP:b.transition=this.slideTop;b.opposite=this.slideBottom;break;case SLIDE_BOTTOM:b.transition=this.slideBottom;b.opposite=this.slideTop;break;case SCROLL_LEFT:b.transition=this.scrollLeft;b.opposite=this.scrollRight;break;case SCROLL_RIGHT:b.transition=this.scrollRight;b.opposite=this.scrollLeft;break;case BLOCKS_SLIDE_TOP:b.transition=this.blocksSlideTop;b.opposite=this.blocksSlideBottom;break;case BLOCKS_SLIDE_BOTTOM:b.transition=this.blocksSlideBottom;b.opposite=this.blocksSlideTop;break;case BLOCKS_SLIDE_LEFT:b.transition=this.blocksSlideLeft;b.opposite=this.blocksSlideRight;break;case BLOCKS_SLIDE_RIGHT:b.transition=this.blocksSlideRight;b.opposite=this.blocksSlideLeft;break;case BLOCKS_SWIRL:b.transition=this.blocksSwirl;b.opposite=this.blocksSwirl;break;case BLOCKS_RANDOM:b.transition=this.blocksRandom;b.opposite=this.blocksRandom;break}b.parent=this;b.zindex=this.zindex;this.list.push(b);this.zindex++;if((b.type==BLOCKS_SLIDE_TOP||b.type==BLOCKS_SLIDE_BOTTOM||b.type==BLOCKS_SLIDE_LEFT||b.type==BLOCKS_SLIDE_RIGHT||b.type==BLOCKS_SWIRL||b.type==BLOCKS_RANDOM)&&!this.tiles){this.createTiles(b.object)}};this.exec=function(){clearTimeout(this.timer);if(!this.currentAd&&this.list[0].type!=SCROLL_LEFT&&this.list[0].type!=SCROLL_RIGHT&&this.list[0].type!=NOT_ANIMATED){this.index++;this.currentAd=this.list[this.index];this.currentAd.fade=this.fade;this.currentAd.duration/=3;this.currentAd.fade(1);this.currentAd.duration*=3}else{if(!this.currentAd){this.doNext()}}this.timer=setTimeout(this.name+".doNext()",(this.currentAd.type==SCROLL_LEFT||this.currentAd.type==SCROLL_RIGHT?this.currentAd.duration:this.currentAd.delay))};this.pause=function(){if(this.currentAd.type!=SCROLL_LEFT&&this.currentAd.type!=SCROLL_RIGHT){clearTimeout(this.timer)}};this.resume=function(){if(this.currentAd.type!=SCROLL_LEFT&&this.currentAd.type!=SCROLL_RIGHT){this.timer=setTimeout(this.name+".doNext()",(this.currentAd.type==SCROLL_LEFT||this.currentAd.type==SCROLL_RIGHT?this.currentAd.duration:this.currentAd.delay))}};this.doNext=function(){if(!this.currentAd||this.currentAd.type==SCROLL_LEFT||this.currentAd.type==SCROLL_RIGHT||this.currentAd&&$("#"+this.currentAd.object).queue().length==0){clearTimeout(this.timer);this.index++;this.next();this.exec()}};this.doPrevious=function(){if(!this.currentAd||this.currentAd.type==SCROLL_LEFT||this.currentAd.type==SCROLL_RIGHT||this.currentAd&&$("#"+this.currentAd.object).queue().length==0){clearTimeout(this.timer);this.currentAd=this.list[this.index];this.index--;this.previous();this.exec()}};this.next=function(){if(this.index>=this.list.length){this.index=0}this.nextAd=this.list[this.index];if(this.currentAd&&this.list.length>1&&this.currentAd.opposite){this.nextAd.transition(null,this.currentAd)}this.currentAd=this.list[this.index];this.currentAd.transition(1)};this.previous=function(){if(this.index==-1){this.index=this.list.length-1}this.nextAd=this.list[this.index];if(this.currentAd&&this.list.length>1&&this.currentAd.opposite){this.nextAd.opposite(null,this.currentAd)}this.currentAd=this.list[this.index];this.currentAd.opposite(1)};this.notAnimated=function(c,b){var b=$("#"+(b?b.object:this.object));b.css("left",0);b.css("top",0);if(c){b.show()}else{b.hide()}};this.fade=function(c,b){var b=$("#"+(b?b.object:this.object));b.css("left",0);b.css("top",0);if(c){b.fadeIn(this.duration)}else{b.fadeOut(this.duration)}};this.scrollLeft=function(){var b=$("#"+this.object);b.stop();b.show();b.css("left",0);b.animate({left:"-="+(b.width()/2)},this.duration,"linear")};this.scrollRight=function(){var b=$("#"+this.object);b.stop();b.show();b.css("left",-(b.width()/2));b.animate({left:"+="+(b.width()/2)},this.duration,"linear")};this.slideLeft=function(c,b){var b=$("#"+(b?b.object:this.object));b.css("top",0);if(c){b.css("left",b.width());b.show();b.animate({left:"-="+b.width()},this.duration)}else{b.css("left",0);b.animate({left:"-="+b.width()},this.duration,function(){b.hide()})}};this.slideRight=function(c,b){var b=$("#"+(b?b.object:this.object));b.css("top",0);if(c){b.css("left",-b.width());b.show();b.animate({left:"+="+b.width()},this.duration)}else{b.css("left",0);b.animate({left:"+="+b.width()},this.duration,function(){b.hide()})}};this.slideTop=function(c,b){var b=$("#"+(b?b.object:this.object));b.css("left",0);if(c){b.css("top",b.height());b.show();b.animate({top:"-="+b.height()},this.duration)}else{b.css("top",0);b.animate({top:"-="+b.height()},this.duration,function(){b.hide()})}};this.slideBottom=function(c,b){var b=$("#"+(b?b.object:this.object));b.css("left",0);if(c){b.css("top",0-b.height());b.show();b.animate({top:"+="+b.height()},this.duration)}else{b.css("top",0);b.animate({top:"+="+b.height()},this.duration,function(){b.hide()})}};this.setBlock=function(d,b,e,c){$("#"+d+this.name+"-"+b+"-"+e).css({top:e*this.sizeY,left:b*this.sizeX,"background-image":"url("+c+")","background-position":-(b*this.sizeX)+"px "+(-(e*this.sizeY)+"px"),"background-repeat":"no-repeat","z-index":this.zindex})};this.blocksSlideTop=function(g,d){var c=(d?d.object:this.object),d=$("#"+c);d.css("left",0);d.css("top",0);if(g){for(var f=this.parent.tiles.length-1,e=0;f>=0;f--,e++){for(var b=0;b<this.parent.tiles[f].length;b++){this.parent.setBlock("tilein_",b,f,d.find("img").attr("src"));$("#tilein_"+this.parent.name+"-"+b+"-"+f).hide();$("#tilein_"+this.parent.name+"-"+b+"-"+f).fadeIn(e*(this.duration/10))}}setTimeout("$('#"+c+"').show();$(\"div[id*='tilein']\").hide();",this.duration)}else{for(var f=this.parent.tiles.length-1,e=0;f>=0;f--,e++){for(var b=0;b<this.parent.tiles[f].length;b++){this.parent.setBlock("tileout_",b,f,d.find("img").attr("src"));$("#tileout_"+this.parent.name+"-"+b+"-"+f).show();$("#tileout_"+this.parent.name+"-"+b+"-"+f).fadeOut(e*(this.duration/10))}}setTimeout("$('#"+c+"').hide();",this.duration)}};this.blocksSlideBottom=function(f,d){var c=(d?d.object:this.object),d=$("#"+c);d.css("left",0);d.css("top",0);if(f){for(var e=0;e<this.parent.tiles.length;e++){for(var b=0;b<this.parent.tiles[e].length;b++){this.parent.setBlock("tilein_",b,e,d.find("img").attr("src"));$("#tilein_"+this.parent.name+"-"+b+"-"+e).hide();$("#tilein_"+this.parent.name+"-"+b+"-"+e).fadeIn(e*(this.duration/10))}}setTimeout("$('#"+c+"').show();$(\"div[id*='tilein']\").hide();",this.duration)}else{for(var e=0;e<this.parent.tiles.length;e++){for(var b=0;b<this.parent.tiles[e].length;b++){this.parent.setBlock("tileout_",b,e,d.find("img").attr("src"));$("#tileout_"+this.parent.name+"-"+b+"-"+e).show();$("#tileout_"+this.parent.name+"-"+b+"-"+e).fadeOut(e*(this.duration/10))}}setTimeout("$('#"+c+"').hide();",this.duration)}};this.blocksSlideLeft=function(g,d){var c=(d?d.object:this.object),d=$("#"+c);d.css("left",0);d.css("top",0);if(g){for(var f=0;f<this.parent.tiles.length;f++){for(var b=this.parent.tiles[f].length-1,e=0;b>=0;b--,e++){this.parent.setBlock("tilein_",b,f,d.find("img").attr("src"));$("#tilein_"+this.parent.name+"-"+b+"-"+f).hide();$("#tilein_"+this.parent.name+"-"+b+"-"+f).fadeIn(e*(this.duration/10))}}setTimeout("$('#"+c+"').show();$(\"div[id*='tilein']\").hide();",this.duration)}else{for(var f=0;f<this.parent.tiles.length;f++){for(var b=this.parent.tiles[f].length-1,e=0;b>=0;b--,e++){this.parent.setBlock("tileout_",b,f,d.find("img").attr("src"));$("#tileout_"+this.parent.name+"-"+b+"-"+f).show();$("#tileout_"+this.parent.name+"-"+b+"-"+f).fadeOut(e*(this.duration/10))}}setTimeout("$('#"+c+"').hide();",this.duration)}};this.blocksSlideRight=function(f,d){var c=(d?d.object:this.object),d=$("#"+c);d.css("left",0);d.css("top",0);if(f){for(var e=0;e<this.parent.tiles.length;e++){for(var b=0;b<this.parent.tiles[e].length;b++){this.parent.setBlock("tilein_",b,e,d.find("img").attr("src"));$("#tilein_"+this.parent.name+"-"+b+"-"+e).hide();$("#tilein_"+this.parent.name+"-"+b+"-"+e).fadeIn(b*(this.duration/10))}}setTimeout("$('#"+c+"').show();$(\"div[id*='tilein']\").hide();",this.duration)}else{for(var e=0;e<this.parent.tiles.length;e++){for(var b=0;b<this.parent.tiles[e].length;b++){this.parent.setBlock("tileout_",b,e,d.find("img").attr("src"));$("#tileout_"+this.parent.name+"-"+b+"-"+e).show();$("#tileout_"+this.parent.name+"-"+b+"-"+e).fadeOut(b*(this.duration/10))}}setTimeout("$('#"+c+"').hide();",this.duration)}};this.blocksSwirl=function(g,d){var c=(d?d.object:this.object),d=$("#"+c);d.css("left",0);d.css("top",0);if(g){xstart=0;xfinish=this.parent.tiles[0].length-1;ystart=0;yfinish=this.parent.tiles.length-1;nn=1;for(var f=0;f<4;f++){for(var b=xstart;b<=xfinish;b++){this.parent.setBlock("tilein_",b,ystart,d.find("img").attr("src"));$("#tilein_"+this.parent.name+"-"+b+"-"+ystart).hide();$("#tilein_"+this.parent.name+"-"+b+"-"+ystart).fadeIn(++nn*(this.duration/100))}ystart++;for(var e=ystart;e<=yfinish;e++){this.parent.setBlock("tilein_",xfinish,e,d.find("img").attr("src"));$("#tilein_"+this.parent.name+"-"+xfinish+"-"+e).hide();$("#tilein_"+this.parent.name+"-"+xfinish+"-"+e).fadeIn(++nn*(this.duration/100))}xfinish--;for(var b=xfinish;b>=xstart;b--){this.parent.setBlock("tilein_",b,yfinish,d.find("img").attr("src"));$("#tilein_"+this.parent.name+"-"+b+"-"+yfinish).hide();$("#tilein_"+this.parent.name+"-"+b+"-"+yfinish).fadeIn(++nn*(this.duration/100))}yfinish--;for(var e=yfinish;e>=ystart;e--){this.parent.setBlock("tilein_",xstart,e,d.find("img").attr("src"));$("#tilein_"+this.parent.name+"-"+xstart+"-"+e).hide();$("#tilein_"+this.parent.name+"-"+xstart+"-"+e).fadeIn(++nn*(this.duration/100))}xstart++}setTimeout("$('#"+c+"').show();$(\"div[id*='tilein']\").hide();",this.duration)}else{xstart=0;xfinish=this.parent.tiles[0].length-1;ystart=0;yfinish=this.parent.tiles.length-1;nn=1;for(var f=0;f<4;f++){for(var b=xstart;b<=xfinish;b++){this.parent.setBlock("tileout_",b,ystart,d.find("img").attr("src"));$("#tileout_"+this.parent.name+"-"+b+"-"+ystart).show();$("#tileout_"+this.parent.name+"-"+b+"-"+ystart).fadeOut(++nn*(this.duration/100))}ystart++;for(var e=ystart;e<=yfinish;e++){this.parent.setBlock("tileout_",xfinish,e,d.find("img").attr("src"));$("#tileout_"+this.parent.name+"-"+xfinish+"-"+e).show();$("#tileout_"+this.parent.name+"-"+xfinish+"-"+e).fadeOut(++nn*(this.duration/100))}xfinish--;for(var b=xfinish;b>=xstart;b--){this.parent.setBlock("tileout_",b,yfinish,d.find("img").attr("src"));$("#tileout_"+this.parent.name+"-"+b+"-"+yfinish).show();$("#tileout_"+this.parent.name+"-"+b+"-"+yfinish).fadeOut(++nn*(this.duration/100))}yfinish--;for(var e=yfinish;e>=ystart;e--){this.parent.setBlock("tileout_",xstart,e,d.find("img").attr("src"));$("#tileout_"+this.parent.name+"-"+xstart+"-"+e).show();$("#tileout_"+this.parent.name+"-"+xstart+"-"+e).fadeOut(++nn*(this.duration/100))}xstart++}setTimeout("$('#"+c+"').hide();",this.duration)}};this.blocksRandom=function(f,d){var c=(d?d.object:this.object),d=$("#"+c);d.css("left",0);d.css("top",0);if(f){for(var e=0;e<this.parent.tiles.length;e++){for(var b=0;b<this.parent.tiles[e].length;b++){this.parent.setBlock("tilein_",b,e,d.find("img").attr("src"));$("#tilein_"+this.parent.name+"-"+b+"-"+e).hide();$("#tilein_"+this.parent.name+"-"+b+"-"+e).fadeIn(Math.floor(Math.random()*(this.duration/2)))}}setTimeout("$('#"+c+"').show();$(\"div[id*='tilein']\").hide();",this.duration)}else{for(var e=0;e<this.parent.tiles.length;e++){for(var b=0;b<this.parent.tiles[e].length;b++){this.parent.setBlock("tileout_",b,e,d.find("img").attr("src"));$("#tileout_"+this.parent.name+"-"+b+"-"+e).show();$("#tileout_"+this.parent.name+"-"+b+"-"+e).fadeOut(Math.floor(Math.random()*(this.duration/2)))}}setTimeout("$('#"+c+"').hide();",this.duration)}}};