function GetObj(objectId)
{
	return document.getElementById(objectId);
}

function isObj(obj)
{
	if(obj) return true;
	return false;
}

function checkInput(obj, value)
{
	if(obj)
	{
		setMessage("");
		
		if(obj.value == value)
		{
			obj.value = "";
		}
		else if(obj.value == "")
		{
			obj.value = value;
		}
		else
		{
			cleanMessage();
		}
	}
}

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 isPostcode(obj)
{
	var filter = /^[1-9]{1}[0-9]{3}[a-zA-Z]{2}$/;
	
	if (filter.test(obj.value)) return true;
	return false;
}

function isSameAsTitle(obj)
{
	if(obj.value == obj.title) return true;
	return false;
}

function focusObject(obj)
{
	obj.focus();
}

function setMessageById(value, messageId)
{
	objMessage = document.getElementById(messageId);
	
	if(objMessage)
	{
		objMessage.innerHTML = value;
	}
}

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;
			}
		}
	}
}

function cleanMessage()
{
	objMessage = document.getElementById('message');
		
	if(objMessage)
	{
		objMessage.innerHTML = "";
	}
}

function SendContact(sLanguage)
{
	objCompany	= document.getElementById('id_company');
	objLastname = document.getElementById('id_lastname');
	objEmail 	= document.getElementById('id_email');
	objPhone 	= document.getElementById('id_phone');
	
	if(objCompany && objLastname && objEmail && objPhone)
	{
		if(sLanguage == 'nl')
		{
			if(isEmpty(objCompany))
			{
				focusObject(objCompany);
				setMessage("U bent vergeten uw <strong>bedrijfsnaam</strong> in te vullen!");
				return;
			}
			
			if(isEmpty(objLastname))
			{
				focusObject(objLastname);
				setMessage("U bent vergeten uw <strong>achternaam</strong> in te vullen!");
				return;
			}
			
			if(isEmpty(objEmail))
			{
				focusObject(objEmail);
				setMessage("U bent vergeten uw <strong>e-mailadres</strong> in te vullen!");
				return;
			}

			if(!isEmail(objEmail))
			{
				focusObject(objEmail);
				setMessage("Het opgegeven <strong>e-mailadres</strong> is onjuist!");
				return;
			}
			
			if(isEmpty(objPhone))
			{
				focusObject(objPhone);
				setMessage("U bent vergeten uw <strong>telefoonnummer</strong> in te vullen!");
				return;
			}
			
			document.ContactForm.submit();
		}
		else if(sLanguage == 'de')
		{
			if(isEmpty(objCompany))
			{
				focusObject(objCompany);
				setMessage("Sie haben Ihr <strong>Firmenname</strong> nicht gefüllt!");
				return;
			}
			
			if(isEmpty(objLastname))
			{
				focusObject(objLastname);
				setMessage("Sie haben Ihr <strong>Nachname</strong> nicht gefüllt!");
				return;
			}
			
			if(isEmpty(objEmail))
			{
				focusObject(objEmail);
				setMessage("Sie haben Ihr <strong>E-Mailadresse</strong> nicht gefüllt!");
				return;
			}

			if(!isEmail(objEmail))
			{
				focusObject(objEmail);
				setMessage("Die <strong>E-Mailadresse</strong> ist falsch!");
				return;
			}
			
			if(isEmpty(objPhone))
			{
				focusObject(objPhone);
				setMessage("Sie haben Ihr <strong>Telefon</strong> nicht gefüllt!");
				return;
			}
			
			document.ContactForm.submit();
		}
		else if(sLanguage == 'en')
		{
			if(isEmpty(objCompany))
			{
				focusObject(objCompany);
				setMessage("Please, fill out your <strong>Company name</strong>!");
				return;
			}
			
			if(isEmpty(objLastname))
			{
				focusObject(objLastname);
				setMessage("Please, fill out your <strong>Surname</strong>!");
				return;
			}
			
			if(isEmpty(objEmail))
			{
				focusObject(objEmail);
				setMessage("Please, fill out your <strong>Email address</strong>!");
				return;
			}

			if(!isEmail(objEmail))
			{
				focusObject(objEmail);
				setMessage("The given <strong>Email address<.strong> is not valid!");
				return;
			}
			
			if(isEmpty(objPhone))
			{
				focusObject(objPhone);
				setMessage("Please, fill out your <strong>Phone</strong>!");
				return;
			}
			
			document.ContactForm.submit();
		}
	}
}

function SendOrder(sLanguage)
{
	objCompany	= document.getElementById('id_company');
	objContact 	= document.getElementById('id_contact');
	objEmail 	= document.getElementById('id_email');
	
	if(objCompany && objContact && objEmail)
	{
		if(sLanguage == 'nl')
		{
			if(isEmpty(objCompany))
			{
				focusObject(objCompany);
				setMessage("U bent vergeten uw <strong>bedrijfsnaam</strong> in te vullen!");
				return;
			}
			
			if(isEmpty(objContact))
			{
				focusObject(objContact);
				setMessage("U bent vergeten de <strong>contactpersoon</strong> in te vullen!");
				return;
			}
			
			if(isEmpty(objEmail))
			{
				focusObject(objEmail);
				setMessage("U bent vergeten uw <strong>e-mailadres</strong> in te vullen!");
				return;
			}

			if(!isEmail(objEmail))
			{
				focusObject(objEmail);
				setMessage("Het opgegeven <strong>e-mailadres</strong> is onjuist!");
				return;
			}
			
			document.OrderForm.submit();
		}
		else if(sLanguage == 'de')
		{
			if(isEmpty(objCompany))
			{
				focusObject(objCompany);
				setMessage("Sie haben Ihr <strong>Firmenname</strong> nicht gefüllt!");
				return;
			}
			
			if(isEmpty(objContact))
			{
				focusObject(objContact);
				setMessage("Sie haben Ihr <strong>Kontactperson</strong> nicht gefüllt!");
				return;
			}
			
			if(isEmpty(objEmail))
			{
				focusObject(objEmail);
				setMessage("Sie haben Ihr <strong>E-Mailadresse</strong> nicht gefüllt!");
				return;
			}

			if(!isEmail(objEmail))
			{
				focusObject(objEmail);
				setMessage("Die <strong>E-Mailadresse</strong> ist falsch!");
				return;
			}
			
			document.OrderForm.submit();
		}
		else if(sLanguage == 'en')
		{
			if(isEmpty(objCompany))
			{
				focusObject(objCompany);
				setMessage("Please, fill out your <strong>Company name</strong>!");
				return;
			}
			
			if(isEmpty(objContact))
			{
				focusObject(objContact);
				setMessage("Please, fill out your <strong>Name</strong>!");
				return;
			}
			
			if(isEmpty(objEmail))
			{
				focusObject(objEmail);
				setMessage("Please, fill out your <strong>Email address</strong>!");
				return;
			}

			if(!isEmail(objEmail))
			{
				focusObject(objEmail);
				setMessage("The given <strong>Email address<.strong> is not valid!");
				return;
			}
			
			document.OrderForm.submit();
		}
	}
}



function MenuItemOver(sMenuItemId)
{
	$("#" + sMenuItemId).show();
}

function MenuItemOut(sMenuItemId)
{
	$("#" + sMenuItemId).hide();
}

var sActiveDepartment = 'bosbeheer';

function MakeDepartmentActive(sDepartment)
{
	$('#' + sActiveDepartment + '_active').hide();
	sActiveDepartment = sDepartment;
	$('#' + sDepartment + '_active').show();

	/*$('#' + sActiveDepartment + '_active').animate({opacity: 0}, function()
	{
		$('#' + sActiveDepartment + '_active').hide();
		sActiveDepartment = sDepartment;
	});

	$('#' + sDepartment + '_active').css({opacity: 0});
	$('#' + sDepartment + '_active').show();
	$('#' + sDepartment + '_active').animate({opacity: 1});*/
}

function DepartmentOver(sDepartment)
{
	
	$('#' + sDepartment + '').hide();
	$('#' + sDepartment + '_over').show();
}

function DepartmentOut(sDepartment)
{
	$('#' + sDepartment + '').show();
	$('#' + sDepartment + '_over').hide();
}


function CheckWhy(oObject)
{
	oObj 	= document.getElementById('ipl_other');
	oOther 	= document.getElementById('id_other');
	
	if(oObj)
	{
		if(oObject.value == "Anders" || oObject.value == "Other")
		{
			oObj.style.display = 'block';
			focusObject(oOther);
		}
		else
		{
			oObj.style.display = 'none';
		}
	}
}
