max=150;
timerID=null;
running=false;
function countChars()
{
if(document.formular.descriere_scurta.value.length>max)
{
document.formular.descriere_scurta.blur();
document.formular.lungime.value =0;
alert("Ati atins numarul maxim de caractere permis!");
}
else document.formular.lungime.value =
max-document.formular.descriere_scurta.value.length;
if (document.formular.lungime.value==0)
        {
        var text=document.formular.descriere_scurta.value
        document.formular.descriere_scurta.value=text.substr(0,max);
        }
}
function timerTick()
        {
        if(running)
                {
                stopTimer();
                if(navigator.appName=="Netscape")
                        {
                        //document.formular.Descript.blur();
                        }
                startTimer();
                countChars();
                }
        }

function stopTimer()
        {
        clearTimeout(timerID);
        running=false;
        }

function startTimer()
        {
        if(!running)
                {
                running=true;
                timerID=setTimeout("timerTick()",150);
                }
        }
function PopupPic(sPicURL) {
        window.open( "popup.htm?"+sPicURL, "", "resizable=1,HEIGHT=200,WIDTH=200");
    }

