//upsize the search textbox for IE4+ and NN5+
function fixtxt(specialCase){
	var d = document;
	var NN4 = (d.layers&& !d.getElementById) ? true:false;
	var IE4 = (d.all) ? true:false;
	var NN5 = (d.getElementById) ? true:false;
	if (NN4){
	  	//do nothing, as browser unable to resize a textbox
	  } else if(IE4 || NN5){
	  	document.seek1.qt.size = (specialCase) ? specialCase:16;
		var el = getEl('master_table',IE4);
		if (el) el.style.width="100%";
	  } else {
	  	//do nothing, as browser capabilities unknown
	  }
} //end function: fixtxt

function getEl(elID,IE4) {
if (IE4) return document.all[elID];
return document.getElementById(elID);
}


///////////BEGIN: SUBNAV IN COLLAGE JS
//the premise is that the sub" pages will be able to
//identify which "parent" button to highlight and where
//to rewrite their collage-generated DHTML sub-nav by referencing
//the containing folder name of the on-screen html document.
//This must always match the 'active' navbar image name
//and the DIV ID where we will rewrite the subnav
//01/20/2003 T.S.

//main function - called onLoad by all subnav masterpages
function fixnav()  {
	var strTopNavName = findparentname();
	imgSrc(strTopNavName);
	MoveSubNavTo(strTopNavName);
} //end function: fixnav

//dissect the page URL, and return the final folder name
function findparentname()  {
	var foldername = " " + window.location + " ";
	var slash2 = 0;
	var slash1 = 0;
	for (i=0;i<foldername.length-1;i++) {
		if (foldername.substring(i,i+1) == "/" || foldername.substring(i,i+1) == "\\") {
			slash1 = slash2;
			slash2 = i;
		}
	}
	return foldername.substring(slash1+1,slash2);
} //end function: findparentname

//change "_no_" portion to "_hi_"
function replaceImgLabel(src) {
	var intReplaceStringStart = src.indexOf("_no_");
	return src.substring(0,intReplaceStringStart) + "_hi_" + src.substring(intReplaceStringStart+4,src.length);
} //end function: replaceImgLabel

//decrement the 4 digit assetID portion by 1. This
//assumes that the "highlighted" (undecorated) gif button
//was created in Collage immediately before its lighter companion
function replaceImgAssetID(src)  {
	var dash2 = 0;
	var dash1 = 0;
	for (i=0;i<src.length-1;i++) {
		if (src.substring(i,i+1) == "_") {
			dash1 = dash2;
			dash2 = i;
		}
	}
	src = src.substring(0,dash1+1) + (src.substring(dash1+1,dash2)-1) + src.substring(dash2,src.length);
	return src;
} //end function: replaceImgAssetID

function getSubNavId(src) {
// 4/22/05 - Makk - THIS IS A HACK!! for a quick fix to this JavaScript, implemented for Collage v4.6 
// The navigation JavaScript contained here is dependent on what Merant spits out in terms of autogenerated image files, 
// any subtle code changes they make will directly impact our navigation, we need to rewrite the navigation 
// JavaScript to be independent of Merant's codebase or find another method.

//pull the end of the file asset ID for the main file for that group

  var getFileEnd = src.substring(src.lastIndexOf("_")+1,src.length-4);  
  
  //alert(getFileEnd);

  //Need to replace the auto folder section 
  var autoFolderStart = src.lastIndexOf("/");  
  var autoFolderEnd = src.indexOf("auto_");
  var autoFolder = src.substring(autoFolderEnd,autoFolderStart);
  var autoAssetID = src.substring(autoFolderEnd+5,autoFolderStart);

  var newautoFolder = "auto_" + getFileEnd;
  src = src.replace(autoFolder,newautoFolder);
  return src;
  //alert(src);
}
//Highlight the rollover image
function imgSrc(img_Name) {

    if (document.images)
    {

        var Img = replaceImgLabel(document [img_Name].src);
        Img = replaceImgAssetID(Img);
        Img = getSubNavId(Img);
        Img = Img.replace(img_Name+"/","");
        //alert(Img);
        document [img_Name].src = Img;
    }
} //end function: imgSrc

//Reproduce the subnav code where it 'belongs'
function MoveSubNavTo(div_Name) {
	var appVer = navigator.appVersion;
	appVer = appVer.toLowerCase();
	if (appVer.indexOf("macintosh") != -1) {
		//macintosh ?x  DO NOTHING AS SUBNAV GYNASTICS UNPREDICTABLE...
	}
	else if (!document.all && document.getElementById) {
		//nn6 plus ie5 and above...
		div1=document.getElementById(div_Name);
		div2=document.getElementById("subnav");
		//'active' section found(reproduce the subnav html code below it)
		div1.innerHTML = div1.innerHTML + div2.innerHTML;
		//hide the original subnav code
		div2.innerHTML = "";
	}
	else if (document.all) {
		//ie4
		for (i=0;i<document.all.length;i++) {
			if (document.all[i].tagName=="DIV" && document.all[i].id==div_Name) {
				//'active' section found(reproduce the subnav html code below it)
				document.all[i].insertAdjacentHTML('beforeEnd',subnav.innerHTML);
				//hide the original subnav code
				subnav.innerHTML = "";
				break;
			}
		}
	}
} //end function: MoveSubNavTo

//////END: SUBNAV IN COLLAGE JS//////


////////////BEGIN: PRINTER FRIENDLY JS

function printMe(markup,URL)  {
//provides printer friendly versions of PVCS content
//stripped of its assigned master page
//with simple, uniform header and footer information
//12/27/2002
//needs companion code for NN6+ browsers
//could be mimicked using a java applet...for NN4

//define doc headers and footers
var header = "<html>";
header += "<head>";
header += "<title>";
header += "FAHC</title>";
header += "<STYLE>";
header += "TH {background: silver};#headline {font-weight: bold}";
header += "</STYLE></head><body>";

var footer = "<p><center>"+URL+"</center></body></html>";

//open a new window
var little_window = window.open();

//write the markup 
little_window.document.open();
little_window.document.write(header+'<center><h4>Fletcher Allen Health Care</h4>'+markup+footer);
little_window.document.close();
}
//////END: PRINTER FRIENDLY JS//////