str=new Array()
str['add']=		'Fág scéala nua'
str['new']=		'Scéala ar cheal'
str['restore']=	'Cuir thar n-ais'
str['name']=		'Tabhair ainm...'
str['title']=	'Tabhair teideal...'
str['write']=	'Scríobh rod éigint nú roghnaigh "Scéala ar cheal"'
str['wait']=		'Fan neomat...'
str['save']=		'Á shábháilt anois...'
str['reply']=	'Freagra ar bith'
str['cancel']=	'Scéala ar cheal'
str['retry']=	'Fág scéala aríst!'
str['send']=		'Á chur ar aghaidh cheanna'

i=typeof innerWidth == 'number'?innerWidth:640
if(typeof document.getElementById == 'undefined' || i < 241) dom=0
else {
	dom=1
	e=s=0
	old=[]
	elm=[
		'<form class="ed"><input type="submit" value="'+str['add']+'" /></form>',
		'<input type="text" size="8" value="Bytes" style="background:#ccc; color:#000; border:0;" />',
		'<input type="button" value="'+str['cancel']+'" accesskey="c" />',
		'<input type="button" value="'+str['restore']+'" />'
	]
	c='@import url(dom.css);'
	if(typeof innerWidth == 'number') c+=innerWidth<650?'#msg,table.figs tr{font-size:0.8125em}tr.x span{display:none}':''
	document.writeln('<style type="text/css">'+c+'</style>')
	window.onload=wrapper
}

function wrapper() {
	if(typeof document.getElementById('add') != 'object') return
	tog=document.forms[0]
	app=document.forms[1]
	bag=app.parentNode.style
	fld=app.elements
	tog.onsubmit=msgAdd
	app.onsubmit=but
	app.onreset=ice
	fld[2].onfocus=len
	fld[2].onchange=len
	fld[5].onclick=redd
	fld[7].onclick=fire
	fld[7].style.visibility='hidden'
	tog.style.visibility='visible'
	bag.zIndex=-1
}

function msgEd() {if(dom && e < elm.length) document.writeln(elm[e]), e++}

function msgAdd() {
	tog.style.visibility='hidden'
	bag.zIndex=2
	bag.visibility='visible'
	setTimeout('fld[0].focus()', 1)
	return false
}

function but() {
	while(!fld[0].value || fld[0].value == 'null' || fld[0].value == 'undefined') fld[0].value=prompt(str['name'])
	while(!fld[1].value || fld[1].value == 'null' || fld[1].value == 'undefined') fld[1].value=prompt(str['title'])
	if(!fld[2].value.length) {
		alert(str['write'])
		fld[2].focus()
		return false
	}
	if(s) {
		but.value=str['wait']
		but.style.background='#ccc'
		return false
	}
	but=fld[4]
	clr=fld[5]
	but.value=str['save']
	but.style.background='#9cf'
	s=1
	setTimeout("fld[3].value=str['reply']; clr.value=str['cancel']; but.value=str['submit']; but.style.background='#fc0'; s=0", 20000)
}

function redd() {
	if(s) {
		clr.value=str['sending']
		return
	}
	ice()
	bag.visibility='hidden'
	bag.zIndex=-1
	tog.style.visibility='visible'
	scrollBy(0,0)
}

function ice() {
	if(!s) {
		for(i=0; i<3; i++) {
			old[i]=fld[i].value
			fld[i].value=''
		}
		fld[7].style.visibility='visible'
		len()
	}
	return false
}

function fire() {
	if(!s) {
		for(i=0; i<3; i++) fld[i].value=old[i]
		len()
	}
}

function len() {fld[3].value=fld[2].value.length}
