function opacity(id, opacStart, opacEnd, millisec) {
	//speed for each frame
	var speed = Math.round(millisec / 100);
	var timer = 0;

	//determine the direction for the blending, if start and end are the same nothing happens
	if(opacStart > opacEnd) {
		for(i = opacStart; i >= opacEnd; i--) {
			setTimeout("changeOpac(" + i + ",'" + id + "')",(timer * speed));
			timer++;
		}
	} else if(opacStart < opacEnd) {
		for(i = opacStart; i <= opacEnd; i++)
			{
			setTimeout("changeOpac(" + i + ",'" + id + "')",(timer * speed));
			timer++;
		}
	}
}

//change the opacity for different browsers
function changeOpac(opacity, id) {
	var object = document.getElementById(id).style; 
	object.opacity = (opacity / 100);
	object.MozOpacity = (opacity / 100);
	object.KhtmlOpacity = (opacity / 100);
	object.filter = "alpha(opacity=" + opacity + ")";
}

function shiftOpacity(id, millisec) {
	//if an element is invisible, make it visible, else make it ivisible
	if(document.getElementById(id).style.opacity == 0) {
		opacity(id, 0, 100, millisec);
	} else {
		opacity(id, 100, 0, millisec);
	}
}

function blendimage(divid, imageid, imagefile, millisec) {
	var speed = Math.round(millisec / 100);
	var timer = 0;
	
	//set the current image as background
	document.getElementById(divid).style.backgroundImage = "url(" + document.getElementById(imageid).src + ")";
	
	//make image transparent
	changeOpac(0, imageid);
	
	//make new image
	document.getElementById(imageid).src = imagefile;

	//fade in image
	for(i = 0; i <= 100; i++) {
		setTimeout("changeOpac(" + i + ",'" + imageid + "')",(timer * speed));
		timer++;
	}
}

function currentOpac(id, opacEnd, millisec) {
	//standard opacity is 100
	var currentOpac = 100;
	
	//if the element has an opacity set, get it
	if(document.getElementById(id).style.opacity < 100) {
		currentOpac = document.getElementById(id).style.opacity * 100;
	}

	//call for the function that changes the opacity
	opacity(id, currentOpac, opacEnd, millisec)
}

function changeImg(newimg){
document.getElementById('agentslideshow').innerHTML=newimg
}

function beginAgentSlideShow(num){
var agents=new Array();
agents[0] = "<a style='text-decoration:none;' href='agent-info.php?agent=1'><img src='phpThumb.php?src=images/000_0232.JPG&w=150' border='0'><br />Travis Bell</a>";
agents[1] = "<a style='text-decoration:none;' href='agent-info.php?agent=5'><img src='phpThumb.php?src=images/Ken_2_Athletes.jpg&w=150' border='0'><br />Ken Foster</a>";
agents[2] = "<a style='text-decoration:none;' href='agent-info.php?agent=6'><img src='phpThumb.php?src=images/Darren_Gill_2008.jpg&w=150' border='0'><br />Darren Gill</a>";
agents[3] = "<a style='text-decoration:none;' href='agent-info.php?agent=7'><img src='phpThumb.php?src=images/Doskor_Hanchett,_Jr-_Picture.bmp&w=150' border='0'><br />Doskor Hanchett, Jr.</a>";
agents[4] = "<a style='text-decoration:none;' href='agent-info.php?agent=14'><img src='phpThumb.php?src=images/alice.jpg&w=150' border='0'><br />Alice Meikle</a>";
agents[5] = "<a style='text-decoration:none;' href='agent-info.php?agent=15'><img src='phpThumb.php?src=images/Brian_Morehouse.jpg&w=150' border='0'><br />Brian Morehouse</a>";
agents[6] = "<a style='text-decoration:none;' href='agent-info.php?agent=19'><img src='phpThumb.php?src=images/Carlos_Pic.jpg&w=150' border='0'><br />Carlos Chavarria</a>";
agents[7] = "<a style='text-decoration:none;' href='agent-info.php?agent=22'><img src='phpThumb.php?src=images/richardavery-president.jpg&w=150' border='0'><br />Richard Avery</a>";
agents[8] = "<a style='text-decoration:none;' href='agent-info.php?agent=32'><img src='phpThumb.php?src=images/Andrew_3.JPG&w=150' border='0'><br />Andrew Moss</a>";
agents[9] = "<a style='text-decoration:none;' href='agent-info.php?agent=37'><img src='phpThumb.php?src=images/Clinton_Head_Shot.jpg&w=150' border='0'><br />CLINTON T. SPENCER</a>";
agents[10] = "<a style='text-decoration:none;' href='agent-info.php?agent=40'><img src='phpThumb.php?src=images/agent_photo.jpg&h=200' border='0'><br />Eric Vaughn</a>";
agents[11] = "<a style='text-decoration:none;' href='agent-info.php?agent=38'><img src='phpThumb.php?src=images/emailsjohn.jpg&w=150' border='0'><br />Tony Farmer</a>";
agents[12] = "<a style='text-decoration:none;' href='agent-info.php?agent=42'><img src='phpThumb.php?src=images/valmorris.jpg&w=150' border='0'><br />Val Morris</a>";
agents[13] = "<a style='text-decoration:none;' href='agent-info.php?agent=45'><img src='phpThumb.php?src=images/kevin_cleary.jpg&w=150' border='0'><br />Kevin Cleary</a>";
agents[14] = "<a style='text-decoration:none;' href='agent-info.php?agent=49'><img src='phpThumb.php?src=images/IMG_2332.JPG&w=150' border='0'><br />ALONSO MARTIN, ESQUIRE</a>";
agents[15] = "<a style='text-decoration:none;' href='agent-info.php?agent=43'><img src='phpThumb.php?src=images/Daddy_website[1].JPG&w=150' border='0'><br />Raymond C. Prospero, Esq.</a>";
agents[16] = "<a style='text-decoration:none;' href='agent-info.php?agent=44'><img src='phpThumb.php?src=images/Bo-Wagner-Picture.jpg&w=150' border='0'><br />Bo Wagner</a>";
agents[17] = "<a style='text-decoration:none;' href='agent-info.php?agent=46'><img src='phpThumb.php?src=images/ericksonb_01r.jpg&w=150' border='0'><br />Brett Erickson</a>";
agents[18] = "<a style='text-decoration:none;' href='agent-info.php?agent=47'><img src='phpThumb.php?src=images/dssi-icondutt.gif&w=150' border='0'><br />Tony dutt</a>";
agents[19] = "<a style='text-decoration:none;' href='agent-info.php?agent=48'><img src='phpThumb.php?src=images/n615867_30688936_3442.jpg&w=150' border='0'><br />LEONARD WILLSON</a>";
agents[20] = "<a style='text-decoration:none;' href='agent-info.php?agent=50'><img src='phpThumb.php?src=images/Me.JPG&w=150' border='0'><br />Eugene Wong</a>";
MM_preloadImages('phpThumb.php?src=images/000_0232.JPG&w=150','phpThumb.php?src=images/Ken_2_Athletes.jpg&w=150','phpThumb.php?src=images/Darren_Gill_2008.jpg&w=150','phpThumb.php?src=images/Doskor_Hanchett,_Jr-_Picture.bmp&w=150','phpThumb.php?src=images/alice.jpg&w=150','phpThumb.php?src=images/Brian_Morehouse.jpg&w=150','phpThumb.php?src=images/Carlos_Pic.jpg&w=150','phpThumb.php?src=images/richardavery-president.jpg&w=150','phpThumb.php?src=images/Andrew_3.JPG&w=150','phpThumb.php?src=images/Clinton_Head_Shot.jpg&w=150','phpThumb.php?src=images/agent_photo.jpg&h=200','phpThumb.php?src=images/emailsjohn.jpg&w=150','phpThumb.php?src=images/valmorris.jpg&w=150','phpThumb.php?src=images/kevin_cleary.jpg&w=150','phpThumb.php?src=images/IMG_2332.JPG&w=150','phpThumb.php?src=images/Daddy_website[1].JPG&w=150','phpThumb.php?src=images/Bo-Wagner-Picture.jpg&w=150','phpThumb.php?src=images/ericksonb_01r.jpg&w=150','phpThumb.php?src=images/dssi-icondutt.gif&w=150','phpThumb.php?src=images/n615867_30688936_3442.jpg&w=150','phpThumb.php?src=images/Me.JPG&w=150');
	shiftOpacity('agentslideshow',1000);
	setTimeout("changeImg(\""+agents[num]+"\")",1000);
    setTimeout("shiftOpacity('agentslideshow',1000)",2000);
	var newnum;
    if(num> 0 && num < (agents.length-1)){
    	newnum=parseInt(num)+1;
    }else if(num == 0){
    	newnum=1;
    }else if(num == agents.length-1){
    	newnum=0;
    }
    setTimeout("beginAgentSlideShow('"+newnum+"')",6500);
}