﻿// Zoeken.js

var displayElement;

function CloseSearch()
{
    if (displayElement)
    {
        displayElement.style.display = 'none'
    }
}

// Initializes global variables and session state.
function pageLoad()
{
    displayElement = $get("ResultId");      
    displayElement.style.display = 'none';    
}

// Callback function invoked on successful 
// completion of the page method.
function OnSucceeded(result, userContext, methodName) 
{
    if (methodName == "GetSessionValue" || methodName == "GeefZoekResultaat")
    {
        displayElement.innerHTML = "<span style='margin-left:177px;font-size:16px'><a href='javascript:CloseSearch();' style=\" padding-left:13px; top:0px; \">[x]</a></span><br/>" + result;       
    }
}

// Callback function invoked on failure 
// of the page method.
function OnFailed(error, userContext, methodName) 
{
    if(error !== null) 
    {
        displayElement.innerHTML = "Er is een fout opgetreden: " + 
            error.get_message();
    }
}

if (typeof(Sys) !== "undefined") Sys.Application.notifyScriptLoaded();

function GeefZoekResultaat(key,target) 
{ 
    if(key.length > 3)
    { 
       
        displayElement.style.display = 'block';        
        Zoeken.GeefZoekResultaat(key,target,OnSucceeded, OnFailed);                    	
     }
     else
     {
        displayElement.style.display = 'none';
     }
}

