// mBanner.js ///////////////////////////////// // File Name: mBanner.js // // By: Manish Kumar Namdeo // ///////////////////////////////// // $Id: eva.js 63 2008-12-30 10:35:23Z dungpt $ // BANNER OBJECT function Banner(objName){ this.obj = objName; this.aNodes = []; this.currentBanner = 0; this.intLoopCount = 0; this.intBannerFix = -1; }; // ADD NEW BANNER Banner.prototype.add = function(bannerType, bannerPath, bannerDuration, height, width, hyperlink) { this.aNodes[this.aNodes.length] = new Node(this.obj +"_"+ this.aNodes.length, bannerType, bannerPath, bannerDuration, height, width, hyperlink); }; // Node object function Node(name, bannerType, bannerPath, bannerDuration, height, width, hyperlink) { this.name = name; this.bannerType = bannerType; this.bannerPath = bannerPath; this.bannerDuration = bannerDuration; this.height = height this.width = width; this.hyperlink= hyperlink; // alert (name +"|" + bannerType +"|" + bannerPath +"|" + bannerDuration +"|" + height +"|" + width + "|" + hyperlink); }; // Outputs the banner to the page Banner.prototype.toString = function() { var str = "" for (var iCtr=0; iCtr < this.aNodes.length; iCtr++){ str = str + '\n'; if (this.aNodes[iCtr].hyperlink != ""){ str = str + ''; } if ( this.aNodes[iCtr].bannerType == "FLASH" ){ str = str + '' str = str + '' }else if ( this.aNodes[iCtr].bannerType == "IMAGE" ){ str = str + ''; } if (this.aNodes[iCtr].hyperlink != ""){ str = str + ''; } str += ''; } return str; }; // START THE BANNER ROTATION Banner.prototype.start = function(){ this.changeBanner(); var thisBannerObj = this.obj; // CURRENT BANNER IS ALREADY INCREMENTED IN cahngeBanner() FUNCTION setTimeout(thisBannerObj+".start()", this.aNodes[this.currentBanner].bannerDuration * 1000); } // CHANGE BANNER Banner.prototype.changeBanner = function(){ // var thisBanner; var prevBanner = -1; if (this.currentBanner < this.aNodes.length ){ thisBanner = this.currentBanner; if (this.aNodes.length > 1){ if ( thisBanner > 0 ){ prevBanner = thisBanner - 1; }else{ prevBanner = this.aNodes.length-1; } } if (this.currentBanner < this.aNodes.length - 1){ this.currentBanner = this.currentBanner + 1; }else{ this.currentBanner = 0; } } if (prevBanner >= 0){ document.getElementById(this.aNodes[prevBanner].name).className = "m_banner_hide"; } document.getElementById(this.aNodes[thisBanner].name).className = "m_banner_show"; } // d_Banner2 // Written by ThaoDX function d_Banner2(objName){ this.obj = objName; this.aNodes = []; this.bNodes = []; this.currentBanner = 0; }; // ADD NEW BANNER d_Banner2.prototype.add = function(bannerType, bannerPath, height, width, hyperlink) { var bannerDuration = 0; this.aNodes[this.aNodes.length] = new Node(this.obj +"_"+ this.aNodes.length, bannerType, bannerPath, bannerDuration, height, width, hyperlink); }; // add2 d_Banner2.prototype.add2 = function(bannerType, bannerPath, height, width, hyperlink, position) { var bannerDuration = 0; this.bNodes[this.bNodes.length] = new Node2(this.obj +"_"+ this.bNodes.length, bannerType, bannerPath, bannerDuration, height, width, hyperlink, position); }; function fw24h_getFlash( object) { var str = ''; return str; } // Outputs the banner to the page function Node2(name, bannerType, bannerPath, bannerDuration, height, width, hyperlink, position) { this.name = name; this.bannerType = bannerType; this.bannerPath = bannerPath; this.bannerDuration = bannerDuration; this.height = height this.width = width; this.hyperlink= hyperlink; this.position= position; }; d_Banner2.prototype.toString = function() { var str = ""; var BannerPostion = Math.floor(Math.random()*12321) % this.aNodes.length; var i = 1; for (var iCtr=BannerPostion; iCtr < this.aNodes.length; iCtr++) { // iB for loop //str += "I: " + i + "
"; for(var iB=0; iB < this.bNodes.length; iB++){ if(i == this.bNodes[iB].position){ str = str + '\n'; if (this.bNodes[iB].hyperlink != ""){ str = str + ''; } if ( this.bNodes[iB].bannerType == "FLASH" ){ str += fw24h_getFlash( this.bNodes[iB]); }else if ( this.bNodes[iB].bannerType == "IMAGE" ){ str = str + ''; } if( this.bNodes[iB].bannerType == "TEXT") { str = str + '' } if (this.bNodes[iB].hyperlink != ""){ str = str + ''; } str += ''; // str = str + 'Thao Pro '+i; i++; continue; } } // End iB for loop str = str + '\n'; if (this.aNodes[iCtr].hyperlink != ""){ str = str + ''; } if ( this.aNodes[iCtr].bannerType == "FLASH" ){ str += fw24h_getFlash( this.aNodes[iCtr]); }else if ( this.aNodes[iCtr].bannerType == "IMAGE" ){ str = str + ''; } if( this.aNodes[iCtr].bannerType == "TEXT") { str = str + '' } if (this.aNodes[iCtr].hyperlink != ""){ str = str + ''; } str += ''; i++; } //BannerPostion = 0; //return str; //str += "
a " + BannerPostion + " a
";; for (var iCtr=0; iCtr < BannerPostion; iCtr++){ // iB for loop for(var iB=0; iB < this.bNodes.length; iB++){ if(i == this.bNodes[iB].position){ str = str + '\n'; if (this.bNodes[iB].hyperlink != ""){ str = str + ''; } if ( this.bNodes[iB].bannerType == "FLASH" ){ str += fw24h_getFlash( this.bNodes[iB]); }else if ( this.bNodes[iB].bannerType == "IMAGE" ){ str = str + ''; } if( this.bNodes[iB].bannerType == "TEXT") { str = str + '' } if (this.bNodes[iB].hyperlink != ""){ str = str + ''; } str += ''; i++; continue; } else{ //str = str + 'i: e '+i; } } // End iB for loop str = str + '\n'; if (this.aNodes[iCtr].hyperlink != ""){ str = str + ''; } if ( this.aNodes[iCtr].bannerType == "FLASH" ){ str += fw24h_getFlash( this.aNodes[iCtr]); }else if ( this.aNodes[iCtr].bannerType == "IMAGE" ){ str = str + ''; } if( this.aNodes[iCtr].bannerType == "TEXT") { str = str + '' } if (this.aNodes[iCtr].hyperlink != ""){ str = str + ''; } str += ''; i++; } for(x = 0; x < this.bNodes.length; x++) { if(this.bNodes[x].position >= i) { str = str + '\n'; if (this.bNodes[x].hyperlink != ""){ str = str + ''; } if ( this.bNodes[x].bannerType == "FLASH" ){ str += fw24h_getFlash( this.bNodes[x]); }else if ( this.bNodes[x].bannerType == "IMAGE" ){ str = str + ''; } if( this.bNodes[x].bannerType == "TEXT") { str = str + '' } if (this.bNodes[x].hyperlink != ""){ str = str + ''; } str += ''; } } document.write( str); str = ''; return str; }; // d_Banner // Written by Dungpt function d_Banner(objName){ this.obj = objName; this.aNodes = []; this.currentBanner = 0; }; // ADD NEW BANNER d_Banner.prototype.add = function(bannerType, bannerPath, height, width, hyperlink) { var bannerDuration = 0; this.aNodes[this.aNodes.length] = new Node(this.obj +"_"+ this.aNodes.length, bannerType, bannerPath, bannerDuration, height, width, hyperlink); }; // Outputs the banner to the page d_Banner.prototype.toString = function() { var str = ""; var BannerPostion = Math.floor(Math.random()*12321) % this.aNodes.length; for (var iCtr=BannerPostion; iCtr < this.aNodes.length; iCtr++){ str = str + '\n'; if (this.aNodes[iCtr].hyperlink != ""){ str = str + ''; } if ( this.aNodes[iCtr].bannerType == "FLASH" ){ str = str + '' str = str + '' }else if ( this.aNodes[iCtr].bannerType == "IMAGE" ){ str = str + ''; } if( this.aNodes[iCtr].bannerType == "TEXT") { str = str + '' } if (this.aNodes[iCtr].hyperlink != ""){ str = str + ''; } str += ''; } for (var iCtr=0; iCtr < BannerPostion; iCtr++){ str = str + '\n'; if (this.aNodes[iCtr].hyperlink != ""){ str = str + ''; } if ( this.aNodes[iCtr].bannerType == "FLASH" ){ str = str + '' str = str + '' }else if ( this.aNodes[iCtr].bannerType == "IMAGE" ){ str = str + ''; } if( this.aNodes[iCtr].bannerType == "TEXT") { str = str + '' } if (this.aNodes[iCtr].hyperlink != ""){ str = str + ''; } str += ''; } return str; }; // d_Banner // Written by Dungpt function dFloat_Banner(objName){ this.obj = objName; this.aNodes = []; this.currentBanner = 0; }; // ADD NEW BANNER dFloat_Banner.prototype.add = function(bannerType, bannerPath, height, width, hyperlink) { var bannerDuration = 0; this.aNodes[this.aNodes.length] = new Node(this.obj +"_"+ this.aNodes.length, bannerType, bannerPath, bannerDuration, height, width, hyperlink); }; // Outputs the banner to the page dFloat_Banner.prototype.toString = function() { var str = ""; var BannerPostion = Math.floor(Math.random()*12321) % this.aNodes.length; for (var iCtr=BannerPostion; iCtr < this.aNodes.length; iCtr++){ str = str + '\n'; if (this.aNodes[iCtr].hyperlink != ""){ str = str + ''; } if ( this.aNodes[iCtr].bannerType == "FLASH" ){ str = str + '' str = str + '' }else if ( this.aNodes[iCtr].bannerType == "IMAGE" ){ str = str + ''; } if( this.aNodes[iCtr].bannerType == "TEXT") { str = str + '' } if (this.aNodes[iCtr].hyperlink != ""){ str = str + ''; } str += ''; } for (var iCtr=0; iCtr < BannerPostion; iCtr++){ str = str + '\n'; if (this.aNodes[iCtr].hyperlink != ""){ str = str + ''; } if ( this.aNodes[iCtr].bannerType == "FLASH" ){ str = str + '' str = str + '' }else if ( this.aNodes[iCtr].bannerType == "IMAGE" ){ str = str + ''; } if( this.aNodes[iCtr].bannerType == "TEXT") { str = str + '' } if (this.aNodes[iCtr].hyperlink != ""){ str = str + ''; } str += ''; } return str; }; function flashWrite(url,w,h,id,bg,vars){ var flashStr= ""+ ""+ ""+ ""+ ""+ ""+ ""+ ""+ ""; document.write(flashStr); } //////////////////////////////////////////////////////////////////////////////////////////////////// var style = ""; document.write( style); banner_ce7e6d = new Banner('banner_ce7e6d'); banner_ce7e6d.add('FLASH','http://banner4rum.24h.com.vn/upload/qcao/2009-09-21/09262_210240-1.swf',15,240,210,''); banner_ce7e6d.add('IMAGE','http://banner4rum.24h.com.vn/upload/qcao/2009-11-19/buu-dien-ha-noi.gif',15,240,210,'http://quangcao.24h.com.vn/qcao/09333_buudienhanoi.html'); try { document.write(banner_ce7e6d);banner_ce7e6d.start(); }catch( error){ }