/*----------------------------------------------------
||Banner Ad Rotater v2.01 [Compatibility Version]    ||
||Script by:  Anarchos                               ||
||URL: http://anarchos.xs.mw/                        ||
||E-mail: anarchos3@hotmail.com                      ||
||ICQ: 12007422                                      ||
||                                                   ||
||E-mail or ICQ me if you have any questions or need ||
||help setting up your banner ad rotator. Check out  ||
||my webpage every once in a while for updates to    ||
||this script.                                       ||
-----------------------------------------------------*/

function Banner(objName,layerName, refreshTime, random, align){
    //Methods
        this.write = b_write //output banner
        this.getCode = b_getCode //return output code
        this.Ad = b_Ad //add an ad to the ads array
        this.newAd = b_newAd //display the next ad
        this.randomAd = b_randomAd //make a random ad
        this.nextAd = b_nextAd //queue the next ad
    //Properties
        if (!objName) this.objName = "myBanner"; else this.objName = objName
        if (!layerName) this.layerName = "bannerAd"; else this.layerName = layerName //init output layer name
        if (!refreshTime) this.refreshTime = 3000; else this.refreshTime = refreshTime*3000 //init refresh time
        if (!random) this.random = 1; else this.random = random //cycle randomly
        if (!align) this.align = "none"; else this.align = align //alignment of the sponsor text
        this.ads = new Array() //init ads array
        this.currentAd = 0 //init current ad
        this.mySize = 0 //init size
        this.myCode = '' //init myCode    
}

function b_Ad(src, href, target, width, height, sponsor, mouseover, alt) {
        this.mySize++;
    this.ads[this.mySize] = new Object()
    this.ads[this.mySize].src = src
    if (!target) this.ads[this.mySize].target = "_self"; else this.ads[this.mySize].target = target
    this.ads[this.mySize].href = href
    this.ads[this.mySize].width = width
    this.ads[this.mySize].height = height
    this.ads[this.mySize].sponsor = sponsor
    this.ads[this.mySize].mouseover = mouseover
    this.ads[this.mySize].altText = alt
}

function b_randomAd(){
    var n
    do { n = Math.floor(Math.random() * (this.mySize) + 1) } 
    while(n == this.currentAd)
    this.currentAd = n
    this.myCode = this.getCode(n)
    myCode = this.myCode;
    this.nextAd()
}

function b_getCode(adNumber){
    if (adNumber > this.mySize) { 
           alert("Error: adNumber("+adNumber+") out of bounds.\nMax: "+this.size) 
        } 
    else {
        var tempCode = ""
        if (this.align == "center" || this.align == "right") tempCode += '<table cellpadding=0 cellspacing=0 border=0><tr><td>'
        tempCode += '<a href="'+ this.ads[adNumber].href +'"'
        tempCode += ' onMouseOver="status=\''+ this.ads[adNumber].mouseover +'\'; return true"'
        tempCode += ' target='+ this.ads[adNumber].target
        tempCode += ' onMouseOut="status=\'\';return true"> \n'
        tempCode += '<img src=' + this.ads[adNumber].src + ' width=' + this.ads[adNumber].width
        tempCode += ' name="'+this.objName+'IMG"'
        tempCode += '\n height=' + this.ads[adNumber].height + ' Alt="'+this.ads[adNumber].altText+'" border=0 >'
        if (this.ads[adNumber].sponsor != null){
            if (this.align == "center" || this.align == "right"){
               tempCode += '</a>'
               tempCode += '</td></tr><tr><td align="'+this.align+'">'
               tempCode += '<a href="'+ this.ads[adNumber].href +'"'
               tempCode += ' onMouseOver="status=\''+ this.ads[adNumber].mouseover +'\'; return true"'
               tempCode += ' target="'+ this.ads[adNumber].target + '"'
               tempCode += ' onMouseOut="status=\'\';return true"> \n'    
               }
            else tempCode += '<br>'
            tempCode += 'Sponsor: <b>' + this.ads[adNumber].sponsor + '</b>' 
        }
        tempCode += '</a>'
        if (this.align == "center" || this.align == "right") tempCode += '</td></tr></table>'
        return tempCode
        }
}

function b_newAd(){
    if (!this.random){    
        this.currentAd++;
        if (this.currentAd > this.mySize)
           this.currentAd = 1;
    }
    else {
         this.randomAd();
         }
    this.write(this.getCode(this.currentAd));
}

function b_nextAd(){
         setTimeout(this.objName+'.newAd()',this.refreshTime)
}

function b_write(text){
if (document.all){
    if (document.layers) {
        temp = "document."+this.layerName+".document.write(text)"
        eval(temp)
        eval("document."+this.layerName+".document.close()")
        
        }
    else
        if (document.all){
            document.all[this.layerName].innerHTML = text
            eval("document."+this.objName+"IMG.src = this.ads[this.currentAd].src")
            }
    }
    
}

myBanner = new Banner("myBanner","bannerAd", 15, 15, "center")
myBanner.Ad("http://mywebstyle.com/add_bin/myadd_banners/re4sellban2.gif","http://www.re4sell.com","_blank",468,60,null,"This is a client of MY HELPER MEDIA SERVICES.","This is a client of MY HELPER MEDIA SERVICES.")
myBanner.Ad("http://mywebstyle.com/add_bin/myadd_banners/webstyle_banner.gif","http://mywebstyle.com","_blank",468,60,null,"Comming Soon! YOUR WEBSYLE.COM","1000`s of Webdesigners and Contribitors come to gether to produce your WebStyle!")
myBanner.Ad("http://mywebstyle.com/add_bin/myadd_banners/Largebanner.gif","http://mywebstyle.com","_blank",468,60,null,"1000`s of Webdesigners and Contribitors come to gether to produce your WebStyle!","Comming Soon! YOUR WEBSYLE.COM")
myBanner.Ad("http://mywebstyle.com/add_bin/myadd_banners/artfortheweb.gif","http://webpagedesign.com.au","_blank",468,60,null,"Contribitor and MyWebStyle Designer","ART FOR THE WEB PRESENTED BY MYWEBSYLE.COM")
myBanner.Ad("http://mywebstyle.com/add_bin/myadd_banners/anarchos.gif","http://anarchos.xs.mw","_blank",468,60,null,"A MyWebStyle partner and contribitor.","More fun than a deflated volleyball and some rope.")
myBanner.Ad("http://mywebstyle.com/add_bin/myadd_banners/powerdownlg1.jpg","http://powerdown.net","_blank",468,60,null,"This is a client of MY HELPER MEDIA SERVICES 1997-2002","POWERDOWN.NET A CLIENT SITE")
myBanner.Ad("http://mywebstyle.com/add_bin/myadd_banners/woodcarvban3.gif","http://artinwood.com","_blank",468,60,null,"ARTISTRY IN WOOD arts and crafts main site.","This is a client of MY HELPER MEDIA SERVICES.")
myBanner.Ad("http://mywebstyle.com/add_bin/myadd_banners/asdban11.jpg","http://www.accessandiego.org","_blank",468,60,null,"Accessible Sandiego client 98-99","Public Service Client of MY HELPER MEDIA SERVICES.")
myBanner.Ad("http://mywebstyle.com/add_bin/myadd_banners/sanban1.gif","http://sanders-inc.com","_blank",468,60,null,"Sanders-inc client","Client of MY HELPER MEDIA SERVICES.")
myBanner.Ad("http://mywebstyle.com/add_bin/myadd_banners/sunban11.jpg","http://mywebstyle.com/sun","_blank",468,60,null,"Sun Adjusters Of Arizona Inc. client 2000","Client of MY HELPER MEDIA SERVICES.")
myBanner.Ad("http://mywebstyle.com/add_bin/myadd_banners/artcrftban1.jpg","http://artinwood.com","_blank",468,60,null,"ARTISTRY IN WOOD arts and crafts main site.","This is a client of MY HELPER MEDIA SERVICES.")
myBanner.Ad("http://mywebstyle.com/add_bin/myadd_banners/re4sellban10.gif","http://www.re4sell.com","_blank",468,60,null,"Client and MyWebStyle Promoter","World Wide website Promotion.")
myBanner.Ad("http://mywebstyle.com/add_bin/myadd_banners/re4sellban5.gif","http://www.re4sell.com","_blank",468,60,null,"Contribitor and MyWebStyle Promoter","World Wide website Promotion.")
myBanner.Ad("http://mywebstyle.com/add_bin/myadd_banners/armbane11.jpg","http://mywebstyle.com/main_web/sample_webs/custom_webs/armindex.html","_blank",468,60,null,"ARM Solutions. client 97-98","Was a client,, out of business.")
myBanner.Ad("http://mywebstyle.com/add_bin/myadd_banners/artcrftban3.gif","http://artinwood.com","_blank",468,60,null,"ARTISTRY IN WOOD arts and crafts main site.","This is a client of MY HELPER MEDIA SERVICES.")
myBanner.randomAd()

