function changeClass(obj, new_class)
{
    obj.className = new_class;
}

function changeBgColor(obj, new_color)
{
	obj.style.backgroundColor=new_color;
}

function changePic(name, pic)
{
	name.src = pic;
}

function popup(url, name, width, height)
{
	left_pos = (screen.width / 2) - (width / 2);
	top_pos = (screen.height / 2) - (height / 2);
	popup = window.open(url, name, 'width=' + width + ',height=' + height + ',left=' + left_pos + ',top=' + top_pos);	
	popup.focus();
}

function cleanField(field, default_value)
{
	if (field.value == default_value) {
		field.value = '';
	}
}

function fillField(field, default_value)
{
	if (field.value == '') {
		field.value = default_value;
	}
}

function changeVisibilitiy(id)
{
	if (document.getElementById(id).style.display == 'none') {	
		document.getElementById(id).style.display = 'block';	
	} else {
		document.getElementById(id).style.display = 'none';	
	}
}

function canAddComment()
{
	validated = true;
	if (!document.getElementById('n_field').value) {
		validated = false;
	}
	if (!document.getElementById('e_field').value) {
		validated = false;
	}
	if (!document.getElementById('c_field').value) {
		validated = false;
	}
	return validated;	
}

function ajaxCall(url, params)
{
	xmlobj = null;	
	try
	{
		xmlobj=new XMLHttpRequest();
	}
	catch(e) {
		try
		{
			xmlobj=new ActiveXObject('Microsoft.XMLHTTP');
		}
		catch(e)
		{
			xmlobj=null;
			return false;
		}
	}
	xmlobj.open('POST', url, true);
	xmlobj.setRequestHeader('Content-Type','application/x-www-form-urlencoded');	
	xmlobj.onreadystatechange = function() {
		if (xmlobj.readyState == 4) {
			xmlobj.status == 200;
			if (xmlobj.responseText) {
				alert(xmlobj.responseText);
			}
		}
	}
	xmlobj.send(params);
}