// JavaScript Document
var myThisPromo=-1;
var myPromoImages;
var myPromoURL;

function createHondaRotateImages()
{
<!-- SORT OUT IMAGES -->
// variable 'promoImages' contains link to images from http://www.honda.co.uk/motorcycles/en/scripts/front.js
// create new array and populate with full links to the images
myPromoImages = new Array(promoImages.length)

// get link to the status dive
//var statusText = document.all.promoAdStatus
//statusText.innerHTML = "Loading Content "



for(var i =0; i < promoImages.length;i++)
{
	myPromoImages[i]= "http://ww1.honda.co.uk" + promoImages[i]
}
	document.promoAd.src=myPromoImages[0]


<!-- SORT OUT LINKS -->
// variable 'promoURL' contains links from http://www.honda.co.uk/motorcycles/en/scripts/front.js

myPromoURL = new Array(promoURL.length)

for(var i =0; i < promoURL.length;i++)
{
	//ie javascript:tc_redirect('', '/offRoadExperience/', '/LINK/CASHONDA/COM/OFFROAD');
	if(promoURL[i].indexOf("javascript:tc_redirect") != -1){
		//need to get the index of the 3rd ' and the 4th '
		var found = false;
		var startValue = 0;
		var thirdPosition = 0;
		var forthPosition = 0;
		var counter = 1;
		var temp = 0;
		while(!found){
			temp = promoURL[i].indexOf("'",startValue);
			if(counter==3){
				thirdPosition = temp;
				//alert("(Ignore me)3rd:" + thirdPosition);
			}
			if(counter==4){
				forthPosition = temp;
				found = true;
				//alert("(Ignore me)4th:" + forthPosition);
			}
			startValue = temp + 1;
			counter = counter + 1;
		}// end while
		
		//get substring 
		myPromoURL[i] = "http://www.honda.co.uk" + promoURL[i].slice(thirdPosition+1, forthPosition);		
		
	}else{
	
	
	if(promoURL[i].indexOf("http") == -1) 
	{
		
		myPromoURL[i]= "http://ww1.honda.co.uk" + promoURL[i]
	}
	else 
	{
		if(promoURL[i].indexOf("javascript") == -1)
		{
			myPromoURL[i] = promoURL[i]
		}
		else
		{
			// find the index of http in the string
			var startLocation = promoURL[i].indexOf("http://")
			// find the close of the web address
			var endLocation = promoURL[i].indexOf("'",28)
			
			myPromoURL[i] = promoURL[i].substr(startLocation, (endLocation - startLocation))
			

		
		}//else
	}//else
	}
	//alert(myPromoURL[i]);
}//for


myImgCt = promoImages.length

myRotate()
}




function myRotate()
{
	if (document.images)
	{
		ad = document.promoAd?document.promoAd:document.promoDiv.document.promoAd;
		if (ad.complete)
		{
			myThisPromo++
			if (myThisPromo == myImgCt)
			{
				myThisPromo = 0
			}
			ad.src=myPromoImages[myThisPromo]
		}
  	setTimeout("myRotate()", 3 * 1000)
 	}
}
	
function myNewLocation()
{
	window.open(myPromoURL[myThisPromo]);
}