﻿/*!
Copyright (c) 2009 Kampeerkaart
generic.js: several all purpose functions
*/

function clearField(strID)
{
	if (document.getElementById(strID).value == 'kies een naam')
	{
		document.getElementById(strID).value = '';
	}
}

function iSmartRollOver(obj)
{
	var strFilename;
	var strExt;
	var intPos;
	if (obj != null)
	{
		strFilename = obj.src.toLowerCase();
		intPos = strFilename.lastIndexOf(".");
		strExt = strFilename.substring(intPos);
		strFilename = strFilename.substring(0, intPos);
		intPos = strFilename.indexOf("_ro");
		if (intPos == -1)
		{
			strFilename = strFilename + "_ro" + strExt;
		}
		else
		{
			strFilename = strFilename.substring(0, intPos) + strExt;
		}
		obj.src = strFilename;
	}
}

/* @@@ let op: een aantal van de functies hieronder zijn niet meer nodig */
function ExcludeWindow(url)
{
	ThisWindow = window.open(url, "window", 'toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=1,resizable=0,width=400,height=300');
	ThisWindow.focus();
}

function NewWindow(url)
{
	ThisWindow = window.open(url, "window", 'toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=0,resizable=0,width=450,height=340');
}

function WindowHelp(url)
{
	ThisWindow = window.open(url, "windowTips", 'toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=0,resizable=0,width=250,height=400');
}

function WindowLinks(url)
{
	ThisWindow = window.open(url, "WindowLinks", 'toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=1,resizable=0,width=280,height=500');
}

function WindowBladen(url)
{
	ThisWindow = window.open(url, "WindowBladen", 'toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=1,resizable=0,width=300,height=400');
}

function WindowMailContact(url)
{
	ThisWindow = window.open(url, "WindowMail", 'toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=1,resizable=0,width=400,height=500');
}

function ClearFormField(FieldText)
{
	if (FieldText.value == FieldText.defaultValue)
	{
		FieldText.value = ''
	}
}

function deleteWarning(strText)
{
	warning = strText + "\n" +
	"\n";
	if (confirm(warning)) return true;
	return false;
}

// this catches enter in forms that use javascript-submit
function enterPressed(e)
{
	var keycode;
	if (window.event)
	{
		keycode = window.event.keyCode;
	}
	else if (e)
	{
		keycode = e.which;
	}
	else
	{
		return false;
	}
	return (keycode == 13);
}
