/*

Written By Michael Edmonson, ParacletePress.com -- 2003-03-19

This library is for the following, not in any order
1) detect the if netscape is the current browser
2) output the assembled code the browser when the "outputIframeInfo()" function is called

the Following is required to be in a header javascript of the browser:

TextBox.width=THE WIDTH
TextBox.height=THE HEIGHT
TextBox.src=URL


*/


// IF NS4 include scrollbar function
if (document.layers){
	BaseScript=""
	var tstVar="<script language=\"Javascript1.2\" src=\"" + BaseScript + "NSscrollbars.js\"></script>"
		document.write(tstVar)

} // end if


/* ---------- SPACER  ---------- */
// GLOBAL VARIABLES
/* ---------- SPACER  ---------- */

var TextBox = new Object()
TextBox.code = new Object()
TextBox.code.open = new Object()

TextBox.Basehref=""



/* ---------- SPACER  ---------- */
// GENERAL FUNCTIONS
/* ---------- SPACER  ---------- */


function getObj(obj) {
	// This is modified 

	var theObj
	if (typeof obj == "string") {
		theObj = eval(obj)
	} else {
		theObj = obj
	}
	return theObj
}




function outPutAtHeader(objectName){
	/* Function newNetscape() From "nsCodeOutPut.js" */
headerOutput=""	
	if (document.layers){ 
	var NSResizeFix="<script language=\"javascript\"><!--OnResize=history.go()//--></script>\n"
		headerOutput+="" //newNetscape(TextBox.width,TextBox.height,TextBox.Basehref+TextBox.src)+"\n\n"
		headerOutput+=NSResizeFix
	}

document.write(headerOutput)
}

/* ---------- SPACER  ---------- */
	function headPrint(){
		groupRenderHead();
	}

	function bodyOpen(){
		//IEVCenter(0);
		nsGroupLayerPrint();
	}


	function bodyMiddle(){
		/* UN REMARK TO DUMP ALL IFRAMES */
		groupRenderBody();
	}


	function bodyClose(){
		//IEVCenter(1);
		nsGroupLayerShift();
	}


/* ---------- SPACER  ---------- */
	function groupRenderHead(){
		dex=objArr.length
		for (i=0;i<dex;i++) {
			outPutAtHeader(objArr[i])
		}
		
	}

	function groupRenderBody(){
		dex=objArr.length
		for (i=0;i<dex;i++) {
			outPutAtBody(objArr[i])
		}
		
	}

	function nsGroupScroll(){
		dex=objArr.length
		for (i=-1;i<dex;i++) {
			initScroll(""+objArr[i]+"");
		}
		
	}

	function nsGroupLayerPrint(){
		dex=objArr.length
		for (i=0;i<dex;i++) {
			 NSBodyBlow(objArr[i])
		}
		
	}

	function nsGroupLayerShift(){
		dex=objArr.length
		for (i=0;i<dex;i++) {
			nsLayerMove(eval(objArr[i]))
		}
	}
/* ---------- SPACER  ---------- */
	function makObj(name,width,height,baseref,src){
		var newObj = new Object()

		// Track Object Names
		dex=objArr.length
		//if ( objArr[dex]!=false ) dex++;
		objArr[dex]=name

		// Build Object
		newObj.name=name;
	        newObj.code = new Object();
        	newObj.code.open = new Object();

	        newObj.Basehref=baseref;

	        newObj.width=width;
        	newObj.height=height;

        	newObj.src=src;
	
		return newObj;
	}

/* ---------- SPACER  ---------- */
function outPutAtBody(objectName){
	var locBox=getObj(objectName);

	/* Assemble IE realted Info
		FILE: from "crossBrowserIframe.js" */
	if (!document.layers){
		var printThis=BuildIframe(objectName)
		document.write(printThis)
	}

	/* Assemble NS realted Info
		FILE: from "nsCodeOutput.js" */
	if (document.layers){ document.write(newScrollerPad(locBox.width, locBox.height,locBox)) }
}

/* ---------- SPACER  ---------- */
// NS 4 FUNCTIONS
/* ---------- SPACER  ---------- */

function NSBodyBlow(objectName){
	if (objectName=="undefined") return
	var locBox=getObj(objectName);

	if (document.layers){
		//NSTableMod();
		document.write(newNetscape(locBox.width,locBox.height,locBox.Basehref+locBox.src,locBox.name)+"\n\n")
	}
}


function NSTableMod(){
	if (document.layers){
		var hFactor=0
		if (window.outerHeight > 600){
			hFactor=6
		} else {
			hFactor=3
		}
		myX=(window.outerHeight/100)*hFactor
		var docOUT = "<tr><td height="+ myX +" bgcolor=\"#ffffff\">&nbsp</td></tr>"
			document.write(docOUT)

	}
}

function nsLayerMove(objectName){
	obj=eval("document."+objectName.name)

	cnt=objectName.cnt
	if (document.layers){obj.moveTo(document.images[cnt].x,document.images[cnt].y)}
}


/* ------------------------------ */
// IFRAME FUNCTIONS
/* ------------------------------ */

function IEVCenter(mode){
	if (document.all){
		var outText=""
			if (mode==0){
				outText="<table width=\"100%\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\" height=\"100%\"><tr><td valign=\"middle\">"
			}
			if (mode==1){
				outText="</td></tr></table>"
			}
		document.write(outText)
	}
} // End fuctionIEVcenter


function BuildIframe(objectName){
	var locBox=getObj(objectName);
	var OutText=""

/* STEP 1  -- Assemble Nessesary Info */
          if (!document.layers){
          		isNS=0;
          		locBox.code.open.start = "<iframe name=\""+locBox.name+"Iframe\" id=\""+locBox.name+"Iframe\" "
          		locBox.code.open.border = " frameborder=\"" + 0 + "\""
          		locBox.code.open.scrolling=" scrolling=\"auto\""
          		locBox.code.open.clip = "" 
          		locBox.code.open.width = " width=\"" + locBox.width + "\""

          myH=locBox.height+2
          		locBox.code.open.height = " height=\"" + myH + "\""
          		locBox.close="</iframe>"

          	locBox.code.open.src = " SRC=\"" + locBox.Basehref+locBox.src + "\""
          	locBox.code.open.end = " name=\"content\">\n"

/* STEP 2  -- PREPARE FOR OUTPUTTING TO DOCUMENT */
          		OutText+=locBox.code.open.start
          		OutText+=locBox.code.open.border
          		OutText+=locBox.code.open.clip
          		OutText+=locBox.code.open.width
          		OutText+=locBox.code.open.height
          		OutText+=locBox.code.open.src
          		OutText+=locBox.code.open.scrolling
          		OutText+=locBox.code.open.end
          		OutText+=locBox.close
	} 

return(OutText)
} // END OF FUNCTION  - BuildIEIframe()