var width=400;
var offsetx=10;
var offsety=18;
var height=0;	
ns4 = (document.layers)? true:false;
ie4 = (document.all)? true:false;
if (ie4) {
	if (navigator.userAgent.indexOf('MSIE 5')>0) {
		ie5 = true;
	} else {
		ie5 = false; 
	}
} else {
	ie5 = false;
}
var x = 0;
var y = 0;
var snow = 0;
var sw = 0;
var cnt = 0;
var dir = 1;
if ( (ns4) || (ie4) ) {
	if (ns4) over = document.overDiv
	if (ie4) over = overDiv.style
	document.onmousemove = mouseMove
	if (ns4) document.captureEvents(Event.MOUSEMOVE)
}
// Down Right
function dr(text,m1, m2, title) {
	dtc(1,text,m1,m2, title, '');
}
// Down Left
function dl(text,m1, m2, title) {
	dtc(0,text,m1, m2, title, '');
}
// Down Center
function dc(text,m1, m2, title) {
	dtc(2,text,m1, m2, title, '');
}
// Up Right
function ur(text,m1, m2, title, height) {
	dtc(3,text,m1,m2, title, height);
}
// Up Left
function ul(text,m1, m2, title, height) {
	dtc(4,text,m1, m2, title, height);
}
// Up Center
function uc(text,m1, m2, title, height) {
	dtc(5,text,m1, m2, title, height);
}
// Clears popups if appropriate
function nd() {
	if ( cnt >= 1 ) { sw = 0 };
	if ( (ns4) || (ie4) ) {
		if ( sw == 0 ) {
			snow = 0;
			hideObject(over);
			//window.status='I n d i a n   M o m e n t s';
			window.status='';
		} else {
    	cnt++;
		}
	}
}
function openWin(pic, header) {
	var sTemp;
	for (var nLoop=0;nLoop<=header.length;nLoop++)
		header=header.replace(" ","$");	
	sTemp=pic.substr(pic.lastIndexOf("/")+1);
	sTemp=sTemp.substr(0,sTemp.lastIndexOf("."))
	for (var nLoop=0;nLoop<=sTemp.length;nLoop++)
		sTemp=sTemp.replace("-","");	
	var win = window.open('popup.htm?header='+header+'&img='+pic+'',sTemp, 'width=315,height=250,left=175,top=2,screenX=175,screenY=2');
	win.focus();	
}

// Caption popup
function dtc(d,text,m1, m2, title, height) {
	txt = "<TABLE WIDTH="+width+" BORDER=1 BORDERCOLOR=#A54108 CELLPADDING=3 CELLSPACING=0 BGCOLOR='#F7E78C'><TR><TD align=center><B><FONT COLOR=#FF3300 SIZE=2><b>"+title+"</b></FONT></B><table border=0 cellspacing=0 cellpadding=4><tr><td><span class=size><font size=1>"+text+"</font></span></td></tr></table></TD></TR></TABLE>"
	layerWrite(txt);
	dir = d;
	disp(height);
	window.status=title;
	return height;
}

function disp(height) {
	if ( (ns4) || (ie4) ) {
		if (snow == 0) 	{
			if (dir == 2) { // Down Center
				moveTo(over,x+offsetx-(width/2),y+offsety);
			}
			if (dir == 1) { // Down Right
				moveTo(over,x+offsetx,y+offsety);
			}
			if (dir == 0) { // Down Left
				moveTo(over,x-width,y+offsety);
			}
			if (dir == 5) { // Up Center
				moveTo(over,x+offsetx-(width/2),y-(height+offsety));
			}
			if (dir == 3) { // Up Right
				moveTo(over,x,y-(offsety+height));
			}
			if (dir == 4) { // Ul Left
				moveTo(over,x-width,y-(height+offsety));
			}
			showObject(over);
			snow = 1;
			this.height= height;
		}
	}
}
// Moves the layer
function mouseMove(e) {
	if (ns4) {x=e.pageX; y=e.pageY;}
	if (ie4) {x=window.event.x; y=window.event.y;}
	if (ie5) {x=window.event.x+document.body.scrollLeft; y=window.event.y+document.body.scrollTop;}
	if (snow) {
			if (dir == 2) { // Down Center
				moveTo(over,x+offsetx-(width/2),y+offsety);
			}
			if (dir == 1) { // Down Right
				moveTo(over,x+offsetx,y+offsety);
			}
			if (dir == 0) { // Down Left
				moveTo(over,x-width,y+offsety);
			}
			if (dir == 5) { // Up Center
				moveTo(over,x+offsetx-(width/2),y-(height+offsety));
			}
			if (dir == 3) { // Up Right
				moveTo(over,x, y-(offsety+height));
			}
			if (dir == 4) { // Ul Left
				moveTo(over,x-width,y-(height+offsety));
			}
		}
	}
// Writes to a layer
function layerWrite(txt) {
        if (ns4) {
                var lyr = document.overDiv.document;
                lyr.write(txt);
                lyr.close();
        }
        else if (ie4) document.all["overDiv"].innerHTML = txt;
}
// Make an object visible
function showObject(obj) {
        if (ns4) obj.visibility = "show";
        else if (ie4) obj.visibility = "visible";
}
// Hides an object
function hideObject(obj) {
        if (ns4) obj.visibility = "hide";
        else if (ie4) obj.visibility = "hidden";
}
// Move a layer
function moveTo(obj,xL,yL) {
        obj.left = xL;
        obj.top = yL;
}