//review functions :
var features = new Array('rating');
var fix_cache = new Array();
var fle = features.length;
	for(var fc = 0; fc < fle; fc++) {
	fix_cache[fc] = '';
		for(var fci = 1; fci <= 5; fci++) {
			fix_cache[fc] += '<img src="/blog/wp-content/themes/mhouse/rm-images/starempty.gif" onmouseover="fluid(' + fc + ',' + fci + ')"/>';
		}
	}
var last_mouseover;	

function fix(fea, num) {//onclick
var f = new getObj(features[fea]);
f.obj.value = num;
do_html(fea, num, 1, 1);
return false
}//fix END

function fluid(fea, num) {//onmouseover
do_html(fea, num);
	if(last_mouseover) {
		discard(last_mouseover);
	}
last_mouseover = fea;	
return false
}//fluid END

function discard(fea) {//onmouseout
var f = new getObj(features[fea]);
var num = f.obj.value;
do_html(fea, num, 1);
return false
}//discard END

function discard_total() {
	for(var a = 0; a < fle; a++) {
		var i = new getObj(features[a] + '_stars');
		i.obj.innerHTML = fix_cache[a]
	}
last_mouseover = null;
return false	
}//discard_total END

function do_html(fea, num, f_discard, f_cache) {
//var f = new getObj(features[fea]);
	if(f_cache) {
		fix_cache[fea] = compose_html(fea, num, f_discard);//onclick - a new choice fixed
	}
	else {
		//discard_total();
		var i = new getObj(features[fea] + '_stars');
			if(f_discard) {
				i.obj.innerHTML = fix_cache[fea];//onmouseout - cached string in use
			}
			else {
				i.obj.innerHTML = compose_html(fea, num);//onmouseover - on fly generated html
			}
	}		
}//do_html END

function compose_html(fea, num, discard) {
//var f = new getObj(features[fea]);
var ihtml = '';
	for(var a = 1; a <= 5; a++) {
	var r = 'full';
		if(num > 0) {
			num--
		}
		else {
			r = 'empty'
		}
	ihtml += '<img src="/blog/wp-content/themes/mhouse/rm-images/star'+ r + '.gif" ';
		if(discard) {
			ihtml += 'onmouseover="fluid'
		}
		else {
			ihtml += 'onclick="fix'	
		}
	ihtml += '(' + fea + ',' + a + ')" />'		
	}
return ihtml	
}//compose_html END

//General functions
function getObj(name) {
var w = 'document.';
var o = 'this.obj = ';
var s = 'this.style = ';
if (document.getElementById) {
eval(o + w + 'getElementById(name);');
eval(s + w + 'getElementById(name).style;');
}
else if (document.all) {
eval(o + w + 'all[name];');
eval(s + w + 'all[name].style;');
}
}
