// Simple.js
function $d(id) {
   return document.getElementById(id);
   }
function STO(func,time) {
    return window.setTimeout(func,time);
    } 
//blinds effects

function $toggle(id) {
   if (act_height(id) == 0) $blinddown(id);
   else $blindup(id);
   }
function act_height(id) {
   height = $d(id).clientHeight;
   if(height == 0) height = $d(id).offsetHeight;
   return height;
   }
function act_width(id) {
   width = $d(id).clientWidth;
   if(width == 0) width = $d(id).offsetWidth;
   return width;
   }
function max_height(id) {
   var ids = $d(id).style;
   ids.overflow = 'hidden';
   if (act_height(id)!=0) return act_height(id);
   else
   {
   origdisp = ids.display;
   origheight = ids.height;
   origpos = ids.position;
   origvis = ids.visibility;
   ids.visibility = 'hidden';
   ids.height = '';
   ids.display = 'block';
   ids.position = 'absolute';
   height = act_height(id);
   ids.display = origdisp;
   ids.height = origheight;
   ids.position = origpos;
   ids.visibility = origvis;
   return height;
   }
   }
function $blindup(id, time) {
   if (!time)time = 500;
   acth = act_height(id);
   maxh = max_height(id);
   if (acth == maxh) {
      $d(id).style.display = 'block';
      var steps;
      steps = Math.ceil(time / acth);
      for(i = 0; i <= acth; i++) {
         newh = acth - i;
         STO("$d('" + id + "').style.height='" + newh + "px'", steps * i);
         }
      }
   }
function $blinddown(id, time) {
   if (!time)time = 500;
   acth = act_height(id);
   if (acth == 0) {
      maxh = max_height(id);
      $d(id).style.display = 'block';
      $d(id).style.height = '0px';
      var steps;
      steps = Math.ceil(time / maxh);
      for(i = 1; i <= maxh; i++) {
         STO("$d('" + id + "').style.height='" + i + "px'", steps * i);
         }
      }
   }  

//$opacity effects
function $opacity(id, opacStart, opacEnd, time) {
   if($d(id).style.width==0) $d(id).style.width=act_width(id);
   var speed = Math.round(time / 100);
   var timer = 0;
   if(opacStart > opacEnd) {
      for(i = opacStart; i >= opacEnd; i--) {
         STO("changeOpac(" + i + ",'" + id + "')", (timer * speed));
         timer++;
         }
      }
   else if(opacStart < opacEnd) {
      for(i = opacStart; i <= opacEnd; i++) {
         STO("changeOpac(" + i + ",'" + id + "')", (timer * speed));
         timer++;
         }
      }
   }
function changeOpac(opacity, id) {
   var ids = $d(id).style;
   ids.opacity = (opacity / 100);
   ids.MozOpacity = (opacity / 100);
   ids.KhtmlOpacity = (opacity / 100);
   ids.filter = "alpha(opacity=" + opacity + ")";
   }
function $shiftOpacity(id, time) {
   if($d(id).style.opacity < 0.50) {
      $opacity(id, 0, 100, time);
      }
   else {
      $opacity(id, 100, 0, time);
      }
   }
function currentOpac(id, opacEnd, time) {
   var currentOpac = 100;
   if($d(id).style.opacity < 100) {
      currentOpac = $d(id).style.opacity * 100;
      }
   $opacity(id, currentOpac, opacEnd, time)}
// Eof simple.js

// Simpleslish.js
var SlishCache = new Array();
var SlishCache2 = new Array();

function $slish(id, str, id2, str2, time) {
   slishnum = 1;
   slishid = id;
   slishid2= id2;
   slishtime = time;
   slishdelay = false;
   slishmax = str.match(/[;]/g).length;
   for (var i = 0; i < slishmax; i++) {
        pos = str.indexOf(";");
        SlishCache.push(str.substring(0, pos));
        str = str.substring(pos + 1, str.length);
        
        pos2 = str2.indexOf(";");
        SlishCache2.push(str2.substring(0, pos2));
        str2 = str2.substring(pos2 + 1, str2.length);
        }
   }
function $slishPLAY(time) {
    if (slishdelay == false) {
          slishdelay = time;
          $slishAUTO();
       }
   }
function $slishSTOP() {
   slishdelay = false;
   }
function $slishAUTO() {
   if (slishdelay != false) {
   if (slishnum < slishmax) slishnum += 1;
   else slishnum = 1;
   num2 = slishnum - 1;
   id = slishid;   id2 = slishid2;

   $opacity(id, 100, 0, slishtime);
   STO("$opacity('" + id + "', 0, 100, " + slishtime + ")", slishtime);
   STO("$d('" + id + "').src='" + SlishCache[num2] + "'", slishtime);
   STO("$d('" + id2 + "').href='" + SlishCache2[num2] + "'", slishtime);
   
   STO("$slishAUTO()", slishdelay);
      }
   }
function $slishNEXT() {
   if (slishnum < slishmax)slishnum += 1;
   else slishnum = 1;
   $slishToNum(slishnum);
   }
function $slishPREV() {
   if (slishnum > 1)slishnum -= 1;
   else slishnum = slishmax;
   $slishToNum(slishnum);
   }
function $slishToNum(num) {
   slishdelay = false;
   slishnum = num;
   num2 = num - 1;
   id = slishid; id2 = slishid2;
   $opacity(id, 100, 0, slishtime);
   STO("$opacity('" + id + "', 0, 100, " + slishtime + ")", slishtime);
   STO("$d('" + id + "').src='" + SlishCache[num2] + "'", slishtime);
   STO("$d('" + id2 + "').href='" + SlishCache2[num2] + "'", slishtime);
   }
// Eof simpleslish.js

