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 txtBoxValue (f_form, f_fields, f_values) {
	aFields = f_fields.split(":");
	aValues = f_values.split("]|[");
	
	for (i=0; i<aFields.length; i++) {
		document[f_form][aFields[i]].value = aValues[i];
	}
}


// -- display toggle
function displaytoggle (idtogg, showhide)
{
	me = document.getElementById(idtogg);
	if ( showhide == "show" ) {
		me.style.display = 'block';
	} else if ( showhide == "toggle" ) {
		if ( me.style.display == "none" ) {
			me.style.display = "block";
		} else {
			me.style.display = "none";
		}
	} else {
		me.style.display = 'none';
	}
	return false;
}

// Image Rollovers
function image_source ( imageid_str, newsource_url_str )
{
	myimage = document.getElementById ( imageid_str );
	myimage.src = newsource_url_str;
}

// Opener Window Location
function openerHREF ( url )
{
	window.opener.location.href = url;
}

// popup window
var popwin = null;
function popup(eURL, eWidth, eHeight, eWinName, ePos, eParams) {
	etoolbar = (eParams.indexOf("toolbar") != -1) ? "yes" : "no";
	elocationbar = (eParams.indexOf("location") != -1) ? "yes" : "no";
	edirectories = (eParams.indexOf("directories") != -1) ? "yes" : "no";
	estatus = (eParams.indexOf("statusbar") != -1) ? "yes" : "no";
	emenubar = (eParams.indexOf("menubar") != -1) ? "yes" : "no";
	escrollbars = (eParams.indexOf("scrollbars") != -1) ? "yes" : "no";
	eresize = (eParams.indexOf("resize") != -1) ? "yes" : "no";
	
	if (eWinName == "") { winName = "popup"; }
	else { winName = eWinName; }
	
	ePos = ePos.split(",");
	// horizontal
	if (ePos[0].indexOf("center") != -1) { posLeft = (screen.width) ? (screen.width-eWidth)/2 : 0; }
	else if (ePos[0].indexOf("left") != -1) { posLeft = 0; }
	else if (ePos[0].indexOf("right") != -1) { posLeft = screen.width - eWidth; }
	else { posLeft = ePos[0]; }
	
	if (ePos[0].indexOf("+") != -1 || ePos[0].indexOf("-") != -1) {
		if (ePos[0].indexOf("+") != -1) {
			ePos_horiz = ePos[0].split("+");
			var int_x = parseInt(ePos_horiz[1]);
			posLeft = posLeft + int_x;
		} else if (ePos[0].indexOf("-") != -1) {
			ePos_horiz = ePos[0].split("-");
			var int_x = parseInt(ePos_horiz[1]);
			posLeft = posLeft - int_x;
		}
	}
	
	//vertical
	if (ePos[1].indexOf("center") != -1) { posTop = (screen.height) ? (screen.height-eHeight)/2 : 0; }
	else if (ePos[1].indexOf("top") != -1) { posTop = 0; }
	else if (ePos[1].indexOf("bottom") != -1) { posTop = screen.height - eHeight; }
	else { posTop = ePos[1]; }
	
	if (ePos[1].indexOf("+") != -1 || ePos[1].indexOf("-") != -1) {
		if (ePos[1].indexOf("+") != -1) {
			ePos_vert = ePos[1].split("+");
			var int_y = parseInt(ePos_vert[1]);
			posTop = posTop + int_y;
		} else if (ePos[1].indexOf("-") != -1) {
			ePos_vert = ePos[1].split("-");
			var int_y = parseInt(ePos_vert[1]);
			posTop = posTop - parseInt(ePos_vert[1]);					
		}
	}

	var args = 'toolbar=' + etoolbar + ',location=' + elocationbar + ',directories=' + edirectories + ',status=' + estatus + ',menubar=' + emenubar + ',scrollbars=' + escrollbars + ',resizable=' + eresize + ',width='+eWidth+',height='+eHeight+',left='+posLeft+',top='+posTop;
	if(popwin && !popwin.closed) popwin.close();
	popwin = window.open(eURL, winName, args);
}