function noSpam()
{	
	if (!document.getElementById("mail")) return false;
	var e = document.getElementById("mail");
	var domain = "pepijnfriederichs";
	var user ="mij";
	var ext = ".nl";
    var locationstring = "mailto:" + user + "@" + domain + ext;
   
	e.onclick= function (){
		
		if (this.href.indexOf("#email") != -1)
		this.href = locationstring;
		locationstring = window.location;
	}
	return false;
}

function externalLinks() {
 if (!document.getElementsByTagName) return;
 var anchors = document.getElementsByTagName("a");
 for (var i=0; i<anchors.length; i++) {
   var anchor = anchors[i];
   if (anchor.getAttribute("href")
         && anchor.getAttribute("rel") == "external")
     anchor.target = "_blank";
 }
}



	
	var sfHover = function() {
		var sfEls = document.getElementById("navigatie").getElementsByTagName("li");
		for (var i=0; i<sfEls.length; i++) {
			sfEls[i].onmouseover=function() {
				this.className+="sfhover";
				//alert(this.className);
				if (this.className == "lastsfhover")
				this.style.borderRight = "none";
			}
			sfEls[i].onmouseout=function() {
				this.className=this.className.replace(new RegExp("sfhover\\b"), "");
				
			}
		}
	}
//if (window.attachEvent) window.attachEvent("onload", sfHover);



function getNextSibling(startBrother){
  endBrother=startBrother.nextSibling;
  while(endBrother.nodeType!=1){
    endBrother = endBrother.nextSibling;
  }
  return endBrother;
}




//reload the pagina display the project for SEO
function GetUrlProject(){
	if (document.location.href.indexOf("projecten#") != -1){
	var url = document.location.href.split("#");
	var part = url[1];
	//alert(part);	
	document.getElementById("projectdetails").style.display = "block";
	HideProjects();
	document.getElementById(part).style.display = "block";	
	}
}

function DisplayProject()
{	
	var x = document.getElementById("projects").getElementsByTagName("a");
	for (var i=0; i < x.length; i++)
	{
		x[i].onclick = function ()
		{	document.getElementById("projectdetails").style.display = "block";
			HideProjects();
			projectnaam = this.getAttribute("title", this);
			//alert(projectnaam);
			//document.getElementById("projectdetails").style.display = "block";
			document.getElementById(projectnaam).style.display = "block";
			
		}
	}
}
function HideProjects()
{	
	var x = document.getElementById("projectdetails").getElementsByTagName("div");
	for (var i=0; i < x.length; i++)
	{
		x[i].style.display = "none";
	}

}
function Validate(){
	
	document.forms[0].onsubmit = function(){
	var d = document.forms[0];
	alert(d.elements["naam"].parentNode.getElementsByTagName("label")[0].childNodes[0]);
	if (d.elements["naam"].value == ""){
	d.elements["naam"].parentNode.getElementsByTagName("label")[0].childNodes[0].style.color = "#ff0000";

	}
	if (d.elements["tel"].value == ""){
	

	}
	if (d.elements["email"].value == ""){
	

	}
	if (d.elements["vraag"].value == ""){
	

	}
	if (d.elements["naam"].value != ""  && d.elements["tel"].value != ""){
	return true;
	}
	else
	{
	return false;
	}
	}

}

function Print(){
	var e = document.getElementById("print");
	if (!e) return false;
	e.onclick = function (){
		window.print();
	}
}

function JQ_DisplayProject(){
	$("#projects a").click(
		function(){
		var current = $(this).attr("title");
		//alert(current);
		if ($("#projectdetails").length)//checken of element bestaat
		$("#projectdetails").show();
		h = $("#projectdetails #"+current).css({position:"relative", left:"200px",top:"5px"});
		$("#projectdetails div").hide();
		$("#projectdetails #"+current).show();	
		$("#projectdetails #"+current).animate({left:"10px",top:"5px"},200);
		}
	
	);
}

// jQuery onload++++++++++++++++++++++++++++++++
$(document).ready(function () {
    //JQ_DisplayProject();
	noSpam();

	$.localScroll({
		target:'#projectdetails',
		axis:'y',
		queue:true,
		duration:1000,
		hash:true
	});

});



