// focus used by all popupsfunction openFocus() {    window.focus();}// handle contitional link on popus opened by outside sites// variable used in all popupsvar openedByOutside = false; // openedByOutside really means opened without JS callif (opener == null) { // there's only an opener if there's a new window created by JS    this.openedByOutside = true;//} else if (!opener.openedByOutside) { // opened by outside js-- not necessary, ruins footnote    // alert("not opened by 1704");//    this.openedByOutside = true;} var switcher = "js switcher hasn't been set";// hide switcher from non-js browserfunction setSwitcher() {    // alert(" got to switcher, maybe set var, then write");    this.switcher = '<ul>' +        '<li><a href="javascript:window.print()"><img src="/mgg/common/images/icon_print.gif" alt="print" width="53" height="20" border="0" align="middle"></a></li>' +        '<li class="label">Text size: </li> ' +	        '<li id="style-left"><a href="styleswitch.html" onclick="activeCSS(\'smalltext\'); return false">A</a></li>' +        '<li id="style-mid"><a href="styleswitch.html" onclick="activeCSS(\'default\'); return false">A</a></li>' +        '<li id="style-right"><a href="styleswitch.html" onclick="activeCSS(\'largetext\'); return false">A</a></li>' +        '</ul>';}// --------------- GLOSSARY  ----------------// for each site change the hard wired site paramter  e.g. mgg// this file is site-specific i.e. /mgg/common/scripts.jsfunction glossary(shortName) {    var theURL = "/shaysapp/glossary.do?shortName=" + shortName;    window.open(theURL,'glossary','scrollbars=yes,resizable=yes,width=350,height=350')}// --------------- ARTIFACT  ----------------function artifact(shortName) {    var theURL = "/shaysapp/artifact.do?shortName=" + shortName;    window.open(theURL,'artifact','scrollbars=yes,resizable=yes,width=750,height=550,location=yes')}// --------------- PRINTABLE (HTML) SCENE   ----------------function scenehtml(shortName) {    var theURL = "/shaysapp/scenehtml.do?shortName=" + shortName ;    window.open(theURL,'scenehtml','scrollbars=yes,resizable=yes,width=650,height=550')}// --------------- SCENE LARGE VIEW   ----------------function sceneLarge(shortName) {    var theURL = "/scenes/lg_view/" + shortName + ".html" ;    window.open(theURL,'sceneLarge','scrollbars=yes,resizable=yes,width=1000,height=750')}// --------------- PERSON  ----------------function person(shortName) {    var theURL = "/shaysapp/person.do?shortName=" + shortName;    window.open(theURL,'person','scrollbars=yes,resizable=yes,width=650,height=550')}function no_observer() {    var theURL = "/scenes/no_observer.html";    window.open(theURL,'person','scrollbars=yes,resizable=yes,width=650,height=550')}// --------------- ESSAY  ----------------function essay(shortName) {    var theURL = "/shaysapp/essay.do?shortName=" + shortName;    window.open(theURL,'essay','scrollbars=yes,resizable=yes,width=650,height=550')}// --------------- MAPS   ----------------function map(shortName) {    var theURL = "/shaysapp/map.do?shortName=" + shortName ;    window.open(theURL,'map','scrollbars=yes,resizable=yes,width=770,height=650')}// --------------- MUSIC   ----------------function music(shortName) {    var theURL = "/shaysapp/music.do?shortName=" + shortName ;    window.open(theURL,'music','scrollbars=yes,resizable=yes,width=770,height=650')}// --------------- FOOTNOTES   ----------------function footnote(shortName, anchor) {    var theURL = "/shaysapp/footnote.do?shortName=" + shortName + "#" + anchor;    window.open(theURL,'footnote','scrollbars=yes,resizable=yes,width=500,height=550')}// --------------- INVESTIGATE FURTHER  ----------------function further(level, id) {    var theURL = "/stories/mgg/" + level + "/further.do?id=" + id ;    window.open(theURL,'further','scrollbars=yes,resizable=yes,width=600,height=500')}// --------------- CSS FUNCTIONS ----------------// css styleswitcher for user-controlled text sizing// activeCSS: Set the active stylesheetfunction activeCSS(title) {  var i, oneLink;  for (i = 0; (oneLink = document.getElementsByTagName("link")[i]); i++) {    if (oneLink.getAttribute("title") && findWord("stylesheet", oneLink.getAttribute("rel"))) {      oneLink.disabled = true;      if (oneLink.getAttribute("title") == title) {        oneLink.disabled = false;      }    }  }}// findWord: Used to find a full word (needle) in a string (haystack)function findWord(needle, haystack) {  return haystack.match(needle + "\\b");}// Set the cookie function setCookie(name,value,days) { if (days) {   var date = new Date();   date.setTime(date.getTime()+(days*24*60*60*1000));   var expires = ";expires="+date.toGMTString(); } else {   expires = ""; } document.cookie = name+"="+value+expires+";";}// Set the active stylesheetfunction activeCSS(title) {  var i, oneLink;  for (i = 0; (oneLink = document.getElementsByTagName("link")[i]); i++) {    if (oneLink.getAttribute("title") && findWord("stylesheet", oneLink.getAttribute("rel"))) { oneLink.disabled = true;      if (oneLink.getAttribute("title") == title) {         oneLink.disabled = false;      }    } } setCookie("mystyle", title, 365);}window.onload = initCSS;// initCSS: If there's a "mystyle" cookie, set the active stylesheet when the page loadsfunction initCSS() { var style = readCookie("mystyle"); if (style) {   activeCSS(style); }}// Read the cookiefunction readCookie(name) { var needle = name + "="; var cookieArray = document.cookie.split(';'); for(var i=0;i < cookieArray.length;i++) {   var pair = cookieArray[i];   while (pair.charAt(0)==' ') {     pair = pair.substring(1, pair.length);   }   if (pair.indexOf(needle) == 0) {     return pair.substring(needle.length, pair.length);   } } return null;}// end of style switcher code// --------------- TEMPORARY FUNCTIONS ----------------// temp - for models onlyfunction popupGlossary(theURL) {window.open(theURL,'popup','scrollbars=yes,resizable=yes,width=350,height=350')}function popupResource(theURL) {window.open(theURL,'popup','scrollbars=yes,resizable=yes,width=500,height=550')}function popupOutside(theURL) {window.open(theURL,'popup','scrollbars=yes,resizable=yes,location=yes,status=yes,menubar=yes')}function popupWindow(theURL, windowName) {    if (windowName == undefined) {        windowName = "popup";    }    window.open(theURL,windowName,'scrollbars=yes,resizable=yes,width=550,height=450')}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];}}