window.onerror=null;

function openWin(wUrl,wWidth,wHeight,wSC,wRS){
scWidth=screen.availWidth;
scHeight=screen.availHeight;
scWidthCenter=scWidth / 2;
scHeightCenter=scHeight / 2;
if(wWidth == 0){wWidth = scWidth;}
if(wHeight == 0){wHeight = scHeight;}
wOption="scrollbars=" + wSC + ",resizable=" + wRS + ",width=" + wWidth + ",height=" + wHeight + ",left=" + (scWidthCenter - (wWidth / 2)) + ",top=" + (scHeightCenter - (wHeight / 2));
window.open(wUrl,'newwin',wOption);
}

////////////////////////////////////////////

function scrollback(y){
  var posY = document.body.scrollTop || document.documentElement.scrollTop;
  var tgtY = 0;
  if(y){tgtY = y}
  var cnt=0;
  var interval=10;
  var timer = setInterval(function(){
	if(Math.abs(tgtY-posY) <=1){
		window.scrollTo(document.body.scrollLeft,tgtY);
		clearInterval(timer);
		return false;	
	}else{
		if(cnt>5) {
			posY += (tgtY-posY)/2;
		}else{
			posY += (tgtY-posY)/10*cnt;
		}
		window.scrollTo(0,posY);
		cnt++;
	}
  },interval);
}

////////////////////////////////////////////

function initRollovers() {
	if (!document.getElementById) return false;
	var aPreLoad = new Array();
	var sTempSrc;
	var aImages = document.getElementsByTagName('img');
	for (var i = 0; i < aImages.length; i++) {
		if (aImages[i].className == 'btn' || aImages[i].className == 'tab' || aImages[i].className == 'ro') {
			var src = aImages[i].getAttribute('src');
			var ftype = src.substring(src.lastIndexOf('.'), src.length);
			var hsrc = src.replace(ftype, '_o'+ftype);
			aImages[i].setAttribute('hsrc', hsrc);
			aImages[i].setAttribute('dsrc', src);
			aPreLoad[i] = new Image();
			aPreLoad[i].src = hsrc;
			aImages[i].onmouseover = function() {
				if(this.getAttribute('off')){
					this.setAttribute('src', this.getAttribute('dsrc'));
				}
				sTempSrc = this.getAttribute('src');
				this.setAttribute('src', this.getAttribute('hsrc'));
			}
			aImages[i].onmouseout = function() {
				if(this.getAttribute('off')) return false;
				//if (!sTempSrc) sTempSrc = this.getAttribute('src').replace('_o'+ftype, ftype);
				//this.setAttribute('src', sTempSrc);
				this.setAttribute('src', this.getAttribute('dsrc'));
			}
		}
	}
}

////////////////////////////////////////////

function expList(o){
	var list = document.getElementById('explist');
	var elem = list.getElementsByTagName('*');
	for(var i=0;i<elem.length;i++){
		if(elem[i].nodeName != 'TABLE' && elem[i].nodeName != 'TR' && elem[i].nodeName != 'TD' ){
			if(elem[i].style.display == "block"){
			elem[i].style.display = "inline";
			}else{
			elem[i].style.display = "block";
			}
		}
		if(navigator.appName == "Microsoft Internet Explorer"){
		if(elem[i].nodeName == 'TABLE'){
			if(elem[i].style.styleFloat == "none"){
				elem[i].style.styleFloat = "right";
				elem[i].style.margin = "5px 0 0 10px";
			}else{
				elem[i].style.styleFloat = "none";
				elem[i].style.margin = "0";
			}
		}
			
		}else{
		if(elem[i].nodeName == 'TABLE'){
			if(elem[i].style.cssFloat == "none"){
				elem[i].style.cssFloat = "right";
				elem[i].style.margin = "5px 0 0 10px";
			}else{
				elem[i].style.cssFloat = "none";
				elem[i].style.margin = "0";
			}
		}
			
		}
	}
	if(o.firstChild.alt == "Open"){
		o.firstChild.src = "../img/btn_close.gif";
		o.firstChild.alt = "Close";
	}else{
		o.firstChild.src = "../img/btn_open.gif";
		o.firstChild.alt = "Open";
	}
	/*
	if(o.firstChild.nodeValue == "Open"){
		o.firstChild.nodeValue = "Close";
	}else{
		o.firstChild.nodeValue = "Open";
	}
	*/
}


////////////////////////////////////////////

function exAbout(o) {
	if(o.firstChild.alt == "About"){
		o.firstChild.alt = "Close About";
		o.childNodes[1].src = "../img/arrow_ud_o.gif";
		//document.getElementById('photoBox').style.display = 'none';
		document.getElementById('about').style.display = 'block';
	}else{
		o.firstChild.alt = "About";
		o.childNodes[1].src = "../img/arrow_ud.gif";
		//document.getElementById('photoBox').style.display = 'block';
		document.getElementById('about').style.display = 'none';
	}
}

////////////////////////////////////////////

function init(){
	initRollovers();
	//expList();
}
window.onload = init;