// BROWSER SNIFF & COMMON JS LIB - v.3.2
// COPYRIGHT SUN MICROSYSTEMS INC. 2006
// QUESTIONS? webdesign -at- sun.com

is = new ottosniff();

function ottosniff()
{
	var b = navigator.appName
	if (b=="Netscape") this.b = "ns"
	else this.b = b
	this.version = navigator.appVersion
	this.v = parseInt(this.version)
	this.ns = (this.b=="ns" && this.v>=5)
	this.op = (navigator.userAgent.indexOf('Opera')>-1)
	this.safari = (navigator.userAgent.indexOf('Safari')>-1)
	this.op7 = (navigator.userAgent.indexOf('Opera')>-1 && this.v>=7 && this.v<8)
	this.op78 = (navigator.userAgent.indexOf('Opera')>-1 && this.v>=7 || navigator.userAgent.indexOf('Opera')>-1 && this.v>=8)
	this.ie5 = (this.version.indexOf('MSIE 5')>-1)
	this.ie6 = (this.version.indexOf('MSIE 6')>-1)
	this.ie7 = (this.version.indexOf('MSIE 7')>-1)
	this.ie56 = (this.ie5||this.ie6)
	this.iewin = (this.ie56 && navigator.userAgent.indexOf('Windows')>-1 || this.ie7 && navigator.userAgent.indexOf('Windows')>-1)
	this.iemac = (this.ie56 && navigator.userAgent.indexOf('Mac')>-1)
	this.moz = (navigator.userAgent.indexOf('Mozilla')>-1)
	this.ff = (navigator.userAgent.indexOf('Firefox')>-1)
	this.moz13 = (navigator.userAgent.indexOf('Mozilla')>-1 && navigator.userAgent.indexOf('1.3')>-1) 
	this.oldmoz = (navigator.userAgent.indexOf('Mozilla')>-1 && navigator.userAgent.indexOf('1.4')>-1 && !this.ff ||navigator.userAgent.indexOf('Mozilla')>-1 && navigator.userAgent.indexOf('1.5')>-1 && !this.ff ||navigator.userAgent.indexOf('Mozilla')>-1 && navigator.userAgent.indexOf('1.6')>-1 && !this.ff)
	this.ns6 = (navigator.userAgent.indexOf('Netscape6')>-1)
	this.docom = (this.ie56||this.ns||this.iewin||this.op||this.iemac||this.safari||this.moz||this.oldmoz||this.ns6)
}

// VARS
ptest="noprint";
var oldmenu = new Array();
var navmenu = new Array();

// ADD BROWSER CLASS TO BODY
if(is.op || is.ie56 || is.ie7 || is.iemac || is.safari){
	var bodycheck=0;
	findbody();
}
function findbody()
{
	var bbod = document.getElementsByTagName('body')[0];
	if (bbod)
	{
		if(is.op){var bclass = "browserOpera";}
		else if(is.safari){var bclass = "browserSafari";}
		else if(is.ie56){var bclass = "browserExplorer56";}
		else if(is.ie7){var bclass = "browserExplorer7";}
		else if(is.iemac){var bclass = "browserExplorerMac";}
		addClassName(bbod, bclass);
	}
	else if(bodycheck < 100)
	{
		bodycheck++;
		setTimeout('findbody();',100);
	}
}

function prepSunPage()
{
	if (is.docom)
	{
		var kdoc = document;
		// prep homepage
		if (kdoc.getElementById('subhover2'))
		{
			prephome();
			done = true;
		}
	}
}

// ADD PREPSUNPAGE ONLOAD
if (is.docom)
{
	if (window.attachEvent){
		window.attachEvent('onload',prepSunPage);
	}
	else if (window.addEventListener){
		window.addEventListener('load',prepSunPage,false);
	}
	else if (is.iemac){
		document.onreadystatechange = function(){if (document.readyState == "interactive"){prepSunPage()}};
	}
}

// ADD ONRESIZE EVENTS
function addOnresizeEvent(func)
{
  var oldrsize = window.onresize;
  if (typeof window.onresize != 'function') {
    window.onresize = func;
  } else {
    window.onresize = function() {
      oldrsize();
      func();
    }
  }
}

// ADD CLASSES TO OBJECTS
function addClassName(element, className) {
	if (hasClassName(element, className)) { return false; }
	if (!element.className) { element.className = className; }
	else { element.className += ' '+className; }
	return true;
}
function hasClassName(element, className) {
	var exp = new RegExp("\\b"+className+"\\b");
	return (element.className && exp.exec(element.className))?true:false;
}
