/////
// init scripts without JS frameworks
////////////////////////////////////

// list of allowed URLs to avoid XSS attacks 
var arrAllowedUrls = new Array(
  "http://java.hlrs.de/hpc-projects-new/public/abstracts/",
  "http://java.hlrs.de/hpc-projects/public/abstracts/"
);

// call the rewrite for the quickfinder at the top right
rewriteQuickfinder();

// Replace H1 Headlines with flash headlines by using sIFR
if(typeof sIFR == "function"){
		sIFR.replaceElement("#home h1", named({sFlashSrc: "/fileadmin/_templates/pages/_css/headline-h1.swf", sColor: "#FFFFFF", sBgColor: "#596166", sFlashVars: "offsetLeft=5&offsetTop=2", sCase: "upper"}));
		sIFR.replaceElement("h1", named({sFlashSrc: "/fileadmin/_templates/pages/_css/headline-h1.swf", sColor: "#596166", sCase: "upper"}));
}

// style external links with images -> remove background and set border, also open external links in new window
$$(".external-link-new-window",".internal-link").each(function(el) {
//  console.log(s.readAttribute('href'));
  if(el.getElementsBySelector('img').length > 0) {
    if(el.hasClassName('external-link-new-window')){
      el.addClassName('external-link-new-window-image');
      el.writeAttribute('target', '_blank');
    } else if (el.hasClassName('internal-link')){
      el.addClassName('internal-link-image');
    }
  };
});

// Check tt_news related links for external, internal or uni-link style
// Add your own Domains/Linkparts here:
restyleExternalLinks = function(){
  $$(".news-single-links a").each(function(el) {
    if(el.readAttribute('href').indexOf('hlrs.') != -1 || el.readAttribute('href').indexOf('www.hlrs.') != -1) {
      // internal links
      el.addClassName('internal-link');
    
    } else if(el.readAttribute('href').indexOf('uni-stuttgart.') != -1 || el.readAttribute('href').indexOf('www.uni-stuttgart.') != -1) {
      // unli links
      el.addClassName('uni-link');
    
    } else {
      // mark all other links as external and open them in new window
      el.addClassName('external-link');
      el.writeAttribute('target', '_blank');
    }
  });
}

loadIframeLinkChecker = function (){
  if(document.getElementById('iframelink') && location.href.indexOf("#iframelink")!=-1){
    loadIframeLink();
  }
}



// check if DOM has been loaded and execute functions within
Event.observe(window, "load", function(){new at.bartelme.newsticker()}, false);
Event.observe(window, "load", function(){restyleExternalLinks();}, false);
Event.observe(window, "load", function(){loadIframeLinkChecker();}, false);
Event.observe(window, "load", function(){new linkRewriter()}, false);














