﻿/* IE PNG Fix */
function loadPng(obj, image) 
{
  if (navigator.platform != "Win32" || navigator.appName != "Microsoft Internet Explorer") return;
	var rslt = navigator.appVersion.match(/MSIE (\d+\.\d+)/, '');
	var itsAllGood = (rslt != null && Number(rslt[1]) >= 5.5 && Number(rslt[1]) < 7);
	
	if (itsAllGood && obj.currentStyle.backgroundImage.match(/\.png/i) != null) {
		var bg	= obj.currentStyle.backgroundImage;
		if (!image) {
		  image = bg.substring(5,bg.length-2);
		}
  	obj.style.filter = "progid:DXImageTransform.Microsoft.AlphaImageLoader(src='" + image + "', sizingMethod='scale')";
  	obj.style.backgroundImage = "url(/images/bg_1x1.gif)";
	}
}

/* Popup links */
function popupWindow(theURL, winName, winWidth, winHeight) 
{
	var posLeft = (Math.floor(screen.width/2)) - (Math.floor(winWidth/2));
	var posTop = (Math.floor(screen.height/2)) - (Math.floor(winHeight/2));

	newWindow = window.open(theURL,winName, "width=" + winWidth + ",height=" + winHeight + ",left=" + posLeft + ",top=" + posTop + ", location=0, menubar=0, resizable=1, scrollbars=1, status=0, toolbar=0");
	newWindow.focus();

	return false;
}

/* Allows chained onload's */
function addLoadEvent(func) 
{
  var oldonload = window.onload;
  if (typeof window.onload != 'function') {
    window.onload = func;
  } else {
    window.onload = function() {
      if (oldonload) {
        oldonload();
      }
      func();
    }
  }
}