<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>test</title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
</head>
<body>
<script type="text/javascript">
function get_src(obj_name,obj_id){
// Quelle der aktuellen Datei finden
cur_src = document.getElementsByName(obj_name)[obj_id].src;
// Datei finden
tmp_src = cur_src.substr(cur_src.lastIndexOf('/')+1);
}
function new_rate_val(rate_value,key){
clear_all(key);
if(document.getElementsByName('rated'+key)[0].value == 0) {
for(var n = 0;n<rate_value;n++) {
get_src('rate_star'+key,n);
(tmp_src == 'star_inactive.gif') ? document.getElementsByName('rate_star'+key)[n].src = '/images/rating/star_active.gif' : document.getElementsByName('rate_star'+key)[n].src = '$path/images/rating/star_inactive.gif';
}
} else {
for(var n = 0;n<rate_value;n++) {
if((n+1) > document.getElementsByName('rate_value'+key)[0].value) {
get_src('rate_star'+key,n);
(tmp_src == 'star_inactive.gif') ? document.getElementsByName('rate_star'+key)[n].src = '/images/rating/star_active.gif' : document.getElementsByName('rate_star'+key)[n].src = '/images/rating/star_inactive.gif';
}
}
}
}
function clear_all(key){
if(document.getElementsByName('rated'+key)[0].value == 0) {
for(var n = 0;n < 5;n++){
if(typeof document.getElementsByName('rate_star'+key)[n] != 'undefined'){
document.getElementsByName('rate_star'+key)[n].src = '$path/images/rating/star_inactive.gif';
}
}
} else {
for(var n = 0;n < 5;n++) {
if((n+1) > document.getElementsByName('rate_value'+key)[0].value) {
if(typeof document.getElementsByName('rate_star'+key)[n] != 'undefined'){
document.getElementsByName('rate_star'+key)[n].src = '/images/rating/star_inactive.gif';
}
}
}
}
}
function rate(rate_value, key){
if(document.getElementsByName('rated'+key)[0].value == 1) {
// Setzen, dass noch nicht bewertet wurde
document.getElementsByName('rated'+key)[0].value = 0;
// Alle Sterne zurücksetzen
clear_all(key);
// Neuen Wert für die Bewertung einlesen
new_rate_val(rate_value,key);
// Setzen, dass bewertet wurde und Wert der Bewertung speichern
document.getElementsByName('rated'+key)[0].value = 1;
document.getElementsByName('rate_value'+key)[0].value = rate_value;
} else {
document.getElementsByName('rated'+key)[0].value = 1;
document.getElementsByName('rate_value'+key)[0].value = rate_value;
}
document.fost.submit();
}
function reset_this(key){
document.getElementsByName('rated'+key)[0].value = 0;
document.getElementsByName('rate_value'+key)[0].value = 0;
clear_all(key);
}
</script>
</body>
</html>