var w3c2 = (document.getElementById) ? 1:0
var ns42 = (document.layers) ? 1:0
var ie42 = (document.all) ? 1:0

var range2 = "";
var cap2 = "";
var mutex2 = 0;
var yplace2 = 0;
var ymax2 = 0;
var ymin2 = 0;
var xplace2 = 0;
var newsHeight2 = 0;

/** The only code you should ever need to change here are the following 3 vars **/
var speed2 = 5;                         //speed2 at which the news scrolls
var newsId2 = "portf_1a";                   //name of the overall news div
var newsClipId2 = "portf_1_scroll";       //name of the news clipping div

function redrawScreen2() {
  location.reload();
  return false
}

function shiftTo2(obj, x, y) {
  if (w3c2) {
    obj.style.left = x + "px";
    obj.style.top = y + "px";
  }
  else if (ns42) {
	 obj.moveTo(x,y);
  } 
  else if (ie42) {
    obj.style.pixelLeft = x;
	obj.style.pixelTop = y;
  }
}

function getObject2(obj) {
	var theObj2 = eval("document." + range2 + obj + cap2);
	return theObj2;
} 

function scrollUp2() {
  if (mutex2 == 1){
    var theObj2 = getObject2(newsId2);
    if (yplace2 < ymax2) {
      yplace2 = yplace2 + speed2;
      if (yplace2 > ymax2) yplace2 = ymax2;
      shiftTo2(theObj2, xplace2, yplace2);
      setTimeout("scrollUp2()",25);
    }
  }
}
  
function scrollDown2() {
  if (mutex2 == 2){
    var theObj2 = getObject2(newsId2);
    if (yplace2 > ymin2) {
      yplace2 = yplace2 - speed2;
      if (yplace2 < ymin2) yplace2 = ymin2;
      shiftTo2(theObj2, xplace2, yplace2);
      setTimeout("scrollDown2()",25);
    }
  }
}

function scrollIt2(msg, dir) {
  window.status = msg; 
  mutex2 = dir;
  if (mutex2 == 1) scrollUp2();
  else if (mutex2 == 2) scrollDown2();
}

function init2() {
  if (w3c2) {
    range2 = "getElementById(\"";
    cap2 = "\")";
    theObj2 = getObject2(newsClipId2);
    newsHeight2 = parseInt(theObj2.offsetHeight);
    theObj2 = getObject2(newsId2);
    ymin2 = (parseInt(theObj2.offsetHeight) - newsHeight2) * -1;
  }
  else if (ns42) {
    window.cap2tureEvents(Event.RESIZE);
    window.onresize = redrawScreen2;
    theObj2 = getObject2(newsClipId2);
    newsHeight2 = theObj2.clip.height;
    newsId2 = newsClipId2 + ".document." + newsId2;
    theObj2 = getObject2(newsId2);
    ymin2 = (theObj2.clip.height - newsHeight2) * -1;
  }
  else if (ie42) {
    range2 = "all.";
    theObj2 = getObject2(newsClipId2);
    newsHeight2 = theObj2.offsetHeight;
    theObj2 = getObject2(newsId2);
    ymin2 = (theObj2.offsetHeight - newsHeight2) * -1;
  }
}
