function cellShow (x) { getObj(x).style.display = ''; }
function cellHide (x) { getObj(x).style.display = 'none'; }
function cellToggle (x) { getObj(x).style.display = (getObj(x).style.display == '') ? 'none' : ''; }

function opac (obj,x) { obj.style.opacity = (x/100); }

function loc (x) { document.location = x; }
function cloc (x) { if (confirm("Are you sure?")) document.location = x; }

function pageWidth () {
	if(window.innerWidth != null) return window.innerWidth;
	if (document.body.clientWidth != null) return document.body.clientWidth;
	return null;
}

// debugger
function dump (x) {
	w=window.open()
	w.document.open();
	for (i in object) w.document.write(object+" ."+i+ " = "+object[i]+'<br />');
	w.document.close();
}

window.addEvent('domready', function() {

	// home

	$('header').addEvent('click', function(e) {
		e = new Event(e);
		loc('/');
		e.stop();
	});

	// go back

	$$('a.back').addEvent('click', function(e) {
		e = new Event(e);
		history.back();
		e.stop();

	});

	var scroll = new Fx.Scroll(window, {
		wait: false,
		duration: 400,
		transition: Fx.Transitions.Sine.easeIn
	});

	// reply box

	$$('a.reply').addEvent('click', function(e) {
		e = new Event(e);
		scroll.toElement('reply_box');
		$('reply_box_input').focus();
		e.stop();
	});

	$$('div.forum-item').addEvent('mouseover', function(e) {
		e = new Event(e);
		this.addClass('forum-hover');
		e.stop();
	});

	$$('div.forum-item').addEvent('mouseout', function(e) {
		e = new Event(e);
		this.removeClass('forum-hover');
		e.stop();
	});

	// top of page

	$$('a.top').addEvent('click', function(e) {
		e = new Event(e);
		scroll.toTop();
		e.stop();
	});

});
