var NumberRegExp = /([^0-9-])/g;

var AnimatieDone=true;
var myFontsize=100;//100%

var ShowZoomTimer=null;
var FlashLoadingTimer=null;

var FotoActief=0;
var VideoActief=0;
var AudioActief=-1;

var AudioFotoBoekReady=false;
var AudioFotoBoekPause=false;

var JWplayerObj=null;
var JWPlayerReady=false;

var ActiveMediaId='';
var ActiveMediaTimer=null;


$(document).ready(function()
{
  $('div.worddoc table').removeAttr('width');
});



//Bij collectie info ballon bij mouseover
function ShowMediaInfoWindow(curObjId)
{

  clearTimeout(ActiveMediaTimer);

  if(ActiveMediaId!=curObjId)
  {
    if(ActiveMediaId) DoHideMediaInfoWindow();

    $('#'+curObjId).addClass('hoveractief');

    var CurObjNr=parseInt(curObjId.replace(NumberRegExp,""));

    var LabelMaker='Vervaardiger:';
    var LabelJaar ='Datering:';
    var LabelBron ='Bron:';

    if(TaalKeuze=='DE')
    {
      LabelMaker='Schöpfer:';
      LabelJaar ='Datiert:';
      LabelBron ='Quelle:';
    }
    else if(TaalKeuze=='EN')
    {
      LabelMaker='Creator:';
      LabelJaar ='Dated:';
      LabelBron ='Source:';
    }

    InfoWindowText='';
    if(CurObjNr>=0 && CurObjNr<CollectieDataLst.length)
    {
      if(CollectieDataLst[CurObjNr].title!='') InfoWindowText+='<strong>'+CollectieDataLst[CurObjNr].title+'</strong><br />';
      if(CollectieDataLst[CurObjNr].jaar!='')  InfoWindowText+='<span class="infolinks">'+LabelJaar+'</span><span class="inforechts">'+CollectieDataLst[CurObjNr].jaar+'</span><br style="clear:both;" />';
      if(CollectieDataLst[CurObjNr].maker!='') InfoWindowText+='<span class="infolinks">'+LabelMaker+'</span><span class="inforechts">'+CollectieDataLst[CurObjNr].maker+'</span><br style="clear:both;" />';

    }

    ActiveMediaId=curObjId;

    if(InfoWindowText!='')
    {
      var MediaInfoHolder=$(document.createElement('div')).attr('id','mediainfowindow').appendTo('#'+curObjId);

      var TopStyle='background-image: url('+repository_url+'images/popup_mediainfo/info_top_'+sectieKleur+'.png);'
      var BottomStyle='background-image: url('+repository_url+'images/popup_mediainfo/info_bottom_'+sectieKleur+'.png);';
      var ContentStyle='background-image: url('+repository_url+'images/popup_mediainfo/info_midden_'+sectieKleur+'.png);'

      var InfoWindowHtml='';
      InfoWindowHtml+='<table cellspacing="0" cellpadding="0">';
      InfoWindowHtml+='<tr><td><img class="mediainfotop" style="'+TopStyle+'" src="'+repository_url+'images/spacer.png" width="247" height="6" alt="" /></td></tr>';
      InfoWindowHtml+='<tr><td class="mediainfocontent" style="'+ContentStyle+'">';

      InfoWindowHtml+='<div>'+InfoWindowText+'</div>';

      InfoWindowHtml+='</td></tr>';
      InfoWindowHtml+='<tr><td><img class="mediainfobottom" style="'+BottomStyle+'"src="'+repository_url+'images/spacer.png" width="247" height="18" alt="" /></td></tr>';
      InfoWindowHtml+='</table>';

      MediaInfoHolder.html(InfoWindowHtml).show();
    }

  }

}

function DoHideMediaInfoWindow()
{
  if(ActiveMediaId!='')
  {
    $('#'+ActiveMediaId).removeClass('hoveractief');
    $('#mediainfowindow').hide();
    $('#mediainfowindow').remove();
    ActiveMediaId='';
  }
}

function HideMediaInfoWindow()
{
  ActiveMediaTimer=setTimeout('DoHideMediaInfoWindow()',300);
}


//JW player geladen?
function playerReady(obj)
{
  JWPlayerReady=true;
	JWplayerObj = document.getElementById(obj['id']);
}


function getFlashDimensions(FlashId)
{
  var FlashGeladen=false;

  var movieObj = document.getElementById(FlashId);
  var FlashWH={'width':0,'height':0};

  if(typeof(movieObj) != 'undefined')
  {
    if(typeof movieObj.TGetProperty != 'undefined')
    {
      try
      {
        movieObj.TGetProperty("/",8);

        FlashGeladen=true;
      }
      catch(err)
      {
        //alert(err);
      }

      if(FlashGeladen)
      {
        FlashWH.width = parseInt(movieObj.TGetProperty("/",8));
        FlashWH.height= parseInt(movieObj.TGetProperty("/",9));
      }

    }
  }

  return FlashWH;
}


function ShowFlashgame()
{

  var FlashWH=getFlashDimensions('mygame');

  var MaxWidth=760;
  if(isKidsSectie) MaxWidth-=40;

  if(FlashWH.width>0 && FlashWH.height>0)
  {
    if(FlashWH.width > MaxWidth)
    { //terugschalen
      var SchaalFactor=MaxWidth / FlashWH.width;
      FlashWH.height=Math.round(FlashWH.height*SchaalFactor);
      FlashWH.width =MaxWidth;
    }

    $('#mygameholder').css({'width':FlashWH.width+'px','height':FlashWH.height+'px'});
    $('#mygame').attr({'width':FlashWH.width,'height':FlashWH.height}).css({'width':FlashWH.width+'px','height':FlashWH.height+'px','visibility':'visible'});

    //correctie positie footer onderaan contentvlak
    $('#footer').css('bottom','-80px');

  }
  else
  {
    setTimeout('ShowFlashgame()',200);
  }

}


function ShowPanorama(ivpfile,tekst,id){

  var flashvars = {
    autoplay: false,
    panorama: ivpfile,
    infotext: tekst
  };

  var params = {
    allowFullScreen: true,
    seamlesstabbing: false,
    allowScriptAccess:"always",
    wmode: 'transparent'
  };

  var attributes = {
    id: 'mygame',
    name: 'mygame'
  };

  swfobject.embedSWF(repository_url+'swf/PurePlayer.swf','panorama'+id,'605','200','9',repository_url+'swf/ExpressInstall.swf',flashvars,params,attributes);  

}



function PlaceGameSwf(FlashUrl)
{

  if(isKidsSectie) $('#mygameholder').addClass('omlijning');

  $(document.createElement('div')).attr({'id':'mygame'}).appendTo('#mygameholder');

  var flashvars = {
    autoplay: false
  };

  var params = {
    allowFullScreen: false,
    seamlesstabbing: false,
    allowScriptAccess:"always",
    wmode: 'transparent'
  };

  var attributes = {
    id: 'mygame',
    name: 'mygame'
  };

  swfobject.embedSWF(FlashUrl,'mygame','720','500','9',repository_url+'swf/ExpressInstall.swf',flashvars,params,attributes);  

  $(window).load(function()
  {
    ShowFlashgame();
  });

}


function setSectieRGB(kleurnaam)
{
  switch(kleurnaam)
  {
    case 'blauw':
      SectieRGBKleur='#15b0ef';
      break;
    case 'bordeau':
      SectieRGBKleur='#850505';
      break;
    case 'cyaan':
      SectieRGBKleur='#04d0d2';
      break;
    case 'grijs':
      SectieRGBKleur='#a5a896';
      break;
    case 'groen':
      SectieRGBKleur='#7fbc0a';
      break;
    case 'magenta':
      SectieRGBKleur='#d708a4';
      break;
    case 'oranje':
      SectieRGBKleur='#ffa200';
      break;
    case 'paars':
      SectieRGBKleur='#9e2dca';
      break;
    case 'rood':
      SectieRGBKleur='#d42f03';
      break;
    default:
      SectieRGBKleur='#000000';
  }

  return SectieRGBKleur;
}


function VerbergAudiobookPause()
{
  ShowZoom=false;
  $('#audiobookpause').fadeOut(200);
}


function InitAudioFotoboek()
{
  AudioActief=-1;
  FotoActief=-1;
  AudioFotoBoekReady=true;

  $('#audiobookplay').show();

  $('#audiobookplay').click(function(){
    if(AudioFotoBoekPause)
    {
      soundManager.resume('myAudiobook');
      $('#audiobookplay').fadeOut(200);
    }
    else
    {
      LaadAudioFotoboek(AudioActief);
    }
  });

  $('#audiobookpause').click(function(){
    $('#audiobookpause').fadeOut(200);
    $('#audiobookplay').fadeIn(200);
    soundManager.pause('myAudiobook');
  });

  $('#audioboekfotoplaceholder, #audiobookpause').mouseover(function(){
    if($('#audiobookplay').css('display')=='none')
    {
      clearTimeout(ShowZoomTimer);
      $('#audiobookpause').fadeIn(200);
    }
  });

  $('#audioboekfotoplaceholder').mouseout(function(){
    if($('#audiobookplay').css('display')=='none' && $('#audiobookpause').css('display')!='none')
      ShowZoomTimer=setTimeout('VerbergAudiobookPause()',1000);

  });

}



function LaadAudioFotoboek(ObjNr)
{

  if(!AudioFotoBoekReady) return false;

  if(ObjNr<0) ObjNr=0;

  FotoActief=-1;

  if(AudioActief!=ObjNr)
  {//nieuwe audio laden 

    $('#thumbsvlak table.thumbsslide td a').removeClass('actief');
    $('#thumb'+ObjNr).addClass('actief');

    if(AudioActief!=-1) soundManager.destroySound('myAudiobook');
    AudioActief=ObjNr;

    var aSoundObject = soundManager.createSound(
    {
      id:'myAudiobook',
      url:QuePointsLst[AudioActief].audio,
      onplay:function()
      {
        $('#audiobookplay').fadeOut(200);
        AudioFotoBoekPause=false;
      },
      onpause:function()
      {
        AudioFotoBoekPause=true;
      },
      onfinish:function()
      {
        $('#audiobookplay').show();
      },
      whileplaying: function()
      {

        curQPointNr=getAudioFotoActief(this.position);
        if(curQPointNr!=FotoActief && AnimatieDone)
        {
          //blokkade tegen evt. te snelle foto wissels
          AnimatieDone=false;

          var ActiefFotoId='audiofoto';
          if(FotoActief>-1) ActiefFotoId+=FotoActief;

          var FotoLeftPos=($('#audioboekfotoplaceholder').innerWidth() - QuePointsLst[AudioActief].qpoint[curQPointNr].width)/2;

          $(document.createElement('img')).attr({'src':QuePointsLst[AudioActief].qpoint[curQPointNr].link,
              'width':QuePointsLst[AudioActief].qpoint[curQPointNr].width,
              'height':QuePointsLst[AudioActief].qpoint[curQPointNr].height,
              'id':'audiofoto'+curQPointNr}).css('left',FotoLeftPos+'px').appendTo('#audioboekfotoplaceholder');

          $('#videoinfovlak').fadeOut(300,function(){
            $('#videoinfovlak').html('<strong>'+QuePointsLst[AudioActief].qpoint[curQPointNr].title + '</strong><br />' +
              QuePointsLst[AudioActief].qpoint[curQPointNr].description).fadeIn(300);
          });

          $('#audiofoto'+curQPointNr).fadeIn(1000);
          $('#'+ActiefFotoId).fadeOut(1000, function(){
            AnimatieDone=true;
            $(this).remove();
          });

          FotoActief=curQPointNr;
        }
      }
  
    });

  }


  soundManager.play('myAudiobook');

  //de 1e foto evt. alvast activeren
  FotoActief=getAudioFotoActief(0);

  $('#audioboekfotoplaceholder').empty();

  if(FotoActief==-1)
  {

    var FotoLeftPos=($('#audioboekfotoplaceholder').innerWidth() - 477)/2;

    $(document.createElement('img')).attr({'src':repository_url+'images/video_leeg.jpg',
            'width':477,
            'height':268,
            'id':'audiofoto'}).css('left',FotoLeftPos+'px').appendTo('#audioboekfotoplaceholder');

    $('#videoinfovlak').html('<strong>'+QuePointsLst[AudioActief].title + '</strong><br />' +
      QuePointsLst[AudioActief].description).show();

  }
  else
  {

    var FotoLeftPos=($('#audioboekfotoplaceholder').innerWidth() - QuePointsLst[AudioActief].qpoint[FotoActief].width)/2;

    $(document.createElement('img')).attr({'src':QuePointsLst[AudioActief].qpoint[FotoActief].link,
            'width':QuePointsLst[AudioActief].qpoint[FotoActief].width,
            'height':QuePointsLst[AudioActief].qpoint[FotoActief].height,
            'id':'audiofoto'+FotoActief}).css('left',FotoLeftPos+'px').appendTo('#audioboekfotoplaceholder');

    $('#videoinfovlak').html('<strong>'+QuePointsLst[AudioActief].qpoint[FotoActief].title + '</strong><br />' +
      QuePointsLst[AudioActief].qpoint[FotoActief].description).show();
  }

  $('#videoinfovlak').html('<strong>'+QuePointsLst[AudioActief].title + '</strong><br />' +
    QuePointsLst[AudioActief].description).show();

  $('#audioboekfotoplaceholder img').show();
  AnimatieDone=true;



  return true;
}



function getAudioFotoActief(curPos)
{

  var curQpoint=FotoActief;

  for(c=FotoActief+1;c<QuePointsLst[AudioActief].qpoint.length;c++)
  {
    if(curPos>=QuePointsLst[AudioActief].qpoint[c].msec)
      curQpoint=c;

    if(curPos<QuePointsLst[AudioActief].qpoint[c].msec)
      return curQpoint;

  }

  return curQpoint;
}


function SetKidsRanden()
{

  if($('#kidsubmenurandlinks').length)
  {

    var HoogteHeader=$('#headerholder').outerHeight();
    var HoogteSubmenu=$('#submenuvlak').outerHeight();
    $('#kidsubmenurandlinks').css('height',(HoogteHeader+HoogteSubmenu+20)+'px');

    var HoogteContent=$('#contentvlak').outerHeight();
    $('#kidcontentrandlinks').css({'top':HoogteSubmenu+'px','height':(HoogteContent-HoogteSubmenu+40)+'px'});
    $('#kidcontentrandlinks').show();

    $('#kidcontentrandrechts').css('height',(HoogteHeader+HoogteContent+25)+'px');
  }
}


function CheckZoekInvoer(Vorm,defvalue)
{

  if(Vorm.words.value!=defvalue)
    return true;
  else
    return false;
}


function VerbergZoom()
{
  ShowZoom=false;
  $('#fotopreviewvlak img.knopzoom').fadeOut(200);
}


function ShowGetFlash(AttachMsg2Obj,Teksten)
{
  var htmlStr='';

  var kopHtml='';
  if(Teksten.titleimg!='')
  {
    kopHtml='<img src="'+Teksten.titleimg+'" width="'+Teksten.titlewidth+'" height="'+Teksten.titleheight+'" alt="'+Teksten.title+'" />';
  }
  else
  {
    kopHtml=Teksten.title;
  }

  htmlStr+='<div>'+kopHtml+'</div>';

  htmlStr+='<img class="hoeklb" src="'+repository_url+'images/hoek_lb.png" width="3" height="3" alt="" />';
  htmlStr+='<img class="hoekrb" src="'+repository_url+'images/hoek_rb.png" width="3" height="3" alt="" />';
  htmlStr+='<img class="hoeklo" src="'+repository_url+'images/hoek_lo.png" width="3" height="3" alt="" />';
  htmlStr+='<img class="hoekro" src="'+repository_url+'images/hoek_ro.png" width="3" height="3" alt="" />';

  htmlStr+='<p>'+Teksten.description+'<br />'+Teksten.download+'<a href="'+Teksten.url+'" target="_blank">'+Teksten.url+'</a></p>';
  htmlStr+='<p style="text-align:center;"><a href="'+Teksten.url+'" target="_blank"><img src="'+repository_url+'images/get_flash_player.gif" width="158" height="39" border="0"></a></p>&nbsp;<br />';

  $(AttachMsg2Obj).css('background-image','none').html('<div id="noflash">'+htmlStr+'</div>');

}


function SwitchVideo(ObjNr)
{

  if(ObjNr>=0 && ObjNr<videoLst.length)
  {

    var flashvars = {
      autoplay: false
    };

    var params = {
      allowFullScreen: true,
      seamlesstabbing: false,
      allowSciptAccess: 'always',
      wmode: 'transparent'
    };

    var attributes = {
		  id: 'myvideo',
      name: 'myvideo'
    };

    $('#thumbsvlak table.thumbsslide td a').removeClass('actief');
    $('#thumb'+ObjNr).addClass('actief');

    if(FlashPluginOk)
    {
      $('#videoinfovlak').html('<strong>'+videoLst[ObjNr].title+'</strong><br />'+videoLst[ObjNr].description);

      if(videoLst[ObjNr].player=='jw')
      {//jwplayer
        var playerUrl=repository_url+'swf/LM_video.swf';
        if(isKidsSectie) playerUrl=repository_url+'swf/LM_kids_video.swf';

        if(videoLst[ObjNr].qpointxml!='')
        {

          var flashvars = {
            autostart: false,
            logo: repository_url+'images/video_logo.png',
            file: videoLst[ObjNr].src,
            image:videoLst[ObjNr].img,
            skin:playerUrl,
            plugins:'captions&captions.file='+videoLst[ObjNr].qpointxml
          };

        }
        else
        {

          var flashvars = {
            autostart: false,
            logo: repository_url+'images/video_logo.png',
            file: videoLst[ObjNr].src,
            image:videoLst[ObjNr].img,
            skin:playerUrl
          };

        }
      
        //30px voor playbalk bij hoogte optellen
        swfobject.embedSWF(repository_url+'swf/player.swf','myvideo',videoLst[ObjNr].width,parseInt(videoLst[ObjNr].height)+30,'7',repository_url+'swf/ExpressInstall.swf',flashvars,params,attributes);  
  
      }
      else
      {//externe player
  
        //30px voor playbalk bij hoogte optellen
        swfobject.embedSWF(videoLst[ObjNr].src,'myvideo',videoLst[ObjNr].width, parseInt(videoLst[ObjNr].height)+20,'7',webroot+'swf/ExpressInstall.swf',flashvars,params,attributes);      
      }
    }

    //correctie positie footer onderaan contentvlak
    $('#footer').css('bottom','-80px');

  }

}



function ShowFotoPreview(curNr)
{
  $('#thumbsvlak table.thumbsslide td a').removeClass('actief');
  $('#thumb'+curNr).addClass('actief');

  var newDescr=$('#preview'+curNr).attr('title');
  if(newDescr.indexOf(': ')!=-1)
  {
    var DescrParts=newDescr.split(': ');
    newDescr='';
    for(dc=0;dc<DescrParts.length;dc++)
    {
      if(!dc) newDescr+='<strong>';
      if(dc>1) newDescr+=': ';
      newDescr+=DescrParts[dc];
      if(!dc) newDescr+='</strong><br />';
    }
  }

  $('#fotoinfovlak').fadeOut(200,function(){
    $('#fotoinfovlak').html(newDescr).fadeIn(200);
  });

  $('#preview'+FotoActief).fadeOut(300);
  $('#preview'+curNr).fadeIn(300);
  FotoActief=curNr;

  //correctie positie footer onderaan contentvlak
  var CorrectiePos=$('#contentvlak').outerHeight()+20;//+kleine offset correctie van 20px
  $('#footer').css('top',CorrectiePos+'px');
}


function StartSlideshow()
{
  $('#preview'+FotoActief).trigger('click');
}


function ThumbsScroll(richting)
{
  if(AnimatieDone)
  {

    if($('#thumbsvlak .thumbsvideoframe').length)
    {
      var VensterWidth=$('#thumbsvlak .thumbsvideoframe').innerWidth();
    }
    else 
    {
      var VensterWidth=$('#thumbsvlak .thumbsframe').innerWidth();
    }

    var SlideWidth=$('#thumbsvlak .thumbsslide').innerWidth();

    if(SlideWidth>VensterWidth)
    {

      var curOffset=parseInt($('#thumbsvlak .thumbsslide').css('left').replace(NumberRegExp,""));

      var Xpos=0;
      var ScrollOk=false;
      var MargeWidth=25;//fotoboek 25
      var CalcNextPos=0;

      if(richting<0)
      {
        var TextOk=false;
        $('#thumbsvlak .thumbsslide td').each(function(i){
          var ElWidth=$(this).outerWidth();
          CalcNextPos+=ElWidth;

          if(ScrollOk && !TextOk && !$(this).hasClass('spacing'))
          {
            TextOk=true;
            //text na gevonden afbeelding meenemen
            if($(this).find('img').length<1)
              Xpos=-1*(CalcNextPos-VensterWidth);

          }

          if(CalcNextPos-MargeWidth>=-curOffset+VensterWidth && !ScrollOk && !$(this).hasClass('spacing'))
          {
            Xpos=-1*(CalcNextPos-VensterWidth);
            ScrollOk=true;

            if($(this).find('img').length<1) TextOk=true;//is incl.text bij gevonden afbeelding
          }

        });
      }
      else if(richting>0 && curOffset<0)
      {
        var PrevWidth=0;
        $('#thumbsvlak .thumbsslide td').each(function(i){
          var ElWidth=$(this).outerWidth();
          CalcNextPos+=ElWidth;
          if(CalcNextPos+MargeWidth>=-1*curOffset && !ScrollOk && !$(this).hasClass('spacing'))
          {

            if($(this).find('img').length<1) CalcNextPos-=PrevWidth;

            Xpos=-(CalcNextPos-ElWidth);
            ScrollOk=true;
          }
          PrevWidth=ElWidth;

        });
      }



      if(ScrollOk)
      {
        AnimatieDone=false;
        if(Xpos>0)
        {
          Xpos=0;
        }
        if(Xpos<VensterWidth-SlideWidth)
        {
          Xpos=VensterWidth-SlideWidth;
        }
  
        $('.thumbsslide').animate({left:Xpos+'px'},150,function()
        {
          AnimatieDone=true;
        });
      }


    }
  }
}

function SchakelAlbumKeuze()
{
  if($('#albumlijst').css('display')=='block')
  {
    $('#albumlijst').slideUp(100);
  }
  else
  {
    $('#albumlijst').slideDown(100);
  }
}

function SchakelZoekSectie()
{
  if($('#sectielijst').css('display')=='block')
  {
    $('#sectielijst').slideUp(100);
  }
  else
  {
    $('#sectielijst').slideDown(100);
  }
}

function SetSectie(sectie,titel)
{
  if($('#sectielijst').css('display')=='block')
  {
    SchakelZoekSectie();
    $('#sectieactief').html(titel);
    $('#advancedzoekform input[name="sectie"]').val(sectie);
  }
}

function SchaalTekst(richting)
{
  var minFontsize=80;//80%
  var maxFontsize=200;//200%

  myFontsize=myFontsize+(richting*10);
  if(richting==0) myFontsize=100;

  if(myFontsize<minFontsize) myFontsize=minFontsize;
  if(myFontsize>maxFontsize) myFontsize=maxFontsize;

  var PercentageFloat=myFontsize/100;

  //110%
  var defaultSize=110;
  $('#submenu a, .opsommingagenda a').css('font-size',Math.round(defaultSize*PercentageFloat)+'%');

  //100%
  $('p').css('font-size',myFontsize+'%');
  $('#homenieuws a, #homepopulair a, #homeopsomming span, #homeinteressant a').css('font-size',myFontsize+'%');
  $('#subsubsubmenu a, #topmenu a, .banners .omschrijving').css('font-size',myFontsize+'%');
  $('#opsomming span, #opsommingkort a, .opsommingagenda .datum, #zoekresultaten span').css('font-size',myFontsize+'%');
  $('#fotoinfovlak, #videoinfovlak').css('font-size',myFontsize+'%');

  $('#datepicker_results').css('font-size',myFontsize+'%');

  //correctie positie box elementen onderaan submenu en contentvlak
  var CorrectiePos=$('#contentvlak').outerHeight()+20;//+kleine offset correctie van 20px
  $('#footer').css('top',CorrectiePos+'px');

  var CorrectiePos=$('#submenuvlak').outerHeight();
  $('img.submenubottom').css('top',CorrectiePos+'px');

  SetKidsRanden();

}


function GaNaar(naarurl,doel)
{
  if(doel!='')
  {
    GaNaarVenster = window.open(naarurl,'_blank');
    GaNaarVenster.focus();
  } else {
    document.location.href=naarurl;
  }
}


function getURLParam(strParamName)
{
  var strReturn = "";
  var strHref = window.location.href;
  if(strHref.indexOf("?") > -1 )
  {
    var strQueryString = strHref.substr(strHref.indexOf("?")).toLowerCase();
    var aQueryString = strQueryString.split("&");
    for(var iParam=0;iParam < aQueryString.length;iParam++)
    {
      if(aQueryString[iParam].indexOf(strParamName.toLowerCase() + "=") > -1)
      {
        var aParam = aQueryString[iParam].split("=");
        strReturn = aParam[1];
        break;
      }
    }
  }
  return unescape(strReturn);
}


//browser bepalen ivm check buggy browsers
function myBrowserChk(){
  var userAgent = navigator.userAgent.toLowerCase();

  var browserinfo = {
    version: (userAgent.match( /.+(?:rv|it|ra|ie|me)[\/: ]([\d.]+)/ ) || [])[1],
    chrome: /chrome/.test( userAgent ),
    safari: /webkit/.test( userAgent ) && !/chrome/.test( userAgent ),
    opera: /opera/.test( userAgent ),
    msie: /msie/.test( userAgent ) && !/opera/.test( userAgent ),
    msie_buggy : false,
    mozilla: /mozilla/.test( userAgent ) && !/(compatible|webkit)/.test( userAgent )
  }

  if(browserinfo.msie){
    if(/msie 6/.test( userAgent )) browserinfo.msie_buggy = true;
    if(/msie 5/.test( userAgent )) browserinfo.msie_buggy = true;
  }

  return browserinfo;
}

