
function init_xmlhttp(){

    var xmlhttp = false;
    try {
        xmlhttp  = new ActiveXObject("Msxml2.XMLHTTP");
    } catch(e) {
        try {
            xmlhttp  = new ActiveXObject("Microsoft.XMLHTTP");
        } catch(e) {
            xmlhttp  = false;
        }
    }
    if (!xmlhttp  && typeof XMLHttpRequest != 'undefined') {
        xmlhttp = new XMLHttpRequest();
    }

    return xmlhttp;

}


function  redim_starvote(idname,vote,id,idname2,id2) {
	var theUL = document.getElementById(idname); // the UL
	var xmlhttp= init_xmlhttp();
	// switch UL with a loading div
	theUL.innerHTML = '<div class="starvote_loading"></div>';
    xmlhttp.open('get', '?tmpl=component&id='+id+'&code=starvote'+'&vote='+vote);

    xmlhttp.onreadystatechange = function () {
     	if(xmlhttp.readyState == 4){
            if (xmlhttp.status == 200){
                theUL.innerHTML = xmlhttp.responseText;

				if (idname2){
			//	alert(idname2);
				redim_starvoteinfo(idname2,id2);
				}


            }else{
            	theUL.innerHTML = 'Error State: '.xmlhttp.status;
            }

     	}
    }
    xmlhttp.send(null);

}

function  redim_starvoteinfo(idname,id) {
	var theUL = document.getElementById(idname); // the UL
	var xmlhttp= init_xmlhttp();
	// switch UL with a loading div
	if (theUL==null){
		return;
	}

	theUL.innerHTML = '<div class="starvote_loading"></div>';

    xmlhttp.open('get', '?tmpl=component&id='+id+'&code=starvote'+'&vote=0');

    xmlhttp.onreadystatechange = function () {
     	if(xmlhttp.readyState == 4){
            if (xmlhttp.status == 200){
                theUL.innerHTML = xmlhttp.responseText;
            }else{
            	theUL.innerHTML = 'Error State: '.xmlhttp.status;
            }

     	}
    }
    xmlhttp.send(null);

}

