// JavaScript Document

var nick=false;
var coment=false;
var clear_nick=false;
var clear_komentar=false;

function clear_it(id)
{
	
var id=id;
	
	if (id=="ime")
	{
	if (clear_nick!=true) {document.getElementById(id).value = "";} clear_nick=true;
	}
	
	if (id=="komentar")
	{
	if (clear_komentar!=true) {document.getElementById(id).value = "";} clear_komentar=true;
	}

	}
	
function check_nick(content)
{

if (content.length < 3) {document.getElementById('ime').style.borderColor="#f00"; nick=false;}
	else {document.getElementById('ime').style.borderColor="#0f0"; nick=true;}
	
	}
	
function check_text(content)
{
maxchar=320;
var x=document.forms.forma.komentar;
x.maxLength=maxchar;
x.value=x.value.substring(0, maxchar);

	
dolzina=content.length;
stevilo=maxchar-dolzina;
if (stevilo==maxchar) document.getElementById("stznaki").style.color="#666";
if (stevilo<maxchar) document.getElementById("stznaki").style.color="#000";
if (stevilo<30) document.getElementById("stznaki").style.color="#f00";
document.getElementById("stznaki").firstChild.nodeValue=stevilo;

if (dolzina < 3) {document.getElementById('komentar').style.borderColor="#f00"; comen=false;}
	else {document.getElementById('komentar').style.borderColor="#0f0"; coment=true;}
	
	}
	
	
function enable_send()
{
document.getElementById("send_gumb").style.backgroundColor="#0f0";
document.getElementById("send_gumb").style.color="#000";
document.getElementById("send_gumb").style.cursor="pointer";
document.forma.poslji.disabled=false;
}

function disable_send()
{
document.getElementById("send_gumb").style.backgroundColor="#999";
document.getElementById("send_gumb").style.color="#666";
document.getElementById("send_gumb").style.cursor="auto";
document.forma.poslji.disabled=true;
}
	
function last_check()
{
		if (nick == true && coment == true)
		{
			document.getElementById("obvezno").style.display="none";
			enable_send();
			}
		else disable_send();
	}
