function drawRating(result){
	
	if (httpXmlShell.CheckError(result) != 0) {
		return;
	} 
	
	var boxId = httpXmlShell.SelectSingleNode( 'container/boxId' ) ;
	if (boxId == null) {
		window.location.reload();
		return;
	}
	var boxId = boxId.attributes.getNamedItem('id').value;
	
	
	
	var arContainers = document.getElementsByTagName('DIV');
	if (typeof(arContainers) == 'object') {
		for (var i = 0; i < arContainers.length; i++) {
			
			if (arContainers[i].className != boxId) {
				continue;	
			}
			
			var container = arContainers[i];
			container.id = boxId;
		
			if (container != null) {
				var oNodes = httpXmlShell.SelectSingleNode( 'container/items' ) ;
				if (oNodes != null) {
					if (bIsIE && typeof(oNodes.text) == 'string' && oNodes.text.length > 0) { 
						container.innerHTML = oNodes.text;
					} else if (typeof(oNodes.textContent) == 'string' && oNodes.textContent.length > 0) {	
						container.innerHTML = oNodes.textContent;
					}
				}
				var oScriptNodes = httpXmlShell.SelectSingleNode( 'container/script_section' ) ;
				if (oScriptNodes != null){
						if (bIsIE && oScriptNodes.text != null && oScriptNodes.text.length > 0) {
								eval(oScriptNodes.text);
						} else if (oScriptNodes.textContent != null && oScriptNodes.textContent.length > 0) { 
								eval(oScriptNodes.textContent);
						}
				}
				$("#"+boxId).show("slow");
				container.id = '';
			}
		}
	
	}
	
	
	
	
}

function setRate(item_id, type, rate) {
	var arContainers = document.getElementsByTagName('DIV');
	if (typeof(arContainers) == 'object') {
		for (var i = 0; i < arContainers.length; i++) {
			
			if (arContainers[i].className != 'rating_'+type+'_'+item_id) {
				continue;	
			}
			
		arContainers[i].id = 'rating_'+type+'_'+item_id; 
		$("#rating_"+type+'_'+item_id).hide("slow"); //alert('rating.php?item_id='+item_id+'&obj='+type+'&rate='+rate);
		arContainers[i].id = '';
		}
	}
        httpXmlShell.LoadUrl('rating.php?item_id='+item_id+'&obj='+type+'&rate='+rate, drawRating);
}

function showRateAlert(type){
	var msg = '';
	switch(type){
		case 1: 
			msg = "The only registered members may vote.\r\nPlease login/register first.";		
			break;
	}
	
	if(msg != ''){
		alert(msg);	
	}
}