// This section checks to see if the browser is IE4
var RunningIE4
RunningIE4 = (msieversion() >=4);

function msieversion() {
	var ua = window.navigator.userAgent
	var msie = ua.indexOf ( "MSIE " )
	if ( msie > 0 )		// is Microsoft Internet Explorer; return version number
		return parseInt ( ua.substring ( msie+5, ua.indexOf ( ".", msie ) ) )
	else
		return 0	// is other browser
}


// Now comes the code to set up the rolling banners. The code that actually kicks off 
// the banner-rolling process is protected from
// execution on non-IE4 browsers, so you can add it to pages and still have them compatible
// with Navigator etc.


var curBanner, intervalHandle
curBanner = 0

// This page uses banner images
// Declare and populate arrays to hold the image file names and corresponding hyperlink targets

Bfiles   = new Array()  // image file names
Btargets = new Array()  // hyperlink targets

Bfiles[0] = "kmtvbanner.jpg"
Btargets[0] = "http://www.kompamagazinetv.com"

Bfiles[1] = "ceepcobanner.jpg"
Btargets[1] = "http://www.checkoutcds.com"

Bfiles[2] = "kmboardbanner.jpg"
Btargets[2] = "http://p080.ezboard.com/bkmboard"

Bfiles[3] = "carimi_words.jpg"
Btargets[3] = "http://www.carimi.com"

function startBanner() {
// This function creates an interval timer that calls the 'changeBanner()' function
// every three seconds (3,000 milliseconds). Once started, it runs until the page is unloaded

// The variable 'intervalHandle' can be used to cancel the interval timer 
// (the statement would be 'window.clearInterval(intervalHandle)')
// However this page never cancels the interval, so the variable isn't strictly necessary.

// This is the only statement which needs to be protected from execution on non-IE4 browsers. 

    if (RunningIE4 == true) {
      intervalHandle = window.setInterval("changeBanner()",3000); }
    }

function changeBanner() {
// This function is called by the interval timer created in startBanner() above

// First it increments the variable 'curBanner', rolling it back to zero instead if its
// current value is equal to the highest element number in the image filename array.
// Doing it this way ('if (curBanner == (Bfiles.length -1))') rather than a simple
// 'if (curBanner == 2)' means that if you add extra entries onto the arrays, this routine
// will adjust automatically

    if (curBanner == (Bfiles.length -1)) {
       curBanner = 0;
    } else {
       curBanner++}

// Now change the displayed image and hyperlink target by updating the relevant properties 
// of the <IMG and <A HREF objects declared in the <BODY> section below. 

    Banner.src   = Bfiles[curBanner]
    BannerTag.href  = Btargets[curBanner]
}  
