/* starrating user */
function rate(rating,id) {
    try {
		req = window.XMLHttpRequest?new XMLHttpRequest():
        new ActiveXObject("Microsoft.XMLHTTP");
    } catch (e) {
    //Kein AJAX Support
    }
	req.onreadystatechange = handlestars;	
	req.open('get', '/profile/starupdate.html?mode=update&rating='+rating+'&id='+id);
	rating = rating * 25;
	document.getElementById('current-rating').style.width = rating+'px';
	req.send(null);
	req.id = id;
}

function handlestars() {
	if ((req.readyState == 4) && (req.status == 200)) {
		id = req.id;
		reloadstars(id);
    }
}

function reloadstars(id) {
    try {
		req1 = window.XMLHttpRequest?new XMLHttpRequest():
        new ActiveXObject("Microsoft.XMLHTTP");
    } catch (e) {
    //Kein AJAX Support
    }
    req1.onreadystatechange = handlerelaodstars;	
    document.getElementById('rating1').innerHTML = loadstatus;
	req1.open('get', '/profile/starupdate.html?mode=reload1&id='+id);
	req1.send(null);
}

function handlerelaodstars(id) {
	if ((req1.readyState == 4) && (req1.status == 200)) {
		document.getElementById('rating1').innerHTML = req1.responseText;
		id = req.id;
		reloaddurchschnitt(id);
	}
}

function reloaddurchschnitt(id) {
    try {
		req2 = window.XMLHttpRequest?new XMLHttpRequest():
        new ActiveXObject("Microsoft.XMLHTTP");
    } catch (e) {
    //Kein AJAX Support
    }
    req2.onreadystatechange = handlerelaoddurchschnitt;	
	req2.open('get', '/profile/starupdate.html?mode=reload2&id='+id);
	req2.send(null);
}

function handlerelaoddurchschnitt(id) {
	if ((req2.readyState == 4) && (req2.status == 200)) {
		document.getElementById('rating2').innerHTML = req2.responseText;
	}
}


/* starrating tiere */
function rate2(rating,id) {
    try {
		req = window.XMLHttpRequest?new XMLHttpRequest():
        new ActiveXObject("Microsoft.XMLHTTP");
    } catch (e) {
    //Kein AJAX Support
    }
	req.onreadystatechange = handlestars2;	
	req.open('get', '/profile/starupdate.html?mode=updatet&rating='+rating+'&id='+id);
	rating = rating * 25;
	document.getElementById('current-rating').style.width = rating+'px';
	req.send(null);
	req.id = id;
}

function handlestars2() {
	if ((req.readyState == 4) && (req.status == 200)) {
		id = req.id;
		reloadstars2(id);
    }
}

function reloadstars2(id) {
    try {
		req1 = window.XMLHttpRequest?new XMLHttpRequest():
        new ActiveXObject("Microsoft.XMLHTTP");
    } catch (e) {
    //Kein AJAX Support
    }
    req1.onreadystatechange = handlerelaodstars2;	
    document.getElementById('rating1').innerHTML = loadstatus;
	req1.open('get', '/profile/starupdate.html?mode=reload1t&id='+id);
	req1.send(null);
}

function handlerelaodstars2(id) {
	if ((req1.readyState == 4) && (req1.status == 200)) {
		document.getElementById('rating1').innerHTML = req1.responseText;
		id = req.id;
		reloaddurchschnitt2(id);
	}
}

function reloaddurchschnitt2(id) {
    try {
		req2 = window.XMLHttpRequest?new XMLHttpRequest():
        new ActiveXObject("Microsoft.XMLHTTP");
    } catch (e) {
    //Kein AJAX Support
    }
    req2.onreadystatechange = handlerelaoddurchschnitt;	
	req2.open('get', '/profile/starupdate.html?mode=reload2t&id='+id);
	req2.send(null);
}

function handlerelaoddurchschnitt2(id) {
	if ((req2.readyState == 4) && (req2.status == 200)) {
		document.getElementById('rating2').innerHTML = req2.responseText;
	}
}