﻿<!--

function MM_swapImgRestore() { //v2.0

  if (document.MM_swapImgData != null)

    for (var i=0; i<(document.MM_swapImgData.length-1); i+=2)

      document.MM_swapImgData[i].src = document.MM_swapImgData[i+1];

}

 

function MM_preloadImages() { //v2.0

  if (document.images) {

    var imgFiles = MM_preloadImages.arguments;

    if (document.preloadArray==null) document.preloadArray = new Array();

    var i = document.preloadArray.length;

    with (document) for (var j=0; j<imgFiles.length; j++) if (imgFiles[j].charAt(0)!="#"){

      preloadArray[i] = new Image;

      preloadArray[i++].src = imgFiles[j];

  } }

}

 

function MM_swapImage() { //v2.0

  var i,j=0,objStr,obj,swapArray=new Array,oldArray=document.MM_swapImgData;

  for (i=0; i < (MM_swapImage.arguments.length-2); i+=3) {

    objStr = MM_swapImage.arguments[(navigator.appName == 'Netscape')?i:i+1];

    if ((objStr.indexOf('document.layers[')==0 && document.layers==null) ||

        (objStr.indexOf('document.all[')   ==0 && document.all   ==null))

      objStr = 'document'+objStr.substring(objStr.lastIndexOf('.'),objStr.length);

    obj = eval(objStr);

    if (obj != null) {

      swapArray[j++] = obj;

      swapArray[j++] = (oldArray==null || oldArray[j-1]!=obj)?obj.src:oldArray[j];

      obj.src = MM_swapImage.arguments[i+2];

  } }

  document.MM_swapImgData = swapArray; //used for restore

}


// -------------------------------------------------------------------
// -------------------------------------------------------------------
// NEWS SCROLLER
// -------------------------------------------------------------------
// -------------------------------------------------------------------
function newsScroller(content, divId, divClass, delay){
this.content=content //message array content
this.tickerid=divId //ID of ticker div to display information
this.delay=delay //Delay between msg change, in miliseconds.
this.mouseoverBol=0 //Boolean to indicate whether mouse is currently over scroller (and pause it if it is)
this.hiddendivpointer=1 //index of message array for hidden div
document.write('<div id="'+divId+'" class="'+divClass+'" style="position: relative; overflow: hidden;"><div class="innerDiv" style="position: absolute; left:0px; width: 100%;" id="'+divId+'1">'+content[0]+'</div><div class="innerDiv" style="position: absolute; width: 100%; visibility: hidden;left:0px;" id="'+divId+'2">'+content[1]+'</div></div>')
var scrollerinstance=this
if (window.addEventListener) //run onload in DOM2 browsers
window.addEventListener("load", function(){scrollerinstance.initialize()}, false)
else if (window.attachEvent) //run onload in IE5.5+
window.attachEvent("onload", function(){scrollerinstance.initialize()})
else if (document.getElementById) //if legacy DOM browsers, just start scroller after 0.5 sec
setTimeout(function(){scrollerinstance.initialize()}, 500)
}

// -------------------------------------------------------------------
// initialize()- Initialize scroller method.
// -Get div objects, set initial positions, start up down animation
// -------------------------------------------------------------------

newsScroller.prototype.initialize=function(){
this.tickerdiv=document.getElementById(this.tickerid)
this.visiblediv=document.getElementById(this.tickerid+"1")
this.hiddendiv=document.getElementById(this.tickerid+"2")
this.visibledivtop=parseInt(newsScroller.getCSSpadding(this.tickerdiv))
//set width of inner DIVs to outer DIV's width minus padding (padding assumed to be top padding x 2)
this.visiblediv.style.width=this.hiddendiv.style.width=this.tickerdiv.offsetWidth-(this.visibledivtop*2)+"px"
this.getinline(this.visiblediv, this.hiddendiv)
this.hiddendiv.style.visibility="visible"
var scrollerinstance=this
document.getElementById(this.tickerid).onmouseover=function(){scrollerinstance.mouseoverBol=1}
document.getElementById(this.tickerid).onmouseout=function(){scrollerinstance.mouseoverBol=0}
if (window.attachEvent) //Clean up loose references in IE
window.attachEvent("onunload", function(){scrollerinstance.tickerdiv.onmouseover=scrollerinstance.tickerdiv.onmouseout=null})
setTimeout(function(){scrollerinstance.animateup()}, this.delay)
}


// -------------------------------------------------------------------
// animateup()- Move the two inner divs of the scroller up and in sync
// -------------------------------------------------------------------

newsScroller.prototype.animateup=function(){
var scrollerinstance=this
if (parseInt(this.hiddendiv.style.left)>(this.visibledivtop+5)){
this.visiblediv.style.left=parseInt(this.visiblediv.style.left)-4+"px"
this.hiddendiv.style.left=parseInt(this.hiddendiv.style.left)-4+"px"
// -------- THIS NUMBER CHANGES THE SPEED THAT THE DIVS CHANGE ----------
setTimeout(function(){scrollerinstance.animateup()}, 25)
}
else{
this.getinline(this.hiddendiv, this.visiblediv)
this.swapdivs()
setTimeout(function(){scrollerinstance.setmessage()}, this.delay)
}
}

// -------------------------------------------------------------------
// swapdivs()- Swap between which is the visible and which is the hidden div
// -------------------------------------------------------------------

newsScroller.prototype.swapdivs=function(){
var tempcontainer=this.visiblediv
this.visiblediv=this.hiddendiv
this.hiddendiv=tempcontainer
}

newsScroller.prototype.getinline=function(div1, div2){
div1.style.left=this.visibledivtop+"px"
div2.style.left=Math.max(div1.parentNode.offsetHeight, div1.offsetHeight)+"px"
}

// -------------------------------------------------------------------
// setmessage()- Populate the hidden div with the next message before it's visible
// -------------------------------------------------------------------

newsScroller.prototype.setmessage=function(){
var scrollerinstance=this
if (this.mouseoverBol==1) //if mouse is currently over scoller, do nothing (pause it)
setTimeout(function(){scrollerinstance.setmessage()}, 100)
else{
var i=this.hiddendivpointer
var ceiling=this.content.length
this.hiddendivpointer=(i+1>ceiling-1)? 0 : i+1
this.hiddendiv.innerHTML=this.content[this.hiddendivpointer]
this.animateup()
}
}

newsScroller.getCSSpadding=function(tickerobj){ //get CSS padding value, if any
if (tickerobj.currentStyle)
return tickerobj.currentStyle["paddingTop"]
else if (window.getComputedStyle) //if DOM2
return window.getComputedStyle(tickerobj, "").getPropertyValue("padding-top")
else
return 0
}


function clearText(box,orig) {
	if (box.value == orig) {
		box.value = ""
	}
}

// -------------------------------------------------------------------
// EMAIL FORM POP-UP
// -------------------------------------------------------------------
function openWindow(id) {
  var url='http://www.shermancountyed.org/email/'+id
  var width=300;
  var height=450;
  var from_top=350;
  var from_left=500;
  var toolbar='no';
  var location='no';
  var directories='no';
  var status='no';
  var menubar='no';
  var scrollbars='no';
  var resizable='no';
  var atts='width='+width+',height='+height+',top='+from_top+',screenY=';
  atts+= from_top+',left='+from_left+',screenX='+from_left+',toolbar='+toolbar;
  atts+=',location='+location+',directories='+directories+',status='+status;
  atts+=',menubar='+menubar+',scrollbars='+scrollbars+',resizable='+resizable;
  window.open(url,'',atts);
}

//-->
