/* $Id: arena.js,v 1.11 2009-08-19 10:14:37 jasper Exp $ */

// pdfs altijd openen in een nieuwe pagina
$("a[href$=.pdf]").click(function(){ var popup = window.open(this.href); return false; });


// filestore links loggen naar Google Analytics
$("#content_div_id a[href*='filestore']").click(function(){
  pageTracker._trackPageview(this.href);
  var popup = window.open(this.href);
  return false;
});

// externe links loggen
$("#content_div_id a").each(function(){
  if (! this.href.match(/^http:\/\/(www\.amsterdamarena\.nl|82\.94\.192\.2)/) && ! this.href.match(/^javascript:/)) {
    $(this).click(function(){
        pageTracker._trackPageview('External: '+this.href);
        // ReadSpeaker opent popup met eigen script
        if (this.href.indexOf("http://app.readspeaker.com") != 0) {
          var popup = window.open(this.href);
          return false;
        }
    });
  }
  if (this.href.match(/^mailto:/)){
    $(this).click(function(){ pageTracker._trackPageview('Mailto: '+this.href); });
  }
});

// evenementen loggen met naam
$(".inner_content_td a").each(function(){
  if (this.href.match(/evenementen(\/en)?\/[0-9]{2,3}/)) {
    $(this).click(function(){ pageTracker._trackPageview('Evenement: ' +$(this).text()); });
  }
});

// start readspeaker
function rsTextSelection()
{
        if (document.getSelection) // older Mozilla versions
        {
                var selectedString = document.getSelection();
        }
        else if (document.all) // MSIE 4+
        {
                var selectedString=document.selection.createRange().text;
        }
        else if (window.getSelection) // recent Mozilla versions
        {
                var selectedString=window.getSelection();
        }
        document.rs_form.selectedtext.value = selectedString;
        if (document.rs_form.url) {
                if (!document.rs_form.url.value) {
                        if (window.location.href)
                        {
                                document.rs_form.url.value=window.location.href;
                        }
                        else if (document.location.href)
                        {
                                document.rs_form.url.value=document.location.href;
                        }
                }
        }
}

function copyselected()
{
        setTimeout("rsTextSelection()",50);
        return true;
}

function openAndRead() {
        window.open('','rs','width=310,height=120,toolbar=0');
        setTimeout("document.rs_form.submit();",500);
}

document.onmouseup = copyselected;
document.onkeyup = copyselected;
// end readspeaker
