isMozilla = (document.all) ? 0 : 1;

function hover(obj) {
	UL = obj.getElementsByTagName('ul');
	if (UL.length > 0) {
		stubMenu = UL[0].style;
		if (stubMenu.display == 'none' || stubMenu.display == '') stubMenu.display = 'block';
		else stubMenu.display = 'none';
	}
}

function setHover() {
	obj = document.getElementById('menutin');
	if (!obj) return ;
	LI = document.getElementById('menutin').getElementsByTagName('li');
	for(i=0; i < LI.length; i++) {
		LI[i].onmouseover = function() { hover(this) };
		LI[i].onmouseout = function() { hover(this); }
	}
}

function ScrollToElement(el) {
	if (!document.getElementById(el)) return ;
	if (document.all) y = document.getElementById(el).offsetParent.offsetTop;
	else y = document.getElementById(el).offsetTop;
	window.scrollTo(0, y);
}



function OpenSubMenu(num) {
	src = document.getElementById('menuimg'+num).src.indexOf('on.gif');
	if (src == -1) {
		document.getElementById('menuimg'+num).src = '/~polux/computers/images/menubulleton.gif';
		disp = 'block';
	}
	else {
		document.getElementById('menuimg'+num).src = '/~polux/computers/images/menubullet.gif';
		disp = 'none';
	}
	var lis = document.getElementsByTagName("li");
	for (var i=0; i<lis.length; i++) if (lis[i].id.indexOf(num+'sub') == 0) lis[i].style.display=disp;
}



function prepareInputsForHints() {
	var inputs = document.getElementsByTagName("input");
	for (var i=0; i<inputs.length; i++) {
		if (inputs[i].parentNode.getElementsByTagName("span")[0]) {
			inputs[i].onfocus = function () {
				this.parentNode.getElementsByTagName("span")[0].style.display = "inline";
			}
			inputs[i].onblur = function () {
				this.parentNode.getElementsByTagName("span")[0].style.display = "none";
			}
		}
	}
	var inputs = document.getElementsByTagName("select");
	for (var i=0; i<inputs.length; i++) {
		if (inputs[i].parentNode.getElementsByTagName("span")[0]) {
			inputs[i].onfocus = function () {
				this.parentNode.getElementsByTagName("span")[0].style.display = "inline";
			}
			inputs[i].onblur = function () {
				this.parentNode.getElementsByTagName("span")[0].style.display = "none";
			}
		}
	}
}


var objincr, incrval, objdecr, decrval, timerDecr, timerIncr;

function RenderRels() {
	if (!document.getElementsByTagName) return; 
	var anchors = document.getElementsByTagName("div"); 
	for (var i=0; i<anchors.length; i++) { 
		var anchor = anchors[i]; 
		if (anchor.getAttribute("rel") == "opac") {
			anchor.className='opac';
			anchor.onmouseover = function() {
				objincr = this;
				incrval = 50;
				OpacIncr();
			}
			anchor.onmouseout = function() {
				objdecr = this;
				decrval = 100;
				OpacDecr();
			}
		}
	}
}


function OpacIncr() {
	clearTimeout(timerDecr);
	if (objdecr) {
		objdecr.style.filter="alpha(opacity=50)";
		objdecr.style.opacity=0.5;
	}
	if (!objincr) return;
	objincr.style.filter="alpha(opacity="+incrval+")";
	opac = incrval/100;
	objincr.style.opacity=opac;
	incrval++;
	if (incrval<101) timerIncr = setTimeout('OpacIncr()',1);
	else objincr = 0;
}

function OpacDecr() {
	clearTimeout(timerIncr);
	if (objincr) {
		objincr.style.filter="alpha(opacity=100)";
		objincr.style.opacity=1;
	}
	if (!objdecr) return;
	objdecr.style.filter="alpha(opacity="+decrval+")";
	opac = decrval/100;
	objdecr.style.opacity=opac;
	decrval--;
	if (decrval>50) timerDecr = setTimeout('OpacDecr()', 10);
	else objdecr = 0;
}
