//#location map popup
//#popup window for map
function showMap() { 
	window.open("map.php","map","scrollbars=yes,resizable=yes,width=600,height=550");
	return false;
}

//#logo rollover
//#credit: http://onlinetools.org/articles/unobtrusivejavascript/chapter2.html
//#modified slightly by tidy may 07 
function findImg(id)
{
	if(document.getElementById)
	{
		var pic = document.getElementById(id);
  		if(pic)
  		{
			// add the function roll to the parent Element of the image
  			pic.parentNode.onmouseover=function(){roll(this);};
			pic.parentNode.onmouseout=function(){roll(this);};
			pic.parentNode.onfocus=function(){roll(this);};
			pic.parentNode.onblur=function(){roll(this);};
  		}
 	}
}

function roll(o)
{
	 var i,isnode,src,ftype,newsrc,nownode;
	// loop through all childNodes
	 for (i=0;i<o.childNodes.length;i++)
	 {
	  nownode=o.childNodes[i];
	// if the node is an element and an IMG set the variable and exit the loop
	  if(nownode.nodeType==1 && /img/i.test(nownode.nodeName))
	  {
	   isnode=i;
	   break;
	  }
	 }
	// check src and do the rollover
	 src = o.childNodes[isnode].src;
	 ftype = src.substring(src.lastIndexOf('.'), src.length);
	 if(/_on/.test(src))
	 {
	  newsrc = src.replace('_on','');
	 }else{
	  newsrc = src.replace(ftype, '_on'+ftype);
	 }
	 o.childNodes[isnode].src=newsrc;
}

window.onload=function(){
 findImg('imgLogo');
}

//#logo scroller functions
function SampleThumbScroller(aryThumb,intTotalLength){
    var _this = this;
    var _aryThumb = aryThumb;
    var s = document.getElementById("logoScroller");
    var _intThumbCount = aryThumb.length;
    var _intThumbWidth = 100; 
	var _intThumbSidePadding = 15; 
    var _intTimerID = 0;
    var _intLeft = 0;
	var _intRight = 0;
    var _intNextIndex = 0;
	var _runningCount = 0;
	var _intTotalLength = intTotalLength;
	var _intFirstLength = aryThumb[0].getElementsByTagName('img')[0].width + 2*_intThumbSidePadding
	var _intLengthToCurrent = _intFirstLength;
	var _intLengthToPrevious = 0;
    this.start = function(){
      _intTimerID = window.setInterval("_sts.scrollLeft()", 40);
    }

    this.stop = function(){
      window.clearInterval(_intTimerID);
    }

	this.scrollLeft = function(){
      _intRight-=1;
      s.style.right = _intRight.toString() + "px";
	  
	if((_intRight % _intTotalLength) % _intLengthToCurrent == 0) {
			var m = (_intRight * -1) + _intTotalLength - (_intLengthToCurrent - _intLengthToPrevious);
			_aryThumb[_intNextIndex].style.right = m.toString() + "px";
			_intLengthToPrevious =_intLengthToCurrent;
		
			_intNextIndex++;
			if(_intNextIndex >= _intThumbCount)
			{
			  _intNextIndex = 0;
			  _intLengthToCurrent = _intFirstLength;
			  _intLengthToPrevious = 0;
			}
			else
			{
				_intLengthToCurrent += aryThumb[_intNextIndex].getElementsByTagName('img')[0].width + 2*_intThumbSidePadding;
			}

      }
    }
  }