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

/*	Bookmark Script */


function addBookmark(title, url) {
	if (window.sidebar) {
		window.sidebar.addPanel(title, url, "");
	}
	else if (document.all) {
		window.external.AddFavorite(url, title);
	}
	else if (window.opera && window.print) {
		return true;
	}
}

function winOpen(w,h,t,p) {
	if (!w) w=600;
	if (!h) h=400;
	if (!t) t='_win';
	if (!p) p=',resizable=1,scrollbars=1,menubar=1,status=1,toolbar=1,location=0';
	var newWin = window.open('',t,'width=' + w +',height='+ h + p);
	newWin.focus();
	return true;
}

/* Set a temp expando to store the current selectedIndex */
function SelectOnFocusIn()
{
	try
	{
		var eSrc = window.event.srcElement;
		if (eSrc)
			eSrc.tmpIndex = eSrc.selectedIndex;
	}
	catch (e)
	{
		HandleError(e, false);
	}
}
/* restore the selectedIndex */
function SelectOnFocus()
{
	try
	{
		var eSrc = window.event.srcElement;
		if (eSrc)
			eSrc.selectedIndex = eSrc.tmpIndex;
	}
	catch (e)
	{
		HandleError(e, false);
	}
}

// A function for finding the actual computed value of a CSS style property on an element
function getStyle( elem, name ){
	// If the property exists in style[], then it's been set via javascript
	// recently and is current
	if ( elem.style[name] ) {
		return elem.style[name];
	}
	// Otherwise, try to use IE's method
	else if ( elem.currentStyle ) {
		return elem.currentStyle[name];
	}
	// Or the W3C's method, if it exists
	else if ( document.defaultView && document.defaultView.getComputedStyle ) {
		// It uses the 'text-align' style of writing
		name = name.replace(/([A-Z])/g,"-$1");
		name = name.toLowerCase();
		// Get the style object and get the value of the property (if it exists)
		var s = document.defaultView.getComputedStyle( elem, "" );
		return s && s.getPropertyValue( name );
	} else {
		// Otherwise we're using a non-compliant, non-IE browser
		return null;
	}
}