function getHTTPObject() {
   var xmlhttp = false;
   if (typeof XMLHttpRequest != 'undefined') {
      try {
         xmlhttp = new XMLHttpRequest();
      } catch (e) {
         xmlhttp = false;
      }
   } else {
        /*@cc_on
        @if (@_jscript_version >= 5)
            try {
                xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
            } catch (e) {
                try {
                    xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
                } catch (E) {
                    xmlhttp = false;
                }
            }
        @end @*/
    }
   return xmlhttp;
}



function setContent( containerID, url)
{
   var container = document.getElementById(containerID);
   if ( container != null)
      container.innerHTML = '';

   var XMLHTTPObject = getHTTPObject();

   //XMLHTTPObject.open('GET', 'XMLHttpRequest/test.txt', true);
   XMLHTTPObject.open('GET', url, true);
   XMLHTTPObject.setRequestHeader("Cache-Control", "no-cache");
   XMLHTTPObject.setRequestHeader("X_USERAGENT", "ICT_CONCEPT_XCALLBACK");

   XMLHTTPObject.onreadystatechange=function()
   {
         if (XMLHTTPObject.readyState == 4 && XMLHTTPObject.responseText != '')
         {
            var txt = XMLHTTPObject.responseText
            if ( container != null && txt != '')
                container.innerHTML = txt;
            else
               alert('MSG :: ' + txt);
         }
   }
   XMLHTTPObject.send(null);
}

function appendContent( containerID, url)
{
   var XMLHTTPObject = getHTTPObject();

   //XMLHTTPObject.open('GET', 'XMLHttpRequest/test.txt', true);
   XMLHTTPObject.open('GET', url, true);
   XMLHTTPObject.setRequestHeader("Cache-Control", "no-cache");
   XMLHTTPObject.setRequestHeader("X_USERAGENT", "ICT_CONCEPT_XCALLBACK");

   XMLHTTPObject.onreadystatechange=function()
   {
         if (XMLHTTPObject.readyState == 4 && XMLHTTPObject.responseText != '')
         {
            var txt = XMLHTTPObject.responseText
            var container = document.getElementById(containerID);
            if ( container != null && txt != '')
                container.innerHTML += txt;
            else
               alert('MSG :: ' + txt);
         }
   }
   XMLHTTPObject.send(null);
}


function loadSearchText(url, callback, method, querystring, separateRequest) {
  if (!method) method = "GET";
  if (!querystring) querystring = null;
  if (!separateRequest) separateRequest = false;

  if (separateRequest == true) {
    var xmlHttpRequest = getHTTPObject();
  } else {
    xmlHttpRequest = getHTTPObject();
  }

  xmlHttpRequest.open(method, url + "?" + querystring, true);

  xmlHttpRequest.onreadystatechange = function() {
    if (xmlHttpRequest.readyState == 4) {
      if (xmlHttpRequest.status == 200) {
        eval(callback + "(xmlHttpRequest.responseText)");
      } else {
        alert("De handeling kon niet worden uitgevoerd\n" + xmlHttpRequest.statusText);
      }
    }
  }
  xmlHttpRequest.send(querystring)

}


function laadZoekResultaat(result) {
  if (result.indexOf("ht://Dig error") != -1) {
    //error
    fResult = "Geen resultaten gevonden met de opgegeven zoekcriteria.";
  } else {
    fResult = result.replace(/\/common\/cgi-bin\/htsearch/g, "/zoek.php");
  }
//alert('prelimenary : ' + result);
//alert('final : ' + fResult);
  document.getElementById('search_result').innerHTML = "<h1>Zoekresultaten</h1>"+fResult;
}

function clearImagePlaceholder()
{

   var iph = document.getElementById('img_ph');
   if ( iph != null)
      iph.innerHTML = '';
}

function setContactContent()
{
   var container = document.getElementById('bck_cell');
   if ( container != null)
   {
      container.style.backgroundRepeat = 'no-repeat';
      container.style.backgroundImage = 'url(images/IntroDummy.jpg)';
   }

   setContent( 'body_content', 'contact.php');
   //clearImagePlaceholder();
}

function setVacatureContent()
{
   var container = document.getElementById('bck_cell');
   if ( container != null)
   {
      container.style.backgroundRepeat = 'no-repeat';
      container.style.backgroundImage = 'url(images/IntroDummy.jpg)';
   }

   setContent( 'body_content', 'vacatures.php');
   //clearImagePlaceholder();
}

function setPersContent()
{
   var container = document.getElementById('bck_cell');
   if ( container != null)
   {
      container.style.backgroundRepeat = 'no-repeat';
      container.style.backgroundImage = 'url(images/IntroDummy.jpg)';
   }

   setContent( 'body_content', 'pers.php');
   //clearImagePlaceholder();
}

function setZoekContent(querystring)
{
   var container = document.getElementById('bck_cell');
   if ( container != null)
   {
      container.style.backgroundRepeat = 'no-repeat';
      container.style.backgroundImage = 'url(images/IntroDummy.jpg)';
   }

    setContent( 'body_content', 'zoek.php');
   //loadSearchText("/common/cgi-bin/htsearch", "laadZoekResultaat", "GET", "'" + querystring + "'");
   //clearImagePlaceholder();
}

function setInternetContent()
{
   var container = document.getElementById('bck_cell');
   if ( container != null)
   {
      container.style.backgroundRepeat = 'no-repeat';
      container.style.backgroundImage = 'url(images/IntroInternet.jpg)';
   }
   setContent( 'body_content', 'internet_diensten.php');
   //clearImagePlaceholder();
}

function setKantoorContent()
{
   var container = document.getElementById('bck_cell');
   if ( container != null)
   {
      container.style.backgroundRepeat = 'no-repeat';
      container.style.backgroundImage = 'url(images/IntroKantoor.jpg)';
   }
   setContent( 'body_content', 'kantoorautomatisering.php')
   //clearImagePlaceholder();
}

function SetVisibility( objid, visi)
{
   //var cf = new Crossfader( new Array(objid ), 1, 2500, 5000 );
   var kb = document.getElementById(objid);
   if ( kb != null) kb.style.visibility=visi;
}

function startXFade(sid)
{
//alert('GO!');
   var cf = new Crossfader( new Array('stad_'+ sid ), 1, 2500, 5000 );
   setTimeout( "SetVisibility('" + 'klok_bar_'+ sid + "', 'visible')" , 2500);
}

function setConceptBalk()
{
   if ( document.getElementById( 'stad_0') != null)
      document.getElementById( 'stad_0').style.visibility = 'visible';
   if ( document.getElementById( 'stad_1') != null)
      document.getElementById( 'stad_1').style.visibility = 'visible';
   if ( document.getElementById( 'stad_2') != null)
      document.getElementById( 'stad_2').style.visibility = 'visible';
   if ( document.getElementById( 'stad_3') != null)
      document.getElementById( 'stad_3').style.visibility = 'visible';

   if ( ICTBrowserCompatible)
   {
      if ( document.getElementById( 'klok_bar_0') != null)
         document.getElementById( 'klok_bar_0').style.visibility = 'visible';
      if ( document.getElementById( 'klok_bar_1') != null)
         document.getElementById( 'klok_bar_1').style.visibility = 'visible';
      if ( document.getElementById( 'klok_bar_2') != null)
         document.getElementById( 'klok_bar_2').style.visibility = 'visible';
      if ( document.getElementById( 'klok_bar_3') != null)
         document.getElementById( 'klok_bar_3').style.visibility = 'visible';
   }
}


function setConceptContent()
{

   var container = document.getElementById('bck_cell');
   if ( container != null)
   {
      container.style.backgroundRepeat = 'no-repeat';
      container.style.backgroundImage = 'url(images/IntroDummy.jpg)';
   }

   // content is set
   setContent( 'body_content', 'ict_concept.php');
   var steden = document.getElementById('steden_bar');
   if ( steden != null)
      return;  // we do nothing want we zijn er al!!!

   var strookBG = document.getElementById('img_ph');
   var images = strookBG.getElementsByTagName("img");
   var imgID = -1;
   if ( images.length > 0 )
      imgID = images.item(0).id;
   // nu moeten de plaatjes van de strook nog gezet worden
   appendContent( 'img_ph', 'plaatsen.php');

   if ( ICTBrowserCompatible )
   {

      setTimeout( "startXFade('0')" , 500);
      setTimeout( "startXFade('1')" , 1500);
      setTimeout( "startXFade('2')" , 2500);
      setTimeout( "startXFade('3')" , 3500);

   }
   else
   {
      setTimeout( "setConceptBalk()", 300);
   }

   if ( images.length > 0)
   {
      if ( ICTBrowserCompatible )
      {
         cf = new Crossfader( new Array( imgID ), -1, 2500, 5000 );
         setTimeout( "delObjectNode('img_ph', 0)", 3000);
      }
      else
         delObjectNode('img_ph', 0);
   }

   // to be sure
   setTimeout( "setConceptBalk()", 1500);

}

function setTelefonieContent()
{
   var container = document.getElementById('bck_cell');
   if ( container != null)
   {
      container.style.backgroundRepeat = 'no-repeat';
      container.style.backgroundImage = 'url(images/IntroTelefonie.jpg)';
   }
   setContent( 'body_content', 'telefonie.php');

   //clearImagePlaceholder();
}

function closePopup()
{
   var cover = document.getElementById('popup_cover');
   if ( cover != null)
   {
      cover.style.display = 'none';
   }
}

function openPopup()
{
   var cover = document.getElementById('popup_cover');
   if ( cover != null)
   {
      cover.style.display = 'block';
   }
}

function  setLoginContent()
{
   setContent( 'popup_content', 'login.php');
   openPopup();

   var cover = document.getElementById('popup');
   cover.style.width = '300px';
   cover.style.height = '150px';

   setTimeout( "setLogin()", 100);
}

function  setVoorwaardenContent()
{
   setContent( 'popup_content', 'voorwaarden.php');
   openPopup();

   var cover = document.getElementById('popup');
   cover.style.width = '400px';
   cover.style.height = '400px';

   //setTimeout( "setLogin()", 100);
}

function  setDisclaimerContent()
{
   setContent( 'popup_content', 'disclaimer.php');
   openPopup();

   var cover = document.getElementById('popup');
   cover.style.width = '600px';
   cover.style.height = '500px';

   //setTimeout( "setLogin()", 100);
}

function  setPrivacyContent()
{
   setContent( 'popup_content', 'privacy.php');
   openPopup();

   var cover = document.getElementById('popup');
   cover.style.width = '600px';
   cover.style.height = '500px';

   //setTimeout( "setLogin()", 100);
}

function startUp()
{
   //var show = ( (is_ie && (is_major > 6)) || (((is_moz)||(is_fb)||(is_fx)) && (is_major >= 2)) ) ? true : false;
   //alert( 'ķe:' + is_ie + ',' + is_major + 'fireb:' + is_fb + 'SHOW: '+ show);

   var obj = document.getElementById('shdw1');
   if ( obj != null && ICTBrowserCompatible )
      obj.style.visibility = 'visible';
   obj = document.getElementById('shdw2');
   if ( obj != null && ICTBrowserCompatible )
      obj.style.visibility = 'visible';
   obj = document.getElementById('shdw3');
   if ( obj != null && ICTBrowserCompatible )
      obj.style.visibility = 'visible';
   obj = document.getElementById('shdw4');
   if ( obj != null && ICTBrowserCompatible )
      obj.style.visibility = 'visible';
   obj = document.getElementById('popup_border');
   if ( obj != null && !ICTBrowserCompatible )
   {
      obj.style.padding = 0;
      obj.style.margin = 0;
      obj.style.background = 'none';
   }
}

