function textCounter(field,cntfield,maxlimit) {
	if (field.value.length > maxlimit) {
		field.value = field.value.substring(0, maxlimit);
	}
	else {
		cntfield.value = maxlimit - field.value.length;
	}
	
}



function rqsubmit_wall_post(){
	if (http_request.readyState == 4) {

		arr=http_request.responseText.split('|#');
		var text = (arr[0]);
		var user = (arr[1]);
		var date = (arr[2]);


		document.getElementById('wall_content').innerHTML += '<div class="hronotitle">'+user+'</div><div class="hronoitem">'+text+' <span class="time">'+date+'</span></div>';
		

	}
}

function submit_wall_post(me) {
	http_request = false;
	if (window.XMLHttpRequest) { // Mozilla, Safari,...
		http_request = new XMLHttpRequest();
		if (http_request.overrideMimeType) {
			http_request.overrideMimeType('text/html');
		}
	}
	else if (window.ActiveXObject) { // IE
		try {
			http_request = new ActiveXObject("Msxml2.XMLHTTP");
		} catch (e) {
			try {
				http_request = new ActiveXObject("Microsoft.XMLHTTP");
			} catch (e) {}
		}
	}
	if (!http_request) {
		return false;
	}

	text = document.getElementById("wallpost").value;
	http_request.onreadystatechange = rqsubmit_wall_post;
	http_request.open('GET', '/ajax/profile.php?text='+text+'&act=submit_comment&id='+me+'&r='+Math.round(Math.random()*1000), true);
	http_request.send(null);
	return false;
}

function hide_startbtn() {
	with(document.getElementById('dropable').style) { 
		if (display == 'block') {
			document.getElementById("startbtn").className = 'down';
			document.getElementById("dropable").style.display = 'block';
			document.getElementById("startbtn").blur();
		}
	}
}



/* ### Nickname */

function nicknamebox(name, id) {
	var tmp = '<iframe name="nickframe" id="nickframe" width=500 height=210 style="display:block;"></iframe><form name="nicker" style="padding:0px; margin:0px;" target="nickframe" method="POST" action="/ajax/nickname.php"><input type="hidden" name="mid" value="'+id+'"><input type="text" name="newnick" value="'+name+'"><input type="submit" value="ok"></form>';
	document.getElementById('nicknamer').innerHTML = tmp;
}


