// COMMON --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- ---

function $(id){ return document.getElementById(id); }

function toggle(id)
{
	if ($(id).style.display!='none')
	{
		$(id).style.display='none';
	}
	else
	{
		$(id).style.display='block';
	}
}

function getInnerText(elt)
{
	var _innerText = elt.innerText;

	if (typeof(_innerText) == 'undefined')
		_innerText = elt.innerHTML.replace(/<[^>]+>/g,"");

	return _innerText;
}

function countdown_id(id,y,m,d,h,i,s)
{
	var o = $(id);
	countdown(y,m,d,h,i,s,function(cd,ch,ci,cs,tick){
		if (!tick)
			o.innerHTML = y+'. '+m+'. '+d+'. '+h+':'+i+':'+s;
		else
			o.innerHTML = cd+' nap '+ch+' óra '+ci+' perc '+cs+' mperc mulva';
	});
}

function toInt(x)
{
    return (parseInt(x) + 0);
}

function datetounix(y,m,d,h,i,s)
{
	return Math.round(new Date(y,m-1,d,h,i,s).getTime()/1000);
}

function blog_update_publishtime()
{
return;
	var y=toInt($('puby').value),
		m=toInt($('pubm').value),
		d=toInt($('pubd').value),
		h=toInt($('pubh').value),
		i=toInt($('pubi').value),
		s=toInt($('pubs').value);

	var t = $('publishtime');

	if (y>0&&m>0&&d>0&&typeof(t) == 'object' && t!= null)
	{
		alert('w date');
		t.value = datetounix(y,m,d,h,i,s);
	}
}


function blog_update_publish(value)
{
return;
	var t = $('publishtime');
	if ((value == 0 || value == 1) && typeof(t) == 'object' && t!= null)
		$('theform').removeChild($('publishtime'));
	else if (value == 'NaN' && typeof(t) != 'object' && t!= null)
	{
		el = document.createElement('input');
		el.type = 'hidden';
		el.name = 'publishtime';
		el.id='publishtime';
		$('theform').appendChild(el);
	}
}
