Array.prototype.ln=function() {return this.length}
function pI(s) {return parseInt(s)}
with (String)
{
  prototype.sb=function(s,e) {return this.substring(s,e)}
  prototype.io=function(s)   {return this.indexOf(s)}
  prototype.ln=function()    {return this.length}
}

var isIE    = 0;
var isIE5   = 0;
var isNS    = 0;
var isNS4   = 0;
var isOP    = 0;
var isMZ    = 0;
var isDOM   = 0;
var isMAC   = 0;
var isVER   = 0;


astyle_getBrowser();

if (!(isOP && isVER<7)) {
  onresize=astyle_setCoords;
  onload=astyle_setCoords;
}

if (isOP && isVER<7) window.setInterval ('astyle_resize()', 500);

var oldW, oldH;
function astyle_resize() {
  var w,h;
  w = innerWidth;
  h = innerHeight;
  if (oldW != w || oldH != h) astyle_setCoords();
}

function astyle_getBrowser() {
   
  // Detects client's browser

  var nv = navigator;
  var a  = nv.userAgent;
  var n  = nv.appName;
  var v  = nv.appVersion;
  var ns = 'Netscape';
  var gk = 'Gecko';
  var pf = function(r) {return parseFloat(r)}
  isMAC  = v.io('Mac') >= 0;
  isDOM  = document.getElementById?1:0;

    
  // Konqueror detect
  if (n.toLowerCase()=='konqueror')
  {
      isMZ  = 1;
      isVER = 1.6;
      return;
  }

  if (a.io('Opera')>=0)
  {
      isOP     = 1;
      isVER    = pf(a.sb(a.io('Opera')+6, a.ln()));
		  return;
  }

  if (n.toLowerCase()=='netscape')
  {
      if (a.io('rv:')!=-1 && a.io(gk)!=-1 && a.io(ns)==-1)
      { 
          isMZ  = 1;
          isVER = pf(a.sb(a.io('rv:')+3, a.ln()));
      }
      else
      {
          isNS = 1;
          if (a.io(gk) != -1 && a.io(ns)>a.io(gk))
          {
    	        var d = (a.io(ns+'6')>-1) ? 10 : (a.io(ns)>-1) ? 9 : 0;
              isVER = pf(a.sb(a.io(ns) + d, a.ln()))
          }
          else
              isVER = pf(v);

          isNS4 = isVER<6;
          isNS6 = !isNS4 && isVER<7;
      }
      return;
  }

  if (document.all?1:0)
  {
      isIE     = 1;
      isVER    = pf(a.sb(a.io('MSIE ')+5, a.ln()));
  }
  isIE5 = isIE && isVER>=5;

 
  //alert("isIE = "+isIE+"\n"+"isOP = "+isOP+"\n"+"isMZ = "+isMZ+"\n"+"isNS = "+isNS+"\n"+"isDOM = "+isDOM+"\n"+"isMAC = "+isMAC+"\n"+"isVER = "+isVER);
}

function astyle_showpic(pid, vis) {
  var pic = document.getElementById("pic_" + pid);
  if (isIE5) {
    if (vis) pic.style.filter = "blendTrans(duration=0.2)";
    if (pic.filters.blendTrans.status == 2) pic.filters.blendTrans.stop();
    pic.filters.blendTrans.apply();
    if (vis) pic.style.visibility = "visible";
    else pic.style.visibility = "hidden";
    pic.filters.blendTrans.play();
  }
  else
    if (vis) pic.style.visibility = "visible";
    else pic.style.visibility = "hidden";
}


function astyle_setCoords() {
  var w,h;
  if (isIE || (isOP && isVER>=7)) {
    w = document.body.clientWidth;
    h = document.body.clientHeight;
    oldW = w;
    oldH = h;
  }
  else {
    w = innerWidth;
    h = innerHeight;
  }
  var l,t;
l = (w - 800)/2;
  t = (h - document.getElementById ('tblMain').offsetHeight)/2;
  if (l<0) l = 0;
  if (t<0) t = 0;
  document.getElementById ('tblSlides').style.left = l+60+'px';
  document.getElementById ('tblSlides').style.top  = t+300+'px';

 
}

var curPic = null;
function astyle_runPics(frst) {
  if (!curPic) curPic = frst;
  
  var pic = document.getElementById ('pic' + curPic);
  pic.style.filter = "blendTrans(duration=3)";
  if (pic.filters.blendTrans.status == 2) return;
  pic.filters.blendTrans.apply();
  if (pic.style.visibility == "visible") pic.style.visibility = "hidden";
  else pic.style.visibility = "visible";
  pic.filters.blendTrans.play();
  
  curPic++;
  if (curPic>7) curPic = frst;
}

function astyle_showPics(frst) {
  var pic;
  for (var i=frst; i<=7; i++) {
    pic = document.getElementById ('pic' + i);
    if (isIE5) pic.style.visibility = "hidden";
 //   pic.src = "images/pic" + i + ".gif";
  }
  if (isIE5) window.setInterval ("astyle_runPics(" + frst + ")", 800);
}

