if (GetCookie('vidsize')==''||GetCookie('vidsize')==null){SetCookie('vidsize',2)}

var onNm = GetCookie("OnNm");
if (onNm!=""&&onNm!=null){logged_in=true}

if (location.href.indexOf("moreaccess") == -1) {
	SetCookie('RtnURL', '');	// clear the last page requested
}

if (logged_in != true) {
	location.replace("/websterworld/localassets/html/moreaccess.html");
}

var ts=""
var ss=""
var isteps=0
if ((typeof mtype)=="undefined"){mtype=0}

function getRandom(){}

function ranoa(picfile,sx,sy,cap,hpage){
	this.picfile=picfile
	this.sx=sx
	this.sy=sy
	this.cap=cap
	this.hpage=hpage
}

if (theheading.substr(theheading.length-1, 1)==")"&&theheading.substr(theheading.length-5, 1)=="("){theheading=theheading.substr(0,theheading.length-5)}

d=document
var topfive=''

function psi2(fname,wid,hit,cap,link){
	if (link.indexOf(".")>-1&&link.indexOf("?")==-1){
		if (document.all){link=link.replace(".","")}
		link=link+".html"
		link=link.replace("html.html",".html")
		link=link.replace("..html",".html")
	}
	cap=fur(cap,"¿","'")
	return "<table border=1 bordercolor=#ff8c00 bordercolorlight=#ffd700 bordercolordark=#ff8c00 cellspacing=0 cellpadding=0 width=80 height="+hit+"><td width=100% bgcolor=white align=center valign=middle><A HREF='" + link + "'><IMG BORDER=0 SRC=" + fname + " WIDTH=" + wid + " HEIGHT=" + hit+ "></A></td></table><TABLE WIDTH=100% border=0 cellspacing=0 cellpadding=0><td valign=top align=center><p class=caption>" + cap + "<BR>&nbsp;<BR></td></table>"
}

function doIndex(){
	d.write("</tr><tr><td colspan='2'>&nbsp;</td><td><TABLE width=100%><tr><td><P class=smaller><A NAME='bot'><SPAN class=smallerbold>Contents Pages:</SPAN></A><BR>• ")
	ccount="#FF0000"
	for (ii=0;ii<isteps.length;ii++){
		if (ccount=="#FF0000"){
			ccount="#003366"
		} else {
			ccount="#FF0000"
		}
		tlink="c"+chap+"_"+mtype+(ii+1)+".html"
		isteps[ii]=isteps[ii].replace(" ","")
		isteps[ii]=isteps[ii].replace("'","")
		isteps[ii]=isteps[ii].replace(",","")
		isteps[ii]=isteps[ii].replace("-","'—'")
		isteps[ii]="'" + isteps[ii]+"'"
		if (ii!=cp-1){
			d.write("<A HREF='" + tlink + "'><FONT COLOR=" + ccount + ">" + (ii+1) + "&nbsp;("+isteps[ii]+")</FONT></A> • ")
		} else {
			d.write((ii+1) + "&nbsp;("+isteps[ii]+") • ")
		}
	}
	d.write('</td><td>&nbsp;</td></tr></table></td></tr>')
}

function CheckFull(){
}

function topFive(){
	getTopFive()
	if (mtype!="-5"){
		if (theheading=="Main Contents"||theheading=="Contents"){
			if (topfive!=""){topfive='<P class=captionwhite>Featured Topics:</P>'+topfive}
		}else{
			topfive='<P class=captionwhite>Popular Titles:</P><BR>'+topfive
		}
	}
	return topfive
}
function addpixels(pixels){
	return ''
// (2005)	return '<IMG SRC="/websterworld/images/spacer.gif" width=1 height='+pixels+'><BR>'
}
function loadbigversion(fname, caption){
	if (location.protocol=="file:"){
		var baseref1=location.pathname.substring(0,location.pathname.lastIndexOf("\\"))
		baseref1=baseref1.substring(0,baseref1.lastIndexOf("\\"))
	}else{
		var baseref1=location.pathname.substring(0,location.pathname.lastIndexOf("/"))
		baseref1=baseref1.substring(0,baseref1.lastIndexOf("/"))
	}
	elementstring="?te="+fname
	elementstring=elementstring+"?"
	elementstring=elementstring+"efname="+efname.toLowerCase() + "?"
	hrefstring="../largersize.html?" + "thetitle="+escape(thetitle)+ "?thesection="+escape(thesection)+ "?theheading="+escape(theheading)+elementstring
	if (location.href.indexOf("largersize.html")>-1||caption=="no"){hrefstring=hrefstring.substring(3,hrefstring.length)}
	location.href=hrefstring + "br=" + baseref1 + "?"
}

function loadbigversion2(fname, caption, heading, js){
	theheading=heading
	efname=js
//	if (logged_in==true||location.protocol=="file:"){
		loadbigversion(fname,caption)
//	}else{
//		location.href="/support/login.html"
//	}
}

function loadlink(ljs){
	if (theheading=="Contents"||theheading=="Main Contents"||thesection=="Special"){
		if (ljs=="contents.html"){
			location.href= "index.html"
		}else{
			location.href= ljs
		}
	}else {
		addto=ljs.substring(0,1)
		if (location.href.indexOf("largersize.html")>-1){
			if (ljs=="contents.html"){
				location.href="index.html"
			} else {
				if (addto=="."){
					location.href=ljs.replace("../","")
				}else{
					location.href=addto + "/" + ljs
				}
			}
		} else {
			if (ljs=="contents.html"){
				location.href="../index.html"
			} else {
				if (addto=="."){
					location.href=ljs
				}else{
					location.href="../" + addto + "/" + ljs
				}
			}
		}
	}
}

function displayThumbnails(){
	if (mmelements.length<2&&maincaption==""){
		d.write("<td width=0 valign=top align=center>")
		return
	}
	if (mmelements.length==1&&mmelements[0].filename.indexOf(".spr")>-1){
		d.write("<td width=0 valign=top align=center>")
		return
	}
	if (location.href.indexOf("largersize.html")>-1&&mmelements.length<2){
		d.write("<td width=0 valign=top align=center>")
		return
	}
	if (mmelements.length==0){
		d.write("<td width=0 valign=top align=center>")
		return
	}
	d.write("<td width=105 valign=top align=center>")
	d.write(addpixels(10))
	d.write('<IMG SRC="/websterworld/images/invisible.gif" width=1 height=1><BR>')
	if (mmelements[0].filename.indexOf(".spr")>-1){return}
	if (mmelements[0].filename.indexOf("cht.")>-1&&mmelements.length==1&&maincaption==""){return}
	if (fname.indexOf(".asf")>-1){fname=fname.slice(0,-3) + "avi"}
	if (maincaption==""){
		fname = mmelements[0].filename
		if (mmelements[0].multi.indexOf(".avi")>-1){fname = mmelements[0].multi}
		if (mmelements[0].multi.indexOf(".wav")>-1){fname = mmelements[0].multi}
		if (mmelements[0].multi.indexOf(".mid")>-1){fname = mmelements[0].multi}
	}
	d.write('<P class=captionwhite>Click on an image to enlarge:</P>')
	for (i=0; i < mmelements.length; i++){
		if (typeof(mmelements[i])=="undefined") break;	// in case the defined array count is greater than the actual number of elements
		
		if (mmelements[i].filename.indexOf(".jpg")>-1){
			if (mmelements[i].filename.indexOf("mapl/")>-1){
				ti='../pics/small/mapl/maplwmap.jpg'
				mmelements[i].smallx = '80'
				mmelements[i].smally = '59'
			}else{
				ti='../pics/small/'+mmelements[i].filename
			}
		}
		if (mmelements[i].filename.indexOf(".gif")>-1){ti='../pics/small/'+mmelements[i].filename}
		if (mmelements[i].filename.indexOf(".avi")>-1||mmelements[i].multi.indexOf(".avi")>-1){ti='/websterworld/images/movie.jpg'}
		if (mmelements[i].filename.indexOf(".wav")>-1||mmelements[i].multi.indexOf(".wav")>-1){ti='/websterworld/images/audio.jpg'}
		if (mmelements[i].filename.indexOf(".mid")>-1||mmelements[i].multi.indexOf(".mid")>-1){ti='/websterworld/images/audio.jpg'}
		if (mmelements[i].filename.indexOf(".spr")>-1){
			ti='/websterworld/images/table.jpg'
		}
		if (mmelements[i].filename.indexOf("cht.")>-1){ti='/websterworld/images/chart.jpg'}
		if (ti=='/websterworld/images/chart.jpg' || ti=='/websterworld/images/table.jpg' || ti=='/websterworld/images/audio.jpg' || ti=='/websterworld/images/movie.jpg'){
			mmelements[i].smallx = '80'
			mmelements[i].smally = '58'
		}
		if ((location.href.indexOf("largersize.html")>-1) && (mmelements[i].filename!=0)) {ti=ti.substring(3,ti.length)}	// don't trim placeholder images (movie.jpg etc.)
		actualfile = mmelements[i].filename
		if (mmelements[i].multi.indexOf(".avi")>-1||mmelements[i].multi.indexOf(".wav")>-1||mmelements[i].multi.indexOf(".mid")>-1){actualfile=mmelements[i].multi}
		if (actualfile==fname){
			inum=i
			d.write("<table border=1 bordercolor=#006699 bordercolorlight=#006699 bordercolordark=#006699 cellspacing=0 cellpadding=0><td>")
			if (mmelements[i].smallx==0){
				d.write("<IMG SRC=" + ti + "></td></table>")
			}else{
				d.write("<IMG SRC=" + ti + " WIDTH=" + mmelements[i].smallx + " HEIGHT=" + mmelements[i].smally + "></td></table>")
			}
		} else {
			d.write("<table border=1 bordercolor=#ff8c00 bordercolorlight=#ffd700 bordercolordark=#ff8c00 cellspacing=0 cellpadding=0><td>")
			if (mmelements[i].smallx==0){
				d.write("<A HREF=\"javascript:(loadbigversion('" + actualfile + "','" + mmelements[i].caption + "'))\"><IMG SRC=" + ti + " BORDER=0></A></td></table>")
			}else{
				d.write("<A HREF=\"javascript:(loadbigversion('" + actualfile + "','" + mmelements[i].caption + "'))\"><IMG SRC=" + ti + " WIDTH=" + mmelements[i].smallx + " HEIGHT=" + mmelements[i].smally + " BORDER=0></A></td></table>")
			}
		}
		thecaption=fur(mmelements[i].caption,"¿","'")
		creditpos=thecaption.indexOf("<H1>")
		if (creditpos>0){thecaption=thecaption.substr(0,creditpos)}
		creditpos=thecaption.indexOf("<P>")
		if (creditpos>0){thecaption=thecaption.substr(0,creditpos)}
		if (thecaption.length>60){
			if (actualfile==fname){
				thecaption=thecaption.substr(0,60)+"..."
			}else{
				thecaption=thecaption.substr(0,60)+"... <A HREF=\"javascript:(loadbigversion('" + actualfile + "','" + mmelements[i].caption + "'))\">(more)</A>"
			}
		}
		d.write("<TABLE WIDTH=100% border=0 cellspacing=0 cellpadding=0><td valign=top align=center><p class=caption>" + thecaption + "<BR>&nbsp;<BR></td></table>")
	}	// for
}

function showstat(thetext){
	window.status=thetext
}
function setTitle(){
	hashpos = (location.pathname.indexOf("/",2))
	ctitle = location.pathname.substring(1,hashpos)
	SetCookie('current',ctitle)
}

function MarkSearch(sw, themaintext, sType){
	var searcharray = new Array();

	re = new RegExp('"', "ig");
	sw = sw.replace(re, '');
		
	if (sType=="exactphrase") {
		searcharray[0] = sw;
	} else {
		searcharray = sw.split(" ");
	}

	for(var i = 0; i < searcharray.length; i++)
	{
		sw = searcharray[i];
		
    // "\s" Matches any white space including space, tab, form-feed, etc. Equivalent to "[ \f\n\r\t\v]".
		// "\b" Matches a word boundary, that is, the position between a word and a space.
		sw2 = "\\b(" + sw + ")\\b";
		re = new RegExp(sw2, "ig");
		themaintext = themaintext.replace(re, "<FONT COLOR='#FF0000'><B>$1</B></FONT>");
	}
	return themaintext;
}

function mainText(themaintext){
	setTitle()
	if (mmelements.length==0||(location.href.indexOf("largersize.html")>-1&&mmelements.length<2)||(themaintext==""&&mmelements.length<2)){
		d.write("</td><td width=* valign=top align=left>")
	}else{
		d.write("</td><td width=2 bgcolor=#006699><IMG SRC='/websterworld/images/invisible.gif' width=1 height=1></td><td width=* valign=top align=left>")
	}
	//contents string

	arts= "../c" + ilevel.substring(0,2)+"_01.html?ts=" + ilevel
	arts=arts.replace("__","_")

	if (thesection!="Video of the Day"){
		if ((thetitle=="WebsterWorld Mini Documentaries")||(thetitle.indexOf("Webster's World Almanac",0)==0)) {
			d.write(addpixels(8))
			d.write("<P class=tablenogap><A HREF='/websterworld/localassets/html/home.htm'>WebsterWorld</A> - " + "<A HREF=\"javascript:(loadlink('" + "contents.html" + "'))\" onFocus='this.blur()'>" + thetitle + "</A><BR>"+addpixels(10))
		}else{
			if ((thetitle!="My Project")&&(thetitle!="sample page")){
				d.write(addpixels(8))
				d.write("<P class=tablenogap><A HREF='/websterworld/localassets/html/home.htm'>WebsterWorld</A> - " + "<A HREF=\"javascript:(loadlink('" + "contents.html" + "'))\" onFocus='this.blur()'>" + thetitle + "</A> - " + "<A HREF=\"javascript:(loadlink('" +arts+ "'))\" onFocus=\"this.blur()\">" + "Section Index" + "</A></P>"+addpixels(10))
			}else{
				d.write(addpixels(0))
			}
		}
	}else{
		d.write(addpixels(10))
	}

	// highlight the search text
	sw = returnParameter(location.search,"searchword")
	sType = returnParameter(location.search,"searchtype")
	if (sw!='') themaintext = MarkSearch(sw, themaintext, sType);

	// World Ency codes:
	themaintext=fur(themaintext,"DT1 ","Born ");
	themaintext=fur(themaintext,"DT2 ","Died ");
	themaintext=fur(themaintext,"DT ","Lived ");
	var re = /EN /;
	themaintext = themaintext.replace(re, "");
//	themaintext=fur(themaintext,"PN [","Pronounced [");
	themaintext=fur(themaintext,"<P>BK Biog99<P>","<P>");
	themaintext=fur(themaintext,"<P>BK Biog99n<P>","<P>");
	themaintext=fur(themaintext,"<P>BK Geog99<P>","<P>");
	themaintext=fur(themaintext,"<P>BK c<P>","<P>");
	themaintext=fur(themaintext,"<P>BK g<P>","<P>");
	themaintext=fur(themaintext,"<P>BK Scie<P>","<P>");
	themaintext=fur(themaintext,"<P>BK AND<P>","<P>");
	themaintext=fur(themaintext,"<P>BK bg p<P>","<P>");
	themaintext=fur(themaintext,"<P>BK f<P>","<P>");
	themaintext=fur(themaintext,"<P>BK r<P>","<P>");
	themaintext=fur(themaintext,"XCY y","");
	themaintext=fur(themaintext,"EN ","");
	themaintext=fur(themaintext,"HS ,","");
	themaintext=fur(themaintext,"¿¿","\"");
	// *****************

	themaintext=fur(themaintext,"%%","")
	themaintext=fur(themaintext,"<FONT COLOR='#FF0000'><B><FONT COLOR='#FF0000'><B>","<FONT COLOR='#FF0000'><B>")
	tempsection=fur(thesection,"'","¿")
	themaintext=fur(themaintext,"</A> .","</A>. ")
	themaintext=fur(themaintext,"</A> ¿s","</A>¿s")
	themaintext=fur(themaintext,"F?</FONT>","·")
	if (document.layers){
		themaintext=fur(themaintext,"</A>. s","</A>'s")
	}
	if (thesection=="Webster's World of Poetry"){
		themaintext=fur(themaintext,"<p><P>","<p>")
		themaintext=fur(themaintext,"<P>","<BR>")
		themaintext=fur(themaintext,"<p>","<P>" + addpixels(3) + "<P>")
	}
	//set up bottom link
	pagelinks=""
	pagelinksbot=""
	ppage=""
	npage=""
	if (prevpage!=""){ppage=" <B>Previous</B> <A HREF=\"javascript:(loadlink('" + prevpage + "'))\"><IMG border=0 align=absmiddle SRC='/websterworld/images/previous_button.gif' width=25 height=25 alt='Go to previous page'></A>"}
	if (nextpage!=""){npage="<A HREF=\"javascript:(loadlink('" + nextpage + "'))\"><IMG align=absmiddle border=0 SRC='/websterworld/images/next_button.gif' width=25 height=25 alt='Go to next page'></A> <B>Next</B>&nbsp;"}
	ttop="<B>Top</B> <A HREF='#top'><IMG border=0 align=absmiddle SRC='/websterworld/images/top_button.gif' width=25 height=25 alt='Go to top of page'></A>"
	if (ppage!=""&&npage!=""){ppage=ppage+ " "}

	//top of page link
	d.write("<A NAME='pictop'></A>")

	if (location.href.indexOf("largersize.html")>-1){
		//fix caption display
		themaintext=fur(themaintext,"<H1>","</P><P class=H1BLUE>")
		themaintext=fur(themaintext,"</H1>","</P>")
		ttheading=efname+".html"
		ppage=""
		npage=""

		//check how many elements
		if (mmelements.length>1){
			if (inum==0){previnum=mmelements.length-1}else{previnum=inum-1}
			if (inum==mmelements.length-1){nextinum=0}else{nextinum=inum+1}
			actualfile = mmelements[previnum].filename
			element = "Image"
			if (mmelements[previnum].multi.indexOf(".avi")>-1){
				actualfile=mmelements[previnum].multi
				element = "Movie"
			}
			if (mmelements[previnum].multi.indexOf(".wav")>-1||mmelements[previnum].multi.indexOf(".mid")>-1){
				actualfile=mmelements[previnum].multi
				element = "Sound"
			}
			ppage=" <B>Previous</B> <A HREF=\"javascript:(loadbigversion('" + actualfile + "','" + mmelements[previnum].caption + "'))\" onMouseOut='return showstat(\"\")' onmousemove=\"return showstat('Previous')\"><IMG border=0 align=absmiddle SRC='/websterworld/images/previous_button.gif' width=25 height=25></A>"
			actualfile = mmelements[nextinum].filename
			element = "Image"
			if (mmelements[nextinum].multi.indexOf(".avi")>-1){
				actualfile=mmelements[nextinum].multi
				element="Movie"
			}
			if (mmelements[nextinum].multi.indexOf(".wav")>-1||mmelements[nextinum].multi.indexOf(".mid")>-1){
				actualfile=mmelements[nextinum].multi
				element="Sound"
			}
			npage="<A HREF=\"javascript:(loadbigversion('" + actualfile + "','" + mmelements[nextinum].caption + "'))\" onMouseOut='return showstat(\"\")' onmousemove=\"return showstat('Next')\"><IMG align=absmiddle border=0 SRC='/websterworld/images/next_button.gif' width=25 height=25></A> <B>Next</B>&nbsp;"
		}
		if (ppage!=""&&npage!=""){ppage=ppage+ " "}

		d.write("<P class=h3>Return to " + "<A HREF=\"javascript:(loadlink('" + ttheading + "'))\">" + theheading + "</A></P>")
	}else{
		d.write("<P class=h4>" + theheading + "</P>")
	}
	if (mmelements.length>0){
		if (mmelements[0].filename.indexOf(".spr")>-1){
			mmelements[0].caption = mmelements[0].caption.replace("WIDTH=435","WIDTH=90%")
			if (themaintext==''){
				themaintext = "<BR><center>" + mmelements[0].caption + "</center>"
			} else {
				themaintext = "<BR><center>" + mmelements[0].caption + "</center><P>" + themaintext
			}
		}
		themaintext=fur(themaintext,"<P><P>","<P>")
		if (themaintext.length<10){
			mmelements[0].caption=fur(mmelements[0].caption,"<H1>","<P class=H1BLUE>")
			if (mmelements[0].multi=="0"||mmelements[0].multi==""){
				//mmelements[0].caption=fur(mmelements[0].caption,"<H1>","<P class=H1BLUE>")
				mmelements[0].caption=fur(mmelements[0].caption,"</H1>","</P>")
				if (location.href.indexOf("largersize.html")>-1){
					themaintext = addpixels(6)+"<center><table border=1 bordercolor=#ff8c00 bordercolorlight=#ffd700 bordercolordark=#ff8c00 cellspacing=0 cellpadding=0><td><img src='"+"pics/"+mmelements[0].filename+"' WIDTH=" + mmelements[0].bigx + " HEIGHT=" + mmelements[0].bigy + "'></td></table><p class=bigcap>" + mmelements[0].caption + "<center>"
				}else{
					themaintext = addpixels(6)+"<center><table border=1 bordercolor=#ff8c00 bordercolorlight=#ffd700 bordercolordark=#ff8c00 cellspacing=0 cellpadding=0><td><img src='"+"../pics/"+mmelements[0].filename+"' WIDTH=" + mmelements[0].bigx + " HEIGHT=" + mmelements[0].bigy + "'></td></table><p class=bigcap>" + mmelements[0].caption + "<center>"
				}
			} else {
				if (mmelements[0].multi.indexOf('.avi')>0||mmelements[0].multi.indexOf('.wav')>0||mmelements[0].multi.indexOf('.mid')>0){
					//mmelements[0].caption=fur(mmelements[0].caption,"<H1>","<P class=H1BLUE>")
					mfname = mmelements[0].multi
					oldfname=mfname
					if (mmelements[0].multi.indexOf('.avi')>0){mfname="movies/"+mfname}
					if (mmelements[0].multi.indexOf('.wav')>0){mfname="sounds/"+mfname}
					if (mfname.indexOf('.mid')>0){
						mfname="sounds/"+mfname
					}else{
						mfname=mfname.slice(0,-3) + "asf"
					}
					mfname = "../" + mfname
					if (oldfname.indexOf('.wav')>0||oldfname.indexOf('.mid')>0){
						if (mfname.indexOf('.asf')>0){mfname=mfname.slice(0,-3) + "mov"}
//						themaintext=addpixels(4) + "<CENTER><EMBED type='video/quicktime' AUTOPLAY='false' cache='true' pluginspage='http://www.apple.com/quicktime/download' SRC='"+mfname+"' width=240 height=30></embed><p class=bigcap>"+mmelements[0].caption + '</center>' + botadd
						themaintext=addpixels(4) + "<CENTER><OBJECT CLASSID='clsid:02BF25D5-8C17-4B23-BC80-D3488ABDDC6B' width='240' height='30' CODEBASE='http://www.apple.com/qtactivex/qtplugin.cab'><param name='type' value='video/quicktime'><param name='cache' value='true'><param name='src' value='" + mfname + "'><param name='autoplay' value='false'><embed src='" + mfname + "' cache='true' type='video/quicktime' width='240' height='30' autoplay='false' PLUGINSPAGE='http://www.apple.com/quicktime/download/'></EMBED></OBJECT><p class=bigcap>"+mmelements[0].caption + '</CENTER>' + botadd
					} else {
						if (GetCookie('vidsize')=='2'){
							nstext="<A HREF='javascript:newvidsize(2)'>Play movie at original size</A>"
							var vidsize=2
							var vwid=322
							var vhit=258
						}else{
							nstext="<A HREF='javascript:newvidsize(0)'>Play movie at double size</A>"
							var vidsize=0
							var vwid=242
							var vhit=198
						}
						mfname=mfname.slice(0,-3) + "mov"
						thecap=fur(mmelements[0].caption,"¿","")
						tbotadd="<CENTER><P class=captionblue>"+nstext+"<BR>"+addpixels(10)+"<P class=captionblue>"+botadd
//						themaintext=addpixels(4) + "<CENTER><TABLE BORDER=1 CELLSPACING=0 CELLPADDING=0><TD><EMBED name='qtime' id='qtime' type='video/quicktime' AUTOPLAY='false' scale='tofit' cache='true' pluginspage='http://www.apple.com/quicktime/download' SRC='"+mfname+"' width="+vwid+" height="+vhit+"></embed></TD></TABLE><p class=bigcap>"+mmelements[0].caption + '</CENTER>' + tbotadd
						themaintext=addpixels(4) + "<CENTER><TABLE BORDER=1 CELLSPACING=0 CELLPADDING=0><TD><OBJECT CLASSID='clsid:02BF25D5-8C17-4B23-BC80-D3488ABDDC6B' width='" + vwid + "' height='" + vhit + "' CODEBASE='http://www.apple.com/qtactivex/qtplugin.cab'><param name='type' value='video/quicktime'><param name='cache' value='true'><param name='scale' value='tofit'><param name='src' value='" + mfname + "'><param name='autoplay' value='false'><embed src='" + mfname + "' cache='true' type='video/quicktime' scale='tofit' width='" + vwid + "' height='" + vhit + "' autoplay='false' PLUGINSPAGE='http://www.apple.com/quicktime/download/'></EMBED></OBJECT></TD></TABLE><p class=bigcap>"+mmelements[0].caption + '</CENTER>' + tbotadd
					}
					haveqt = GetCookie('qtime')
					if (haveqt!='true'&&thebrowser!="ie"){
						themaintext=addpixels(4) + "<CENTER><TABLE width=320 height=240 BORDER=1 CELLSPACING=0 CELLPADDING=0><TD valign=middle align=center><A HREF='http://www.apple.com/quicktime/download'><IMG border=0 SRC='/websterworld/images/getquicktime.gif' width=88 height=31 vspace=16></A><p class=captionblue>This page requires Apple Quicktime version 4.1 or greater to run. Click on the above link to download the free Quicktime Player from Apple.<BR>"+addpixels(10)+"<p class=captionblue>QuickTime and the QuickTime Logo are trademarks of Apple Computer, Inc., registered in the U.S. and other countries. The Get QuickTime Badge is a trademark of Apple Computer Inc., used with permission.</TD></TABLE>"
					}
					if (thebrowser=="ie"){
						themaintext = "<DIV id='vidmenu' name='vidmenu' style='z-index:25;visibility:visible;'>" + themaintext + "</DIV>"
					}else{
						themaintext = "<ILAYER name='vidmenu' visibility='visible'>" + themaintext + "</ILAYER>"
					}
				}
			}
		}
	}

	//fix main caption and write it
	themaintext=fur(themaintext,"¿","'")
	if (document.layers){
		themaintext=fur(themaintext,"<B>","<SPAN class=bold>")
		themaintext=fur(themaintext,"</B>","</SPAN>")
	}
	d.write("<p>" + themaintext)

	// write related topics
	if (relateditems.length>0){
		d.write("<P class=linktext><B>Related Items:</B><BR>")
		for (i=0; i < relateditems.length; i++){
			ttheading=fr(relateditems[i].caption,"'")
			d.write("<A HREF=\"javascript:(loadlink('" + relateditems[i].link + "'))\">" + relateditems[i].caption + "</A><BR>")
		}
	}

	//page number
	if ((thetitle=="Webster's World Almanac"&&ilevel=="2_1")||thetitle=="My Project"||thetitle=="Acknowledgements"){
	}else{
		if (location.href.indexOf("largersize.html")==-1){d.write("<CENTER><P class=pagenum><I>Page " + cp + " of " + tp + "</I></center>")}
	}

	//bottom page links
	if (ppage!=""&&npage==""){ppage=ppage + "&nbsp;"}
	if (ppage==""&&npage==""){ttop=ttop + "&nbsp;"}
	if (ppage==""&&npage!=""){ttop=ttop + "&nbsp;"}
	if (location.href.indexOf("largersize.html")!=-1){ttop=""}
	pagelinksbot = "<table border=0 cellspacing=0 width=100%><tr><td align=right valign=center><p class=smallerbold>" + ttop + ppage + npage + "</td></tr></table>"
	d.write("</P>&nbsp;<BR>" + pagelinksbot + addpixels(8))

	//last column
	d.write("</td><td valign=top bgcolor = #FFFFFF width=73>")
	d.write('<IMG SRC="/websterworld/images/invisible.gif" width=73 height=1>')

	d.write("<CENTER>")
	if (thetitle!="My Project"){
		//d.write("<A HREF='javascript:addtoproject()'><IMG SRC='/websterworld/images/add_to_project.gif' border=0 width=74 height=27></A><BR>" + addpixels(6))
		d.write("<A HREF='javascript:addtofav()' title='Bookmark this page'><IMG SRC='/websterworld/images/bookmark.gif' border=0 width=74 height=27 alt='Bookmark this page'></A><BR>" + addpixels(6))
	}
	d.write("<A HREF='javascript:printit()' title='Print this page'><IMG SRC='/websterworld/images/print.gif' border=0 width=66 height=27 alt='Print this page'></A><BR>" + addpixels(6))

	//search related
	if (thetitle!="My Project"){
		if (thetitle!="Projects"){
			//d.write("<P class=smallerbold>Click <A HREF='javascript:searchrelated()'>here</A> to search for related articles.")
			d.write("<A HREF='javascript:searchrelated()' title='Find related pages'><IMG border=0 SRC='/websterworld/images/find_related.gif' width=74 height=27 alt='Find related pages'></A>")
		}
	}

	ppage = fur(ppage,">Previous",">")
	npage = fur(npage,">Next",">")
	ppage = fur(ppage,"&nbsp;","")
	npage = fur(npage,"&nbsp;","")
	d.write("<BR>" + addpixels(1) + "<BR>" + ppage + " ")
	d.write(npage) + "<BR>"

	d.write("</td>")
// (2005)	d.write("</TD></TABLE>")
	maincaption=themaintext
}

function searchrelated(){
	location.replace('/websterworld/localassets/asp/search.asp?optCriteriaVal="allwords"&target=' + theheading);
}

//write main panel stuff

panel="<TITLE>"+theheading+"</TITLE></HEAD>"

function extras(){
	sw = returnParameter(location.search,"searchword")
	re = new RegExp('"', "ig");
	sw = sw.replace(re, '');
	sw2 = sw.substr(0,1)
	sw2a=sw.substring(1,sw.length)
	sw2 = (sw2.toUpperCase()+sw2a)
	if ((sw!='')&&(document.all)) {
		var rng = document.body.createTextRange();
		if (rng.findText(sw)==true) {
		    rng.scrollIntoView();
		} else {
			if (rng.findText(sw2)==true) {
			    rng.scrollIntoView();
			}
		}
	}
}

panel=panel + '<LINK REL="SHORTCUT ICON" HREF="/myicon.ico">'
panel=panel+'<body onload="extras()" onscroll="hideall()" class="ta" bgcolor="#FFFFFF" LINK="#006699" ALINK="#006699" VLINK="#006699">'
panel=panel+'<div id="completeholder" onmousemove="hideall()">'
panel=panel+'<TABLE width=100% border=0 cellspacing=0 cellpadding=0>'
// (2005) document.write(panel)

function showthumbs(showem){
	if (showem==true){
		SetCookie('showthumbs',true)
	}else{
		SetCookie('showthumbs',false)
	}
	location.replace(location.href)
}

function addtofav(){
	if (location.href.indexOf("largersize.html")>-1){
		thepathpos = location.href.indexOf("largersize.html")
		thepath = location.href.substring(0,thepathpos)
		addto=efname.substring(0,1)
		addto = thepath + addto + "/" + efname + ".html"
	}else{
		addto = location.href
	}

	if (document.all) {
		external.AddFavorite(addto, document.title);
	}else{
		alert('Please type Ctrl-D to bookmark this page.');
	}
}

function printit(){
	window.print()
}

var helptext=addpixels(5) + "<P class=h3><b>What do the icons mean?</b></P></center>";
//<P class=smaller><img border='0' src='/websterworld/images/blue_bullet.gif' width='9' height='9'> Click on the icon below from within an article to add that article, selected text or image to your project.<BR>"+ addpixels(8) + "<CENTER><A HREF='/projectcreator/createproject.ASP?WCI=ProjectLogon'><img border='0' src='/websterworld/images/add_to_project_button.gif' width='74' height='27'></A><BR>" + addpixels(8)

helptext=helptext + "</P></center><P class=smaller><img border='0' src='/websterworld/images/blue_bullet.gif' width='9' height='9'> Click on the icon below from within an article to add that article to your bookmarks.<BR>"+ addpixels(8) + "<CENTER><A HREF='javascript:addtofav()'><IMG SRC='/websterworld/images/bookmark.gif' border=0 width=74 height=27></A><BR>" + addpixels(8)

helptext=helptext + "</P></center><P class=smaller><img border='0' src='/websterworld/images/blue_bullet.gif' width='9' height='9'> Click on the icon below to print the current article.<BR>"+ addpixels(8) + "<CENTER><A HREF='javascript:printit()'><IMG SRC='/websterworld/images/print.gif' border=0 width=66 height=27></A><BR>" + addpixels(8)

helptext=helptext + "</P></center><P class=smaller><img border='0' src='/websterworld/images/blue_bullet.gif' width='9' height='9'> Click on the icon below to search for topics related to the current article.<BR>"+ addpixels(8) + "<CENTER><A HREF='javascript:searchrelated()'><IMG border=0 SRC='/websterworld/images/find_related.gif' width=74 height=27></A>" + addpixels(8)

function setFrames(){
return;	// (2005) 
	if (top.frames.length == 0) {
		SetCookie('newURL',document.URL)
		location.replace("/support/main.html");
	}
}

if (theheading=="Contents"){
	setTitle()

	thetopfive=topFive()
	if (thetopfive!="") {
		d.write("<td width=105 valign=top align=center>")
		document.write('<IMG SRC="/images/invisible.gif" width=105 height=1>')
		d.write(addpixels(9))
		document.write(thetopfive)
		d.write("</td><td width=2 bgcolor=#006699><IMG SRC='/websterworld/images/invisible.gif' width=2 height=1></td><td width=* valign=top align=left>")
	} else {
		d.write("</td><td width=2><IMG SRC='/websterworld/images/invisible.gif' width=1 height=1></td><td width=447 valign=top align=left>") // This last td is the main body column
	}

	d.write(addpixels(8))

	//contents string
	var pn=""
	var hr=""
	var hr1=""
	if (tp>1){
		hr="<A HREF='#bot'>"
		hr1="</A>"
	}
	pn=" " + hr + "<SPAN class=pagenumwhite><I>(Page " + cp + " of " + tp + ")"+hr1+"</I></SPAN>"

	mcontent="<A HREF='c0_" + mtype + "1.html'>Full Index</A>"
	if (thesection=="Entire Title"||thesection==thetitle){
		thesection="Index"
		d.write("<P class=tablenogap><A HREF='/websterworld/localassets/html/home.htm'>WebsterWorld</A> - " + "<A HREF=\"javascript:(loadlink('" + "contents.html" + "'))\" onFocus='this.blur()'>" + thetitle + "</A> - " + thesection + pn + "</P>"+addpixels(8))
	}else{
		d.write("<P class=tablenogap><A HREF='/websterworld/localassets/html/home.htm'>WebsterWorld</A> - " + "<A HREF=\"javascript:(loadlink('" + "contents.html" + "'))\" onFocus='this.blur()'>" + thetitle + "</A> - " + mcontent + " - " + thesection + pn + "</P>"+addpixels(8))
	}

	//set heading type
	if (mtype==0){atype="Articles"}
	if (mtype==1){atype="Images"}
	if (mtype==3){atype="Videos/Sounds"}
	oldatype=atype
	thumbs=""

	//next and previous page bar
	ppage=""
	npage=""
	pagelinks=""
	prevpage=""
	nextpage=""
	if (cp>1){prevpage = "c" + chap + "_" + mtype + (cp-1) + ".html"}
	if (cp<tp){nextpage = "c" + chap + "_" + mtype + (cp+1) + ".html"}
	pagelinks1=""
	if (prevpage!=""){ppage="<A HREF=\"javascript:(loadlink('" + prevpage + "'))\"><FONT COLOR='#FFFFFF'><IMG SRC='/websterworld/images/previous_button.gif' border=0 width=25 height=25></A>"}
	if (nextpage!=""){npage="<A HREF=\"javascript:(loadlink('" + nextpage + "'))\"><FONT COLOR='#FFFFFF'><IMG SRC='/websterworld/images/next_button.gif' border=0 width=25 height=25></A>"}
	if (ppage!=""){ppage=" " + ppage}
	if (ppage!=""&&npage!=""){ppage=ppage+ " "}
	if (ppage==""&&npage!=""){npage=" " + npage}
	ttop="<A HREF='#top'><IMG SRC='/websterworld/images/top_button.gif' width=25 height=25 border=0></A>"
	pagelinks2 = "</P><table border=0 cellspacing=0 cellpadding=3 height=20 width=100%><tr><td align=right valign=center>" + ttop + ppage + npage + "</td></tr></table></td></td><td width=150 bgcolor=#D4E5E9 valign=top><table cellpadding='5'><tr><td>" + helptext + "</td></tr></table></td>" // (2005) </table>"

	//heading
	thearts="<A HREF=\"javascript:(loadlink('" + "c"+chap+"_01.html" + "'))\" onFocus=\"this.blur()\">Articles</A>"
	thepics="<A HREF=\"javascript:(loadlink('" + "c"+chap+"_11.html" + "'))\" onFocus=\"this.blur()\">Images</A>"
	thevids="<A HREF=\"javascript:(loadlink('" + "c"+chap+"_31.html" + "'))\" onFocus=\"this.blur()\">Videos/Sounds</A>"

	if (mtype==0){addto=atype + " - " + thepics + " - " + thevids}
	if (mtype==1){addto=thearts + " - " + atype + " - " + thevids}
	if (mtype==3){addto=thearts + " - " + thepics + " - " + atype}

	var columnone="<P class=h4><B>" + addto + "</B></P>"
}

if (theheading=="Main Contents"){
	setTitle()

	thetopfive=topFive()
	if (thetopfive!=""){
		d.write("<td width=105 valign=top align=center>")
		document.write('<IMG SRC="/images/invisible.gif" width=105 height=1>')
		d.write(addpixels(9))
		document.write(thetopfive)
		d.write("</td><td width=2 bgcolor=#006699><IMG SRC='/websterworld/images/invisible.gif' width=2 height=1></td><td width=* valign=top align=left>")
	}else{
		d.write("</td><td width=2><IMG SRC='/websterworld/images/invisible.gif' width=1 height=1></td><td width=* valign=top align=left>")
	}

	d.write(addpixels(8))

	//contents string
	if (thetitle.indexOf("Webster's World Almanac",0)==0) {
		d.write("<P class=tablenogap><A HREF='/websterworld/localassets/html/home.htm'>WebsterWorld</A> - " +  thetitle + "<BR>" + addpixels(8));
	} else if (thetitle!="WebsterWorld Mini Documentaries"){
		d.write("<P class=tablenogap><A HREF='/websterworld/localassets/html/home.htm'>WebsterWorld</A> - " +  thetitle + " - <A HREF='c0_01.html'>Index</A><BR>" + addpixels(8))
	}
	var titlepic=fur(thetitle," ","")
	titlepic=fur(titlepic,"'","")
	titlepic=titlepic.toLowerCase()
	var columnone="<P class=h4>" + thetitle + "</P><CENTER><IMG border=1 SRC='/websterworld/images/image_"+titlepic+".jpg' height=105 width=420></CENTER><BR>"

	helptext = "";	// helptext doesn't fit when topfive thumbsnails are showing (2006)
//	var pagelinks2="</td><td width=140 bgcolor=#D4E5E9 valign=top><table cellpadding='5'><tr><td>" + helptext + "</td></tr></table></td>"
	var pagelinks2="</td><td width=10 valign=top><table cellpadding='5'><tr><td>" + helptext + "</td></tr></table></td>"
}

if (mtype==-5){
	d.write("<td width=0 valign=top align=center></td><td width=* valign=top align=left>" + addpixels(8))

	//contents string
	var titlepic=fur(thetitle," ","")
	titlepic=fur(titlepic,"'","")
	titlepic=titlepic.toLowerCase()
	if (theheading!=""){
		var columnone="<P class=h4><B>" + theheading + "</B></P>"
	}else{
		var columnone=""
	}
	var pagelinks2="</td><td width=100 bgcolor=#D4E5E9 valign=top>" + '<IMG SRC="/images/invisible.gif" width=100 height=1>' + addpixels(2) + helptext + "</td>" // (2005) </table>"
}

if (thesection=="Special"){
	d.write("<td width=0 valign=top align=center></td><td width=* valign=top align=left>" + addpixels(8))

	//contents string
	if (theheading!=thetitle){
		d.write("<P class=tablenogap><A HREF='/websterworld/localassets/html/home.htm'>WebsterWorld</A> - " + "<A HREF='index.html'>" + thetitle + "</A> - " + theheading + "<BR>" + addpixels(10))
	}
	var titlepic=fur(thetitle," ","")
	titlepic=fur(titlepic,"'","")
	titlepic=titlepic.toLowerCase()
	var columnone="<P class=h4>" + theheading + "</p><CENTER><IMG border=1 SRC='/websterworld/images/image_"+titlepic+".jpg' height=105 width=435></CENTER><BR>"
	var pagelinks2="</td><td width=100 bgcolor=#D4E5E9 valign=top>" + addpixels(2) + '<IMG SRC="/images/invisible.gif" width=100 height=1>' + helptext + "</td>" // (2005) </table>"
} else {
	var doc_title = thetitle;
	if (thesection != thetitle) doc_title += " - " + thesection;
	if (theheading != thesection) doc_title += " - " + theheading;
	document.title = doc_title; // (Apr 2006) for bookmarks

	if (thesection.indexOf("noiconhelp")>-1) {
		d.write("<td width=0 valign=top align=center></td><td width=* valign=top align=left>" + addpixels(8))
		if (theheading!=thetitle) {
			var pathpos = thetitle.indexOf("#");
			if (pathpos>-1) {
				d.write("<P class=tablenogap><A HREF='/websterworld/localassets/html/home.htm'>WebsterWorld</A> - " + "<A HREF='" + thetitle.substr(pathpos+1) + "index.html'>" + thetitle.substring(0, pathpos) + "</A> - " + theheading + "<BR>" + addpixels(10));
			} else {
				d.write("<P class=tablenogap><A HREF='/websterworld/localassets/html/home.htm'>WebsterWorld</A> - " + "<A HREF='index.html'>" + thetitle + "</A> - " + theheading + "<BR>" + addpixels(10));
			}
		}
		var titlepic=fur(thetitle," ","")
		titlepic=fur(titlepic,"'","")
		titlepic=titlepic.toLowerCase()
		var columnone="<P class=h4>" + theheading + "</p>";
		if (thesection=="noiconhelp") {columnone+="<CENTER><IMG border=1 SRC='/websterworld/images/image_"+titlepic+".jpg' height=105 width=435></CENTER><BR>";}
		var pagelinks2="</td>" // (2005) </table>"
	}
}

