function createRequestObject() {
	var ro;
	var browser = navigator.appName;
	if(browser == "Microsoft Internet Explorer"){
		ro = new ActiveXObject("Microsoft.XMLHTTP");
	}
	else{
		ro = new XMLHttpRequest();
	}
	return ro;
}

var browser = navigator.appName;
var http = createRequestObject();

if(browser == "Microsoft Internet Explorer"){
	var meth = "POST";
}
else{
	var meth = "GET";
}

function setKal(jaar,maand){
	http = createRequestObject();
	http.onreadystatechange = pakKalender;
	var mom = document.getElementById('mom').value;
	http.open(meth,mom+"includes/kalender.php?jaar="+jaar+"&maand="+maand,true);
	http.setRequestHeader('Content-Type','text/plain');
	http.send(null);
}

function pakKalender(){
	if(http.readyState == 4) { 
		if(http.status  == 200) {
			document.getElementById('kalender').innerHTML = http.responseText;
		}
	}
}


function checkBoek(){
	if(document.getElementById('gast1').value == ""){
		document.getElementById('gast1').style.border = "1px solid #BE1317";
		document.getElementById('gast1').style.background = "#FF7F84";
		document.getElementById('gast1').focus();
		
		document.getElementById('gastFout').innerHTML = "naam vergeten in te vullen";
		
		return false;	
	}
	else{
		document.getElementById('gast1').style.border = "1px solid #e3e3e1";
		document.getElementById('gast1').style.background = "#FFFFFF";
		
		document.getElementById('gastFout').innerHTML = "&nbsp;";
	}
	if(document.getElementById('gast2').value == ""){
		document.getElementById('gast2').style.border = "1px solid #BE1317";
		document.getElementById('gast2').style.background = "#FF7F84";
		document.getElementById('gast2').focus();
		
		document.getElementById('gastFout').innerHTML = "code vergeten in te vullen";
		
		return false;	
	}
	else{
		document.getElementById('gast2').style.border = "1px solid #e3e3e1";
		document.getElementById('gast2').style.background = "#FFFFFF";
		
		document.getElementById('gastFout').innerHTML = "&nbsp;";
	}
	if(document.getElementById('gast3').value == ""){
		document.getElementById('gast3').style.border = "1px solid #BE1317";
		document.getElementById('gast3').style.background = "#FF7F84";
		document.getElementById('gast3').focus();
		
		document.getElementById('gastFout').innerHTML = "bericht vergeten in te vullen";
		
		return false;	
	}
	else{
		document.getElementById('gast3').style.border = "1px solid #e3e3e1";
		document.getElementById('gast3').style.background = "#FFFFFF";
		
		document.getElementById('gastFout').innerHTML = "&nbsp;";
	}
}
$(function(){
  //Get our elements for faster access and set overlay width
  var div = $('div.sc_menu'),
               ul = $('ul.sc_menu'),
               // unordered list's left margin
               ulPadding = 15;

  //Get menu width
  var divWidth = div.width();

  //Remove scrollbars
  div.css({overflow: 'hidden'});

  //Find last image container
  var lastLi = ul.find('li:last-child');

  //When user move mouse over menu
  div.mousemove(function(e){

    //As images are loaded ul width increases,
    //so we recalculate it each time
    var ulWidth = lastLi[0].offsetLeft + lastLi.outerWidth() + ulPadding;

    var left = (e.pageX - div.offset().left) * (ulWidth-divWidth) / divWidth;
    div.scrollLeft(left);
  });
});

function setFoto(foto){
	var mom = document.getElementById('fmom').value;
	document.getElementById('defoto').src = mom+"afbeeldingen/groot"+foto;
}
