var daBin = 'http://www.maximonline.bg/img/';
function call(url,handler,data){http = this.getHttp(); if(!http) alert('No HTTP Object'); http.onreadystatechange = function(){if (http.readyState == 4) {if (http.status == 200) {if (http.responseXML != null) {return eval(handler+'(http.responseXML)');}}}return false;}; http.open("POST", url, true); http.setRequestHeader("Content-Type", "application/x-www-form-urlencoded; charset=UTF-8"); http.send(data);}
function getHttp(){var xmlHttp = null; try {xmlHttp = new XMLHttpRequest();} catch (e) {var progIds = ['MSXML2.XMLHTTP', 'Microsoft.XMLHTTP', 'MSXML2.XMLHTTP.5.0', 'MSXML2.XMLHTTP.4.0', 'MSXML2.XMLHTTP.3.0'];var success = false;for (var iterator = 0; (iterator < progIds.length) && ( ! success); iterator ++) {try {xmlHttp = new ActiveXObject(progIds[iterator]); success = true;}catch (e) {}}if (! success){return null;}} return xmlHttp;}

function net_LightVote(rate){for(var i = 1; i < 11; i++){if(rate < i){document.getElementById('rate_'+i).src=daBin+"off.gif";}else {document.getElementById('rate_'+i).src=daBin+"on.gif";}}}
function net_DoVote(vote, id, type){call('dovote.php?id='+id+'&vote='+vote+'&type='+type,'net_ReturnVote','');return false;}
function net_ReturnVote(data){var root = data.childNodes;if(root[1] != null){var status_node = root[1].firstChild; var i = 1;}else {var status_node = root[0].firstChild; var i = 0};
    if(status_node.getAttribute('ok') != 1){var tmp = root[i].childNodes;showSmallError('userRating', getXMLErrors(tmp[1]));}
    else{showSmallMessage('userRating', 'Благодарим за вашия глас!');}
}
function getXMLErrors(errorXML){var error_str = ''; for(i = 0; i < errorXML.childNodes.length; i++){error_str += errorXML.childNodes[i].firstChild.nodeValue + "<br />";}return error_str;}
function showSmallError(name, errors){var errorDiv = document.getElementById(name); errorDiv.innerHTML = errors; return false;}
function showSmallMessage(name, messages){var messageDiv = document.getElementById(name); messageDiv.innerHTML = messages; return false;}
function showSmallNotice(name, notices){var noticeDiv = document.getElementById(name); noticeDiv.innerHTML = notices; return false;}
function getURL(url){window.location = url;}

