

//alert('Softball1');
var sshow_Softball1 = function () {
// Slide show name space

    // Local Variables
    var timer = 0;
    var currImg = 0;
    var myName = "";    
    var delay = 5000;
    var parLyr = null; //(document.layers && parLyr ? eval(parLyr) : window);
    var data = new Array();
    
    
    // Print the html that we will manipulate to rotate the images
    document.write("<span style='margin: 0px;'><a name='picRotateSoftball1Lnk' id='picRotateSoftball1Lnk' href='#' style='margin: 0px; padding: 0px;'><img name='picRotateSoftball1Img' id='picRotateSoftball1Img'  src='/App_Themes/DefaultTheme/art/loading.gif' style='filter:blendTrans(duration=1)'   border='0' style='z-index: 1; margin: 0px; padding: 0px;' width='450px' height='345px'></a><div name='picRotateSoftball1Div' id='picRotateSoftball1Div' style='visibility: visible; width: 450px; height: 32px; z-index: 1000; margin: 0px; padding: 0px; text-align: left; font-weight: normal; font-size: 12pt; vertical-align: middle; font-family: Arial;'></div></span>");
    
    _init('picRotateSoftball1', '7000', null, '~/get_image.aspx?id=3444|#|Carly Swingle throws a fast ball|White|Black|0', '~/get_image.aspx?id=3455|#|Samantha Flett lays down a bunt|Black|Gold|0', '~/get_image.aspx?id=3457|#|Ashley Lowe-Thaens takes a throw at third|White|Black|0', '~/get_image.aspx?id=3458|#|Marquita Espinoza leads team in HRs|Black|Gold|0', '~/get_image.aspx?id=3460|#|Colleen Murphy-Carey gets some instructions|White|Black|0', '~/get_image.aspx?id=3461|#|Bethany "AK" Holt fires the ball in from left|Black|Gold|0', '~/get_image.aspx?id=3462|#|Molly Fletcher lays down a bunt|White|Black|0', '~/get_image.aspx?id=3463|#|Brittany Norton awaits a play at first|Black|Gold|0', '~/get_image.aspx?id=3464|#|Laura Campbell and Tasha Taylor get their signs|White|Black|0', '~/get_image.aspx?id=3465|#|Coach Jim Cheney|Black|Gold|0' );         
 //'red.gif', 'yellow.gif', 'green.gif', 'blue.gif'
    
    // Don't call play automatically, need to wait for the global var is defined
    //_play();
        
    function _play() {        
        // Cycle one image forwards -- cycle() will stop an existing timeout if applied. 
        _cycle(1); 
        timer = setTimeout('sshow_Softball1.Play()', delay);
    }
       
    function _stop() {
        clearTimeout(timer);
        timer = null;
    }
    
    function _init(item_name, item_delay, item_parLyr) {
        myName = item_name;
        parLyr = (document.layers && item_parLyr ? eval(item_parLyr) : window);
        delay = item_delay;
     
         for (var i = 3; i < arguments.length; i++)
         {
          // Preload images into an array before swapping.
          data[i - 3] = new Image();
          var txt = arguments[i];
          // imgurl|targeturl|text|textcolor|backgroundcolor|opacity
          parts = txt.split("|");
          data[i - 3].src = parts[0].replace("~", "");
          data[i-3].targeturl=parts[1];
          data[i-3].text=parts[2];
          data[i-3].textcolor=parts[3];
          data[i-3].bgcolor=parts[4];
          data[i-3].opacity=parts[5];  
         }
     }

    
    function _getRefToLink(lnkID, oDoc) {
        if( document.getElementById ) {
            return document.getElementById(lnkID); }
        if( document.all ) {
            return document.all[lnkID]; }
        if( !oDoc ) { oDoc = document; }
        alert('NO LINK!');
        return null;
    }
    
    function _getRefToDiv(divID,oDoc) {
      if( document.getElementById ) {
        return document.getElementById(divID); }
      if( document.all ) {
        return document.all[divID]; }
      if( !oDoc ) { oDoc = document; }
      if( document.layers ) {
        if( oDoc.layers[divID] ) { return oDoc.layers[divID]; } else {
          //repeatedly run through all child layers
          for( var x = 0, y; !y && x < oDoc.layers.length; x++ ) {
            //on success, return that layer, else return nothing
            y = _getRefToDiv(divID,oDoc.layers[x].document); }
        return y; } }    
      return false;
    }
    
    function _showDiv(divID_as_a_string) {
      //get a reference as above ...
      myReference = _getRefToDiv(divID_as_a_string);
      if( !myReference ) {
        window.alert('Nothing works in this browser');
        return; //don't go any further
      }
      //now we have a reference to it
      if( myReference.style ) {
        //DOM & proprietary DOM
        myReference.style.visibility = 'visible';
      } else {
        //layers syntax
        myReference.visibility = 'show';
      }
    }
    
    function _cycle(dir) {
     // Stop any exiting play function if this is called manually.
     _stop();

     // Increment and mod by the image array length.
     currImg += dir;
     currImg = currImg % data.length;
     if (currImg < 0) currImg += data.length;

     // The image in question -- perhaps nested within its parent layer for NS4.
     var imgRef = parLyr.document.images[myName + 'Img'];
     var lnkRef = _getRefToLink(myName + 'Lnk');
      lnkRef.href=data[currImg].targeturl;
     var divRef = _getRefToDiv(myName+'Div');
     _showDiv(myName+'Div');
     divRef.style.backgroundColor=data[currImg].bgcolor;
     divRef.style.color=data[currImg].textcolor;
     divRef.innerText=data[currImg].text; // set IE text
     divRef.textContent=data[currImg].text; // set FFox text
     //divRef.style.opacity="." + data[currImg].opacity;
     //divRef.style._mox_opacity="." + data[currImg].opacity;
     

     // IE filters active?
     var f = imgRef.filters;
     if (f&&f.length&&f[0]) f[0].Apply();
     // Swap the image, and play the filter if applicable.
     imgRef.src = data[currImg].src;
     if (f&&f.length&&f[0]) f[0].Play();
    }

    
 return {   
    Play: function() {
        _play();
    },
    Stop: function() {
        _stop();
    }
 };
}();
sshow_Softball1.Play();