function MM_openBrWindow(theURL,winName,features) { //v2.0
  window.open(theURL,winName,features);
}

function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}

function MM_jumpMenu(targ,selObj,restore){ //v3.0
  eval(targ+".location='"+selObj.options[selObj.selectedIndex].value+"'");
  if (restore) selObj.selectedIndex=0;
}

function MM_showHideLayers() { //v6.0
  var i,p,v,obj,args=MM_showHideLayers.arguments;
  for (i=0; i<(args.length-2); i+=3) if ((obj=MM_findObj(args[i]))!=null) { v=args[i+2];
    if (obj.style) { obj=obj.style; v=(v=='show')?'visible':(v=='hide')?'hidden':v; }
    obj.visibility=v; }
}

var hasFlash = 0;
var hasShockwave = 0;
if (navigator.mimeTypes) {
	var plugin = (navigator.mimeTypes && navigator.mimeTypes["application/x-shockwave-flash"]) ? navigator.mimeTypes["application/x-shockwave-flash"].enabledPlugin : 0;
	if (plugin && parseInt(plugin.description.substring(plugin.description.indexOf(".")-1)) >= 7) hasFlash = 1;
	if (navigator.mimeTypes && navigator.mimeTypes["application/x-director"] && navigator.mimeTypes["application/x-director"].enabledPlugin) {
		if (navigator.plugins && navigator.plugins["Shockwave for Director"] && (versionIndex = navigator.plugins["Shockwave for Director"].description.indexOf(".")) != - 1) {
			var versionString = navigator.plugins["Shockwave for Director"].description.substring(versionIndex-2, versionIndex);
			versionIndex = parseInt( versionString );
			if ( versionIndex >= 10 ) hasShockwave = 1;
		}
	}
}
if ((navigator.appVersion.indexOf("MSIE") != -1) && (navigator.appVersion.indexOf("Windows") != -1)) {
	document.writeln('<script language="VBScript">');
	document.writeln('on error resume next');
	document.writeln('hasFlash = (Isobject(Createobject("ShockwaveFlash.ShockwaveFlash.7")))');
	document.writeln('<\/script>');
	document.writeln('<script language="VBScript">');
	document.writeln('on error resume next');
	document.writeln('hasShockwave = (Isobject(Createobject("SWCtl.SWCtl.7")))');
	document.writeln('<\/script>');
}

function showFlash(flashFile, width, height, flashAlt) {
	if (hasFlash) document.writeln('<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://active.macromedia.com/flash/cabs/swflash.cab" width="'+width+'" height="'+height+'"><param name="movie" value="'+flashFile+'"><param name="quality" value="best"><param name="menu" value="false"><embed src="'+flashFile+'" width="'+width+'" height="'+height+'" quality="best" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash"><\/embed><\/object>');
	else document.writeln(flashAlt);
}

function showShockwave(shockwaveFile, width, height, shockwaveAlt) {
	if (hasShockwave) document.writeln('<object classid="clsid:166B1BCA-3F9C-11CF-8075-444553540000" codebase="http://active.macromedia.com/director/cabs/sw.cab" width="'+width+'" height="'+height+'"><param name="src" value="'+shockwaveFile+'"><param name="swRemote" value="swContextMenu=\'FALSE\'"><embed src="'+shockwaveFile+'" width="'+width+'" height="'+height+'" swRemote="swContextMenu=\'FALSE\'" type="application/x-director" pluginspage="http://www.macromedia.com/shockwave/download/index.cgi"><\/embed><\/object>');
	else document.writeln(shockwaveAlt);
}

function initWindow(theWidth, theHeight) {
	if (window.innerHeight) {
		//netscape: scrollbars appear outside this width & height
		if (theWidth != 0) window.resizeBy(theWidth-window.innerWidth, 0);
		if (theHeight != 0) window.resizeBy(0, theHeight-window.innerHeight);
	} else if (document.documentElement && document.documentElement.clientHeight) {
		//ie: scrollbars appear outside this width & height
		if (theWidth != 0) window.resizeBy(theWidth-document.documentElement.clientWidth, 0);
		if (theHeight != 0) window.resizeBy(0, theHeight-document.documentElement.clientHeight);
	} else if (document.body && document.body.clientHeight) {
		//ie: scrollbars appear outside this width & height
		if (theWidth != 0) window.resizeBy(theWidth-document.body.clientWidth, 0);
		if (theHeight != 0) window.resizeBy(0, theHeight-document.body.clientHeight);
	}
	parent.window.focus();
}

// popup
function trackMouse() {
	var d=document,i,j,obj,args=trackMouse.arguments;
	if(!d.trackMouseObj) d.trackMouseObj=new Array();
	for (i=0; i<(args.length-1); i+=2) { v=args[i+1];
		if (v=='track') { d.trackMouseObj.length = d.trackMouseObj.length + 1;obj=d.trackMouseObj[d.trackMouseObj.length - 1] = new Array();obj[0] = args[i];obj[1] = args[i+1];obj[2] = args[i+2];if ((obj=MM_findObj(obj[0]))!=null) moveDivTo(obj,-1000,-1000); }
		if (v=='stop') { for (j=0; j<(d.trackMouseObj.length); j+=1) { if (d.trackMouseObj[j][0]==args[i]) { d.trackMouseObj[j] = d.trackMouseObj[d.trackMouseObj.length - 1]; d.trackMouseObj.length = d.trackMouseObj.length - 1; } } }
	}
	if (document.layers) document.captureEvents(Event.MOUSEMOVE);
	document.onmousemove=trackMouseEvent;
}

function trackMouseEvent(e) {
	var d=document,i,obj;
	if(!d.trackMouseObj) d.trackMouseObj=new Array();
	for (i=0; i<(d.trackMouseObj.length); i++) if ((obj=MM_findObj(d.trackMouseObj[i][0]))!=null) {
		eventPageX = parseInt(getEventPageX(e));
		pageWidth = parseInt(getPageWidth());
		if (eventPageX < pageWidth / 2) moveDivToX = eventPageX+10;
		else moveDivToX = eventPageX-getDivWidth(obj)-10;
		eventPageY = parseInt(getEventPageY(e));
		windowHeight = parseInt(getWindowHeight());
		divHeight = parseInt(getDivHeight(obj));
		winYOffset = parseInt(getWinYOffset());
		moveDivToY = eventPageY - (divHeight / 2);
		if ((moveDivToY + divHeight) > (winYOffset + windowHeight)) moveDivToY = winYOffset + windowHeight - divHeight;
		if (moveDivToY < winYOffset) moveDivToY = winYOffset;
		moveDivTo(obj,moveDivToX,moveDivToY);
	}
}

function writeDivHTML(obj,html) {
	if(document.layers){ obj.document.open();obj.document.write(html);obj.document.close(); } else if(typeof obj.innerHTML!="undefined") obj.innerHTML=html;
}

function moveDivTo(obj,left,top) {
	if(document.layers){ obj.moveTo(left,top); return; }
	if(typeof(obj.style.left)=="string") { obj.style.left=left+'px';obj.style.top=top+'px'; }
	else if(typeof(obj.style.pixelLeft)!="undefined") { obj.style.pixelLeft=left;obj.style.pixelTop=top; }
}

function setDivClip(obj,top,right,bottom,left) {
	if(document.layers){ obj.clip.top=top;obj.clip.right=right;obj.clip.bottom=bottom;obj.clip.left=left; }
	else if(typeof obj.style.clip!="undefined") { obj.style.clip='rect('+top+'px '+right+'px '+bottom+'px '+left+'px)'; }
}

function initDivPos(obj) {
	if(document.layers) return;
	if(typeof obj.style.left!="undefined"&& typeof obj.style.left=="string"){ obj.style.left=obj.offsetLeft+'px'; obj.style.top=obj.offsetTop +'px'; }
	else if(typeof obj.style.pixelLeft!="undefined"){ obj.style.pixelLeft=obj.offsetLeft;obj.style.pixelTop=obj.offsetTop; }
}

function getDivLeft(obj) {
	initDivPos(obj);
	return document.layers?obj.left:(obj.offsetLeft||obj.style.pixelLeft||0);
}

function getDivTop(obj) {
	initDivPos(obj);
	return document.layers?obj.top:(obj.offsetTop||obj.style.pixelTop||0);
}

function initDivSize(obj) {
	if(document.layers) return;
	if(typeof obj.style.width!="undefined"&& typeof obj.style.width=="string"){ obj.style.width=obj.offsetWidth +'px';obj.style.height=obj.offsetHeight+'px'; }
	else if(typeof obj.style.pixelWidth!="undefined"){ obj.style.pixelWidth=obj.offsetWidth;obj.style.pixelHeight=obj.offsetHeight; }
}

function getDivWidth(obj) {
	initDivSize(obj);
	return document.layers?obj.clip.width:(obj.offsetWidth||obj.style.pixelWidth||0);
}

function getDivHeight(obj) {
	initDivSize(obj);
	return document.layers?obj.clip.height:(obj.offsetHeight||obj.style.pixelHeight||0);
}

function resizeDivTo(obj,width,height) {
	if(document.layers) obj.resizeTo(width,height);
	else if(typeof obj.style.width!="undefined"&& typeof obj.style.width=="string"){ obj.style.width=width+'px';obj.style.height=height+'px'; }
	else if(typeof obj.style.pixelWidth!="undefined"){ obj.style.pixelWidth=width;obj.style.pixelHeight=height; }  
}

function getPageWidth() {
	if (document.layers || (document.getElementById&&!document.all)) return(document.width);
	if (document.all) return(document.body.scrollWidth);
	return 0;
}

function getPageHeight() {
	if (document.layers || (document.getElementById&&!document.all)) return(document.height);
	if (document.all) return(document.body.scrollHeight);
	return 0;
}

function getWindowWidth() {
	if(window.innerWidth) return window.innerWidth;
	if(document.documentElement && document.documentElement.clientWidth) return document.documentElement.clientWidth;
	else if(document.body && document.body.clientWidth) return document.body.clientWidth;
	return 0;
}

function getWindowHeight() {
	if(window.innerHeight) return window.innerHeight;
	if(document.documentElement && document.documentElement.clientHeight) return document.documentElement.clientHeight;
	else if(document.body && document.body.clientHeight) return document.body.clientHeight;
	return 0;
}

function getWinXOffset() {
	if(window.scrollX) return window.scrollX;
	if(window.pageXOffset) return window.pageXOffset;
	if(document.documentElement && document.documentElement.scrollLeft) return document.documentElement.scrollLeft;
	else if(document.body && document.body.scrollLeft) return document.body.scrollLeft;
	return 0;
}

function getWinYOffset() {
	if(window.scrollY) return window.scrollY;
	if(window.pageYOffset) return window.pageYOffset;
	if(document.documentElement && document.documentElement.scrollTop) return document.documentElement.scrollTop;
	else if(document.body && document.body.scrollTop) return document.body.scrollTop;
	return 0;
}

function getEventPageX(e) {
	if(!e) var e = window.event;
	if(window.opera) return (document.documentElement?window.pageXOffset:0)+e.clientX;
	else if(e.pageX) return e.pageX;
	else if(e.clientX) {
		var sl=0;
		if(document.documentElement && document.documentElement.scrollLeft) sl=document.documentElement.scrollLeft;
		else if(document.body && document.body.scrollLeft) sl=document.body.scrollLeft;
		else if(window.scrollX||window.pageXOffset) sl=(window.scrollX||window.pageXOffset);
		return sl+e.clientX;
	}
	return 0;
}

function getEventPageY(e) {
	if(!e) var e = window.event;
	if(window.opera) return (document.documentElement?window.pageYOffset:0)+e.clientY;
	else if(e.pageY) return e.pageY;
	else if(e.clientY) {
		var st=0;
		if(document.documentElement && document.documentElement.scrollTop) st=document.documentElement.scrollTop;
		else if(document.body && document.body.scrollTop) st=document.body.scrollTop;
		else if(window.scrollY||window.pageYOffset) st=(window.scrollY||window.pageYOffset);
		return st+e.clientY;
	}
	return 0;
}
