var currentPhoto = 0;
var secondPhoto = 1;
var currentPhoto2 = 0;
var secondPhoto2 = 1;

var currentOpacity = new Array();
var currentOpacity2 = new Array();

var imageArray = new
Array("/resource.mapinfo.com/static/hpbanner/jp/be_location_intelligent_v2.gif","/resource.mapinfo.com/static/hpbanner/jp/builds_relationships_v2.gif","/resource.mapinfo.com/static/hpbanner/jp/drives_decisions_v2.gif","/resource.mapinfo.com/static/hpbanner/jp/finds_customers_v2.gif","/resource.mapinfo.com/static/hpbanner/jp/powers_communication_v2.gif");
var imageArray2 = new
Array("/resource.mapinfo.com/static/hpbanner/us/be_location_intelligent_sub_v2.jpg","/resource.mapinfo.com/static/hpbanner/us/builds_relationships_sub_v2.jpg","/resource.mapinfo.com/static/hpbanner/us/drives_decisions_sub_v2.jpg","/resource.mapinfo.com/static/hpbanner/us/finds_customers_sub_v2.jpg","/resource.mapinfo.com/static/hpbanner/us/powers_communication_sub_v2.jpg");
var linkArray = new
Array("../index.html","../index.html","../index.html","../index.html","../index.html");

var FADE_STEP = 2;
var FADE_INTERVAL = 10;
var pause = false;
var arrayLoc = 0;

function init() {
	currentOpacity[0]=99;
	currentOpacity2[0]=99;
	for(i=1;i<imageArray.length;i++)currentOpacity[i]=0;
	mHTML="";
	for(i=0;i<imageArray.length;i++)mHTML+="<div id=\"photo\" name=\"photo\" class=\"mPhoto\"><img src=\"" + imageArray[i]  +"\" border=\"0\"></div>";
	for(i=1;i<imageArray2.length;i++)currentOpacity2[i]=0;
	mHTML2="";
	for(i=0;i<imageArray2.length;i++)mHTML2+="<div id=\"photo2\" name=\"photo2\" class=\"mPhoto\"><img src=\"" + imageArray2[i]  +"\" border=\"0\"></div>";
	document.getElementById("mContainer").innerHTML = mHTML;
	document.getElementById("mContainer2").innerHTML = mHTML2;
	
	if(document.all) {
		document.getElementsByName("photo")[currentPhoto].style.filter="alpha(opacity=100)";
document.getElementsByName("photo2")[currentPhoto2].style.filter="alpha(opacity=100)";
	} else {
		document.getElementsByName("photo")[currentPhoto].style.MozOpacity = .99;
		document.getElementsByName("photo2")[currentPhoto2].style.MozOpacity = .99;
	}

	mInterval = setInterval("crossFade()",FADE_INTERVAL);
		
}

function crossFade() {
	if(pause)return;
	
	currentOpacity[currentPhoto]-=FADE_STEP;
	currentOpacity[secondPhoto] += FADE_STEP;
	currentOpacity2[currentPhoto2]-=FADE_STEP;
	currentOpacity2[secondPhoto2] += FADE_STEP;

	if(document.all) {
		document.getElementsByName("photo")[currentPhoto].style.filter = "alpha(opacity=" + currentOpacity[currentPhoto] + ")";
		document.getElementsByName("photo")[secondPhoto].style.filter = "alpha(opacity=" + currentOpacity[secondPhoto] + ")";
		document.getElementsByName("photo2")[currentPhoto2].style.filter = "alpha(opacity=" + currentOpacity2[currentPhoto2] + ")";
		document.getElementsByName("photo2")[secondPhoto2].style.filter = "alpha(opacity=" + currentOpacity2[secondPhoto2] + ")";

	} else {
		document.getElementsByName("photo")[currentPhoto].style.MozOpacity = currentOpacity[currentPhoto]/100;
		document.getElementsByName("photo")[secondPhoto].style.MozOpacity =currentOpacity[secondPhoto]/100;
		document.getElementsByName("photo2")[currentPhoto2].style.MozOpacity = currentOpacity2[currentPhoto2]/100;
		document.getElementsByName("photo2")[secondPhoto2].style.MozOpacity =currentOpacity2[secondPhoto2]/100;
	}

	if(currentOpacity[secondPhoto]/100>=.98) {
		currentPhoto = secondPhoto;
		currentPhoto2 = secondPhoto2;
		secondPhoto++;
		secondPhoto2++;
		if(secondPhoto == imageArray.length)secondPhoto=0;
		if(secondPhoto2 == imageArray2.length)secondPhoto2=0;
		pause = true;
		xInterval = setTimeout("pause=false",10000);
		
		if (arrayLoc==imageArray.length-1) {
			arrayLoc = 0; }
		else {
			arrayLoc++; }
	}
}

function goTo() {
  document.location = linkArray[arrayLoc];

} 

function chooseLink() {
  var optionNumber = document.getElementById.selectedIndex
  document.write(i);
}