
$(document).ready(function() 
 {
 domain = window.location.host;
 domainReplace = "";
 if (domain.indexOf("www.erasmusmc.nl")>=0) { domainReplace = "http://erasmusmcweb-www";}
 if (domain.indexOf("localhost:")>=0) { domainReplace = "http://erasmusmcweb-www";}
 if (domain.indexOf("erasmusmcweb-www")>=0) { domainReplace = "http://www.erasmusmc.nl"; }
 if (domain.indexOf("intranet.erasmusmc.nl")>=0) { domainReplace = "http://erasmusmcweb-intra"; }
 if (domain.indexOf("erasmusmcweb-intra")>=0) { domainReplace = "http://intranet.erasmusmc.nl"; }
 $("#content a[href^='"+domainReplace+"']")
  .each(function()
  {
  this.href = this.href.replace(domainReplace,"");
  });
 $("#content img[src^='"+domainReplace+"']")
  .each(function()
  {
  this.src = this.src.replace(domainReplace,"");
  });

 $('#textcontent a').bind('click', function()
 {
 locationId = "erasmusmc";
 if (window.location.hostname.indexOf(locationId)>-1 && this.href.indexOf(locationId)>-1 && window.location.search.indexOf("lang=en")>0 && this.href.indexOf("?")<0)
 {  this.href = this.href+"?lang=en";  }
 else if(window.location.hostname.indexOf(locationId)>-1 && this.href.indexOf(locationId)>-1 && window.location.search.indexOf("lang=en")>0 && this.href.indexOf("?")>=0)
 {this.href = this.href+"&lang=en";  }
 return true;
 });
 });

