var topVal;
var showFormInterval;
var step = 1;

function checkShowContactFormAnchor() {
	var locationStr = document.location;
	locationStr += ''
	
	if(locationStr.indexOf('#contact') > 0) {
		var contactForm = document.getElementById('form');
		contactForm.style.top = '0px';
		document.getElementById('showform').innerHTML = 'Verberg contact formulier';
		document.getElementById('showform').style.backgroundImage = 'url("img/arrow_bottom_white.gif")';
	}

	if(document.getElementById("contact_home")) {
		document.getElementById("contact_home").scrollTop = 0;
	}
}

function showContactForm() {
	var contactForm = document.getElementById('form');
	
	topVal = contactForm.style.top;
	topVal = topVal.substring(0, topVal.length - 2);
	
	if(topVal > 0)
		showFormInterval = setTimeout('showForm()', 20);
	else
		showFormInterval = setTimeout('hideForm()', 30);
}

function showForm() {
	var contactForm = document.getElementById('form');
	topVal = parseFloat(topVal) - step;
	if(topVal < 0) topVal = 0;
	contactForm.style.top = topVal + 'px';
	
	if(topVal > 0) {
		step++;
		showFormInterval = setTimeout('showForm()', 20);
	} else {
		document.getElementById('showform').innerHTML = 'Verberg contact formulier';
	  	document.getElementById('showform').style.backgroundImage = 'url("img/arrow_bottom_white.gif")';
		clearInterval(showFormInterval);
		step = 1;
	}
}
function hideForm() {
	var contactForm = document.getElementById('form');
	topVal = parseFloat(topVal) + step;
	if(topVal > 177) topVal = 177;
	contactForm.style.top = topVal + 'px';
	
	if(topVal < 177) {
		step++;
		showFormInterval = setTimeout('hideForm()', 20);
	} else {
		document.getElementById('showform').innerHTML = 'Laat uw gegevens achter';
		document.getElementById('showform').style.backgroundImage = 'url("img/arrow_top_white.gif")';
		clearInterval(showFormInterval);
		step = 1;
	}
}