function sidebar(obj, state)
{
	if(state==0){obj.className="sidebar_hover";}
	else{obj.className="sidebar_link";}
}

function list(obj, state)
{
	if(state==0){obj.className="portfolio_list_box";}
	else{obj.className="portfolio_list_box_hover";}
}

function adjust_sidebar(){
	/*if(typeof(sidebar_count)=="undefined"){return null;}
	
	cnt=sidebar_count;
	h=(cnt*30)+75;
	h_content=(cnt*30)+75+20+140;
	if(h>parseInt(document.getElementById("content").clientHeight))
	{
		document.getElementById("content").style.height=h_content+"px";
		document.getElementById("sidebar").style.height=h+"px";
	}
	else if(h<parseInt(document.getElementById("content").clientHeight))
	{
		h=parseInt(document.getElementById("content").clientHeight)-20;
		document.getElementById("sidebar").style.height=h+"px";
	}*/

}

// Form Functions
	
	// Form Validation Functions
	function checkEmail(email)
	{
		var characters = /^[^@]+@[^@]+.[a-z]{2,}$/i;
		if (email.value.search(characters) == -1)
		{	
			return false;
		}
		return true;
	}
	
	function checkPhone(item, num)
	{
		size=item.value.length;
		if(isNaN(item.value) == true){return false;}
		if(size < num){return false;}
		return true;
	}

	function checkForm(item)
	{
		if(item.value == "" || item.value == null)
		{
			return false;
		}
		
		return true;
	}

	function checkAddress(address, state, zip, city, country)
	{	
		
		if(address.value.length == 0 || address.value == null){return -3;}
		if(city.value.length == 0 || city.value == null){return -4;}
		if(state.value.length < 2 || state.value == null){return -2;}
		if(isNaN(zip.value) == true){return -1;}
		if(zip.value.length < 5){return -1;}
		if(country.value == "" || country.value == null){return -5;}

		return 0;
	}

function checkContact(){
	
	var name = document.getElementById("name");
	var email = document.getElementById("email");
	var area = document.getElementById("area");
	var access = document.getElementById("access");
	var local = document.getElementById("local");
	var info = document.getElementById("info");
	
	if(!checkForm(name)){alert("Invalid Name"); name.focus(); return false;}
	if(!checkEmail(email)){alert("Invalid E-Mail Address"); email.focus(); return false;}
	if(!checkPhone(area,3)){alert("Invalid Area Code"); area.focus(); return false;}
	if(!checkPhone(access,3)){alert("Invalid Access Number"); access.focus(); return false;}
	if(!checkPhone(local,4)){alert("Invalid Local Number"); local.focus(); return false;}
	if(!checkForm(info)){alert("Not enough information.\nPlease enter something."); info.focus(); return false;}
	
	return true;
}

// Screenshot Functions
var count=0; 
var animation=null;
var screenCount=0;

	function moveForward()
	{
		document.getElementById("screen").style.left=parseInt(document.getElementById("screen").style.left, 10)-10+"px";
		if(parseInt(document.getElementById("screen").style.left, 10) <= 400*count*-1){animationCount=0; clearInterval(animation); setDescription(); animation=null;}
	}
	
	function moveBackwards()
	{
		document.getElementById("screen").style.left=parseInt(document.getElementById("screen").style.left, 10)+10+"px";
		if(parseInt(document.getElementById("screen").style.left, 10) >= 400*count*-1){animationCount=0; clearInterval(animation); setDescription(); animation=null;}
	}
	
	function setDescription(){
		var str="<strong>Description (Image "+(count+1)+"/"+screenCount+"):</strong><br/>"+document.getElementById("screen"+count).alt;
		document.getElementById("screenshot_desc").innerHTML=str;
	}

	function changeScreen(direction)
	{
		if(animation == null)
		{
			if(direction == 1)
			{
				if(count < screenCount-1){count++; animation=setInterval("moveForward()", 1); }
			}
			else if(direction == -1)
			{
				if(count != 0){count--; animation=setInterval("moveBackwards()", 1); }
			}
			
			if(count+1 == screenCount){document.getElementById("btnNext").className="btnScreenNextFalse"}
			else{document.getElementById("btnNext").className="btnScreenNextTrue"}
			if(count == 0){document.getElementById("btnPrevious").className="btnScreenPreviousFalse"}
			else{document.getElementById("btnPrevious").className="btnScreenPreviousTrue"}
		}
	}

	function generateScreen()
	{
		
		while(count < screenCount)
		{
			document.getElementById("screen"+count).style.left=400*count+"px";
			count++;
		}
		
		count=0;
		
		setDescription();
		
		if(count+1 == screenCount){document.getElementById("btnNext").className="btnScreenNextFalse"}
		else{document.getElementById("btnNext").className="btnScreenNextTrue"}
		
		
		
	}
