function nihongo(){
  currenturl=location.href;
  if (currenturl.slice(currenturl.length-5,currenturl.length-4)=='s') {
  currenturl=currenturl.slice(0,currenturl.length-6);
  window.location=currenturl+"-j.shtml";
  }
  else {
  currenturl=currenturl.slice(0,currenturl.length-5);
  window.location=currenturl+"-j.html";
  }

}

function english(){
  currenturl=location.href;
  if (currenturl.slice(currenturl.length-5,currenturl.length-4)=='s') {
  currenturl=currenturl.slice(0,currenturl.length-8);
  window.location=currenturl+".shtml";
  }
  else {
  currenturl=currenturl.slice(0,currenturl.length-7);
  window.location=currenturl+".html";
  }
}

function lightupgreen(imgName){ 
  if (document.images){ 
  imgOn=eval(imgName + "green.src"); 
  document[imgName].src= imgOn; 
  chalkboardon(imgName);
  } 
} 

function lightuporange(imgName){ 
  if (document.images){ 
  imgOn=eval(imgName + "orange.src"); 
  document[imgName].src= imgOn; 
  chalkboardon(imgName);
  } 
} 

function lightuppurple(imgName){ 
  if (document.images){ 
  imgOn=eval(imgName + "purple.src"); 
  document[imgName].src= imgOn; 
  chalkboardon(imgName);
   } 
} 

function turnoff(imgName){ 
  if (document.images){ 
  imgOff=eval(imgName + "off.src"); 
  document[imgName].src= imgOff; 
  chalkboardoff();
  }
} 

function clickdowngreen(imgName){ 
  if (document.images){ 
    imgDown=eval(imgName + "downgreen.src"); 
    document[imgName].src=imgDown; 
    } 
  } 

function clickdownorange(imgName){ 
  if (document.images){ 
    imgDown=eval(imgName + "downorange.src"); 
    document[imgName].src=imgDown; 
    } 
  } 

function clickdownpurple(imgName){ 
  if (document.images){ 
    imgDown=eval(imgName + "downpurple.src"); 
    document[imgName].src=imgDown; 
    } 
  } 

function chalkboardon(msgName){
  if (document.images){
    chalkName=eval(msgName+"chalk.src");
    document.chalkboard.src=chalkName
    }
  }

function chalkboardoff(){
  if (document.images){
    chalkName="graphics/chalkboard.jpg";
    document.chalkboard.src=chalkName
    }
  }

function showphoto(photoName,photoCaption,photoOrient,Linesoftext){
  if (document.images){
    if (!Linesoftext){
      Linesoftext='1';
      }
    if (photoOrient=='h'){
      xpos=150;
      ypos=25;
      winheight=412+(browserName=="Microsoft Internet Explorer")*20+(Linesoftext*12);
      winwidth=570;
      tablewidth=560;
      photoheight=367;
      photowidth=550;
      }
      else{
        if (photoOrient=='s'){
          xpos=150;
          ypos=5;
          winheight=494+(browserName=="Microsoft Internet Explorer")*20+(Linesoftext*12);
          winwidth=470;
          tablewidth=460;
          photoheight=450;
          photowidth=450;
          }
          else{
          xpos=250;
          ypos=5;
          winheight=495+(browserName=="Microsoft Internet Explorer")*20+(Linesoftext*12);
          winwidth=340;
          tablewidth=310;
          photoheight=450;
          photowidth=300;
          }
        }
      var photowindow = window.open('','Photo','screenX=' + xpos + ',screenY=' + ypos + ',left=' + xpos + ',top=' + ypos + ',width=' + winwidth + ',height=' + winheight + ',resizable=no,scrollbars=no,toolbar=no,directories=no,status=no,menubar=no');

      photowindow.document.write ("<HTML><HEAD><meta http-equiv='Content-Type' content='text/html; charset=iso-8859-1'><TITLE>Photo Window</TITLE></HEAD><BODY bgcolor='#400000' onBlur='javascript:window.close()'><center><table border='0' cellpadding='0' cellspacing='5' width='" + tablewidth + "'><tr><td align='center'><font color='#FFFFFF' size=-3>" + photoCaption+ "</font></td></tr><tr><td align='center'><img src = '" + domain + photoName + ".jpg' height=" + photoheight + "width=" + photowidth + "></td></tr><tr><td align='center'><img src='graphics/close.gif' onclick='window.close()'></td></tr></table></center><br><br><br><br><br><br></BODY>");

      photowindow.document.close();

      photowindow.resizeTo(winwidth+20,winheight+20);

      return true;

    }
  }

function HttpRequest(url){
var pageRequest = false //variable to hold ajax object
/*@cc_on
   @if (@_jscript_version >= 5)
      try {
      pageRequest = new ActiveXObject("Msxml2.XMLHTTP")
      }
      catch (e){
         try {
         pageRequest = new ActiveXObject("Microsoft.XMLHTTP")
         }
         catch (e2){
         pageRequest = false
         }
      }
   @end
@*/

if (!pageRequest && typeof XMLHttpRequest != 'undefined')
   pageRequest = new XMLHttpRequest()

if (pageRequest){ //if pageRequest is not false
   pageRequest.open('GET', url, false) //get page synchronously 
   pageRequest.send(null)
   embedpage(pageRequest)
   }
}

function embedpage(request){
//if viewing page offline or the document was successfully retrieved online (status code=2000)
if (window.location.href.indexOf("http")==-1 || request.status==200)
   document.write(request.responseText)
}

function clientSideInclude(id,url) {
  var req = false;
  // For Safari, Firefox, and other non-MS browsers
  if (window.XMLHttpRequest) {
    try {
      req = new XMLHttpRequest();
    } catch (e) {
      req = false;
    }
  } else if (window.ActiveXObject) {
    // For Internet Explorer on Windows
    try {
      req = new ActiveXObject("Msxml2.XMLHTTP");
    } catch (e) {
      try {
        req = new ActiveXObject("Microsoft.XMLHTTP");
      } catch (e) {
        req = false;
      }
    }
  }
 var element = document.getElementById(id);
 if (!element) {
  alert("Bad id " + id + 
   "passed to clientSideInclude." +
   "You need a div or span element " +
   "with this id in your page.");
  return;
 }
  if (req) {
    // Synchronous request, wait till we have it all
    req.open('GET', url, false);
    req.send(null);
    element.innerHTML = req.responseText;
  } else {
    element.innerHTML =
   "Sorry, your browser does not support " +
      "XMLHTTPRequest objects. This page requires " +
      "Internet Explorer 5 or better for Windows, " +
      "or Firefox for any system, or Safari. Other " +
      "compatible browsers may also exist.";
  }
}
