
var refreshTime 		= 5000; // Refresh time in ms.
var refreshTimeRight 	= 12000; // Refresh time in ms.
var numAdsRightBanner 	= 17;  // Number of ads to rotate in the 3 right hand banners.
var numAdsBottomBanner 	= 6; // Number of ads to rotate in the bottom banner.

function makeBannerArray() {
	this.width = ''
	this.height = ''
	this.src = ''
	this.href = ''
	this.mouseover = ''
	this.sponsor = ''
}

var rightBannerArray = new Array();
var bottomBannerArray = new Array();

for(var k = 1; k <= numAdsRightBanner; k++) { rightBannerArray[k] = new makeBannerArray() }
for(var i = 1; i <= numAdsBottomBanner; i++) { bottomBannerArray[i] = new makeBannerArray() }


i = 1;
k = 1;


/*------------begin right banner definition----------*/
rightBannerArray[k].width = "120"                           //width of image
rightBannerArray[k].height = "90"                           //height of image
rightBannerArray[k].src = "butt_movietoneNew.gif"  			       //image url
rightBannerArray[k].href = "http://www.movietone.com"           	       //link url
rightBannerArray[k].mouseover = "British Movietone News"            //text to display when mouse moves over banner
rightBannerArray[k].sponsor = "Movietone"                     //text to display for text link under banner
k++

rightBannerArray[k].width = "120"    
rightBannerArray[k].height = "90"                  
rightBannerArray[k].src = "small_a_2.gif"  			
rightBannerArray[k].href = "http://www.framepool.com"           	 
rightBannerArray[k].mouseover = "Framepool"       
rightBannerArray[k].sponsor = "Framepool"                 
k++

rightBannerArray[k].width = "120"                           //width of image
rightBannerArray[k].height = "90"                           //height of image
rightBannerArray[k].src = "butt_focal_banner.gif"  			
rightBannerArray[k].href = "http://www.focalint.org"           	 
rightBannerArray[k].mouseover = "FOCAL International"       
rightBannerArray[k].sponsor = "FOCAL International"
k++

rightBannerArray[k].width = "120"    
rightBannerArray[k].height = "90"                  
rightBannerArray[k].src = "butt_history06.gif"  			
rightBannerArray[k].href = "http://www.history2006.com"           	 
rightBannerArray[k].mouseover = "World Congress of History Producers"       
rightBannerArray[k].sponsor = "World Congress of History Producers"                 
k++

rightBannerArray[k].width = "120"                           //width of image
rightBannerArray[k].height = "90"                           //height of image
rightBannerArray[k].src = "butt_sheffield.gif"  			       //image url
rightBannerArray[k].href = "http://www.sidf.co.uk"           	       //link url
rightBannerArray[k].mouseover = "Sheffield DocFest"            //text to display when mouse moves over banner
rightBannerArray[k].sponsor = "Sheffield DocFest"                     //text to display for text link under banner
k++

rightBannerArray[k].width = "120"    
rightBannerArray[k].height = "90"                  
rightBannerArray[k].src = "butt_tmr.gif"  			
rightBannerArray[k].href = "http://www.clipstream.co.uk"           	 
rightBannerArray[k].mouseover = "TMR Digital"       
rightBannerArray[k].sponsor = "TMR Digital"                 
k++

rightBannerArray[k].width = "120"    
rightBannerArray[k].height = "90"                  
rightBannerArray[k].src = "butt_focal_banner.gif"  			
rightBannerArray[k].href = "http://www.focalint.org"           	 
rightBannerArray[k].mouseover = "FOCAL International"       
rightBannerArray[k].sponsor = "FOCAL International"                 
k++

rightBannerArray[k].width = "120"    
rightBannerArray[k].height = "90"                  
rightBannerArray[k].src = "butt_focal_banner.gif"  			
rightBannerArray[k].href = "http://www.focalint.org"           	 
rightBannerArray[k].mouseover = "FOCAL International"       
rightBannerArray[k].sponsor = "FOCAL International"                 
k++

rightBannerArray[k].width = "120"    
rightBannerArray[k].height = "90"                  
rightBannerArray[k].src = "buttina3.gif"  			
rightBannerArray[k].href = "http://www.inamedia.com/index.jsp?lang=en&source=1"           	 
rightBannerArray[k].mouseover = "ina"       
rightBannerArray[k].sponsor = "ina"                 
k++

rightBannerArray[k].width = "120"    
rightBannerArray[k].height = "90"                  
rightBannerArray[k].src = "buttina3.gif"  			
rightBannerArray[k].href = "http://www.inamedia.com/index.jsp?lang=en&source=1"           	 
rightBannerArray[k].mouseover = "ina"       
rightBannerArray[k].sponsor = "ina"                 
k++

rightBannerArray[k].width = "120"    
rightBannerArray[k].height = "90"                  
rightBannerArray[k].src = "buttina3.gif"  			
rightBannerArray[k].href = "http://www.inamedia.com/index.jsp?lang=en&source=1"           	 
rightBannerArray[k].mouseover = "ina"       
rightBannerArray[k].sponsor = "ina"                 
k++

rightBannerArray[k].width = "120"    
rightBannerArray[k].height = "90"                  
rightBannerArray[k].src = "butt_itnSource3.gif"  			
rightBannerArray[k].href = "http://www.itnarchive.com/showreel"           	 
rightBannerArray[k].mouseover = "ITN Archive"       
rightBannerArray[k].sponsor = "ITN Archive"                 
k++

rightBannerArray[k].width = "120"    
rightBannerArray[k].height = "90"                  
rightBannerArray[k].src = "buttfilmimages.gif"  			
rightBannerArray[k].href = "http://www.film-images.com"           	 
rightBannerArray[k].mouseover = "Film Images"       
rightBannerArray[k].sponsor = "Film Images"                 
k++

rightBannerArray[k].width = "120"    
rightBannerArray[k].height = "90"                  
rightBannerArray[k].src = "butt_osf.gif"  			
rightBannerArray[k].href = "http://www.osffootage.com"           	 
rightBannerArray[k].mouseover = "OSF"       
rightBannerArray[k].sponsor = "OSF"                 
k++

rightBannerArray[k].width = "120"    
rightBannerArray[k].height = "90"                  
rightBannerArray[k].src = "butt_filmaust_banner.gif"  			
rightBannerArray[k].href = "http://www.filmaust.com.au/"           	 
rightBannerArray[k].mouseover = "Film Australia"       
rightBannerArray[k].sponsor = "Film Australia"                 
k++

rightBannerArray[k].width = "120"    
rightBannerArray[k].height = "90"                  
rightBannerArray[k].src = "butt_osf.gif"  			
rightBannerArray[k].href = "http://www.osffootage.com"           	 
rightBannerArray[k].mouseover = "OSF"       
rightBannerArray[k].sponsor = "OSF"                 
k++

rightBannerArray[k].width = "120"    
rightBannerArray[k].height = "90"                  
rightBannerArray[k].src = "butt_focal_banner.gif"  			
rightBannerArray[k].href = "http://www.focalint.org"           	 
rightBannerArray[k].mouseover = "Focal International"       
rightBannerArray[k].sponsor = "Focal International"                 
k++

/*-------------end right banner definition-----------*/


/*------------begin bottom banner definition----------*/
bottomBannerArray[i].width = "728"                           //width of image
bottomBannerArray[i].height = "90"                           //height of image
bottomBannerArray[i].src = "bottombanner_0.gif"  			       //image url
bottomBannerArray[i].href = "/index.htm"           	       //link url
bottomBannerArray[i].mouseover = "Mouseover text"            //text to display when mouse moves over banner
bottomBannerArray[i].sponsor = "Sponsor"                     //text to display for text link under banner
i++

bottomBannerArray[i].width = "728"    
bottomBannerArray[i].height = "90"                  
bottomBannerArray[i].src = "bottombanner_1.gif"  			
bottomBannerArray[i].href = "http://www.clipstream.co.uk"           	 
bottomBannerArray[i].mouseover = "This will show you terms!"       
bottomBannerArray[i].sponsor = "Sponsor"                 
i++

bottomBannerArray[i].width = "728"    
bottomBannerArray[i].height = "90"                  
bottomBannerArray[i].src = "bottombanner_2.gif"  			
bottomBannerArray[i].href = "http://www.clipstream.co.uk"           	 
bottomBannerArray[i].mouseover = "This is will take you to advertisers space"       
bottomBannerArray[i].sponsor = "Sponsor"                 
i++

bottomBannerArray[i].width = "728"    
bottomBannerArray[i].height = "90"                  
bottomBannerArray[i].src = "bottombanner_3.gif"  			
bottomBannerArray[i].href = "http://www.clipstream.co.uk"           	 
bottomBannerArray[i].mouseover = "This is will take you to a new website"       
bottomBannerArray[i].sponsor = "Sponsor"                 
i++

bottomBannerArray[i].width = "728"    
bottomBannerArray[i].height = "90"                  
bottomBannerArray[i].src = "bottombanner_4.gif"  			
bottomBannerArray[i].href = "http://www.clipstream.co.uk"           	 
bottomBannerArray[i].mouseover = "This is will take you to your advertisers space"       
bottomBannerArray[i].sponsor = "Sponsor"                 
i++

/*-------------end bottom banner definition-----------*/


var rightBannerCode1 = '';
var rightBannerCode2 = '';
var rightBannerCode3 = '';
var bottomBannerCode = '';



var currentRightBannerIndex1 = getRandomIndex (numAdsRightBanner);
rightBannerCode1 = getRightBannerCode(currentRightBannerIndex1, true);

var currentRightBannerIndex2 = getRandomIndex (numAdsRightBanner);
do {
	currentRightBannerIndex2 = getRandomIndex (numAdsRightBanner);
} while(currentRightBannerIndex2 == currentRightBannerIndex1);	
rightBannerCode2 = getRightBannerCode(currentRightBannerIndex2, false);

var currentRightBannerIndex3 = getRandomIndex (numAdsRightBanner);
do {
	currentRightBannerIndex3 = getRandomIndex (numAdsRightBanner);
} while ( (currentRightBannerIndex3 == currentRightBannerIndex1) || (currentRightBannerIndex3 == currentRightBannerIndex2) );	
rightBannerCode3 = getRightBannerCode(currentRightBannerIndex3, false);

/*
var currentRightBannerIndex1 = getRandomIndex (numAdsRightBanner);
rightBannerCode1 = getRightBannerCode(currentRightBannerIndex1, true);

var currentRightBannerIndex2 = getRandomIndex (numAdsRightBanner);
rightBannerCode2 = getRightBannerCode(currentRightBannerIndex2, false);

var currentRightBannerIndex3 = getRandomIndex (numAdsRightBanner);
rightBannerCode3 = getRightBannerCode(currentRightBannerIndex3, false);	

var bottomBannerIndex = getRandomIndex (numAdsBottomBanner);
bottomBannerCode = getBottomBannerCode(bottomBannerIndex);
*/

function getRandomIndex (max) {
	
	// modified by Hong 2003-08-26
	
	return ( (Math.floor(Math.random()*100) % max) + 1 );
	
	/*
	do {
		var n= Math.floor(Math.random() * (max + 1) + 1);
	} while(n > max);	
	return n;
	*/
}


function getRightBannerCode(bannerIndex, isTimeOut){
	
	var tempCode = "";
	//var tempVal = eval(refreshTimeRight + bannerIndex);
	var tempVal = refreshTimeRight + bannerIndex;
	tempCode += ('<a href="'+ rightBannerArray[bannerIndex].href +'" \n');
	tempCode += ('onMouseOver="status=\''+ rightBannerArray[bannerIndex].mouseover +'\';return true" \n');
	tempCode += ('onMouseOut="status=\'\'"> \n');
	tempCode += ('<img src="' + rightBannerArray[bannerIndex].src + '" width=' + rightBannerArray[bannerIndex].width);
	if (isTimeOut) {
		tempCode += (' onLoad="setTimeout(\'createRightBanner();\',' + tempVal +');"');
	}
	tempCode += ('\n height=' + rightBannerArray[bannerIndex].height + ' border=0 ></a>');
	
	//alert( tempCode );
	
	return tempCode;
}


function getBottomBannerCode(adNumber){
	var tempCode = "";
	tempCode += ('<a href="'+ bottomBannerArray[adNumber].href +'" \n');
	tempCode += ('onMouseOver="status=\''+ bottomBannerArray[adNumber].mouseover +'\';return true" \n');
	tempCode += ('onMouseOut="status=\'\'"> \n');
	tempCode += ('<img src="' + bottomBannerArray[adNumber].src + '" width=' + bottomBannerArray[adNumber].width);
	tempCode += (' onLoad="setTimeout(\'createBottomBanner();\',' + refreshTime + ');"');
	tempCode += ('\n height=' + bottomBannerArray[adNumber].height + ' border=0 ></a>');
	
	return tempCode;
}


function createRightBanner(){
	if (document.all){
		/*
		var currentRightBannerIndex1 = getRandomIndex (numAdsRightBanner);
		rightBannerCode1 = getRightBannerCode(currentRightBannerIndex1, true);
	
		var currentRightBannerIndex2 = getRandomIndex (numAdsRightBanner);
		rightBannerCode2 = getRightBannerCode(currentRightBannerIndex2, false);
		
		var currentRightBannerIndex3 = getRandomIndex (numAdsRightBanner);
		rightBannerCode3 = getRightBannerCode(currentRightBannerIndex3, false);	
		*/
		
		var currentRightBannerIndex1 = getRandomIndex (numAdsRightBanner);
		rightBannerCode1 = getRightBannerCode(currentRightBannerIndex1, true);
		
		var currentRightBannerIndex2 = getRandomIndex (numAdsRightBanner);
		do {
			currentRightBannerIndex2 = getRandomIndex (numAdsRightBanner);
		} while(currentRightBannerIndex2 == currentRightBannerIndex1);	
		rightBannerCode2 = getRightBannerCode(currentRightBannerIndex2, false);
		
		var currentRightBannerIndex3 = getRandomIndex (numAdsRightBanner);
		do {
			currentRightBannerIndex3 = getRandomIndex (numAdsRightBanner);
		} while ( (currentRightBannerIndex3 == currentRightBannerIndex1) || (currentRightBannerIndex3 == currentRightBannerIndex2) );	
		rightBannerCode3 = getRightBannerCode(currentRightBannerIndex3, false);	

	    writeRightBanner(rightBannerCode1, rightBannerCode2, rightBannerCode3);
	}
}



function createBottomBanner(){
	bottomBannerIndex = getRandomIndex (numAdsBottomBanner);
	if (document.all){
	   writeBottomBanner (getBottomBannerCode(bottomBannerInsdex));
	   
	}
}


function writeRightBanner(text1, text2, text3){
	//alert( 'writeRightBanner' );
	if (document.layers) {
		document.rightBanner1.document.write(text1);
		document.rightBanner1.document.close();
		document.rightBanner2.document.write(text2);
		document.rightBanner2.document.close();
		document.rightBanner3.document.write(text3);
		document.rightBanner3.document.close();				
	} else {
		if (document.all) {
			document.all.rightBanner1.innerHTML = text1;
			document.all.rightBanner2.innerHTML = text2;
			document.all.rightBanner3.innerHTML = text3;
		}
	}
}

function writeBottomBanner (text){
	if (document.layers) {
		document.bottomBanner.document.write(text);
		document.bottomBanner.document.close();
		}
	else
		if (document.all) {
			document.all.bottomBanner.innerHTML = text;
		}
}

/***************** test new code *****************************/



