var ipBanners = null; var loadBannersOk = false; var isIE5, isIE55, isIE6; var isNN6, isNN7; var isOpera; ua = navigator.userAgent; if( ua.indexOf( "Opera" ) != -1 ){ isOpera = true; } else if( ua.indexOf( "MSIE" ) != -1 ){ vers = ua.substring( ua.indexOf( "MSIE" ) + 5, ua.indexOf( ";", ua.indexOf( "MSIE" ) ) ); if( vers == "6.0" ){ isIE6 = true; } else if( vers == "5.5" ){ isIE55 = true; } else if( vers == "5.0" ){ isIE5 = true; } } else if( ua.indexOf( "Netscape" ) != -1 ){ vers = ua.substring( ua.lastIndexOf( "/" ) + 1, ua.lastIndexOf( "/" ) + 4 ); if( ( vers == "7.0" ) || ( vers == "7.1" ) ){ isNN7 = true; } else if( ( vers == "6.0" ) || ( vers == "6.1" ) || ( vers == "6.2" ) ){ isNN6 = true; } } else if( ua.indexOf( "Mozilla" ) != -1 ){ vers = ua.substring( ua.indexOf( "rv:" ) + 3, ua.indexOf( "rv:" ) + 5 ); if( vers == "1." ){ isNN7 = true; } else if( ( vers == "0." ) ){ isNN6 = true; } } //--------------------------------------------------------------------------------------------------------- // bannerName : unique name // bannerWidth : width in pixels // bannerHeight : height in pixels //--------------------------------------------------------------------------------------------------------- function bannerChanger( bannerName, bannerWidth, bannerHeight ){ this.name = bannerName; this.width = bannerWidth; this.height = bannerHeight; this.pause = new Array(); this.bannersLength = 0; this.currentBanner = 0; this.bannerObjs = new Array(); this.URLs = new Array(); this.imageURLs = new Array(); this.targets = new Array(); this.needToChange = false; this.mouseOver = false; this.timeoutID = null; this.image = null; this.notRun = 1; // methods this.addBanner = addBanner; this.closeBanners = closeBanners; // register banner changer if( ipBanners == null ){ ipBanners = new Array(); } ipBanners[ ipBanners.length ] = this; this.bannerIndex = ipBanners.length - 1; } function addBanner( imageURL, link, target, pause ){ this.bannersLength++; this.bannerObjs[ this.bannerObjs.length ] = null; this.imageURLs[ this.imageURLs.length ] = imageURL; this.URLs[ this.URLs.length ] = link; this.targets[ this.targets.length ] = target; this.pause[ this.pause.length ] = pause; } function closeBanners(){ this.currentBanner = Math.round( Math.random() * ( this.bannerObjs.length - 1 ) ); document.writeln( "
" ); if( isIE6 || isIE5 || isIE55 ){ document.writeln( "
" ); } else if ( isNN6 || isNN7 ){ document.writeln( "
" ); } else if( isOpera ){ document.writeln( "
" ); } else { document.writeln( "
" ); } if ( isNN6 || isNN7 ){ document.writeln( "
" ); } else { document.writeln( "" ); } document.writeln( "
" ); var im = document.getElementById( "bannerImage_" + this.bannerIndex ); this.image = im; } function loadNextImage( tIndex ){ if( loadBannersOk ){ obj = ipBanners[ Number( tIndex ) ]; if( obj.notRun ){ foo = obj.currentBanner; obj.currentBanner = ( obj.currentBanner + 1 ) % obj.bannersLength; } if( obj.bannerObjs[ obj.currentBanner ] && obj.notRun ){ obj.currentBanner = foo; obj.notRun = 0; obj.timeoutID = setTimeout( "changeBanner(" + obj.bannerIndex + ")", obj.pause[ obj.currentBanner ] ); } else if( obj.notRun ){ obj.bannerObjs[ obj.currentBanner ] = new Image(); obj.bannerObjs[ obj.currentBanner ].onload = obj.image.onload; obj.bannerObjs[ obj.currentBanner ].src = obj.imageURLs[ obj.currentBanner ]; } } } function changeBanner( tIndex ){ obj = ipBanners[ Number( tIndex ) ]; clearTimeout( obj.timeoutID ); obj.timeoutID = null; obj.needToChange = true; if( !obj.mouseOver ){ if( obj.needToChange ){ obj.currentBanner = ( obj.currentBanner + 1 ) % obj.bannersLength; obj.needToChange = false; obj.image.src = obj.bannerObjs[ obj.currentBanner ].src; obj.timeoutID = setTimeout( "changeBanner(" + obj.bannerIndex + ")", obj.pause[ obj.currentBanner ] ); } } } function bannerMouseIn( tIndex ){ obj = ipBanners[ Number( tIndex ) ]; obj.mouseOver = true; } function bannerMouseOut( tIndex ){ obj = ipBanners[ Number( tIndex ) ]; obj.mouseOver = false; if( obj.needToChange && !obj.timeoutID ){ changeBanner( tIndex ); } } function clickBanner( tIndex ){ obj = ipBanners[ Number( tIndex ) ]; window.open( obj.URLs[ obj.currentBanner ], obj.targets[ obj.currentBanner ] ); }