function validateContact() {
	var n = document.getElementById("contact_name");
	var p = document.getElementById("contact_phone");
	var e = document.getElementById("contact_email");
	
	if (n.value.length > 0 && p.value.length > 0 && e.value.length > 0
		&& n.value != "Name" && p.value != "Phone" && e.value != "Email") {
		return true;
	}
	
	alert("Please enter your name, phone, and email.");
	return false;
}

function showService(x) {
	var t ="link-" + x;
	document.getElementById(t).blur();
	var entries = document.getElementById("num_services").value;
	entries = parseInt(entries);
	for ( var i = 1; i <= entries; i++ ) {
		var t = "service-" + i;
		document.getElementById(t).style.display = "none";
	}
	t = "service-" + x;
	document.getElementById(t).style.display = "block";
}

function movePortfolio(px) {
	document.getElementById('projects').style.left = (parseInt(document.getElementById('projects').style.left) + px) + "px";
}

function changePortfolioPage(n) {
	var o = document.getElementById('projects');
	var p = document.getElementById('portfolioPage');
	if (n != p.value) {
		var t = "link-" + p.value;
		document.getElementById(t).style.textDecoration = "none";
		document.getElementById(t).style.cursor = "pointer";
		t = n - p.value;
		var z = 1;
		if (Math.abs(t) > 1) {
			z = Math.abs(t * 5) - 4;
		}
		/*if (Math.abs(t) == 2) {
			z = 6;
		} else if (Math.abs(t) == 3) {
			z = 11;
		} else if (Math.abs(t) == 4) {
			z = 16;
		} else if (Math.abs(t) == 5) {
			z = 21;
		} else if (Math.abs(t) == 6) {
			z = 26;
		} else if (Math.abs(t) == 7) {
			z = 31;
		} else if (Math.abs(t) == 8) {
			z = 36;
		}*/
		if (t < 0) {
			t = (Math.abs(t) * 20);
			movePortfolioLeftNow(t,z);
		} else {
			t = (Math.abs(t) * 20);
			movePortfolioRightNow(t,z);
		}
		p.value = n;
		t = "link-" + n;
		document.getElementById(t).style.textDecoration = "underline";
		document.getElementById(t).style.cursor = "default";
	}
}

function movePortfolioRightNow(ts,os) {
	var o = document.getElementById('projects');
	var p = document.getElementById('portfolioPage');
	var np = document.getElementById('numPortfolioPages');
	if (p.value != np.value) {
		if (ts > 0) { } else {
			var t = "link-" + p.value;
			document.getElementById(t).style.textDecoration = "none";
			document.getElementById(t).style.cursor = "pointer";
			t = "link-" + (parseInt(p.value)+1);
			document.getElementById(t).style.textDecoration = "underline";
			document.getElementById(t).style.cursor = "default";
		}
		setTimeout('movePortfolio(-2)',10);
		setTimeout('movePortfolio(-4)',20);
		setTimeout('movePortfolio(-6)',30);
		setTimeout('movePortfolio(-8)',40);
		
		if (ts == null) { var ts = 20; }
		var t = 50;
		var i = 0;
		while (i < ts) {
			setTimeout('movePortfolio(-20)',t);
			t = t + 10;
			i++;
		}
		
		if (os == null) { var os = 1; }
		var i = 0;
		while (i < os) {
			setTimeout('movePortfolio(-10)',t);
			t = t + 10;
			i++;
		}

		t = t + 10; setTimeout('movePortfolio(-8)',t);
		t = t + 10; setTimeout('movePortfolio(-6)',t);
		t = t + 10; setTimeout('movePortfolio(-4)',t);
		t = t + 10; setTimeout('movePortfolio(-2)',t);
		p.value = parseInt(p.value) + 1;
	}
}

function movePortfolioLeftNow(ts,os) {
	var o = document.getElementById('projects');
	var p = document.getElementById('portfolioPage');
	var np = document.getElementById('numPortfolioPages');
	if (p.value != 1) {
		if (ts > 0) { } else {
			var t = "link-" + p.value;
			document.getElementById(t).style.textDecoration = "none";
			t = "link-" + (parseInt(p.value)-1);
			document.getElementById(t).style.textDecoration = "underline";
		}
		setTimeout('movePortfolio(2)',10);
		setTimeout('movePortfolio(4)',20);
		setTimeout('movePortfolio(6)',30);
		setTimeout('movePortfolio(8)',40);
		
		if (ts == null) { var ts = 20; }
		var t = 50;
		var i = 0;
		while (i < ts) {
			setTimeout('movePortfolio(20)',t);
			t = t + 10;
			i++;
		}
		
		if (os == null) { var os = 1; }
		var i = 0;
		while (i < os) {
			setTimeout('movePortfolio(10)',t);
			t = t + 10;
			i++;
		}

		t = t + 10; setTimeout('movePortfolio(8)',t);
		t = t + 10; setTimeout('movePortfolio(6)',t);
		t = t + 10; setTimeout('movePortfolio(4)',t);
		t = t + 10; setTimeout('movePortfolio(2)',t);
		p.value = parseInt(p.value) - 1;
	}
}
