function showDiv(id) {
	for (var i = 1; i < 4; i++){
		var theDiv = document.getElementById('res' + i);
		var thePlus = document.getElementById('tab' + i);
		var theLink = document.getElementById('link' + i);
		var theCont = document.getElementById('footer');
		if (id < 1) {
			id = 1;
		}
		if (i == id) {
			theDiv.style.display = "";
			thePlus.style.background = 'url(/g/tabactive.gif) top left repeat-x';
			theLink.style.color = '#fff';
			theCont.style.bottom = '';
			theCont.style.bottom = '0';
		} else {
			theDiv.style.display = "none";
			thePlus.style.background = 'transparent';
			theLink.style.color = '#555';
			theCont.style.bottom = '';
			theCont.style.bottom = '0';
		}
	}
}

function changeContent(id,shtml) {
   if (document.getElementById || document.all) {
      var el = document.getElementById? document.getElementById(id): document.all[id];
      if (el && typeof el.innerHTML != "undefined") el.innerHTML = shtml;
   }
}

function toggleLayer(whichLayer,stater) {
	var elem, vis;
	if( document.getElementById ) // this is the way the standards work
		elem = document.getElementById( whichLayer );
	else if( document.all ) // this is the way old msie versions work
		elem = document.all[whichLayer];
	else if( document.layers ) // this is the way nn4 works
		elem = document.layers[whichLayer];
	vis = elem.style;
	// if the style.display value is blank we try to figure it out here
	if (stater == 'show') {
		vis.display = 'block';
	} else {
		vis.display = 'none';
	}
	//if(vis.display==''&&elem.offsetWidth!=undefined&&elem.offsetHeight!=undefined)
	//	vis.display = (elem.offsetWidth!=0&&elem.offsetHeight!=0)?'block':'none';
	//vis.display = (vis.display==''||vis.display=='block')?'none':'block';
}

function changeClass(Elem, myClass) {
	var elem;
	if(document.getElementById) {
		var elem = document.getElementById(Elem);
	} else if (document.all){
		var elem = document.all[Elem];
	}
	elem.className = myClass;
}

function menu_goto( menuform ) {
	var selecteditem = menuform.newurl.selectedIndex ;
	var newesturl = menuform.newurl.options[ selecteditem ].value ;
	if (newesturl.length != 0) {
		menuform.newurl.options[0].selected=true;
		location.href = newesturl ;
	}
}

// Start tooltips code --------------------------------------------------------------
var offsetx = 12;
var offsety =  8;
function newelement(newid) { 
    if(document.createElement)
    { 
        var el = document.createElement('div'); 
        el.id = newid;     
        with(el.style)
        { 
            display = 'none';
            position = 'absolute';
        } 
        el.innerHTML = '&nbsp;'; 
        document.body.appendChild(el); 
    } 
} 
var ie5 = (document.getElementById && document.all); 
var ns6 = (document.getElementById && !document.all); 
var ua = navigator.userAgent.toLowerCase();
var isapple = (ua.indexOf('applewebkit') != -1 ? 1 : 0);
function getmouseposition(e) {
    if(document.getElementById) {
        var iebody=(document.compatMode && 
        	document.compatMode != 'BackCompat') ? 
        		document.documentElement : document.body;
        pagex = (isapple == 1 ? 0:(ie5)?iebody.scrollLeft:window.pageXOffset);
        pagey = (isapple == 1 ? 0:(ie5)?iebody.scrollTop:window.pageYOffset);
        mousex = (ie5)?event.x:(ns6)?clientX = e.clientX:false;
        mousey = (ie5)?event.y:(ns6)?clientY = e.clientY:false;

        var lixlpixel_tooltip = document.getElementById('tooltip');
        lixlpixel_tooltip.style.left = (mousex+pagex+offsetx) + 'px';
        lixlpixel_tooltip.style.top = (mousey+pagey+offsety) + 'px';
    }
}
function tooltip(tip) {
    if(!document.getElementById('tooltip')) newelement('tooltip');
    var lixlpixel_tooltip = document.getElementById('tooltip');
    lixlpixel_tooltip.innerHTML = tip;
    lixlpixel_tooltip.style.display = 'block';
    document.onmousemove = getmouseposition;
}
function exit() {
    document.getElementById('tooltip').style.display = 'none';
}
// End tooltips code ----------------------------------------------------------------

// functions for experimental menu
var navHover = function() {
	if (document.all&&document.getElementById) {
		var lis = document.getElementById("navmenu").getElementsByTagName("LI");
		for (var i=0; i<lis.length; i++) {
			lis[i].onmouseover=function() {
				this.className+=" iehover";
			}
			lis[i].onmouseout=function() {
				this.className=this.className.replace(new RegExp(" iehover\\b"), "");
			}
		}
	}
}
if (window.attachEvent) window.attachEvent("onload", navHover);
function changeRemote(id,newtext){
	document.getElementById(id).innerHTML=newtext;
}
// end experimental nav functions

// Start div scroller code ----------------------------------------------------------
// gives up and down scroll buttons to images, spans, ... named up_name, down_name, respectively.
// will keep the default scroll_box's style overflow if it encounters errors (so make overflow: auto;)
// usage: put this after the scrollbox div:  var div_scroll1 = new TextScroll('div_scroll1', 'scroll_box');

function TextScroll(scrollname, div_name, up_name, down_name) {
    this.div_name = div_name;
    this.name = scrollname;
    this.scrollCursor = 0;
    this.speed = 10;
    this.timeoutID = 0;
    this.div_obj = null;
    this.up_name = up_name;
    this.dn_name = down_name;
	{
        if (document.getElementById) {
            var div_obj = document.getElementById(this.div_name);
            if (div_obj) {
                this.div_obj = div_obj;
                this.div_obj.style.overflow = 'hidden';
            }
            var div_up_obj = document.getElementById(this.up_name);
            var div_dn_obj = document.getElementById(this.dn_name);
            if (div_up_obj && div_dn_obj) {
                div_up_obj.onmouseover = function() { eval(scrollname + ".scrollUp();") };
				div_up_obj.onmouseout = function() { eval(scrollname + ".stopScroll();") };
				div_dn_obj.onmouseover = function() { eval(scrollname + ".scrollDown();") };
				div_dn_obj.onmouseout = function() { eval(scrollname + ".stopScroll();") };
            }
        }
    }
	this.stopScroll = function() {
        clearTimeout(this.timeoutID);
    }
	this.scrollUp = function() {
        if (this.div_obj) {
            this.scrollCursor = (this.scrollCursor - this.speed) < 0 ? 0 : this.scrollCursor - this.speed;
            this.div_obj.scrollTop = this.scrollCursor;
            this.timeoutID = setTimeout(this.name + ".scrollUp()", 60);
        }
    }
	this.scrollDown = function() {
        if (this.div_obj) {
            this.scrollCursor += this.speed;
            this.div_obj.scrollTop = this.scrollCursor;
            this.timeoutID = setTimeout(this.name + ".scrollDown()", 60);
        }
    }
	this.resetScroll = function() {
        if (this.div_obj) {
            this.div_obj.scrollTop = 0;
            this.scrollCursor = 0;
        }
    }
}
// end div scroller code ------------------------------------------------------------

navHover = function() {
if (document.all&&document.getElementById) {
	var lis = document.getElementById("navmenu").getElementsByTagName("LI");
	for (var i=0; i<lis.length; i++) {
		lis[i].onmouseover=function() {
			this.className+=" iehover";
		}
		lis[i].onmouseout=function() {
			this.className=this.className.replace(new RegExp(" iehover\\b"), "");
		}
	}
}
}
if (window.attachEvent) window.attachEvent("onload", navHover);

// pop up window function
function openWin(url, width, height, winName) {
	var win;
	var windowName;
	var params;
	windowName  = winName;
	params = "width="+width+",";
	params += "height="+height + ",";
	params += "scrollbars=yes,";
	params += "top=50,";
	params += "left=50,";
	params += "toolbar=0,";
	params += "location=0,";
	params += "directories=0,";
	params += "status=0,";
	params += "menubar=0,";
	params += "resizable=0";
	win = window.open(url, windowName, params);
}

function MM_jumpMenu(targ,selObj,restore){ //v3.0
  eval(targ+".location='"+selObj.options[selObj.selectedIndex].value+"'");
  if (restore) selObj.selectedIndex=0;
}
