function $(str) {
	return document.getElementById(str);
}

function hide(str) {
	$(str).style.display = 'none';
}

function show(str, type) {
	$(str).style.display = type;
}

Date.prototype.getMaxDays = function() {
	return 32 - new Date(this.getFullYear(), this.getMonth(), 32).getDate();
}



function replaceUTC()
{
	var date;
	var deadlines = document.getElementsByClassName('deadline');
	
	for(i=deadlines.length-1; i>=0; --i)
	{
		date = new Date(parseInt(deadlines[i].innerHTML)*1000);
		deadlines[i].innerHTML = date.getDate() + '.' + (date.getMonth()+1) +'.' + date.getFullYear();
		deadlines[i].className = '';
	}
}



function numbersonly(myfield, e)
{
	var key;
	var keychar;

	if (window.event)
	   key = window.event.keyCode;
	else if (e)
	   key = e.which;
	else
	   return true;

	keychar = String.fromCharCode(key);

	if ((key==null) || (key==0) || (key==8) || (key==9) || (key==13) || (key==27))
		return true;
	else if ((("-0123456789,.").indexOf(keychar) > -1))
	   return true;

	return false;
}


if (!document.getElementsByClassName) {
    document.getElementsByClassName = function(class_name) {
		var docList = this.all || this.getElementsByTagName('*');
		var matchArray = new Array();

		var re = new RegExp("(?:^|\\s)"+class_name+"(?:\\s|$)");
		for (var i = 0; i < docList.length; i++) {
			if (re.test(docList[i].className) ) {
				matchArray[matchArray.length] = docList[i];
			}
		}
		return matchArray;
	}
}
