function highlight(event, o) 
{
	//***** DEFINE THESE VARS *****//
	
	//nums = 15; //number of thumbnails
	nums = getChildren(document.getElementById('thumbs'), 'img');
	thumbs_height = 65; //height of single thumbnail

	//UNLESS YOU STOP USING CSS HEIGHT FOR THE thumbs_box, box_height IS AUTO DEFINED//
	box_height = stripAlphaChars(document.getElementById("thumbs_box").style.height); //height of thumbnail box

	//***** END OF VAR DEFINE *****//

	o.style.border = "1px solid #FC0";
	pos_y = event.offsetY === undefined?event.pageY-findPos(o)-2:(event.offsetY);
	if(pos_y > 30)
	{
		scroll(pos_y - 10);
	} else {
		scroll(-50 + pos_y);
	}
}

function unhighlight(o)
{
	o.style.border = "0px";
	o.style.borderBottom = "2px solid #000"
}

function chgpic(o)
{
	document.getElementById("bigpic").src = o.src.substring(0,o.src.length-5)+".jpg"
}

function findPos(obj)
{
	var curtop = 0;
	if (obj.offsetParent)
     {
		curtop = obj.offsetTop
		while (obj = obj.offsetParent)
          {
			curtop += obj.offsetTop
		}
	}
	return curtop;
}

function stripAlphaChars(pstrSource) 
{ 
	var m_strOut = new String(pstrSource); 
	m_strOut = m_strOut.replace(/[^0-9|\-]/g, ''); 
	return m_strOut; 
}

function scroll(remain)
{
	if(Number(stripAlphaChars(document.getElementById("thumbs").style.top)) > 0 && remain > 0 )
	{
		return true;	
	}
	if(Number(stripAlphaChars(document.getElementById("thumbs").style.top)) < -(nums * thumbs_height - box_height) && remain < 0)
	{
		return true;	
	}
	if(remain == 0)
	{
		return true;
	} else if (remain < 0) {
		document.getElementById("thumbs").style.top	= Number(stripAlphaChars(document.getElementById("thumbs").style.top)) - 1;
		remain = remain + 1;
	} else {
		document.getElementById("thumbs").style.top	= Number(stripAlphaChars(document.getElementById("thumbs").style.top)) + 1;
		remain = remain - 1;
	}
	window.setTimeout('window.parent.scroll('+remain+')', 1);
}

// Node functions
if(!window.Node)
{
	var Node = {ELEMENT_NODE : 1, TEXT_NODE : 3};
}

function checkNode(node, filter)
{
	return (filter == null || node.nodeType == Node[filter] || node.nodeName.toUpperCase() == filter.toUpperCase());
}

function getChildren(node, filter)
{
	var result = new Array();
	var children = node.childNodes;
	for(var i = 0; i < children.length; i++){
		if(checkNode(children[i], filter)) result[result.length] = children[i];
	}
	return result.length;
}