var workshops = new Object();
workshops.div_workshops = null;
workshops.devEls=[null];
workshops.lasthighlighted=null;
workshops.rsbase=null;
workshops.blockReset=0;

ooom.highlight=function( divId)  {
  var el = ps$( divId);
  if( el) { 
    if( workshops.lasthighlighted  && workshops.lasthighlighted.wsEl)  {
      workshops.lasthighlighted.wsEl.style.backgroundColor = '#777';
    }
    highlight( el);
  }
}

 
function highlight( whichpic)  {
   whichpic.style.color = '#ffffff';
   whichpic.style.backgroundColor = "#202004";
   //ooom.log("highlight start, id=" + whichpic.id + ", workshops.blockReset=" + workshops.blockReset);
   if( whichpic.ooom_rs )  {
      workshops.lasthighlighted.style.display = 'none';
      whichpic.ooom_rs.style.display = 'block';
      workshops.lasthighlighted = whichpic.ooom_rs;
   }
   return false;
}

function highlightRS()  {
    // alert("resetRS, workshops.blockReset=" + workshops.blockReset + ", lasthighlighted=" + workshops.lasthighlighted.id);
    // workshops.rsbase.style.display = 'none';
    // workshops.lasthighlighted.style.display = 'block';
     if( workshops.lasthighlighted && workshops.lasthighlighted.wsEl)  { 
        highlight( workshops.lasthighlighted.wsEl);
     }

    return false;
}

function reset( whichpic)  {
   // alert("reset, workshops.blockReset=" + workshops.blockReset + " whichpic.id=" + whichpic.id);
   whichpic.style.color = '#606000';
   whichpic.style.backgroundColor = 'transparent';
   if( whichpic.ooom_rs && workshops.blockReset == 0 )  {
       whichpic.ooom_rs.style.display = 'none';
   } else {
       highlightRS();
   }
   return false;
}

function reset00( )  {
  // alert("reset00, workshops.blockReset=" + workshops.blockReset);
  if( workshops.blockReset == 0)  {
     
     workshops.rsbase.style.display = 'block';
     if( workshops.lasthighlighted && workshops.lasthighlighted.wsEl)  { 
        reset( workshops.lasthighlighted.wsEl);
     } else if( workshops.lasthighlighted.wsEl) {
       workshops.lasthighlighted.style.display = 'none';
     }
  }
   return false;
}

function prepareWorkshops() {
  if( !document.getElementsByTagName || !document.getElementById) return false;
  workshops.div_workshops = ps$( "div_workshops");
  workshops.rsbase=ps$( "div_rs00");
  workshops.lasthighlighted=workshops.rsbase;
  var tdRightside = ps$( "div_rightside");
  if( workshops.div_workshops && workshops.rsbase && tdRightside)   {
     workshops.devEls   = workshops.div_workshops.getElementsByTagName( "div");
     devsLen = workshops.devEls.length;
     for( var i=0; i<devsLen; i++)  {
        var wsel = workshops.devEls[ i];
        if( cssClass.is( wsel, 'div_wscls'))  {
          wsel.onmouseover = function() {
              return highlight( this);
          }
          wsel.onmouseout = function() {
              return reset( this);
          }
          var wsid = wsel.id;
          var rsid = wsid.replace( 'div_ws', 'div_rs');
          var rsel = ps$( rsid);
          if( rsel)  {
            wsel.ooom_rs = rsel;
            rsel.wsEl=wsel;
          }
        }
     }
     workshops.div_workshops.onmouseout = function() {
        return reset00();
     }
     tdRightside.onmouseover = function() {
        return highlightRS();
     }
     tdRightside.onmouseout = function() {
        return reset00();
     }
   }
   
   if( window.location.hash  ) {
    //  alert( "hash=" + window.location.hash.substring( 1));
      var el = ps$( window.location.hash.substring( 1));
      if( el)   {
         highlight(el);
      }
   }
   
}


