function rollover(img_id, mode)
{
	obj = document.getElementById(img_id);
	obj.src = img_root+"/"+img_id+"_"+mode+".gif";
	
	return;
}

function multirollover(img_id, mode, num)
{
	obj = document.getElementById(img_id + "_" + num);
	obj.src = img_root+"/"+img_id+"_"+mode+".gif";
	
	return;
}

function rolloverexpand(img_id, mode, num, intTotalItemCount, intLocalItemCount)
{
	if (eval("showHideFlag_" + intTotalItemCount + "_" + intLocalItemCount))
	{
		if (mode == "over")
		{
			multirollover(img_id, "down_over", num);
		} else {
			multirollover(img_id, "down_out", num);
		}
	} 
	else 
	{
		multirollover(img_id, mode, num);
	}
	
	return;
}

function showHide(strName, intTotalItemCount, intLocalItemCount)
{
	if (eval("showHideFlag_" + intTotalItemCount + "_" + intLocalItemCount))
	{
		var newstate = "none";
		eval("showHideFlag_" + intTotalItemCount + "_" + intLocalItemCount + "=false");
	}
	else
	{
		var newstate = "block";
		eval("showHideFlag_" + intTotalItemCount + "_" + intLocalItemCount + "=true");
	}

	// There MAY be only one checkbox, in which case this will NOT be an array!
	// If there is more than one it IS an array.
	var checkboxes
	checkboxes = document.getElementById('checkboxform').elements[strName + 'Items'];

	for (var n=intTotalItemCount ; n<=intTotalItemCount+intLocalItemCount ; n++)
	{
		if ( (checkboxes[n] && !checkboxes[n].checked) || (!checkboxes[n] && !checkboxes.checked) )
		{
			document.getElementById(strName + "Div" + n).style.display = newstate;
		}
	}
	
	return;
}

function UpdateGroup(strName, intTotalItemCount, intLocalItemCount)
{
	if (eval("showHideFlag_" + intTotalItemCount + "_" + intLocalItemCount))
	{
		var hidestate = "block";
	} else {
		var hidestate = "none";
	}
	
	for (var n=intTotalItemCount; n<=intTotalItemCount+intLocalItemCount; n++)
	{
		if (document.getElementById('checkboxform').elements[strName + "Items"][n].checked)	
		{
			document.getElementById(strName + "Div" + n).style.display = "block";
		} else {
			document.getElementById(strName + "Div" + n).style.display = hidestate;
		}
	}
	
	return;
}

function SetGroup(strName, intTotalItemCount, intLocalItemCount, strSwitch)
{
	if (strSwitch == "flip")
	{
		strCode= "!document.getElementById('checkboxform').elements[strName + 'Items'][n].checked"; 
	} else {
		strCode = strSwitch; 
	}

	for (var n=intTotalItemCount; n<=intTotalItemCount+intLocalItemCount; n++)
	{
		document.getElementById('checkboxform').elements[strName + "Items"][n].checked=eval(strCode);
	}
	
	UpdateGroup(strName, intTotalItemCount, intLocalItemCount);
	
	return;
}

// For progress display...
var current = 0;
var IE50 = (navigator.appVersion.indexOf('MSIE 5.0')>-1 ? true : false);

function msg(txt)
{
	if (txt != '')
	{
		txt = 'Searching Database...<br>' + txt + '.';
	} else {
		txt = 'Search Complete.';
	}

	document.getElementById('msg').innerHTML = txt;
	
	return;
}

function set(num)
{
	var style;
	
	if (num > (current*15))
	{
		current++;

		style = document.getElementById('progress'+current).style;
		
		// IE5.0 doesn't work with visibility alone...
		if (IE50) 
			style.display = 'block';
			
		style.visibility = 'visible';
	}
	
	return;
}

var ua = navigator.userAgent;
var ps = navigator.productSub;
var dom = (document.getElementById)? 1:0;
var ie4 = (document.all&&!dom)? 1:0;
var ie5 = (document.all&&dom)? 1:0;
var nn4 =(navigator.appName.toLowerCase() == "netscape" && parseInt(navigator.appVersion) == 4);
var nn6 = (dom&&!ie5)? 1:0;
var sNav = (nn4||nn6||ie4||ie5)? 1:0;
//var cssFilters = ((ua.indexOf("MSIE 5.5")>=0||ua.indexOf("MSIE 6")>=0)&&ua.indexOf("Opera")<0)? 1:0;
var Count=0,sbw=0,move=0,hs="",mx,my,scl,sct,ww,wh,obj,sl,st,ih,iw,vl,hl,sv,evlh,evlw,tbody;
var HideTip = "eval(obj+sv+hl+';'+obj+sl+'=0;'+obj+st+'=-800')";
var doc_root = ((ie5&&ua.indexOf("Opera") < 0 || ie4) && document.compatMode == "CSS1Compat") ? "document.documentElement" : "document.body";
var PX = (nn6)? "px" : "" ;
//var FiltersEnabled = 1; // if your not going to use transitions or filters in any of the tips set this to 0
//var Style=["white","black","#420C7B","#EFEBF7","","","","","","","","keep","","",200,"",2,2,10,10,"","","","",""];
var Style=["white","black","#420C7B","#EFEBF7","","","","","","","","","","",200,"",2,2,10,10,37,0.5,"","simple","gray"];
//48/49 fadeup/fadedown
//46/47 faderight/fadeleft

if (sNav) 
{
	window.onresize = ReloadTip;
	document.onmousemove = MoveTip;
	if (nn4) 
		document.captureEvents(Event.MOUSEMOVE); 
}
	
if (nn4 || nn6) 
{
	mx = "e.pageX";
	my = "e.pageY";
	scl = "window.pageXOffset";
	sct = "window.pageYOffset";
	if (nn4) 
	{
		obj = "document.TipLayer.";
		sl = "left";
		st = "top";
		ih = "clip.height";
		iw = "clip.width";
		vl = "'show'";
		hl = "'hide'";
		sv = "visibility=";
	}
	else 
		obj = "document.getElementById('TipLayer').";
} 

if (ie4 || ie5) 
{
	obj = "TipLayer.";
	mx = "event.x";
	my = "event.y";
	scl = "eval(doc_root).scrollLeft";
	sct = "eval(doc_root).scrollTop";
	
	if (ie5) 
	{
		mx = mx+"+"+scl ;
		my = my+"+"+sct;
	}
}
 
if (ie4 || dom)
{
	sl = "style.left";
	st = "style.top";
	ih = "offsetHeight";
	iw = "offsetWidth";
	vl = "'visible'";
	hl = "'hidden'";
	sv = "style.visibility=";
}

if (ie4 || ie5 || ps >= 20020823) 
{
	ww = "eval(doc_root).clientWidth";
	wh = "eval(doc_root).clientHeight";
}	 
else 
{ 
	ww = "window.innerWidth";
	wh = "window.innerHeight";
	evlh = eval(wh);
	evlw = eval(ww);
	sbw = 15;
}	

/*function applyCssFilter()
{
	if (cssFilters && FiltersEnabled) 
	{ 
		var dx = " progid:DXImageTransform.Microsoft.";
		TipLayer.style.filter = "revealTrans()"+dx+"Fade(Overlap=1.00 enabled=0)"+dx+"Inset(enabled=0)"+dx+"Iris(irisstyle=PLUS,motion=in enabled=0)"+dx+"Iris(irisstyle=PLUS,motion=out enabled=0)"+dx+"Iris(irisstyle=DIAMOND,motion=in enabled=0)"+dx+"Iris(irisstyle=DIAMOND,motion=out enabled=0)"+dx+"Iris(irisstyle=CROSS,motion=in enabled=0)"+dx+"Iris(irisstyle=CROSS,motion=out enabled=0)"+dx+"Iris(irisstyle=STAR,motion=in enabled=0)"+dx+"Iris(irisstyle=STAR,motion=out enabled=0)"+dx+"RadialWipe(wipestyle=CLOCK enabled=0)"+dx+"RadialWipe(wipestyle=WEDGE enabled=0)"+dx+"RadialWipe(wipestyle=RADIAL enabled=0)"+dx+"Pixelate(MaxSquare=35,enabled=0)"+dx+"Slide(slidestyle=HIDE,Bands=25 enabled=0)"+dx+"Slide(slidestyle=PUSH,Bands=25 enabled=0)"+dx+"Slide(slidestyle=SWAP,Bands=25 enabled=0)"+dx+"Spiral(GridSizeX=16,GridSizeY=16 enabled=0)"+dx+"Stretch(stretchstyle=HIDE enabled=0)"+dx+"Stretch(stretchstyle=PUSH enabled=0)"+dx+"Stretch(stretchstyle=SPIN enabled=0)"+dx+"Wheel(spokes=16 enabled=0)"+dx+"GradientWipe(GradientSize=1.00,wipestyle=0,motion=forward enabled=0)"+dx+"GradientWipe(GradientSize=1.00,wipestyle=0,motion=reverse enabled=0)"+dx+"GradientWipe(GradientSize=1.00,wipestyle=1,motion=forward enabled=0)"+dx+"GradientWipe(GradientSize=1.00,wipestyle=1,motion=reverse enabled=0)"+dx+"Zigzag(GridSizeX=8,GridSizeY=8 enabled=0)"+dx+"Alpha(enabled=0)"+dx+"Dropshadow(OffX=3,OffY=3,Positive=true,enabled=0)"+dx+"Shadow(strength=3,direction=135,enabled=0)";
	}
}*/

function stm(t,s) 
{
  	if (sNav) 
  	{
  		if (t.length < 2 || s.length < 25) 
  		{
			var ErrorNotice = "DHTML TIP MESSAGE VERSION 1.2 ERROR NOTICE.\n";
			
			if (t.length < 2 && s.length < 25) 
				alert(ErrorNotice+"It looks like you removed an entry or more from the Style Array and Text Array of this tip.\nTheir should be 25 entries in every Style Array even though empty and 2 in every Text Array. You defined only "+s.length+" entries in the Style Array and "+t.length+" entry in the Text Array. This tip won't be viewed to avoid errors");
			else if (t.length < 2) 
				alert(ErrorNotice+"It looks like you removed an entry or more from the Text Array of this tip.\nTheir should be 2 entries in every Text Array. You defined only "+t.length+" entry. This tip won't be viewed to avoid errors.");
			else if (s.length < 25) 
				alert(ErrorNotice+"It looks like you removed an entry or more from the Style Array of this tip.\nTheir should be 25 entries in every Style Array even though empty. You defined only "+s.length+" entries. This tip won't be viewed to avoid errors.");
 		}
  		else 
  		{
			var ab = "";
			var ap = "";
			var titCol = (s[0])? "COLOR='"+s[0]+"'" : "";
			var txtCol = (s[1])? "COLOR='"+s[1]+"'" : "";
			var titBgCol = (s[2])? "BGCOLOR='"+s[2]+"'" : "";
			var txtBgCol = (s[3])? "BGCOLOR='"+s[3]+"'" : "";
			var titBgImg = (s[4])? "BACKGROUND='"+s[4]+"'" : "";
			var txtBgImg = (s[5])? "BACKGROUND='"+s[5]+"'" : "";
			var titTxtAli = (s[6] && s[6].toLowerCase()!="left")? "ALIGN='"+s[6]+"'" : "";
			var txtTxtAli = (s[7] && s[7].toLowerCase()!="left")? "ALIGN='"+s[7]+"'" : "";   
			var add_height = (s[15])? "HEIGHT='"+s[15]+"'" : "";
			
			if (!s[8])  
				s[8] = "Verdana,Arial,Helvetica";
			if (!s[9])  
				s[9] = "Verdana,Arial,Helvetica";				
			if (!s[12]) 
				s[12] = 1;
			if (!s[13]) 
				s[13] = 1;
			if (!s[14]) 
				s[14] = 200;
			if (!s[16]) 
				s[16] = 0;
			if (!s[17]) 
				s[17] = 0;
			if (!s[18]) 
				s[18] = 10;
			if (!s[19]) 
				s[19] = 10;
				
			hs = s[11].toLowerCase();
			
			if (ps == 20001108)
			{
				if (s[2]) 
					ab="STYLE='border:"+s[16]+"px solid"+" "+s[2]+"'";
					
				ap="STYLE='padding:"+s[17]+"px "+s[17]+"px "+s[17]+"px "+s[17]+"px'"
			}
				
			//var closeLink = (hs == "sticky")? "<td align='right'><font size='"+s[12]+"' face='"+s[8]+"'><a href='javascript:void(0)' onclick='stickyhide()' STYLE='text-decoration:none;color:"+s[0]+"'><b>Close</b></a></font></td>":""
			var closeLink = ""
			var title = (t[0] || hs == "sticky")? "<table width='100%' border='0' cellpadding='0' cellspacing='0'><tr><td "+titTxtAli+"><font size='"+s[12]+"' face='"+s[8]+"' "+titCol+"><b>"+t[0]+"</b></font></td>"+closeLink+"</tr></table>" : ""
			var txt = "<table "+titBgImg+" "+ab+" width='"+s[14]+"' border='0' cellpadding='"+s[16]+"' cellspacing='0' "+titBgCol+" ><tr><td>"+title+"<table width='100%' "+add_height+" border='0' cellpadding='"+s[17]+"' cellspacing='0' "+txtBgCol+" "+txtBgImg+"><tr><td "+txtTxtAli+" "+ap+" valign='top'><font size='"+s[13]+"' face='"+s[9]+"' "+txtCol +">"+t[1]+"</font></td></tr></table></td></tr></table>"
		
			if (nn4) 
			{
				with(eval(obj+"document")) 
				{
					open();
					write(txt);
					close();
				}
			}
			else 
				eval(obj+"innerHTML=txt");
			
			tbody = {
					Pos:s[10].toLowerCase(), 
					Xpos:s[18],
					Ypos:s[19], 
					Transition:s[20],
					Duration:s[21], 
					Alpha:s[22],
					ShadowType:s[23].toLowerCase(),
					ShadowColor:s[24],
					Width:parseInt(eval(obj+iw)+3+sbw)
			}
		
			if (ie4) 
			{ 
				TipLayer.style.width = s[14];
		 		tbody.Width = s[14];
			}
		
			Count = 0;
			move = 1;
 	 	}
  	}
}

function MoveTip(e) 
{
	if (move) 
	{
		var X, Y, MouseX = eval(mx), MouseY = eval(my); 
		tbody.Height = parseInt(eval(obj+ih)+3);
		tbody.wiw = parseInt(eval(ww+"+"+scl)); 
		tbody.wih = parseInt(eval(wh+"+"+sct));
		
		switch(tbody.Pos) 
		{
			case "left" : X=MouseX-tbody.Width-tbody.Xpos; Y=MouseY+tbody.Ypos; break;
			case "center": X=MouseX-(tbody.Width/2); Y=MouseY+tbody.Ypos; break;
			case "float": X=tbody.Xpos+eval(scl); Y=tbody.Ypos+eval(sct); break;	
			case "fixed": X=tbody.Xpos; Y=tbody.Ypos; break;		
			default: X=MouseX+tbody.Xpos; Y=MouseY+tbody.Ypos
		}

		if (tbody.wiw < tbody.Width+X) 
			X = tbody.wiw-tbody.Width;
		if (tbody.wih < tbody.Height+Y+sbw) 
		{
			if (tbody.Pos == "float" || tbody.Pos == "fixed") 
				Y = tbody.wih-tbody.Height-sbw;
			else 
				Y = MouseY-tbody.Height;
		}
		
		if (X < 0) 
			X = 0; 
			
		eval(obj+sl+"=X+PX;"+obj+st+"=Y+PX");
		ViewTip();
	}
}

function ViewTip() 
{
  	Count++;
	if (Count == 1) 
	{
		/*if (cssFilters && FiltersEnabled) 
		{	
			for (Index = 28; Index < 31; Index++) 
			{ 
				TipLayer.filters[Index].enabled = 0;
			}
			
			for (s = 0; s < 28; s++) 
			{ 
				if (TipLayer.filters[s].status == 2) 
					TipLayer.filters[s].stop();
			}
			
			if (tbody.Transition == 51) 
				tbody.Transition = parseInt(Math.random()*50);
			
			var applyTrans = (tbody.Transition>-1&&tbody.Transition<24&&tbody.Duration>0)? 1:0;
			var advFilters = (tbody.Transition>23&&tbody.Transition<51&&tbody.Duration>0)? 1:0;
			var which = (applyTrans)?0:(advFilters)? tbody.Transition-23:0; 
			
			if (tbody.Alpha > 0&&tbody.Alpha < 100) 
			{
	  			TipLayer.filters[28].enabled = 1;
	  			TipLayer.filters[28].opacity = tbody.Alpha;
			}
			
			if (tbody.ShadowColor && tbody.ShadowType == "simple") 
			{
	  			TipLayer.filters[29].enabled = 1;
	  			TipLayer.filters[29].color = tbody.ShadowColor;
			}
			else if (tbody.ShadowColor && tbody.ShadowType == "complex") 
			{
	  			TipLayer.filters[30].enabled = 1;
	  			TipLayer.filters[30].color = tbody.ShadowColor;
			}
			
			if (applyTrans || advFilters) 
			{
				eval(obj+sv+hl);
				
	  			if (applyTrans) 
	  				TipLayer.filters[0].transition = tbody.Transition;
	  				
	  			TipLayer.filters[which].duration = tbody.Duration;
	  			TipLayer.filters[which].apply();
			}
		}*/
		
 		eval(obj+sv+vl);
 		
		//if (cssFilters && FiltersEnabled && (applyTrans || advFilters)) 
			//TipLayer.filters[which].play();
			
		if (hs == "sticky") 
			move = 0;
  	}
}

function stickyhide() 
{
	eval(HideTip);
}

function ReloadTip() 
{
	 if (nn4 && (evlw != eval(ww) || evlh != eval(wh))) 
	 	location.reload();
	 else if (hs == "sticky") 
	 	eval(HideTip);
}

function htm() 
{
	if (sNav) 
	{
		if (hs != "keep") 
		{
			move = 0; 
			if (hs != "sticky") 
				eval(HideTip);
		}	
	} 
}

/*function getCookie(Name) 
{
  	var search = Name + "="
  	var returnValue = "";
  	
  	if (document.cookie.length > 0) 
  	{
    	offset = document.cookie.indexOf(search);
    	// if cookie exists
    	if (offset != -1) 
    	{ 
      		offset += search.length;
      		// set index of beginning of value
      		end = document.cookie.indexOf(";", offset);
      		// set index of end of cookie value
      		if (end == -1) 
      			end = document.cookie.length;
      			
      		returnvalue = unescape(document.cookie.substring(offset, end));
      	}
   	}
   	
  	return returnValue;
}

function setCookie(name, value)
{
	document.cookie = name + "=" + value;
}*/

function toggleHelp()
{
	//var help = getCookie("help");
	
	if (getCursor() == "help")
	{
		//setCookie("help", "false");
		setCursor("");
		htm();
	}
	else
	{
		//setCookie("help", "true");
		setCursor("help");
	}
}

/*function isHelpOn()
{
	return (getCookie("help") == "true");
}*/

function getCursor()
{
	return document.body.style.cursor;
}

function setCursor(cursor)
{
	document.body.style.cursor = cursor;
	
	var aarr = document.getElementsByTagName('a');
  	
  	for (var i = 0; i < aarr.length; i++) 
  	{
  		aarr[i].style.cursor = cursor;
  	}
  	
  	var inputarr = document.getElementsByTagName('input');
  	
  	for (i = 0; i < inputarr.length; i++) 
  	{
  		inputarr[i].style.cursor = cursor;
  	}
}

function init() 
{
  	//applyCssFilter();
  	
    if (!document.getElementById) 
  		return;
  		
  	var imgTemp = new Array();
  	var imgElements = document.getElementsByTagName('img');
  	
  	for (var i = 0; i < imgElements.length; i++) 
  	{  		
		if (imgElements[i].getAttribute('hsrc') && imgElements[i].getAttribute('ssrc') && imgElements[i].getAttribute('hssrc'))
    	{
  			imgTemp[i] = new Image();
        	imgTemp[i].src = imgElements[i].getAttribute('hsrc');
        	imgTemp[i].src = imgElements[i].getAttribute('hssrc');

        	imgElements[i].onmouseover = function() 
        	{
            	if (this.bSelected) 
            	{
            		this.setAttribute('src', this.getAttribute('hssrc'));
            	}
            	else               
            	{
            		this.OriginSrc = this.getAttribute('src');
            		this.setAttribute('src', this.getAttribute('hsrc'));
            	}
			}
			
        	imgElements[i].onmouseout = function() 
        	{
        		if (this.bSelected)
        		{
            		this.setAttribute('src', this.getAttribute('ssrc'));
            	}
            	else
            	{
            		this.setAttribute('src', this.OriginSrc);
            	}
			}
			 
        	imgElements[i].onclick = function() 
        	{
            	if (this.bSelected = !this.bSelected)
            	{
            		this.setAttribute('src', this.getAttribute('hssrc'));
            	}
	            else
	            {
	            	this.setAttribute('src', this.getAttribute('hsrc'));
	            }
        	}
    	}
    	else if (imgElements[i].getAttribute('hsrc'))
  		{
  			imgTemp[i] = new Image();
        	imgTemp[i].src = imgElements[i].getAttribute('hsrc');
        	
        	imgElements[i].onmouseover = function() 
			{
				this.OriginSrc = this.getAttribute('src');
				this.setAttribute('src', this.getAttribute('hsrc'));
        	}
        	
        	imgElements[i].onmouseout = function() 
        	{
            	this.setAttribute('src', this.OriginSrc);
        	}
    	}
    	else if (imgElements[i].getAttribute('ssrc'))
  		{
  			imgElements[i].onclick = function() 
        	{
            	if (this.bSelected = !this.bSelected)
            	{
            		this.OriginSrc = this.getAttribute('src');
            		this.setAttribute('src', this.getAttribute('ssrc'));
	            }
	            else
	            {
	            	this.setAttribute('src', this.OriginSrc);
	            }
        	}
  		}
    }

  	var elements = document.getElementsByTagName('a');
  	CheckHelpElements(elements);
  
	elements = document.getElementsByTagName('input');
  	CheckHelpElements(elements);
}

function CheckHelpElements(elements)
{
	for (var i = 0; i < elements.length; i++) 
  	{  			
        if (elements[i].getAttribute('help'))
  		{
        	elements[i].onmouseover = function() 
        	{        		
        		if (getCursor() != "help")
        			return false;
        			
            	var HelpText = this.getAttribute('help');
            	var HelpInfo = ["Help!", "No Help Information"];
            	HelpInfo[1] = HelpText;
            	htm();
            	stm(HelpInfo, Style);
        	}
        	
        	elements[i].onmouseout = function() 
        	{        	
        		if (getCursor() != "help")
        			return false;
        			
            	htm();
        	}
    	}
  	}
}
