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() {

	// clickable logo

	$('logo-link').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
	});

	// scroll to reply

	$$('a.reply').addEvent('click', function(e) {
		e = new Event(e);
		scroll.toElement('reply_box');
		var replyid = this.id.split('-');
		var qn = $('name-'+replyid[1]).getText();
		var qt = $('quote-'+replyid[1]).innerHTML.replace(/<br>/gi,"");
		$('reply_box_input').setText('[QUOTE='+qn+']'+qt+'[/QUOTE]\n').focus();
		e.stop();
	});

	// top

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

});
