arPhotos = new Array('m_st','mohark','ny_playground','n_st','ridge_st','5_st','5_st_market','7_st','warehouse','metro','seal');
arPhotoText = new Array('The 400 block of M Street, NW','The Mohark condominium building on M Street, NW','The New York Avenue Playground at ? and Kirby Street, NW','The 200 block of N Street, NW','The 400 block of Ridge Street, NW','The 1100 block of 5th Street, NW','The 5th Street Market at the corner of 5th Street and N Street, NW','The 1300 block of 7th Street, NW','The Warehouse arts complex on 7th Street (the Convention Center is on the opposite side of the street)','The Mt Vernon Sq metro stop on the corner of 7th and M Street, NW','The Mount Vernon Square Historic District seal was placed by the DC Historic Board has been placed every street corner');
var currentPhoto = 0;
function goNext() {
	setNavOff(currentPhoto);
	if (currentPhoto < arPhotos.length-1) {
		++currentPhoto;
	} else {
		currentPhoto = 0;
	}
	set();
}
function goBack() {
	setNavOff(currentPhoto);
	if (currentPhoto > 0 ) {
		--currentPhoto;
	} else {
		currentPhoto = arPhotos.length-1;
	}
	set();
}
function goTo(NUM) {
	setNavOff(currentPhoto);
	currentPhoto = NUM;
	set();
}
function set() {
	document.getElementById('photoDiv').innerHTML = '<img src="../images/' + arPhotos[currentPhoto] + '.jpg" align="center">';
	document.getElementById('explainDiv').innerHTML = arPhotoText[currentPhoto];
	setNavOn(currentPhoto);
}
function setNavOff(ele) {
	document.getElementById('nav'+ele).className = 'photoOff';
}
function setNavOn(ele) {
	document.getElementById('nav'+ele).className = 'photoOn';
}



/* By http://www.brainerror.net/scripts_js_blendtrans.php */
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) {
	if (!document.getElementById(id)) {
		document.getElementById('error').innerHTML += 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)
}
/* End script */
