function GetObj(objectId)
{
	return document.getElementById(objectId);
}

function IsObj(obj)
{
	if(obj) return true;
	return false;
}

/* Navigator */

function PositionNavigator()
{
	$('#Navigator').css('top',$(window).scrollTop());
}

$(document).ready(function()
{
	$(window).scroll(function () 
	{
		PositionNavigator();
    });	
});

function Show(sId)
{
	$('#' + sId).show();
}

function Hide(sId)
{
	$('#' + sId).hide();
}

var iCurrent = 0;
var iStep = 132;
var iWidth = 660;

function ImageNext(iRows)
{
	var iScrollLeft = $('#Slider').scrollLeft() + iStep;

	if((iScrollLeft + iWidth) > (iRows * iStep))
	{
		iScrollLeft = 0;
	}
	
	$('td.SliderTd').animate({opacity: 0.2},500);
	
	setTimeout(function()
	{
		
		$('#Slider').animate({scrollLeft: iScrollLeft + 'px'},{duration:750,queue:true,easing:"easeOutExpo", complete: function()
			{
				$('td.SliderTd').animate({opacity: 1},500);
			}
		});
	}, 500);
}

function ImagePrev(iRows)
{
	var iScrollLeft = $('#Slider').scrollLeft() - iStep;

	if(iScrollLeft < 0)
	{
		iScrollLeft = (iRows * iStep) - iStep;
	}
	
	$('td.SliderTd').animate({opacity: 0.2},500);
	
	setTimeout(function()
	{
		
		$('#Slider').animate({scrollLeft: iScrollLeft + 'px'},{duration:750,queue:true,easing:"easeOutExpo", complete: function()
			{
				$('td.SliderTd').animate({opacity: 1},500);
			}
		});
	}, 500);
}

function HandleImage(sImageId)
{
	var oObj = GetObj(sImageId);
	
	if(IsObj(oObj))
	{
		
	}
}

function Show(sId)
{
	$('#' + sId).show();
}

function Hide(sId)
{
	$('#' + sId).hide();
}

$(document).ready(function(){
	//Examples of how to assign the ColorBox event to elements
	$("a[rel='woonhuis']").colorbox();
	// rel="woonhuis"
});

function VerstuurAfspraak()
{
	objName		= document.getElementById('id_name');
	objPhone 	= document.getElementById('id_phone');
	objEmail 	= document.getElementById('id_email');
	
	if(isEmpty(objName))
	{
		focusObject(objName);
		setMessage("U bent vergeten uw <strong>naam</strong> in te vullen!");
		return;
	}
	
	if(isEmpty(objPhone))
	{
		focusObject(objPhone);
		setMessage("U bent vergeten uw <strong>telefoonnummer</strong> in te vullen!");
		return;
	}
	
	if(isEmpty(objEmail) == false)
	{
		if(!isEmail(objEmail))
		{
			focusObject(objEmail);
			setMessage("Het opgegeven <strong>e-mailadres</strong> is onjuist!");
			return;
		}
	}
	
	document.ContactForm.submit();
}

function isEmpty(obj)
{
	if(obj.value == "") return true;
	return false;
}

function isEmail(obj)
{
	var filter = /^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$/;
	
	if (filter.test(obj.value)) return true;
	return false;
}

function focusObject(obj)
{
	obj.focus();
}

function setMessage(value, objectId)
{
	objMessage = document.getElementById(objectId);
		
	if(objMessage)
	{
		objMessage.innerHTML = value;
	}
	else
	{
		objMessage = document.getElementById('message');
		
		if(objMessage)
		{
			if(value != "")
			{
				scroll(0,0);
				objMessage.innerHTML = value;
			}
		}
	}
}
