// see if browser follows the standards
function wc3DOM(){
	if(document.getElementById){
		return true;
	}
	else{
		return false;
	}
}

// return anchor
function getAnchor(query){
	return query.split('#')[1];
}

// show div
function show(id){

	var objs = document.getElementById('servicesInformation').getElementsByTagName('div');

	for(i=0;i<objs.length;i++){
		current = objs[i].id; 
		if(current == id){
			objs[i].style.display = "block";
		}
		else{
			if(current.indexOf("option_") != -1){
				objs[i].style.display = "none";
			}
		}
	}
}

// assign the class active to navigation
function activate(thisone, inthisarray){
	for(i=0;i<inthisarray.length;i++){
		if(inthisarray[i] == thisone){
			inthisarray[i].className = "servicesInformationSelected";
		}
		else{
			inthisarray[i].className = " ";
		}
	}
}

// runs onload to assing javascript functions to navigation
function setLinks(){
	var links = document.getElementById('box-curled_edge').getElementsByTagName('a');
	// onload request
	if(getAnchor(document.location.href)){
		display = getAnchor(document.location.href);
		show(display);
		activate(document.location.href, links);
	}else{
		show('option_1');
		activate(document.location.href+'#option_1', links);
	}
	// assign to links
	for(i=0;i<links.length;i++){
		links[i].onclick = function(){
			activate(this, links);
			var anchor = getAnchor(this.href);
			show(anchor);
		}
	}
}

addLoadEvent(function() {
	if(wc3DOM()){
   	setLinks();
	}
});