/******************************************************************************
 * Javascript functions used throughout the site                              *
 ******************************************************************************/

function move(form, from, to) {
   var fromSelect = document.forms[form][from];
   var toSelect   = document.forms[form][to];
   var index      = fromSelect.selectedIndex;
   var toLength   = toSelect.length;

   var text  = fromSelect.options[index].text;
   var value = fromSelect.options[index].value;

   fromSelect.options[index] = null;
   toSelect.options[toLength] = new Option (text, value);
}

function popUp(url,width,height,winname) {
  var url, width, height;
  if (width == null)  { width  = 623; }   // default width
  if (height == null) { height = 675; }   // default height
  if (winname == null) { winname = (new Date()).getTime(); }   // default height
  window.open(url,winname,'toolbar=no,location=no,directories=no,status=yes,menubar=no,scrollbars=yes,resizable=yes,width='+width+',height='+height);
}

function randomImage() {
  var rand = Math.random();
  var i = 1;
  var images = new Array();

  images[i++] = "http://techsupport.olivet.edu/images/longimage1.jpg";
  images[i++] = "http://techsupport.olivet.edu/images/longimage2.jpg";
  images[i++] = "http://techsupport.olivet.edu/images/longimage3.jpg";
  images[i] = "http://techsupport.olivet.edu/images/longimage4.jpg";
  
  var randnum = Math.round(rand * (i-1)) + 1;

  return images[randnum];
}

function reload(frame){
  top.frames[frame].location.reload();
}

function selectAll(form, name) {
  var select = document.forms[form][name];

  for (i=0; i< select.length; i++) {
    select.options[i].selected = true; 
  }
}

function updateFrame(frame, page){
  parent.frames[frame].location=page;
}
