// IE recognition
var brIndicator;
if( window.clipboardData && document.compatMode ) brIndicator=window.XMLHttpRequest? 'IE7' : 'IE6';

// Check that the Browser supports certain Methods so that Scripts can work.
function supportsDOM() {
	var returnValue = false;
	if(document.getElementById && document.getElementsByTagName && document.createTextNode) {returnValue = true;}
	return returnValue;
}

// getElementsByClassName-property
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;
}

// ie6 button rollover
function ieButtonHover () {
	var ieBtn = getElementsByClass("btn_submit");
	for (i=0;i<=ieBtn.length-1;i++){
		ieBtn[i].onmouseover = function () {
			this.style.backgroundPosition = "0 -18px";
		}
		ieBtn[i].onmouseout = function () {
			this.style.backgroundPosition = "0 0";
		}
	}
}

// load event
function addLoadEvent(func) {
  var oldonload = window.onload;
  if (typeof window.onload != 'function') {
    window.onload = func;
  } else {
    window.onload = function() {
      if (oldonload) {
        oldonload();
      }
      func();
    }
  }
}

//addLoadEvent(nameOfSomeFunctionToRunOnPageLoad);
addLoadEvent(function() {
  // ie form button rollover
  if(brIndicator == "IE6"){
 	 ieButtonHover ();
  }
  
  // unobtrusive popup
  if (getElementsByClass("popup")!=""){
	popup = new PopUp(); // create new PopUp-Instance
	popup.apply(); // Apply Popup-Behavior to all Links using the Class "popup"
  }
});