(function(){
  var id = 0, head = $$('head')[0], global = this;
  global.getJSON = function(url, callback) {
    var script = document.createElement('script'), token = '__jsonp' + id;

    global[token] = callback;

    script.src = url.replace(/\?(&|$)/, '__jsonp' + id + '$1');

    script.onload = function() {
      script.remove();
      script = null;
      delete global[token];
    };
    head.appendChild(script);

    id++;
  }
})();


function embedMediacenter(element,id) {

    var myelement = element;
    var myTemplate = new Template('<div class="article_movie_snip"><div class="movie_snip_top">VIDEO</div><div class="movie_snip_bottom"><a class="zwp_movie_snippet" href="http://mediacenter.dental-tribune.com/index/index/movie/#{mp4_url}"><img class="movie_snip_bottom_img" src="http://mediacenter.dti-online.info/thumb/phpThumb.php?src=/videos/img/#{thumb_url}&w=110&h=62&zc=1&fltr[]=wmi|/img/play_watermark.png|BR|100" /></a><div class="movie_snip_bottom_h6">#{date}</div><div class="movie_snip_bottom_h1"><a class="zwp_movie_snippet" href="http://mediacenter.dental-tribune.com/index/index/movie/#{mp4_url}">#{title}</a></div></div></div>');

    getJSON(
        'http://mediacenter.dti-online.info/index/embed/ID/'+id+'?jsoncallback=?',
        function(data){
            $(myelement).update(myTemplate.evaluate(data));
        }
    );
}

function embedImagecenter(element,id) {
    // Anzeige mit großem Vorschaubild
    //document.write('<iframe src="http://mediacenter.dental-tribune.com/image/embed/ID/'+ id +'" width="610" height="566" scrolling="no" style="background-color:#FCF1E7; " frameborder="0" name="Imagecenter | Dental Tribune"></iframe>');
    document.write('<iframe src="http://mediacenter.dental-tribune.com/image/searchembed/ID/'+ id +'" width="100%" height="148" scrolling="no" style="background-color:#FCF1E7; " frameborder="0" name="Imagecenter | Dental Tribune"></iframe>');
}

function searchembedImagecenter(element,id) {
    document.write('<iframe src="http://mediacenter.dental-tribune.com/image/searchembed/ID/'+ id +'" width="610" height="148" scrolling="no" style="background-color:#FCF1E7; " frameborder="0" name="Imagecenter | Dental Tribune"></iframe>');
}
