function com_show(id) {
	var body = document.getElementById("cb"+id);
	var link = document.getElementById("cl"+id);
	var rate = document.getElementById("cr"+id);
	if(body.style.display == "none") {
		body.style.display = "";
		link.textContent = "ausblenden";
		rate.style.display = "";
	} else {
		body.style.display = "none";
		link.textContent = "anzeigen";
		rate.style.display = "none";
	}
	return false;
}

function com_rate_nl() {
	alert('Du musst eingeloggt sein um Kommentare bewerten zu können.');
}

function com_rate(comid,com,rating) {
	var xmlHttp = null;
	// Mozilla, Opera, Safari sowie Internet Explorer 7
	if (typeof XMLHttpRequest != 'undefined') {
	    xmlHttp = new XMLHttpRequest();
	}
	if (!xmlHttp) {
	    // Internet Explorer 6 und älter
	    try {
	        xmlHttp  = new ActiveXObject("Msxml2.XMLHTTP");
	    } catch(e) {
	        try {
	            xmlHttp  = new ActiveXObject("Microsoft.XMLHTTP");
	        } catch(e) {
	            xmlHttp  = null;
	        }
	    }
	}
	if (xmlHttp) {
	    xmlHttp.open('GET', 'http://'+bfd_comments_srv+'/scripts/ratecomment.php?com='+comid+','+com+'&rating='+rating, true);
	    xmlHttp.send(null);
	    var rate = document.getElementById('r'+comid);
	    rate.innerHTML = parseInt(rate.innerHTML)+rating;
	    var rate = document.getElementById('cr'+comid);
	    if(rating>0) {
	    	rate.innerHTML = '<img src="'+bcom_vpg+'" class="com-votep" align="absmiddle">';
	    } else {
	    	rate.innerHTML = '<img src="'+bcom_vmg+'" class="com-votep" align="absmiddle">';
	    }
	}
}

function check_length(field, maxlimit) {
	var countfield = document.getElementById('count_chars');
	if (field.value.length > maxlimit) {
		field.value = field.value.substring(0, maxlimit);
		countfield.innerHTML = "0";
	} else {
		countfield.innerHTML = maxlimit - field.value.length;
	}
}
