function PopUp(nURL,winName,popW,popH,nShowControls) {
	w = screen.width ; h = screen.height
  	if (document.layers) {
    		if ((w >= 800) && (w <= 1028)) {w = 1028}
    		if ((h >= 600) && (h <= 780))  {h = 780}
    		if ((w >= 640) && (w <= 800))  {w = 800}
    		if ((h >= 480) && (h <= 600))  {h = 600}
    		if (w <= 640) {w = 640}
    		if (h <= 480) {h = 480}
  	}
	var leftPos = (w-popW)/2, topPos = (h-popH)/2;
	switch(nShowControls){
		case 1: 
			// For full windows
			var windowprops = "location=yes,scrollbars=yes,menubar=yes,toolbar=yes,resizable=yes,status=yes" + ",left=" + leftPos + ",top=" + topPos + ",width=" + popW + ",height=" + popH;
			break;
		case 2: 
			// For printing
			var windowprops = "location=no,scrollbars=yes,menubar=yes,toolbar=yes,resizable=yes,status=yes" + ",left=" + leftPos + ",top=" + topPos + ",width=" + popW + ",height=" + popH;
			break;
		default:
			// For clean simple popups
			var windowprops = "location=no,scrollbars=yes,menubar=no,toolbar=no,resizable=no,status=yes" + ",left=" + leftPos + ",top=" + topPos + ",width=" + popW + ",height=" + popH;
	}
	popup = window.open(nURL,winName,windowprops);
	if (popup.blur) {
	  popup.focus();
	}
}

function mover(obj) {
	if (document.images) {
		eval( "document." + obj + ".src = " + obj + "1.src;");
		return 1;
	}
}

function mout(obj) {
	if (document.images) {
		eval( "document." + obj + ".src = " + obj + ".src;");
		return 1;
	}
}

function gotoHref(theSelect) {
	if(theSelect.value != "") {
		thehref = theSelect.options[theSelect.selectedIndex].value;
		window.location.href = thehref;
	}
}

function MM_showHideLayers() { //v3.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')?'block':(v='hide')?'none':v; }
    obj.display=v; }
}

function MM_findObj(n, d) { //v4.0
  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 && document.getElementById) x=document.getElementById(n); return x;
}

function formSubmit(submitBtnObj,formObj){
	submitBtnObj.value="Please wait...";
	submitBtnObj.disabled=true;
	formObj.submit();
}

// Tabbing
var nTotalTabs = 0;
function initTabs(){
	// Get total num of tabs present (50 max)
	for(x=1;x<=50;x++){
		if(eval("document.getElementById('tab" + x + "')")){ nTotalTabs = x; }
	}
	ChangeTab(1);
}
function ChangeTab(nNewActiveTab){
	// Make all tabs inactive and hide all tab page content, then set new tab active and show its content
	if(eval("document.getElementById('tab" + nNewActiveTab + "')")){ // only if new tab DIV exists
		for(x=1;x<=nTotalTabs;x++){
			eval("document.getElementById('tab" + x + "').className='tab'");
			eval("MM_showHideLayers('tabbody" + x + "','','hide')");
		}
		eval("document.getElementById('tab" + nNewActiveTab + "').className='tabActive'");
		eval("MM_showHideLayers('tabbody" + nNewActiveTab + "','','show')");
	}
}
function ChangeMiniTab(nNewActiveTab,nFullTabARRAY){
	needToConfirm=false;
	confirmBackOn=true;
	// Make all tabs inactive and hide all tab page content, then set new tab active and show its content
	if(eval("document.getElementById('" + nNewActiveTab + "')")){ // only if new tab DIV exists
		for(x=0;x<nFullTabARRAY.length;x++){
			eval("document.getElementById('" + nFullTabARRAY[x] + "').className='minitab'");
			eval("MM_showHideLayers('tabbody" + nFullTabARRAY[x] + "','','hide')");
		}
		eval("MM_showHideLayers('tabbody" + nNewActiveTab + "','','show')");
		eval("document.getElementById('" + nNewActiveTab + "').className='minitabActive'");
	}
}

// Confirm save dialog
var needToConfirm = false;
// to flip back on after turned off intentionally for an event
var confirmBackOn = false;
function formChanged(){
	if(document.getElementById('fc')){ // only if DIV exists
		MM_showHideLayers('fc','','show');
	}
	needToConfirm = true;
}
function confirmExit(){
	if (needToConfirm){ return "If you leave this page without clicking 'Save Changes', all changes you have made will be lost."; }
	if (confirmBackOn){ needToConfirm = true; }
}
