function addLoadEvent(func) {
  var oldonload = window.onload;
  if (typeof window.onload != 'function') {
    window.onload = func;
  } else {
    window.onload = function() {
      if (oldonload) {
        oldonload();
      }
      func();
    }
  }
}

function getElementsByClass(searchClass,node,tag) {
	var classElements = new Array();
	if ( node == null )
		node = document;
	if ( tag == null )
		tag = '*';
	var els = node.getElementsByTagName(tag);
	var elsLen = els.length;
	var pattern = new RegExp("(^|\\\\s)"+searchClass+"(\\\\s|$)");
	for (i = 0, j = 0; i < elsLen; i++) {
		if ( pattern.test(els[i].className) ) {
			classElements[j] = els[i];
			j++;
		}
	}
	return classElements;
}

addLoadEvent(function() {
	if(document.getElementById('tabs')) {
		document.getElementById('tabs').className = 'jsenabled';
		var tabs = new ddtabcontent("tabs");
		tabs.setpersist(true);
		tabs.setselectedClassTarget("link"); //"link" or "linkparent"
		tabs.init(5000);
	}
	// "more" links in "fresh thinking" box
	if(document.getElementById('freshtabs')) {
		var freshtabs = new ddtabcontent("freshtabs");
		freshtabs.setpersist(false);
		freshtabs.setselectedClassTarget("link"); //"link" or "linkparent"
		freshtabs.init();
		
	}
	if(document.getElementById('index') && document.getElementById('main')) {
		document.getElementById('main').className = 'jsenabled';
	}
	if(swfobject){
		document.getElementById("main").style.position = "absolute";
		document.getElementById("main").style.top = "-999em";
	}
});
