﻿/**
* Copyright:	Graphic Form & Function Automation
* Project:		Domein
* Module:		ECMAScript Function Library
* Versie:		1.0.0
* Datum:		201109
*
*/

var objGs;

function init() {
    objGs = initUtils("", "");
    objGs.event.catchEvent("click", clickEventHandler);
}

function clickEventHandler(e) {
    var strUrl = "";
    var arrTemp;
    var objSource, objForm;

    objSource = objGs.event.fire(e);
    if (objSource.className) {
        switch (objSource.className) {
            case "ihkop01":
                if (objSource.attributes["title"].value == "Home") {
                    strUrl = "./";
                } else {
                    strUrl = "./?pag=" + objSource.attributes["title"].value.toLowerCase();
                }
                window.location.href = strUrl;
                break;
        }
    }
}

function checkForm(objF) {
    var boolReturn = true;
    var objElement = null;
    var objAttribute = null;

    with (objF.elements) {
        if (!naam.value || !email.value || !bericht.value || !confirmatie.value) {
            boolReturn = false;
        }
    }
    if (boolReturn) {
        if (!(boolReturn = objGs.text.checkFormField(objF.elements.email.value, "email"))) {
            objElement = document.getElementById("label_email");
            objElement.className = "ongeldig";
            objAttribute = document.createAttribute("title");
            objAttribute.value = "Ongeldig e-mail-adres!";
            objElement.setAttributeNode(objAttribute);
        }
    }

    return boolReturn;
}