function checkForm()
{
    var ccheckbox_yes, ctxt_title, ctxt_firstname, ctxt_familyname, ctxt_birthday, ctxt_ocupation, ctxt_address, ctxt_postcode, ctxt_couontry, ctxt_phone_home, ctxt_phone_business, ctxt_fax, ctxt_email, cradiobutton_fee;

    var rad = myform.elements['radiobutton_fee'];
    var val = '';

    with(window.document.myform)
    {
    ccheckbox_yes = checkbox_yes;
    ctxt_title = txt_title;
    ctxt_firstname = txt_firstname;
    ctxt_familyname = txt_familyname;
    ctxt_birthday = txt_birthday;
    ctxt_ocupation = txt_ocupation;
    ctxt_address = txt_address;
    ctxt_postcode = txt_postcode;
    ctxt_couontry = txt_couontry;
    ctxt_phone_home = txt_phone_home;
    ctxt_phone_business = txt_phone_business;
    ctxt_fax = txt_fax;
    ctxt_email = txt_email;
    cradiobutton_fee = radiobutton_fee;
    }

for ( var i = 0; i < rad.length; i++ ) {
    if ( rad[i].checked ) val = rad[i].value;
}



    if (ccheckbox_yes.checked == false)
    {
        alert('Please accept to become a member of InGentibus Foundation e.V');
        ccheckbox_yes.focus();
        return false;
    }
    else if (trim(ctxt_title.value) == '')
    {
        alert('Please enter your Title!');
        ctxt_title.focus();
        return false;
    }
    else if(trim(ctxt_firstname.value) == '')
    {
        alert('Please enter your first name!');
        ctxt_firstname.focus();
        return false;
    }
    else if(trim(ctxt_familyname.value) == '')
    {
        alert('Please enter your family name!');
        ctxt_familyname.focus();
        return false;
    }
    else if(trim(ctxt_birthday.value) == '')
    {
        alert('Please enter your birthday!');
        ctxt_birthday.focus();
        return false;
    }
    else if(trim(ctxt_ocupation.value) == '')
    {
        alert('Please enter your ocupation!');
        ctxt_ocupation.focus();
        return false;
    }
    else if(trim(ctxt_address.value) == '')
    {
        alert('Please enter your address!');
        ctxt_address.focus();
        return false;
    }
    else if(trim(ctxt_postcode.value) == '')
    {
        alert('Please enter your Zip code/Postcode!');
        ctxt_postcode.focus();
        return false;
    }
    else if(trim(ctxt_couontry.value) == '')
    {
        alert('Please enter your Country!');
        ctxt_couontry.focus();
        return false;
    }
    else if(trim(ctxt_phone_home.value) == '')
    {
        alert('Please enter your home phone number!');
        ctxt_phone_home.focus();
        return false;
    }
    else if(trim(ctxt_phone_business.value) == '')
    {
        alert('Please enter your business phone number!');
        ctxt_phone_business.focus();
        return false;
    }
    else if(trim(ctxt_fax.value) == '')
    {
        alert('Please enter your fax number!');
        ctxt_fax.focus();
        return false;
    }
    else if(trim(ctxt_email.value) == '')
    {
        alert('Please enter your email');
        ctxt_email.focus();
        return false;
    }
    else if(!isEmail(trim(ctxt_email.value)))
    {
        alert('Email address is not valid');
        ctxt_email.focus();
        return false;
    }
    else if(val.length == 0)
    {
        alert('Please select your membership type!');
        rad[0].focus();
        return false;
    }
    else
    {
       //   ccheckbox_yes.value = trim(ccheckbox_yes.value);
          ccheckbox_yes.checked = true;
          ctxt_title.value = trim(ctxt_title.value);
          ctxt_firstname.value = trim(ctxt_firstname.value);
          txt_familyname.value = trim(txt_familyname.value);
          cradiobutton_fee.checked = true;

        return true;
    }
}

/*
Strip whitespace from the beginning and end of a string
Input : a string
*/
function trim(str)
{
    return str.replace(/^\s+|\s+$/g,'');
}

/*
Check if a string is in valid email format.
Returns true if valid, false otherwise.
*/
function isEmail(str)
{
    var regex = /^[-_.a-z0-9]+@(([-_a-z0-9]+\.)+(ad|ae|aero|af|ag|ai|al|am|an|ao|aq|ar|arpa|as|at|au|aw|az|ba|bb|bd|be|bf|bg|bh|bi|biz|bj|bm|bn|bo|br|bs|bt|bv|bw|by|bz|ca|cc|cd|cf|cg|ch|ci|ck|cl|cm|cn|co|com|coop|cr|cs|cu|cv|cx|cy|cz|de|dj|dk|dm|do|dz|ec|edu|ee|eg|eh|er|es|et|eu|fi|fj|fk|fm|fo|fr|ga|gb|gd|ge|gf|gh|gi|gl|gm|gn|gov|gp|gq|gr|gs|gt|gu|gw|gy|hk|hm|hn|hr|ht|hu|id|ie|il|in|info|int|io|iq|ir|is|it|jm|jo|jp|ke|kg|kh|ki|km|kn|kp|kr|kw|ky|kz|la|lb|lc|li|lk|lr|ls|lt|lu|lv|ly|ma|mc|md|mg|mh|mil|mk|ml|mm|mn|mo|mp|mq|mr|ms|mt|mu|museum|mv|mw|mx|my|mz|na|name|nc|ne|net|nf|ng|ni|nl|no|np|nr|nt|nu|nz|om|org|pa|pe|pf|pg|ph|pk|pl|pm|pn|pr|pro|ps|pt|pw|py|qa|re|ro|ru|rw|sa|sb|sc|sd|se|sg|sh|si|sj|sk|sl|sm|sn|so|sr|st|su|sv|sy|sz|tc|td|tf|tg|th|tj|tk|tm|tn|to|tp|tr|tt|tv|tw|tz|ua|ug|uk|um|us|uy|uz|va|vc|ve|vg|vi|vn|vu|wf|ws|ye|yt|yu|za|zm|zw)|(([0-9][0-9]?|[0-1][0-9][0-9]|[2][0-4][0-9]|[2][5][0-5])\.){3}([0-9][0-9]?|[0-1][0-9][0-9]|[2][0-4][0-9]|[2][5][0-5]))$/i;
    return regex.test(str);
}


// This code is from Dynamic Web Coding www.dyn-web.com
// Copyright 2002 by Sharon Paine Permission granted to use this code as long as this entire notice is included.
// Courtesy of SimplytheBest.net - http://simplythebest.net/scripts/

var dom = (document.getElementById) ? true : false;
var ns5 = ((navigator.userAgent.indexOf("Gecko")>-1) && dom) ? true: false;
var ie5 = ((navigator.userAgent.indexOf("MSIE")>-1) && dom) ? true : false;
var ns4 = (document.layers && !dom) ? true : false;
var ie4 = (document.all && !dom) ? true : false;
var nodyn = (!ns5 && !ns4 && !ie4 && !ie5) ? true : false;

var origWidth, origHeight;
if (ns4) {
        origWidth = window.innerWidth; origHeight = window.innerHeight;
        window.onresize = function() { if (window.innerWidth != origWidth || window.innerHeight != origHeight) history.go(0); }
}

if (nodyn) { event = "nope" }
var tipFollowMouse        = true;
var tipWidth              = 150;
var offX                  = 12;        // how far from mouse to show tip
var offY                  = 12;
var tipFontFamily         = "Verdana, arial, helvetica, sans-serif";
var tipFontSize           = "8pt";
var tipFontColor          = "#996600";
var tipBgColor            = "#FBF5D3";
var origBgColor           = tipBgColor; // in case no bgColor set in array
var tipBorderColor        = "#996600";
var tipBorderWidth        = 1;
var tipBorderStyle        = "ridge";
var tipPadding            = 0;

var messages = new Array();
messages[0] = new Array('../img/number_1_popup.gif','<hr align="center" width="100%" size="1">Obligatory field. Select it to confirm that you wish to become a member of InGentibus Foundation e.V.',"#FBF5D3");
messages[1] = new Array('../img/number_2_popup.gif','<hr align="center" width="100%" size="1">All fields are obligatory. The data will be used only for internal purposes of InGentibus Foundation e.V.',"#FBF5D3");
messages[2] = new Array('../img/number_3_popup.gif','<hr align="center" width="100%" size="1">This field is obligatory too. Choose one of the membership type which is more appropirate to you.',"#FBF5D3");

if (document.images) {
        var theImgs = new Array();
        for (var i=0; i<messages.length; i++) {
          theImgs[i] = new Image();
                theImgs[i].src = messages[i][0];
  }
}

var startStr = '<table width="' + tipWidth + '"><tr><td align="center" width="100%"><img src="';
var midStr = '" border="0"></td></tr><tr><td valign="top">';
var endStr = '</td></tr></table>';

var tooltip, tipcss;
function initTip() {
        if (nodyn) return;
        tooltip = (ns4)? document.tipDiv.document: (ie4)? document.all['tipDiv']: (ie5||ns5)? document.getElementById('tipDiv'): null;
        tipcss = (ns4)? document.tipDiv: tooltip.style;
        if (ie4||ie5||ns5) {        // ns4 would lose all this on rewrites
                tipcss.width = tipWidth+"px";
                tipcss.fontFamily = tipFontFamily;
                tipcss.fontSize = tipFontSize;
                tipcss.color = tipFontColor;
                tipcss.backgroundColor = tipBgColor;
                tipcss.borderColor = tipBorderColor;
                tipcss.borderWidth = tipBorderWidth+"px";
                tipcss.padding = tipPadding+"px";
                tipcss.borderStyle = tipBorderStyle;
        }
        if (tooltip&&tipFollowMouse) {
                if (ns4) document.captureEvents(Event.MOUSEMOVE);
                document.onmousemove = trackMouse;
        }
}

window.onload = initTip;

var t1,t2;        // for setTimeouts
var tipOn = false;        // check if over tooltip link
function doTooltip(evt,num) {

        if (!tooltip) return;
        if (t1) clearTimeout(t1);        if (t2) clearTimeout(t2);
        tipOn = true;
        // set colors if included in messages array
        if (messages[num][2])        var curBgColor = messages[num][2];
        else curBgColor = tipBgColor;
        if (messages[num][3])        var curFontColor = messages[num][3];
        else curFontColor = tipFontColor;
        if (ns4) {
                var tip = '<table bgcolor="' + tipBorderColor + '" width="' + tipWidth + '" cellspacing="0" cellpadding="' + tipBorderWidth + '" border="0"><tr><td><table bgcolor="' + curBgColor + '" width="100%" cellspacing="0" cellpadding="' + tipPadding + '" border="0"><tr><td>'+ startStr + messages[num][0] + midStr + '<span style="font-family:' + tipFontFamily + '; font-size:' + tipFontSize + '; color:' + curFontColor + ';">' + messages[num][1] + '</span>' + endStr + '</td></tr></table></td></tr></table>';
                tooltip.write(tip);
                tooltip.close();
        } else if (ie4||ie5||ns5) {
                var tip = startStr + messages[num][0] + midStr + '<span style="font-family:' + tipFontFamily + '; font-size:' + tipFontSize + '; color:' + curFontColor + ';">' + messages[num][1] + '</span>' + endStr;
                tipcss.backgroundColor = curBgColor;
                 tooltip.innerHTML = tip;
        }
        if (!tipFollowMouse) positionTip(evt);
        else t1=setTimeout("tipcss.visibility='visible'",100);
}

var mouseX, mouseY;
function trackMouse(evt) {
        mouseX = (ns4||ns5)? evt.pageX: window.event.clientX + document.body.scrollLeft;
        mouseY = (ns4||ns5)? evt.pageY: window.event.clientY + document.body.scrollTop;
        if (tipOn) positionTip(evt);
}

function positionTip(evt) {
        if (!tipFollowMouse) {
                mouseX = (ns4||ns5)? evt.pageX: window.event.clientX + document.body.scrollLeft;
                mouseY = (ns4||ns5)? evt.pageY: window.event.clientY + document.body.scrollTop;
        }
        // tooltip width and height
        var tpWd = (ns4)? tooltip.width: (ie4||ie5)? tooltip.clientWidth: tooltip.offsetWidth;
        var tpHt = (ns4)? tooltip.height: (ie4||ie5)? tooltip.clientHeight: tooltip.offsetHeight;
        // document area in view (subtract scrollbar width for ns)
        var winWd = (ns4||ns5)? window.innerWidth-20+window.pageXOffset: document.body.clientWidth+document.body.scrollLeft;
        var winHt = (ns4||ns5)? window.innerHeight-20+window.pageYOffset: document.body.clientHeight+document.body.scrollTop;
        // check mouse position against tip and window dimensions
        // and position the tooltip
        if ((mouseX+offX+tpWd)>winWd)
                tipcss.left = (ns4)? mouseX-(tpWd+offX): mouseX-(tpWd+offX)+"px";
        else tipcss.left = (ns4)? mouseX+offX: mouseX+offX+"px";
        if ((mouseY+offY+tpHt)>winHt)
                tipcss.top = (ns4)? winHt-(tpHt+offY): winHt-(tpHt+offY)+"px";
        else tipcss.top = (ns4)? mouseY+offY: mouseY+offY+"px";
        if (!tipFollowMouse) t1=setTimeout("tipcss.visibility='visible'",100);
}

function hideTip() {
        if (!tooltip) return;
        t2=setTimeout("tipcss.visibility='hidden'",100);
        tipOn = false;
}