﻿var sMovie = "<div id=\"mediaspace~INDEX~\"></div> " +
"<script type='text/javascript' >" +
  "var s~INDEX~ = new SWFObject('/static/swf/player.swf','mpl','246','147','9'); " +
  "s~INDEX~.addParam('allowfullscreen','true'); " +
  "s~INDEX~.addParam('allowscriptaccess','always'); " +
  "s~INDEX~.addParam('wmode', 'opaque'); " +
  "s~INDEX~.addVariable('image', '~IMAGE~'); " +
  "s~INDEX~.addVariable('file', '~FILE~'); " +
  "s~INDEX~.write('mediaspace~INDEX~');" +
  
"</script>";

$(document).ready(function() {
  $(".slidedown_close").hide();
  $(".slidedown_holder_menu a").click(function() {
    $(".slidedown_menu_holder").animate({ top: 323 }, 'slow');
    $(".slidedown_close").show();
  });

  $(".slidedown_close a").click(function() {

    $(".slidedown_holder_menu .slidedown_close").hide();
    $(".slidedown_menu_holder").animate({ top: 0 }, 'slow');

  });

  $("div.listitem").click(function() {
    var e = $(this).find("div.explanation");
    if (e != null) {
      if (e.height() == 0) {
        $(e).css({ "display": "block" });
        $(e).css({ "height": "auto" });
      }
      else {
        $(e).css({ "display": "none" });
        $(e).css({ "height": "0px" });
      }
    }

  });

  $.fn.showMovie = function(px) {
    addReference();
    $(this).each(function(i) {
      var sVideo = sMovie;
      sVideo = sVideo.replace(/~INDEX~/gi, i);
      sVideo = sVideo.replace(/~FILE~/gi, $(this).attr("flv"));
      sVideo = sVideo.replace(/~IMAGE~/gi, $(this).attr("src"));
      
      //alert($(this).attr("src"));
      $(this).replaceWith(sVideo);

    });

  };

  $("img[flv]").showMovie();

  //    $("#hypSearch").click(function() {
  //        doSearch();
  //    });

  //    $("#txtSearch").keypress(function() {
  //        if (event.keyCode == 13) {
  //            setTimeout("doSearch();", 5000);
  //            return false;


  //        }
  //    });
});

function addReference() {
  $("head").append("<script src=\"/static/js/swfobject2.js\"></script>");
}
//function doSearch() {
//    var sSearchText = $("#txtSearch").val();

//    if (sSearchText.length > 0) {
//        $("#hypSearch").attr("href", "\zoeken&q=" + sSearchText + "&start=0");
//    }
//}