// JavaScript Document

function init_nav(){
	var nav_div = document.getElementById('nav');
	var links = nav_div.getElementsByTagName('a');
	var img_link = Array();
	for(var i=0; i<links.length; i++){
		img_link[i] = links[i].firstChild;	
		/*
		img_link[i].onmouseover = function(){
			return nav_roll(img_link[i]);
		}
		img_link[i].onmouseout = function(){
			return nav_unroll(img_link[i]);
		}
		*/
	}
	
	img_link[0].onmouseover = function(){
		return nav_roll(img_link[0]);
	}
	img_link[0].onmouseout = function(){
		return nav_unroll(img_link[0]);
	}
	img_link[1].onmouseover = function(){
		return nav_roll(img_link[1]);
	}
	img_link[1].onmouseout = function(){
		return nav_unroll(img_link[1]);
	}
	img_link[2].onmouseover = function(){
		return nav_roll(img_link[2]);
	}
	img_link[2].onmouseout = function(){
		return nav_unroll(img_link[2]);
	}
	img_link[3].onmouseover = function(){
		return nav_roll(img_link[3]);
	}
	img_link[3].onmouseout = function(){
		return nav_unroll(img_link[3]);
	}
	img_link[4].onmouseover = function(){
		return nav_roll(img_link[4]);
	}
	img_link[4].onmouseout = function(){
		return nav_unroll(img_link[4]);
	}
	
}



function nav_roll(option){
	var id_name = option.getAttribute("id");

	if(id_name != "position"){
		if(id_name == "home"){
			option.setAttribute("src", "images/home_over.gif");
		}
		if(id_name == "method"){
			option.setAttribute("src", "images/method_over.gif");
		}
		if(id_name == "services"){
			option.setAttribute("src", "images/services_over.gif");
		}
		if(id_name == "folio"){
			option.setAttribute("src", "images/folio_over.gif");
		}
		if(id_name == "contact"){
			option.setAttribute("src", "images/contact_over.gif");
		}
	}
}





function nav_unroll(option){
	var id_name = option.getAttribute("id");
	
	if(id_name != "position"){
		if(id_name == "home"){
			option.setAttribute("src", "images/home_up.gif");
		}
		if(id_name == "method"){
			option.setAttribute("src", "images/method_up.gif");
		}
		if(id_name == "services"){
			option.setAttribute("src", "images/services_up.gif");
		}
		if(id_name == "folio"){
			option.setAttribute("src", "images/folio_up.gif");
		}
		if(id_name == "contact"){
			option.setAttribute("src", "images/contact_up.gif");
		}
	}	
}


///////////////////////////////////////////////////////////
//               SERVICE LIST FUNCTIONS                  //
///////////////////////////////////////////////////////////

function hide_texts(){
	var para = Array();
	para[0] = document.getElementById("p_right1");
	para[1] = document.getElementById("p_right2");
	para[2] = document.getElementById("p_right3");
	para[3] = document.getElementById("p_right4");
	para[4] = document.getElementById("p_right5");
	para[5] = document.getElementById("p_right6");
	para[6] = document.getElementById("p_right7");
	para[7] = document.getElementById("p_right8");
	para[8] = document.getElementById("p_right9");
	para[9] = document.getElementById("p_right10");
	para[10] = document.getElementById("p_right11");
	para[11] = document.getElementById("p_right12");
	para[12] = document.getElementById("p_right13");
	para[13] = document.getElementById("p_right14");
	para[14] = document.getElementById("p_right15");
	para[15] = document.getElementById("p_right16");
	para[16] = document.getElementById("p_right17");
	para[17] = document.getElementById("p_right18");
	para[18] = document.getElementById("p_right19");
	para[19] = document.getElementById("p_right20");
	para[20] = document.getElementById("p_right21");
	para[21] = document.getElementById("p_right22");
	para[22] = document.getElementById("p_right23");
	para[23] = document.getElementById("p_right24");
	para[24] = document.getElementById("p_right25");
	para[25] = document.getElementById("p_right26");
	para[26] = document.getElementById("p_right27");
	para[27] = document.getElementById("p_right28");
	para[28] = document.getElementById("p_right29");
	para[29] = document.getElementById("p_right30");
	para[30] = document.getElementById("p_right31");
	para[31] = document.getElementById("p_right32");
	para[32] = document.getElementById("p_right33");
	


	for(var i = 0; i < para.length; i++){
		para[i].style.display = "none";
	}
}



function show_text(option){		
	var para = Array();	
	para[0] = document.getElementById("p_right1");
	para[1] = document.getElementById("p_right2");
	para[2] = document.getElementById("p_right3");
	para[3] = document.getElementById("p_right4");
	para[4] = document.getElementById("p_right5");
	para[5] = document.getElementById("p_right6");
	para[6] = document.getElementById("p_right7");
	para[7] = document.getElementById("p_right8");
	para[8] = document.getElementById("p_right9");
	para[9] = document.getElementById("p_right10");
	para[10] = document.getElementById("p_right11");
	para[11] = document.getElementById("p_right12");
	para[12] = document.getElementById("p_right13");
	para[13] = document.getElementById("p_right14");
	para[14] = document.getElementById("p_right15");
	para[15] = document.getElementById("p_right16");
	para[16] = document.getElementById("p_right17");
	para[17] = document.getElementById("p_right18");
	para[18] = document.getElementById("p_right19");
	para[19] = document.getElementById("p_right20");
	para[20] = document.getElementById("p_right21");
	para[21] = document.getElementById("p_right22");
	para[22] = document.getElementById("p_right23");
	para[23] = document.getElementById("p_right24");
	para[24] = document.getElementById("p_right25");
	para[25] = document.getElementById("p_right26");
	para[26] = document.getElementById("p_right27");
	para[27] = document.getElementById("p_right28");
	para[28] = document.getElementById("p_right29");
	para[29] = document.getElementById("p_right30");
	para[30] = document.getElementById("p_right31");
	para[31] = document.getElementById("p_right32");
	para[32] = document.getElementById("p_right33");
	

	//alert(option.getAttribute("id"));	


	for(var i = 0; i < para.length; i++){
		para[i].style.display = "none";
	}
	


	switch(option.getAttribute("id")){
		case 'p_left1':
			para[0].style.display = "block";
			para[1].style.display = "block";
		break;
		case 'p_left2':
			para[3].style.display = "block";
			para[4].style.display = "block";
		break;
		case 'p_left3':
			para[6].style.display = "block";
			para[7].style.display = "block";
		break;
		case 'p_left4':
			para[9].style.display = "block";
			para[10].style.display = "block";
		break;
		case 'p_left5':
			para[12].style.display = "block";
			para[13].style.display = "block";
		break;
		case 'p_left6':
			para[15].style.display = "block";
			para[16].style.display = "block";
		break;
		case 'p_left7':
			para[18].style.display = "block";
			para[19].style.display = "block";
		break;
		case 'p_left8':
			para[21].style.display = "block";
			para[22].style.display = "block";
		break;
		case 'p_left9':
			para[24].style.display = "block";
			para[25].style.display = "block";
		break;
		case 'p_left10':
			para[27].style.display = "block";
			para[28].style.display = "block";
		break;
		case 'p_left11':
			para[30].style.display = "block";
			para[31].style.display = "block";
		break;
	}
}

function combine_things(){
	init_nav();
	if(document.getElementById("p_right33")){
		hide_texts();
	}
	
}

window.onload = combine_things;