/**
 * subterreignmedia sitelib 1.0
 * by sysop, december 2003
 * copyright (c) 2003 subterreign media.
 *
 */


// error handling - do nothing
function stopError() {
  return true;
  }
window.onerror = stopError;


// browser detection
var isIE = (document.all) ? true : false;
var isNav = (document.layers) ? true : false;
var isOff = false;
if (navigator.appName == "Microsoft Internet Explorer" &&
navigator.appVersion.indexOf("Mac") != -1 ) { 
    var isOff = true;
}

// Defines a new image for preloading
function newImage(arg) {
    if (document.images) {
        rslt = new Image();
        rslt.src = arg;
        return rslt;
    }
}

// Preloads images (mostly nav images). 
var preloadFlag = false;
function preloadImages() {
    if (document.images) {
		samiam = newImage("/images/samiam-over.gif");
		scottreyns = newImage("/images/scottreyns-over.gif");
        preloadFlag = true;
    }
}


// open a global new browser window
//Call function example: <a href="javascript:open_details('file name here',w,h);">Hello World!</a>
function open_details(url,w,h){
	var myWindow = window.open(url, '', 'resizable=0,toolbar=0,location=0,directories=0,status=0,scrollbars=0,menubar=0,copyhistory=0, width='+w+', height='+h );
	return;
}

// opens a large (680 x 420) new browser window (without controls) for external links
var win;
function bigext(URL) {
    win = window.open(URL, "", 
    "resizable=1,toolbar=0,location=0,directories=0,status=0,scrollbars=1,menubar=0,copyhistory=0,width=680,height=420"); 
    win.location = URL;
    // win.focus();
}

// opens a general new browser window (520 x 500, without controls) for external links
var win;
function ext(URL) {
    win = window.open(URL, "", 
    "resizable=yes,resizable=1,toolbar=0,location=0,directories=0,status=0,scrollbars=1,menubar=0,copyhistory=0,width=580,height=410"); 
    win.location = URL;
    // win.focus();
}

// opens a taller new browser window (580 x 500, without controls) for external links
var win;
function tallext(URL) {
    win = window.open(URL, "", 
    "resizable=no,resizable=0,toolbar=0,location=0,directories=0,status=0,scrollbars=1,menubar=0,copyhistory=0,width=580,height=500"); 
    win.location = URL;
    // win.focus();
}


// opens a small new browser window (305 x 305, non-resizable, without controls) for external links
var win;
function smallext(URL) {
    win = window.open(URL, "", 
    "resizable=0,toolbar=0,location=0,directories=0,resizable=no,resizable=0,status=0,scrollbars=0,menubar=0,copyhistory=0,width=305,height=305"); 
    win.location = URL;
    // win.focus();
}

// opens an extra large new browser window (685 x 535, scrollable) for blog, flash, multimedia, .ppt presos or other popups
var win;
function varext(URL) {
    win = window.open(URL, "", 
    "toolbar=0,location=0,directories=0,resizable=no,status=0,scrollbars=1,menubar=0,copyhistory=0,width=685,height=535"); 
    win.location = URL;
    // win.focus();
}

// opens a thin new browser window (550 x 250, without controls) for small flash, multimedia, .ppt presos or other popups
var win;
function thinext(URL) {
    win = window.open(URL, "", 
    "resizable=1,toolbar=0,location=0,directories=0,status=0,scrollbars=0,menubar=0,copyhistory=0,width=550,height=250");
    win.location = URL;
    // win.focus();
}

// opens window for streaming mp3 player and lyrics
var win;
function mp3ext(URL) {
    win = window.open(URL, "", 
    "resizable=0,toolbar=0,location=0,directories=0,status=0,scrollbars=0,menubar=0,copyhistory=0,width=400,height=165,left=400,top=150");
    win.location = URL;
    // win.focus();
}

// opens window for streaming mp3 player and lyrics
var win;
function lyricext(URL) {
    win = window.open(URL, "", 
    "resizable=0,toolbar=0,location=0,directories=0,status=0,scrollbars=1,menubar=0,copyhistory=0,width=363,height=300");
    win.location = URL;
    // win.focus();
}

// opens window for streaming webcam
var win;
function camext(URL) {
    win = window.open(URL, "", 
    "resizable=0,toolbar=0,location=0,directories=0,status=0,scrollbars=0,menubar=0,copyhistory=0,width=340,height=300,left=400,top=150");
    win.location = URL;
    // win.focus();
}

// Opens a new browser window (with controls) for printable content
var win;
function printext(URL) {
    win = window.open(URL, "", 
    "resizable=1,toolbar=0,location=0,directories=0,resizable=yes,status=0,scrollbars=1,menubar=1,copyhistory=0,width=800,height=600"); 
    win.location = URL;
    // win.focus();
}

// Swaps out an image 
// the arguments are:
//    1) the NAME of the image, and 
//    2) the location of the image file
function changeImages() {
    if (document.images && (preloadFlag == true)) {
        for (var i=0; i<changeImages.arguments.length; i+=2) {
            document[changeImages.arguments[i]].src = changeImages.arguments[i+1];
        }
    }
}

// Next two functions flip a mouseover image on and off, but are not 
// supported by the newer NS/Mozilla codebases (ex: NS 6+). 
// Use it when DHTML drop-downs are needed in conjunction with mouseovers, 
// or when mouseovers are being used as a "nice-to-have" visual effect, 
// the absence of which would not impair usability for non-IE users. 
// DO NOT USE THIS FOR "MUST-HAVE" rollovers. Also, not that it requires 
// that all rollover image sets be kept in the SAME directory.
// Pass it a single param representing the image to be flipped
// The NAME value of the image should be the same as the navbar gif
// The mouseover image should be the navbar image name plus "over"
//    Example:  <IMG NAME="nav-news" SRC="/toolkit/images/nav/nav-news.gif">
//    Mouseover:  nav-news-over.gif
function onImage(arg) {
   changeImages(arg, "/images/" + arg + "-over.gif"); 
}
function offImage(arg) {
   changeImages(arg, "/images/" + arg + ".gif"); 
}

function onLoad() {
    window.preloadImages();
}

function clearText(thefield){
  if (thefield.defaultValue==thefield.value){
    thefield.value = "";
  }
} 

if (document.all) {
    onLoad();
}

// print this page tool
function print_page()
{
	if (navigator.appName == "Netscape") 
	{
       		window.print();
	} 
	else 
	{
		try 
		{
       			var webBrowser = '<object id="WebBrowser1" width=0 height=0 classid="CLSID:8856F961-340A-11D0-A96B-00C04FD705A2"></object>';
       			document.body.insertAdjacentHTML('beforeEnd', webBrowser);
       			WebBrowser1.ExecWB(6,2);
       			WebBrowser1.outerHTML = "";
		} 
		catch(e) 
		{
           		window.location.reload();
		}
   	}
}
//==============================
//==============================

