var slideshowPosition = 0;
function playSlideshow(){
	var texts = new Array();
	var author = new Array();
	var company = new Array();
	
	texts[0] = "Bahman rises to the challenge like the true champion that he is, and exemplifies the devotion of a natural leader and good business partner. Going above and beyond the call.";
	texts[1] = "Bahman’s dedication and professionalism are unparalleled. Most importantly, he has an ambidextrous mind, easily straddling complex languages and communication with non-technical personnel to accurately specify business applications.";
	texts[2] = "What is most exceptional about Bahman is his promptness and follow-through in providing deliverables. He is quick to grasp the essence of a project and maintains thorough communication to project completion.";
	texts[3] = "Bahman handles complex web projects with apparent ease, delivering applications with both amazing functionality and stunning aesthetic appeal. And he’s a good guy to boot.";
	texts[4] = "Bahman Zakeri is one of those individuals who make the most complex projects not only possible, but enjoyable.";
	texts[5] = "I have been impressed with the depth of Bahman’s technical knowledge as well as with his organizational skills. He continually exceeds my expectations in keeping projects on time and within budget often delivering more than promised.";
	
	author[0] = "Phil Walker";
	author[1] = "Ryan Zerwer";
	author[2] = "Diana Howles";
	author[3] = "Kyle Henderson";
	author[4] = "James Zychowicz";
	author[5] = "Bonnie Schulte";
	
	company[0] = "eBusiness Manager, MasterCraft Boat Co.";
	company[1] = "Clotho Business Solutions";
	company[2] = "Senior Learning Specialist, Howles Associates, LLC";
	company[3] = "Director of Business Development, Stephan & Brady";
	company[4] = "";
	company[5] = "Director of E-Commerce at Pacific Cycle";
	
	
	slideshowPosition++;
	total = texts.length
	
	
	
	if(slideshowPosition < total){
		idx = slideshowPosition
	}else {
		idx = 0;
		slideshowPosition = 0;
	}	
			
	txt = texts[slideshowPosition]
	auth = author[slideshowPosition] 
	comp = company[slideshowPosition] 
	
	document.getElementById('slText').style.opacity = 0
//	document.getElementById('slideshow').filters.alpha.opacity = 0
	
	
	document.getElementById('slideShowText').innerHTML = txt
	document.getElementById('author').innerHTML = auth
	document.getElementById('company').innerHTML = comp
	//document.getElementById('slideShowText').style.color="red"	
	
	
	porImgOver('slText')
	
	clearTimeout(t);

	autoplay();
}


var lowerOpac = 0;
var opacSpeed = 2000;
var opacCSteps = {};

var idImg = 0;
var t;

function opacity(id, opacStart, opacEnd, millisec) {
    //speed for each frame
    var speed = Math.round(millisec / 100);
   idImg = idImg + 1;

    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 = i-2) {
            setTimeout("changeOpac(" + i + ",'" + id + "', -1, " + idImg +")",(timer * speed));
            timer++;
        }
    } else if(opacStart < opacEnd) {
        for(i = opacStart; i <= opacEnd; i = i + 2)
            {
            setTimeout("changeOpac(" + i + ",'" + id + "', 1," + idImg +")",(timer * speed));
            timer++;
        }
    }
  	 
    return true
}

//change the opacity for different browsers
function changeOpac(opacity, id, step, g) {
	
	if (g != idImg) return false; 
	if(typeof(step)!='undefined' && step != opacCSteps[id]) return; 
    var object = document.getElementById(id).style;
    object.opacity = (opacity / 100);
    object.MozOpacity = (opacity / 100);
    object.KhtmlOpacity = (opacity / 100);
    object.filter = "alpha(opacity=" + opacity + ")";
} 

function changeOpacArr(elements) {
	for(var i in elements) {
		changeOpac(lowerOpac, 'pimg_' + elements[i]);
	}
} 

function porImgOver(el) {
	opacCSteps[el] = 1;
 	x = opacity(el, lowerOpac, 100, opacSpeed);
}

function autoplay(){
	t = setTimeout ("playSlideshow()",8000);
	
}

function showControls(){
	document.getElementById('button').style.display = "block"
	document.getElementById('NextLabel').style.display = "block"
}
function hideControls(){
	document.getElementById('button').style.display = "none"
	document.getElementById('NextLabel').style.display = "none"
}


