ns4    = (document.layers);
ns6    = (!document.all && document.getElementById);
ie4    = (document.all && !document.getElementById && !window.opera);
ie5    = (document.all && !document.fireEvent && !window.opera);
op7  	 = (window.opera && document.createComment) ;
w3dom  = (document.getElementById || op7);

function setCurrentMainLink(currentId) {
	document.getElementById("currentMainLink").id = "justAnId";
	currentId.id = "currentMainLink";
}


var slideCache = new Array();
function SlideShow(pictureName,imageFiles,displaySecs)
{
  var imageSeparator = imageFiles.indexOf(";");
  var nextImage = imageFiles.substring(0,imageSeparator);
  if (document.all)
  {
    document.getElementById(pictureName).style.filter="blendTrans(duration=2)";
    document.getElementById(pictureName).filters.blendTrans.Apply();
  }
  document.getElementById(pictureName).src = nextImage;
  if (document.all)
  {
    document.getElementById(pictureName).filters.blendTrans.Play();
  }
  var futureImages= imageFiles.substring(imageSeparator+1,imageFiles.length)
    + ';' + nextImage;
  setTimeout("SlideShow('"+pictureName+"','"+futureImages+"',"+displaySecs+")",
    displaySecs*1000);
  // Cache the next image to improve performance.
  imageSeparator = futureImages.indexOf(";");
  nextImage = futureImages.substring(0,imageSeparator);
  if (slideCache[nextImage] == null) {
    slideCache[nextImage] = new Image;
    slideCache[nextImage].src = nextImage;
  }
}

function defineObjects() {
  page          = new Object();
  page.width    = (ns4 || ns6 ||op7) ? innerWidth  : document.body.clientWidth;
  page.height   = (ns4 || ns6 ||op7) ? innerHeight : document.body.clientHeight;
  //content       = new layerSetup(null,"",100,100,7,"visible");
  //                sizeAnimator(content,page.width-200,page.height);
  //				  setTimeout("actionManager()",500);
}

function layerSetup(parent,id,left,top,zindex,visibility) {
  if(ns4) {
    this.obj             = (parent != null) ? parent.document[id]          : document[id];
    this.obj.htm         = (parent != null) ? parent.document[id].document : document[id].document;
  } else if(ie4 ||ie5) {
    this.obj             = document.all[id].style;
    this.obj.htm         = document.all[id];
  } else if(w3dom) {
    this.obj             = document.getElementById(id).style;
    this.obj.htm         = document.getElementById(id);
  }
  this.obj.left          = (w3dom) ? left + "px" : left;
  this.obj.top           = (w3dom) ? top  + "px" : top;
  this.obj.zIndex        = zindex;
  this.obj.visibility    = visibility;
  return this.obj;
}

function sizeAnimator(obj,width,height) {
  if(ns4) {
    obj.clip.right  = width;
    obj.clip.bottom = height;
  } else {
    obj.width       = (w3dom) ? width  + "px" : width;
    obj.height      = (w3dom) ? height + "px" : height;
  }
}

function actionManager() {
    pageManager("load_page","contents/start.php");
}

var page_timer = null;
function pageManager() {
  var args = pageManager.arguments;
  switch(args[0]) {
    case "load_page" :
	content.top = (w3dom) ? 120  + "px": 120;
      if(ie4) {
        document.frames["frameData"].document.location = args[1];
      }
      if(w3dom) {
        document.getElementById("frameData").src = args[1];
      }
      if(ns4) {
        content.load(args[1],page.width-300);
      }
    break;
    case "page_is_loaded" :
      if(ns4) {
        sizeAnimator(content,page.width-300,content.htm.height);
      }
      clearTimeout(page_timer);
      page_timer = setTimeout("pageManager('display_page')",500);
    break;
    case "display_page" :
      if(ie4) {
        content.htm.innerHTML = document.frames['frameData'].document.body.innerHTML;
      } else if(w3dom) {
        content.htm.innerHTML = window.frames.frameData.window.document.getElementById('body').innerHTML;
      }
    break;
  }
}

