d=document;l=(d.layers)?1:0;op=navigator.userAgent.toLowerCase().indexOf('opera')!=-1;
function gE(e,f){if(l){f=(f)?f:self;var V=f.document.layers;if(V[e])return V[e];for(var W=0;W<V.length;)t=gE(e,V[W++]);return t;}if(d.all)return d.all[e];return d.getElementById(e);}
function sE(e){if(l)e.visibility='show';else e.style.visibility='visible';}
function hE(e){if(l)e.visibility='hide';else e.style.visibility='hidden';}
function sZ(e,z){if(l)e.zIndex=z;else e.style.zIndex=z;}
function sX(e,x){if(l)e.left=x;else if(op)e.style.pixelLeft=x;else e.style.left=x;}
function sY(e,y){if(l)e.top=y;else if(op)e.style.pixelTop=y;else e.style.top=y;}
function sXY(e,x,y){sX(e,x);sY(e,y);}
function gX(e){if(l)return e.top;else if(op)return e.style.pixelTop;else return e.style.top;}
function gY(e){if(l)return e.left;else if(op)return e.style.pixelLeft;else return e.style.left;}
function sW(e,w){if(l)e.clip.width=w;else if(op)e.style.pixelWidth=w;else e.style.width=w;}
function sH(e,h){if(l)e.clip.height=h;else if(op)e.style.pixelHeight=h;else e.style.height=h;}
function goH(e){if(l)return e.clip.height;else return parseInt(e.offsetHeight);}
function goW(e){var ret;if(l)return e.clip.width;else return parseInt(e.offsetWidth);}
function sC(e,t,r,b,x){if(l){X=e.clip;X.top=t;X.right=r;X.bottom=b;X.left=x;}else e.style.clip='rect('+t+' '+r+' '+b+' '+x+')';}
function wH(e,h){if(l){Y=e.document;Y.write(h);Y.close();}if(e.innerHTML)e.innerHTML=h;}
/*
	gE(elementName,[frame]) - element ref
	sE(elementRef)  - show element
	hE(elementRef)	- hide element
	sZ(elemtnRef,z-index) - set index
	sW(elementRef,width)  - set width
	sH(elementRef,height) - set height
	sC(elementRef,top,right,bottom,left) - set clipping
	sX(elementRef,x)    - set x pos
	sY(elementRef,y)    - set y pos	
	sXY(elementRef,x,y) - set both
	gX(elementRef)		- get x
	gY(elementRef)		-get y
	wH(elementRef,html) - write html text to a layer
*/


function inArray(str,arr){
	for(i=0;i<arr.length;i++){
		if(arr[i]==str)return 1;
	}
	return 0;
}

function MM_findObj(n, d) { //v3.0
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document); return x;
}

function findObj(n,d){
	return MM_findObj(n,d);
}

function WM_netscapeCssFix() {
    document.location = document.location;
}
 
function WM_netscapeCssFixCheckIn() {
  if ((navigator.appName == 'Netscape') && (parseInt(navigator.appVersion) == 4)) {
   if (typeof document.WM == 'undefined'){
      document.WM = new Object;
    }
    if (typeof document.WM.WM_scaleFont == 'undefined') {
      document.WM.WM_netscapeCssFix = new Object;
    }
    window.onresize = WM_netscapeCssFix;
  }
}
 
WM_netscapeCssFixCheckIn();

function winop(filename,width,height){
	if(!loaded)return;
	params = "height="+height
		   + " ,width="+width
		   + " ,top=0"
		   + " ,left=0"
		   + " ,scrollBars=0"
		   + ", resize=1"
	window.open(filename,"preview",params);
}

function preload() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=preload.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}


function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}

function rollOver(imgName,imgSrc){
	MM_swapImage(imgName,'',imgSrc,1);
}

var yPos = 10;
var mutex = 10;
var yplace = yPos;
var ymax = 10;
var ymin = 0;
var xplace = 10;
var newsHeight = 0;

/** The only code you should ever need to change here are the following 3 vars **/
var speed = 3;                         //speed at which the news scrolls
var newsId = "news";                   //name of the overall news div
var newsClipId = "newsClipping";       //name of the news clipping div

function shiftTo(obj, x, y) {
	sXY(obj,x,y);
}
function getObject(obj) {
	return gE(obj)
} 

function scrollUp() {
  if (mutex == 1){
    var theObj = gE(newsId);
    if (yplace < ymax) {
      yplace = yplace + speed;
      if (yplace > ymax) yplace = ymax;
      shiftTo(theObj, xplace, yplace);
	  yPos=yplace;
      setTimeout("scrollUp()",25);
    }
  }
}
  
function scrollDown() {
  if (mutex == 2){
    var theObj = gE(newsId);
    if (yplace > ymin) {
      yplace = yplace - speed;
      if (yplace < ymin) yplace = ymin;
      shiftTo(theObj, xplace, yplace);
	  yPos=yplace;
     setTimeout("scrollDown()",25);
    }
  }

}

function scrollIt(msg, dir) {
  window.status = msg; 
  mutex = dir;
  if (mutex == 1) scrollUp();
  else if (mutex == 2) scrollDown();
}

function init() {
    ymin = (goH(gE(newsId))- goH(gE(newsClipId))) * -1;
	sY(gE(newsId),yPos)
}

function initLayers(){
	if(!window.newsLayer)newsLayer = gE('news');
	if(!window.clipLayer)clipLayer = gE(newsClipId);
	if(!window.pressLayer)pressLayer = gE('press');
	if(!window.imgPrev)imgPrev		= gE("imgHolder");
	xPos=10;yPos=10;yplace=10;xplace=10;
	sXY(newsLayer,10,10);
	sXY(pressLayer,10,10);
}
function instr(str,Src){
	if(Src.toLowerCase().indexOf(str.toLowerCase())>-1){
		return 1;
	}
	return 0;
}

function rollPreview(Src,hideNews){
	document.title=docTitle;
	initLayers();
	preview = findObj("bigPic");
	if(hideNews){
		//if(document.all){
			if(bc = findObj("biocell"))bc.className="litebg"
			if(prc = findObj("prcell"))prc.className="litebg";
		//}
		hE(clipLayer);
		hE(newsLayer);hE(pressLayer);
		sE(imgPrev);
	}
	
	if(document.all){//boss doesn't want transitions
		doAlpha(Src.substring(Src.lastIndexOf("/"),Src.length));
		with(preview){
			/*if(navigator.appVersion.toLowerCase().indexOf("msie 5.5")>-1){
					style.filter="progid:DXImageTransform.Microsoft.Fade(Overlap=0.00,Duration=1)";
			}else{
				style.filter="blendTrans(duration=crossFadeDuration)";
			}*/
				src=Src;	
				/*filters[0].Apply();
				filters[0].Play();	*/
		}	
	}else{
		content = '<table border=0 width=350 height=335><TR><TD align=center><img border=0 src="'+Src+'" name="bigPic"></td></tr></table>';
		if(0/*instr("mac",navigator.userAgent)*/){
			content="<ilayer src="+Src+">&nbsp;</ilayer>";
		}
		wH(imgPrev,content);
	}
}

function showBio(){
	document.title=docTitle;
	newsId="news";
	init();
	initLayers();
	rollOver('bigPic','/assets/blank.gif');
	hE(imgPrev);
	sE(clipLayer);
	hE(pressLayer);
	sE(newsLayer);	
	doAlpha("",1);
	if(document.all){
		document.all("biocell").className="darkbg";
		if(findObj("prcell"))document.all("prcell").className="litebg"
	}
}
function showPr(){
	document.title=docTitle;
	newsId="press";
	init();
	initLayers();
	rollOver('bigPic','/assets/blank.gif');
	hE(imgPrev);
	sE(clipLayer);
	sE(pressLayer);
	hE(newsLayer);	
	doAlpha("",1);
	if(document.all){
		if(findObj("biocell"))document.all("biocell").className="litebg"
		document.all("prcell").className="darkbg";
	}
}


function doAlpha(imgSrc,noFilters){
	if(!document.all)return;
	for(i=0;i<document.images.length;i++){
		img = document.images[i];
		thumbName = (img.name.split("")[0]=="-")?1:0;
		if(!thumbName)continue;
		filterName = (img.src.indexOf(imgSrc)>-1&&!noFilters)?"alphaImg":"noAlphaImg";
		img.className=filterName;
	}
}
