var isIE4 = (document.all && !document.getElementById) ? true : false;
var isNS4 = (document.layers) ? true : false;
var isIE5 = (document.all &&  document.getElementById) ? true : false;
var isN6  = (document.getElementById && !document.all) ? true : false;
var isIE6 = (navigator.appName === "Microsoft Internet Explorer") & (navigator.appVersion.indexOf( "MSIE 6") != -1);

////if( isIE6)
////	isIE5 = false;


//if( isIE4)
//	alert( "IE 4");
//if( isNS4)
//	alert( "NS 4");
//if( isIE5)
//	alert( "IE 5");
//if( isN6)
//	alert( "N6");
//if( isIE6)
//	alert( "IE6");

// -------------------------------------------------------------------
var localDebug = false;

// -------------------------------------------------------------------
// IDs for the menu
var PAGEID_NONE				= 0;
var PAGEID_HOME_PAGE			= 100;
var PAGEID_GALLERY_INDEX_PAGE		= 200;
var PAGEID_HISTORY_INDEX_PAGE		= 300;
var PAGEID_INTERESTING_INFO_INDEX_PAGE	= 400;
var PAGEID_LINKS_INDEX_PAGE		= 500;
var PAGEID_MODEL_LAYOUTS_INDEX_PAGE	= 600;
var PAGEID_SEARCH_INDEX_PAGE		= 700;
var PAGEID_SEARCH_RESULTS_PAGE		= 800;
var PAGEID_SIGHTINGS_INDEX_PAGE		= 900;
var PAGEID_CVRR_ROCK_MOLDS_PG1		= 1000;
var PAGEID_CVRR_MOUNTAIN_PG1		= 1100;
var PAGEID_CVRR_SUPPLIES_PG1		= 1200;
var PAGEID_CVRR_TIPS_PG1		= 1300;


var pageID = PAGEID_NONE;//PAGEID_HOME_PAGE;

// -------------------------------------------------------------------
// Set the location for the menu
var main_menu_x = 100;		// default
var main_menu_y = 100;		// default

// -------------------------------------------------------------------
// stub function
function doLocalInit(){ return;};

// -------------------------------------------------------------------
// ActiveElement
var AE_isNav4 = false;
var AE_isNav = false;
var AE_isIE4 = false;
var AE_isIE5 = false;
var AE_isIE6 = false;
var AE_isIE = false;

if( navigator.appName == "Netscape")
	{
	AE_isNav = true;
	if( parseInt( navigator.appVersion) == 4) AE_isNav4 = true;
	}
else if( navigator.appName === "Microsoft Internet Explorer")
	{
	AE_isIE = true;
	if( navigator.appVersion.indexOf( "MSIE 4") != -1) AE_isIE4 = true;
	if( navigator.appVersion.indexOf( "MSIE 5") != -1) AE_isIE5 = true;
	if( navigator.appVersion.indexOf( "MSIE 6") != -1) AE_isIE6 = true;
	}

function ActiveElement( obj, parent)
{
	if( AE_isNav4)
		{
		this.name = obj;
		this.css = (parent) ? eval( "document." + parent + ".document.layers['" + obj + "']") : document.layers[obj];
		this.elem = this.css;
		this.x = this.css.left;
		this.y = this.css.top;
		this.h = this.css.clip.height;
		this.w = this.css.clip.width;
		this.elem.captureEvents( Event.MOUSEDOWN | Event.MOUSEUP | Event.MOUSEMOVE | Event.CLICK);
//		this.obj = eval( "this");	// uncomment to add reference to the object itself		
		}
	else if( AE_isIE4)
		{
		this.name = obj;
		this.css = document.all[obj].style;
		this.elem = document.all[obj];
		this.x = this.css.pixelLeft;
		this.y = this.css.pixelTop;
		this.h = this.css.pixelHeight;
		this.w = this.css.pixelWidth;
//		this.obj = eval( "this");	// uncomment to add reference to the object itself	
		}
	else if( AE_isIE5)
		{
		this.name = obj;
		this.css = document.all[obj].style;
		this.elem = document.all[obj];
		this.x = this.elem.offsetLeft;
		this.y = this.elem.offsetTop;
		this.h = this.elem.offsetHeight;
		this.w = this.elem.offsetWidth;
//		this.obj = eval( "this");	// uncomment to add reference to the object itself	
		}
}

function dynoWriteNav( html)
	{
	this.css.document.open();
	this.css.document.write( html);
	this.css.document.close();
	}
function dynoWriteIE( html)
	{
	this.elem.innerHTML = html;
	}
ActiveElement.prototype.write = (AE_isNav) ? dynoWriteNav : dynoWriteIE;

function moveItToNav( x, y)
	{
	this.css.left = x;
	this.css.top = y;
	this.x = x;
	this.y = y;
	}
function moveItToIE( x, y)
	{
	this.css.pixelLeft = x;
	this.css.pixelTop = y;
	this.x = x;
	this.y = y;
	}
ActiveElement.prototype.moveTo = (AE_isNav) ? moveItToNav : moveItToIE;

function moveItByNav( dx, dy)
	{
	this.css.left += dx;
	this.css.top += dy;
	this.x += dx;
	this.y += dy;
	}
function moveItByIE( dx, dy)
	{
	this.css.pixelLeft += dx;
	this.css.pixelTop += dy;
	this.x += dx;
	this.y += dy;
	}
ActiveElement.prototype.moveBy = (AE_isNav) ? moveItByNav : moveItByIE;

function setZIndex( zInd)
	{
	this.css.zIndex = zInd;
	}
ActiveElement.prototype.setZ = setZIndex;

function showIt()
	{
	this.css.visibility = (AE_isNav4) ? "show" : "visible";
	}
ActiveElement.prototype.show = showIt;

function hideIt()
	{
	this.css.visibility = (AE_isNav4) ? "hide" : "hidden";
	}
ActiveElement.prototype.hide = hideIt;

function setBGCol( color)
	{
	(AE_isNav4) ? this.css.bgColor = color : this.css.backgroundColor = color;
	}
ActiveElement.prototype.setBGColor = setBGCol;

function toggleVisNav()
	{
	(this.css.visibility == "show") ?  this.css.visbility = "hide" : this.css.visbility = "show"; 
	}
function toggleVisIE()
	{
	(this.css.visibility == "visible") ?  this.css.visbility = "hidden" : this.css.visbility = "visible"; 
	}
ActiveElement.prototype.toggle = (AE_isNav) ? toggleVisNav : toggleVisIE;

// -------------------------------------------------------------------



