
var intDuration = 500;
var objTransition = Fx.Transitions.Sine.easeInOut;

function positionFooter(bolAnimate){
	// get height window
	var intHeightWindow = window.getSize().y;

	// get height body
	var intHeightHeader = $('header').getSize().y;
	var intHeightBody = $('body').getSize().y;
	var intHeightFooter = 180;
	
		
	var intTopHeader = intHeightHeader + intHeightBody + 10;
	var intHeightMain = intHeightHeader + intHeightBody + intHeightFooter + 10;
	
	if(intHeightMain < intHeightWindow){
		intTopHeader = intHeightWindow - intHeightFooter;
	}
	intHeightMain = intTopHeader + intHeightFooter;
	
	if(bolAnimate){
		var bodyFx = new Fx.Morph($('footer'), {duration: intDuration, transition: objTransition});
		bodyFx.start({'top': intTopHeader});
		
		var mainFx = new Fx.Morph($('main'), {duration: intDuration, transition: objTransition});
		mainFx.start({'height': intHeightMain});
	}
	else{
		$('footer').setStyle('top', intTopHeader);
		$('main').setStyle('height', intHeightMain);
	}
	$('footer').setStyle('display', 'block');
}

function menuItemMouseOver(strMenuId){
	$('img_'+strMenuId).setProperty('src', '/images/system/menu/'+strMenuId+'_hover.png');
}

function menuItemMouseOut(strMenuId){
	$('img_'+strMenuId).setProperty('src', '/images/system/menu/'+strMenuId+'_inactive.png');
}

var arrItems = ['index', 'overnp', 'diensten', 'portfolio', 'contact'];
function loadMenu(strMenuId){
	
	var objMenuItem;
	var objMenuItemOther;
	var objMenuItemHover;

	arrItems.each(function(item, index){
		
		objMenuItemActive = new Asset.image('/images/system/menu/'+item+'_active.png', {id: 'img_'+item, title: item});
		objMenuItemInactive = new Asset.image('/images/system/menu/'+item+'_inactive.png');
		objMenuItemHover = new Asset.image('/images/system/menu/'+item+'_hover.png', {id: 'img_'+item, title: item});
		
		if(strMenuId == item) {
			$('menu_'+item).removeProperty('href');
			$('menu_'+item).innerHTML = '';
			objMenuItemActive.inject($('menu_'+item));
		}
		else{
			$('menu_'+item).setProperty('onmouseover', "menuItemMouseOver('"+item+"')");
			$('menu_'+item).setProperty('onmouseout', "menuItemMouseOut('"+item+"')");
		}

	});
	
	

}

function validateForm(){
	
	if($('contactpersoon').value == ''){
		alert("Om het contactformulier te verzenden zijn de velden aangeduid met een sterretje (*) verplicht om in te vullen.");
		return false;
	}
	else if($('email').value == ''){
		alert("Om het contactformulier te verzenden zijn de velden aangeduid met een sterretje (*) verplicht om in te vullen.");
		return false;
	}
	else if($('telefoon').value == ''){
		alert("Om het contactformulier te verzenden zijn de velden aangeduid met een sterretje (*) verplicht om in te vullen.");
		return false;
	}
	else{
		return true;
	}
	
}


function onDomReady(){
	if(!Browser.Engine.trident){
		$('htmlbody').setStyle('overflow-y', 'scroll');
	}
	
	loadMenu(strMenuId);	
}

function onLoad(){
	positionFooter(false);
}

function onResize(){
	positionFooter(false);
}

function onScroll(){
	
}

window.addEvent("domready", onDomReady);

window.addEvent("load", onLoad);

window.addEvent("resize", onResize);

window.addEvent("scroll", onScroll);


