// common.js	Common javascript 
// ------------------------------------------------------------------
// All scripting code is protected by the following copyright.
//
// (c) Copyright 1998-1999 Smoke & Mirrors. All rights reserved.
//
// This code is made available under the terms of a license from
// Smoke & Mirrors. Please contact info@smoke-and-mirrors.net
// for more information and licensing conditions.
// ------------------------------------------------------------------

// ------------------------------------------------------------------
// Kill framesets
// ------------------------------------------------------------------

//if (parent != self) {
//	parent.location = document.location;		
//}

// ------------------------------------------------------------------
// Common control variables
// ------------------------------------------------------------------

var Screen_Height	= 480;			// Screen Size in pixels
var Screen_Width 	= 640;

var Window_Height	= 440;			// Window Size in pixels
var Window_Width 	= 600;

var Browser_Name	= 'Other';		// Browser identification
var Browser_Version	= 0;
var Browser_System 	= 'Unknown';

var Browser_HasJScript = false;
var Browser_HasFrames = false;
var Browser_HasCSS = false;
var Browser_HasDHTML = false;

// ------------------------------------------------------------------
// Identify Browser
// ------------------------------------------------------------------

Browser_Version = parseInt (navigator.appVersion); 		// Navigator Version

if (navigator.appName == 'Netscape') {
	Browser_Name = 'Netscape';
	Doc = 'document.';
	Sty = '';
} else
if (navigator.appName == 'Microsoft Internet Explorer') {
	Browser_Name 	= 'Explorer';
	Doc = '';
	Sty = '.style';
}
			
// ------------------------------------------------------------------
// Check for Mac and Unix systems
// ------------------------------------------------------------------

if (navigator.appVersion.indexOf ('X11') != -1) {
	Browser_System = 'Unix';
} else 
if (navigator.appVersion.indexOf ('Macintosh') != -1) {
	Browser_System = 'Macintosh';
} else 
if (navigator.appVersion.indexOf ('Win') != -1) {
	Browser_System = 'Windows';
}

// ------------------------------------------------------------------
// Check compatibilities
// ------------------------------------------------------------------

if (Browser_Name == 'Explorer') {
	if (Browser_Version >= 3) {
		Browser_HasJScript = true;
		Browser_HasFrames = true;
		Browser_HasCSS = true;
	}
	if	(Browser_Version >= 4) {
		Browser_HasDHTML = true;
	}
}
else
if (Browser_Name == 'Netscape') {
	if (Browser_Version >= 3) {
		Browser_HasJScript = true;
		Browser_HasFrames = true;
	}
	if	(Browser_Version >= 4) {
		Browser_HasCSS = true;
		Browser_HasDHTML = true;
	}
}
else
if (Browser_Name == 'Opera') {
	if (Browser_Version >= 3) {
		Browser_HasJScript = true;
		Browser_HasFrames = true;
	}
}

// ------------------------------------------------------------------
// Identify screen and window dimensions
// ------------------------------------------------------------------

function GetWindowSize () {
	if ((Browser_Name == 'Explorer') && (Browser_Version >= 4)) {
		Screen_Height = screen.height;
		Screen_Width  = screen.width;
		Window_Height = document.body.clientHeight;
		Window_Width  = document.body.clientWidth;
	}
	else
	if ((Browser_Name == 'Netscape') && (Browser_Version >= 4)) {
		Screen_Height = screen.height;
		Screen_Width  = screen.width;
		Window_Height = innerHeight;
		Window_Width  = innerWidth;
	}
}

// ------------------------------------------------------------------
// Swap images
// ------------------------------------------------------------------

function NewImage (img_var, img_name) {
	if (document.images) {
		document.images[img_var].src = img_name.src;
	}
}

// ------------------------------------------------------------------
// Confirm a delete action
// ------------------------------------------------------------------

function CheckDelete () {
	return confirm ("Do you want to delete this entry");
}

// ------------------------------------------------------------------
// Open a popup window
// ------------------------------------------------------------------

function PopUp (page, height, width) {
	popup = window.open (page, "popup", 
		"height=" + height + ",width=" + width + ",scrollbars=yes,left=1,top=1");
	return false;
}
