function upte(m,e) {
	l=document.getElementById(m).value.length;
	document.getElementById(e).innerHTML=l;
	return true;
}

function setf() {
	document.getElementById('url').focus();
	document.getElementById('url').select();
}
	
function ime(im) {
	document.getElementById('e_'+im).src='img/processthumb.png';
}

function disactinp(id) {
	obj=document.getElementById(id);
		obj.value='Zpracovávám ...';
		obj.disabled=1;
		return true;
}

function gotopage(w) {
	if(!window.open(w))
		location.href=w;
}

function setstars(kolik) {
		for (i=1;i<=5;i++) {
			var fna = 's' + i;
			if (kolik>=i) {
				document.getElementById(fna).src = './img/star_active_ico.png';
			} else {
				document.getElementById(fna).src = './img/star_inactive_ico.png';
			}
		}	
}

function remath(id,val) {
	document.getElementById(id).innerHTML=val;
}

function ajax(stranka, kam)
{

    var httpRequest;
    
    if(typeof window.ActiveXObject != 'undefined')
    {
        httpRequest = new ActiveXObject("Microsoft.XMLHTTP");
    }
    else
    {  
        httpRequest = new XMLHttpRequest();
    }
    httpRequest.open("GET", stranka, true);
    httpRequest.onreadystatechange= function () 
    {
        processRequest(httpRequest, kam) 
    };
    httpRequest.send(null);
}


function processRequest(httpRequest, kam) 
{
    if (httpRequest.readyState == 4)
    {
        if(httpRequest.status == 200)
        {
            if (typeof kam == 'string') 
            {
                document.getElementById(kam).innerHTML = httpRequest.responseText;
            }
            if (typeof kam == 'function') 
            {
                kam(httpRequest.responseText);
            }
        }
        else
        {
            alert("Chyba pri nacitani stanky " + httpRequest.status +" : "+ httpRequest.statusText);
        }
    }
    else
    {
        if (typeof kam == 'string' && kam != '') 
        {
            document.getElementById(kam).innerHTML = ' [ nacitam .. ] ';
        }
    }
       
} 
