// jscript.js
// Weblink
// Created: 10/9/99
// Purpose: Capture all javascript into one file to maximize reuse
//          and minimize complexity
//
// URL Assignments
   var tocUrl = "-toc.html";
   var previewUrl = "-preview.html";

// Email address for all comments and reviews to be sent to
  var emailAddr = "mirlag@speechbooks.com";
  var infoAddr = "info@speechbooks.com";

// Boolean flags that indicate browser type and ability to show popup menus.
var gIsIE4   = false;
var gIsIE4up = false;	// For IE functions that work with IE4 or greater
var gIsIE5   = false;	// For IE functions that work with IE5
var gIsIE5up = false;	// For IE functions that work with IE5 or greater
var gIsNS4   = false;
var gIsNS4up = false;	// For NS functions that work with NS4 or greater
var gIsNS5   = false;	// For NS functions that work with NS5
var gIsNS5up = false;	// For NS functions that work with NS5 or greater

// Get Browser Name and Version then set Browser variables 
function browserID()
{
	var browserName = navigator.appName.toLowerCase();
	var browserAgent = navigator.userAgent.toLowerCase();
      var vers = navigator.appVersion;
	var major = parseInt(vers);
	var minor = parseFloat(vers);

   if ( browserName == "netscape" ) {
		if ( major >= 4 ) {
			gIsNS4up = true;
      	if ( major == 4 ) {
         	gIsNS4 = true;
      	}
		} else {
			alert ("Non-supported version of Netscape being used.");
		}
   } else if ( browserName == "microsoft internet explorer" ) {
		if ( major >= 4 ) {
			gIsIE4up = true;
      	if (( major == 4 ) && ( browserAgent.indexOf("msie 5.0") == -1 )) {
         	gIsIE4 = true;
      	} else {
      		gIsIE5 = true;
      	}
		} else {
			alert ("Non-supproted version of Internet Explorer being used.");
		}
   } else {
		alert (browserName + " is a non-supported browser.  \n" + 
		"Compass supports Netscape and Microsoft Internet Explorer.");
	}
}

function OpenNewWindow( url, name, opts )
{
   if ( opts == null ) {
      opts = "width=600,height=400,resizable,toolbar,location,scrollbars";
   }
   if ( name == null ) {
      name = "Ordering";
   }
   if ( gIsIE4up ) {
      opts = opts + ",left=30,top=30";
   } else {
      opts = opts + ",screenX=30,screenY=30";
   }
   ordering = window.open( url, name, opts );
   ordering.focus();
}
//
// The WriteFooter function will write the copyright information on the bottom of every page.
//
function WriteFooter()
{
  document.write( '<TABLE><TR><TD><FONT FACE="Lucida Sans Unicode" SIZE=1 COLOR="#000000"> \
                   Site developed by <a href="mailto:webbies@home.com">Weblink</a> \
                   All site contents © GerstenWeitz Publishers.</TD> \
                   </TR></TABLE> ' );
}
//
// The WriteNav function will create the buttons on the left hand side of every page
//  These buttons are for navigation of the site.
//
function WriteNav()
{
  document.write( '<TD WIDTH="115" VALIGN="TOP"> \
    <a href="book.html"><img src="images/offbutton-book.gif" border=0 alt="Book Index"></a><br> \
    <a href="order.html"><img src="images/offbutton-order.gif" border=0 alt="Order Books"></a><br> \
    <a href="author.html"><img src="images/offbutton-author.gif" border=0 alt="Mirla G. Raz"></a><br> \
    <a href="keepup.html"><img src="images/offbutton-keepup.gif" border=0 alt="Keep Up with Mirla"></a><br> \
    <a href="qa.html"><img src="images/offbutton-qa.gif" border=0 alt="Questions and Answers"></a><br> \
    <a href="other.html"><img src="images/offbutton-other.gif" border=0 alt="Other great references"></a> \
    <a href="contactus.html"><img src="images/offbutton-contactus.gif" border=0 alt="Contact Us"></a> \
    <br><br><center> \
    <a href="index.html"><img src="images/home.gif" border=0 alt="Home"></a></center></TD>' );
}
//
// The WriteNav function will create the buttons on the left hand side of every page
//  These buttons are for navigation of the site.
//
function WriteExtendedNav( book )
{
  document.write( '<TD WIDTH="115" VALIGN="TOP"> \
    <a href="book.html"><img src="images/offbutton-book.gif" border=0 alt="Book Index"></a><br> \
    <a href="order.html"><img src="images/offbutton-order.gif" border=0 alt="Order Books"></a><br> \
    <a href="author.html"><img src="images/offbutton-author.gif" border=0 alt="Mirla G. Raz"></a><br> \
    <a href="keepup.html"><img src="images/offbutton-keepup.gif" border=0 alt="Keep Up with Mirla"></a><br> \
    <a href="qa.html"><img src="images/offbutton-qa.gif" border=0 alt="Questions and Answers"></a><br> \
    <a href="other.html"><img src="images/offbutton-other.gif" border=0 alt="Other great references"></a> \
    <a href="contactus.html"><img src="images/offbutton-contactus.gif" border=0 alt="Contact Us"></a> \
    <br><br><center> \
    <a href="index.html"><img src="images/home.gif" border=0 alt="Home"></a><br><br> \
    <a href="' + book + '-toc.html"><img src="images/button-toc.gif" border=0></a><br><br> \
    <a href="' + book + '-preview.html"><img src="images/button-preview.gif" border=0></a><br><br> \
    <a href="' + book + '-review.html"><img src="images/button-review.gif" border=0></a></center></TD>' );
}

function WriteEmailAddr(subjectText, displayText, from)
{
  if (from == '') 
  { 
   from = 'none';
  }
  if (from == 'qa') 
  {
   document.write( '<a href="mailto:' + infoAddr + '?subject=' + subjectText + '">' + displayText );
  } else {
   document.write( '<a href="mailto:' + emailAddr + '?subject=' + subjectText + '">' + displayText );
  }
}
