function clicked(name)
{
	if ((name == "foward" && fowardtrip == "reset") || (name == "back" && backtrip == "reset"))
	{
		document.getElementById(name).src = "icons/" + name + "2.png";
	}
}

function unclicked(name)
{
	if ((name == "foward" && fowardtrip == "reset") || (name == "back" && backtrip == "reset"))
	{
		document.getElementById(name).src = "icons/" + name + ".png";
	}
}

function changePhoto(add)
{
	if (add == 1 && fowardtrip == "tripped")
	{
	}
	else if(add == -1 && backtrip == "tripped")
	{
	}
	else
	{	
 		picnum += add;
 		if (fowardtrip == "tripped")
		{
			document.getElementById("foward").src = "icons/foward.png";
			fowardtrip = "reset";
		}
		else if (backtrip == "tripped")
		{
			document.getElementById("back").src = "icons/back.png";
			backtrip = "reset";
		}
		else
		{
		}
		document.getElementById("gallery").src = "icons/loading.png";
		document.getElementById("gallery").src = "http://i263.photobucket.com/albums/ii135/ryanhollis_photos/iPhone3G" + picnum + ".jpg";
	}
	if (picnum==8)
	{
		document.getElementById("foward").src = "icons/foward3.png";
		fowardtrip = "tripped";
	}
	else if (picnum==0)
	{
		document.getElementById("back").src = "icons/back3.png";
		backtrip = "tripped";
	}
	switch(picnum)
	{
		case 0:
		document.getElementById('caption').innerHTML = "I stood in this long line to get this amazing, new, sleek device. It was well worth it.";
		break;
		case 1:
		document.getElementById('caption').innerHTML = "There it is. I wish that woman would hurry up with switching over my phone!";
		break;
		case 2:
		document.getElementById('caption').innerHTML = "It's all mine... but it doesn't work yet. Now I have to take it home and finish the activation.";
		break;
		case 3:
		document.getElementById('caption').innerHTML = "Yep. I got the white 16 GB iPhone 3G.";
		break;
		case 4:
		document.getElementById('caption').innerHTML = "It has all metal buttons on the side, which makes it feel nicer. It also is curved on the back so it fits better in your hand.";
		break;
		case 5:
		document.getElementById('caption').innerHTML = "After THREE hours of trying to activate my phone it finally worked!";
		break;
		case 6:
		document.getElementById('caption').innerHTML = "The iPhone messed up, so I took a screen shot of it before I reset my phone. This was wierd so I thought I would share.";
		break;
		case 7:
		document.getElementById('caption').innerHTML = "This is a picture I drew with the thrid-party drawing application. It is fun to use, and I can make some great artwork with it.";
		break;
		case 8:
		document.getElementById('caption').innerHTML = "This is a screen shot of my home page. Notice that I bought Enigmo and put it on the home bar instead of phone. Also notice the new App Store and Contacts buttons.";
		break;
		default:
		document.getElementById('caption').innerHTML = "AN ERROR HAS OCCURED! PLEASE NOTIFY ME OF THIS ERROR!";
		break;
	}
}