/*
 Filename: /cs-scripts/library.js
 Author: Eric Scoles, escoles@antikoan.com
 Created: 2002.03.11
 DESCRIPTION: 
	Browser detection and display compatibility routines

 Modified		By	Description
 --------		--	-----------
 2004-07-20		ES	Consolidated browser detection w/ example adjustment 
 					routines. 
*/

/* ----------------------------
 BROWSER-CAPABILITIES DETECTION
 ------------------------------ */

// check browser version to trap version 3 & below
// (not being used at this time, but may be...)
var intBrowserVer = parseInt(navigator.appVersion)
if (intBrowserVer >= 4) {
	var blnBrowserDOM = true;
} else {
	var blnBrowserDOM = false;
}

// check for DOM version & set variables accordingly
if (document.layers) {		// NN4+ DOM
	var strBrowser = "NN4"
	var blnCanDoRollover = true;
	var blnNonCSSP = false;
	var strVisible = 'show';
	var strHidden = 'hide';
} else if (document.all) {	// IE4+ DOM
	var strBrowser = "IE4+"
	var blnCanDoRollover = true;
	var blnNonCSSP = false;
	var strVisible = 'visible';
	var strHidden = 'hidden';
// NEED TO ADD DETECTION FOR NN6/Gecko...
// can check for "Gecko" in navigator.userAgent 
} else if (document.images) {	// NN3
	var strBrowser = "NN3"
	var blnCanDoRollover = true;
	var blnNonCSSP = true;
	var strVisible = 'visible';
	var strHidden = 'hide';
	blnBrowserDOM = true;
} else {						// anything else
	var strBrowser = "Other"
	var blnCanDoRollover = false;
	var blnNonCSSP = true;
	var strVisible = 'visible';
	var strHidden = 'hidden';
	blnBrowserDOM = false;
}

var blnMozilla;
blnMozilla = true;
if (navigator.userAgent.indexOf("Gecko",0)==-1) {
	blnMozilla = false;
}
var blnSafari;
blnSafari = true;
if (navigator.userAgent.indexOf("afari",0)==-1) {
	blnSafari = false;
} else {
//	alert();
}
var blnKonq;
blnKonq = true;
if (navigator.userAgent.indexOf("onque",0)==-1) {
	blnKonq	 = false;
} else {
//	alert(blnKonq);
}

// browscap debug alert():
var strBCAlert = "";
strBCAlert += "Browser: ";
strBCAlert += strBrowser ;
strBCAlert += ", integer version " + intBrowserVer + "\n";
strBCAlert += "DOM support/Images array/Non-CSSP: " + blnBrowserDOM + " / " + blnCanDoRollover + " / " + blnNonCSSP + "\n";
strBCAlert += "visibility & hidden values: " + strVisible + ", " + strHidden + "\n";
strBCAlert += "\n" + navigator.appVersion;
strBCAlert += "\n" + navigator.appName;
strBCAlert += "\n" + navigator.userAgent;
strBCAlert += "\n" + navigator.userAgent.indexOf("Gecko",0);
strBCAlert += "\n" + blnMozilla;
//alert(strBCAlert);

/* -------------------------------------------------------------------------
 	LAYOUT DEBUGGING
 	
 ------------------------------------------------------------------------ */

function toggleTableBorders() {
//	alert('');
	
}
 
 

/* -------------------------------------------------------------------------
 	NN4 CORRECTION ROUTINES
 	Code is sample code -- must be modified to point to the specific 
	objects required. This is not required for NN4 for this implementation, 
	due to use of an alternate technique. 
 ------------------------------------------------------------------------ */

if (document.layers) {
/*
	TURN OFF ALL BORDERS: In NN4, <span> containers become block 
	elements when borders have a width attribute.
*/
//	NOTE: Must be applied to EACH SIDE of the container class
//	alert(document.classes.primaryMenuItem.all.borderWidth);
	// Must clear all padding on this class to render any primary/secondary
	// navigation. 
//alert(document.classes.xel-primary-menu-item.all.paddingBottom);
//alert(document.classes.xel-primary-menu-item.all.borderBottomWidth.text);
//alert(document);
/*
	document.classes.classname.all.borderBottomWidth='';
	document.classes.classname.all.borderTopWidth='';
	document.classes.classname.all.borderLeftWidth='';
	document.classes.classname.all.borderRightWidth='';
*/	
} else {
//	alert('not NN4');
}	

/* -------------------------------------------------------------------------
 	MOZILLA CORRECTION ROUTINES
	This code will only work as long as the rule controlling display of
	lists in the sidebars is the first rule in the 4th style container. 
 ------------------------------------------------------------------------ */

if (blnMozilla) {
//	var sidebarListItems = document.styleSheets[3].cssRules[0];
//	sidebarListItems.style.marginLeft = "0px"
//	alert(sidebarListItems.style.marginLeft);
}
/* -------------------------------------------------------------------------
 	SAFARI CORRECTION ROUTINES
	This code will only work as long as the rule controlling display of
	lists in the sidebars is the first rule in the 4th style container. 
 ------------------------------------------------------------------------ */

if (blnSafari) {
//	var sidebarListItems = document.styleSheets[3].cssRules[0];
//	sidebarListItems.style.marginLeft = "0";
//	alert(sidebarListItems.style.marginLeft);
}

/* -------------------------------------------------------------------------
 	KONQUEROR	 CORRECTION ROUTINES
	This code will only work as long as the rule controlling display of
	lists in the sidebars is the first rule in the 4th style container. 
 ------------------------------------------------------------------------ */

if (blnKonq==true) {
//	var sidebarListItems = document.styleSheets[3].cssRules[0];
//	sidebarListItems.style.marginLeft = "0px";
//	alert(sidebarListItems.style.marginLeft);
//	sidebarListItems.style.offsetLeft = "0px";
//	alert(sidebarListItems.style.offsetLeft);
//	alert();
}


