var bDebug 				= false;
var bListerLoaded = false;
var bResize 			= false;
var sWaitImage 		= '/imagelib/acsi.eu/nav/ajax-indicator2.gif';

var bIE5 = -1 != navigator.appVersion.indexOf("MSIE 5");

function init(bMenuHandlers, bFoldOutOnInit)
{
	bFoldOutOnInit = (!bFoldOutOnInit) ? false : bFoldOutOnInit;
	
	if (bMenuHandlers)
	{
		addOnclickHandlers();
		if (bFoldOutOnInit)	showCurrentSubMenu();
	}
	
	if (bResize)
	{
		initPage();
	}
	
	try
	{	
  	document.execCommand('BackgroundImageCache', false, true);
	} 
	catch(e) { }
}

// Check if content height is smaller then iScreenHeight
// If so, adjust the content height to the screen height
function initPage()
{
	clearInterval(TimeOutID);
	var iFooterHeight   = xHeight("Footer");
	var iHeaderHeight   = xHeight("Header");
	var iScreenHeight   = xClientHeight();
	var iLeftDivHeight  = xHeight("MenuLeft");

	var iMarginBottom   = 0; // ruimte aan de onderkant.
	var iMarginTop      = 0;

	var iContentDivHeight = xHeight("Content");

	// Add Top menu height + content height	
	var iContentHeight  = iContentDivHeight + iHeaderHeight + iMarginBottom + iFooterHeight;	
	var iLeftDivHeight  = iLeftDivHeight + iHeaderHeight + iMarginBottom + iFooterHeight;

	// Find the maximum height
	var iUseHeight = Math.max(iContentHeight, iScreenHeight, iLeftDivHeight);

	// substract topmenu
	iUseHeight = iUseHeight - iHeaderHeight - iFooterHeight;

	// Reset all div heights
	xHeight("Content", iUseHeight);	

	if (!bListerLoaded)
	{
		xAddEventListener(window, "resize", ResizeListener, false);
		bListerLoaded = true;
	}
}

var TimeOutID;
function ResizeListener()
{
	if (TimeOutID) clearInterval(TimeOutID);		
	TimeOutID = setInterval("initPage()", 1000);	
}

function fnSetCampsiteCountry(iCountryId)
{
	document.getElementById('countryid').value = iCountryId;
	document.getElementById('setcountryid').submit();
}

function fnPrintOfferte()
{
	window.print();
}

function fnCheckForm()
{
	if (	doc.getElementById('contact_campsitename').value == ''
				|| doc.getElementById('contact_email').value == ''
				|| doc.getElementById('contact_subject').value == ''
				|| doc.getElementById('contact_code').value == ''
				|| doc.getElementById('contact_city').value == ''
				|| doc.getElementById('contact_address').value == ''
				|| doc.getElementById('contact_contact').value == ''
				|| doc.getElementById('contact_postalcode').value == ''
				|| doc.getElementById('contact_telefoon').value == ''
				|| doc.getElementById('contact_email').value.indexOf("@") == -1
				|| doc.getElementById('contact_email').value.indexOf(".") == -1
	)
	{
		alert(aTransPage['923']); // Niet alle velden gevuld
		return false;
	}
	
	return true;
}


function fnCheckFormBezoekAanvraag()
{
	
	
	if (	doc.getElementById('campsitename').value == ''
				|| doc.getElementById('email').value == ''
				|| doc.getElementById('code').value == ''
				|| doc.getElementById('city').value == ''
				|| doc.getElementById('address').value == ''
				|| doc.getElementById('contact_person').value == ''
				|| doc.getElementById('postcode').value == ''
				|| doc.getElementById('telefoon').value == ''
				|| doc.getElementById('aantal_tourplaatsen').value == ''
				|| doc.getElementById('aantal_vasteplaatsen').value == ''
				|| doc.getElementById('email').value.indexOf("@") == -1
				|| doc.getElementById('email').value.indexOf(".") == -1
	)
	{
		alert(aTransPage['923']); // Niet alle velden gevuld
		return false;
	}
	
	if(doc.getElementById('aantal_tourplaatsen').value < 30) 
	{
		alert(aTransPage['35604']); // Niet alle velden gevuld
		return false;
	}
	
	
	return true;
	
}
