/*

Functions and browser detection for the Galt Web site.

This file should be in the HEAD section of every page.

*/



/*

ABOUT GALT SCRIPTS

The browser detection script is to resolve the Netscape 4 font incompatibility.

For some reason, WIN NS4 displays fonts one pixel smaller than specified.



The Macromedia scripts drive the image swapping behavior on each page. 

The only image swapping that occurs are the "bars" between the top nav

elements.



ABOUT GALT FONTS

galt_style.css and galt_style_WinNS4.css control the display of the fonts on the

Galt Web site. Below are the specs for how the fonts are to be used:



.topNav: All topnav main elements (About Galt, Investing With Galt, Galt Institute, Galt Labs, Principals + SPARE)

date: date

.lowerNav: All secondary nav elements (Members, Galt Library, Contact, Who is John Galt)

A: All other links within text.

.body: All <p> elements are specified the same way the body elements are. If there is no <p> element, you will need to place a <span> tag around the item to have it display properly.

.head: All header elements

.subhead: Subhead elements are the same weight as body or <p> elements, they're just green.

.white: a top nav link that is not active

.green: used for a lowerNav link that is not active


NOTE: If you're creating a link and want to specify the type style, ensure that the "class" specifier is within the <a href> tag itself. If it is not, the style will not be displayed properly.

*/



// Browser Detection

isDOM = (document.getElementById) ? true : false;

isNS4 = (document.layers) ? true : false;

isIE = (document.all) ? true : false;

isIE4 = isIE && !isDOM;

isMac = (navigator.appVersion.indexOf("Mac") != -1);

isIE4M = isIE4 && isMac;


// Date Script

months = new Array("January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December");

function get() {
	var now, temp, month, date, year;
	now = new Date();
	month = months[now.getMonth()];
	temp = String(now.getDate());
	date = temp.length == 1 ? "0" + temp : temp;
	year = now.getFullYear();
	document.write('<span class="date">' + date + ' ' + month + ' ' + year + '</span>')
}


// Macromedia Scripts

function MM_swapImgRestore() { //v3.0

  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;

}


function MM_swapImage() { //v3.0

  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)

   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}

}


function MM_preloadImages() { //v3.0

  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();

    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)

    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}

}


function MM_findObj(n, d) { //v4.01

  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {

    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}

  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];

  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);

  if(!x && d.getElementById) x=d.getElementById(n); return x;

}

