var PlatJS_index_left_2 ={ width: 255, height: 75, adsConf: {"48":{"id":"48","imageurl":"UploadFile\/Upfile\/gameImg\/201402\/201402111526045457.gif","ads_type":"1","target":"_blank","is_login":"0","tourl":"http:\/\/www.yaowan.com\/?m=platads&action=gettgtourl&key=index_left_2&tourl=http%3A%2F%2Fgc.yaowan.com%2F&i=UploadFile%2FUpfile%2FgameImg%2F201402%2F201402111526045457.gif"}}, host:'img.yaowan.com', id : 'PlatAdsJS_index_left_2', sign: 'index_left_2', curCarouselIndex : 0, allCarousels : [], init : function(){ document.writeln(''); this.writeContent().showContent(); return this; }, click: function(adsid){ var islogin = this.adsConf[adsid].is_login; if(islogin && typeof is_user_logined == 'function'){ return is_user_logined(); }else{ return true; } }, writeImageContent: function(adsid){ var adsConf = this.adsConf[adsid]; var imageurl = 'http://'+this.host+'/'+adsConf.imageurl; var html = ''; return html; }, writeFlashContent: function(adsid){ var adsConf = this.adsConf[adsid]; var tourl = escape(adsConf.tourl); var imageurl = 'http://'+this.host+'/'+adsConf.imageurl+"?tourl="+tourl; var html = ' '; return html; }, writeContent: function(){ var i = 0; var html = ''; for(adsid in this.adsConf){ if(this.adsConf[adsid].ads_type == 2){ html += this.writeFlashContent(adsid); }else{ html += this.writeImageContent(adsid); } this.allCarousels[i++] = adsid; } document.getElementById(this.id).innerHTML = html; return this; }, show: function(second){ if(this.allCarousels.length <= 1) return; if(second <= 0) return; var i = setInterval(function(){ PlatJS_index_left_2.showContent(); }, second*1000); return this; }, showContent: function(){ var curIndex = this.curCarouselIndex % this.allCarousels.length; this.curCarouselIndex++; $("[rel=platads_"+this.sign+"]").hide(); $("#imageSP"+this.allCarousels[curIndex]).show(); return this; } }.init().show(5);