/*
* Nav
*/

var timeout    = 500;
var closetimer = 0;
var ddmenuitem = 0;

function jsddm_open()
{  jsddm_canceltimer();
   jsddm_close();
   ddmenuitem = $(this).find('ul').css('visibility', 'visible');}

function jsddm_close()
{  if(ddmenuitem) ddmenuitem.css('visibility', 'hidden');}

function jsddm_timer()
{  closetimer = window.setTimeout(jsddm_close, timeout);}

function jsddm_canceltimer()
{  if(closetimer)
   {  window.clearTimeout(closetimer);
      closetimer = null;}}

$(document).ready(function()
{  $('#jsddm > li').bind('mouseover', jsddm_open)
   $('#jsddm > li').bind('mouseout',  jsddm_timer)});

document.onclick = jsddm_close;


/*
* Check auth
*/
function check_auth(id){
    if ($("#name_"+id).val().length() < 1 || $("#name_"+id).val() == "Naam"){
        $("#name_"+id+"_text").html("Dit veld is vereist.");
    }
    else
    {
        $("#name_"+id+"_text").html("&nbsp;");    
    }
    
    var web = $("#web_"+id).val().split(".");
    if (web.length() < 2){
        $("#web_"+id+"_text").html("Dit veld is vereist.");
    }
    else
    {
        $("#web_"+id+"_text").html("&nbsp;");    
    }
    
    var email1 = $("#email_"+id).val().split("@");
    if (email1.length() < 2){
        $("#email_"+id+"_text").html("Dit veld is vereist.");
    }else
    {
        var email2 = email1[1].split(".");
        if (email2.length() < 2){
            $("#email_"+id+"_text").html("Dit veld is vereist.");
        }else
        {
            $("#email_"+id+"_text").html("&nbsp;");    
        }
    }
}

/*
* Clear field
*/

function clear_field(id, value){
    if ($("#"+id).val() == value){
        $("#"+id).val("");    
    }        
}

/*
* Set val
*/

function enter_field(id, value){
    if ($("#"+id).val().length() == 0){
        $("#"+id).val(value);    
    }    
}
