function processPopups() {
	if (!document.getElementsByTagName) return false;
	var links = document.getElementsByTagName("a");
	for (var i=0; i < links.length; i++) {
		if (links[i].className.match("popup")) {
			//alert(i + ' : ' + links[i].href);
			//add onclick code
			links[i].onclick = function() {
				//alert('clicked');
				var sWidth = '';
				var sHeight = '';
				var sModal = '';
				if(this.getAttribute('w')) sWidth = ',width='+ this.getAttribute('w');
				if(this.getAttribute('h')) sHeight = ',height='+ this.getAttribute('h');
				if(this.getAttribute('modal')) sModal = ',modal=1,dependant=1,chrome=0,alwaysRaised=1';
				//alert('w='+w+' h='+h);
				window.open(this.href,'','toolbar=0,resizable=1,menubar=0,scrollbars=1'+sWidth+sHeight+sModal);
				return false;
			}//end func
		}//end if
	}//end if
}//end func


var currentWindowOnload =(window.onload)?window.onload:function(){};
window.onload = function(){
	currentWindowOnload();

	//process links with popup class
	processPopups();

	if(	window.adminmode && window.bLoggedIn){
		//we are logged in and editing
		qp = document.location.search.toQueryParams();  //convert to struct of sorts
		elm = $('c_' + qp.uuid);  //get the object ID
		if(elm){
			Element.scrollTo(elm);  //scroll to it
		}
	}
}


function addLoadEvent(func) {
  var oldonload = window.onload;
  if (typeof window.onload != 'function') {
    window.onload = func;
  } else {
    window.onload = function() {
      oldonload();
      func();
    }
  }
}