
function RunFlash(width, height, src, align) {
  document.write('<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=5,0,0,0" width="' +width+ '" height="' +height+ '" align="' +align+ '">\n');
  document.write('<param name="movie" value="' +src+ '" />\n');
  document.write('<param name="wmode" value="transparent" />\n');
  document.write('<param name="quality" value="high" />\n');
  document.write('<embed src="' +src+ '" quality="high" wmode="transparent" align="' +align+ '" pluginspage="http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash" type="application/x-shockwave-flash" width="' +width+ '" height="' +height+ '">\n');
  document.write('</embed>\n');
  document.write('</object>\n');
}

function getDiv(divID,oDoc) {
  if (!oDoc) { oDoc = document; }
  if (document.layers) {
    if (oDoc.layers[divID]) { return oDoc.layers[divID]; }
    else {
      for (var x = 0, y; !y && x < oDoc.layers.length; x++) { y = getRefToDiv(divID,oDoc.layers[x].document); }
      return y;
    }
  }
  if (document.getElementById) { return document.getElementById(divID); }
  if (document.all) { return document.all[divID]; }
  return false;
}

function getX(obj) {
  return (obj.offsetParent==null ? obj.offsetLeft : obj.offsetLeft+getX(obj.offsetParent));
}

function getY(obj) {
  return (obj.offsetParent==null ? obj.offsetTop : obj.offsetTop+getY(obj.offsetParent));
}

function getWindowWidth() {
	var windowWidth = 0;
	if (typeof(window.innerWidth) == 'number') {
		windowWidth = window.innerWidth;
	}
	else {
		if (document.documentElement && document.documentElement.clientWidth) {
			windowWidth = document.documentElement.clientWidth;
		}
		else {
			if (document.body && document.body.clientWidth) {
				windowWidth = document.body.clientWidth;
			}
		}
	}
	return windowWidth;
}

function getWindowHeight() {
	var windowHeight = 0;
	if (typeof(window.innerHeight) == 'number') {
		windowHeight = window.innerHeight;
	}
	else {
		if (document.documentElement && document.documentElement.clientHeight) {
			windowHeight = document.documentElement.clientHeight;
		}
		else {
			if (document.body && document.body.clientHeight) {
				windowHeight = document.body.clientHeight;
			}
		}
	}
	return windowHeight;
}

function popUp(URL, width, height) {
  var windowWidth = getWindowWidth();
  var windowHeight = getWindowHeight();
  var posX = (windowWidth - width)/2;
  var posY = (windowHeight - height)/2;
  window.open(URL, '', 'toolbar=0,scrollbars=1,location=0,statusbar=0,menubar=0,resizable=1,width='+width+',height='+height+',left='+posX+',top='+posY+'');
}

