//review functions :
/*
if(request.querystring("frating") > 0) { 
alert(request.querystring("frating"));
 fix("frating",request.querystring("frating"));
}
*/
var features = new Array('frating');
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="/images/starempty.gif" onmouseover="fluid(' + fc + ',' + fci + ')"/>';
		}
	}
var last_mouseover;	

function fix(fea, num) {//onclick
var f = new getObj(features[fea]);

//alert(fea+"-"+num);
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="/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;');
}
}


/////////////////////////////////////////////////////////////
function PageQuery(q) {
if(q.length > 1) this.q = q.substring(1, q.length);
else this.q = null;
this.keyValuePairs = new Array();
if(q) {
for(var i=0; i < this.q.split("&").length; i++) {
this.keyValuePairs[i] = this.q.split("&")[i];
}
}
this.getKeyValuePairs = function() { return this.keyValuePairs; }
this.getValue = function(s) {
for(var j=0; j < this.keyValuePairs.length; j++) {
if(this.keyValuePairs[j].split("=")[0] == s)
return this.keyValuePairs[j].split("=")[1];
}
return false;
}
this.getParameters = function() {
var a = new Array(this.getLength());
for(var j=0; j < this.keyValuePairs.length; j++) {
a[j] = this.keyValuePairs[j].split("=")[0];
}
return a;
}
this.getLength = function() { return this.keyValuePairs.length; }
}
function queryString(key){
var page = new PageQuery(window.location.search);
return unescape(page.getValue(key));
}
function displayItem(key){
if(queryString(key)=='false')
{
//document.write("you didn't enter a ?name=value querystring item.");
}else{
return queryString(key);
}
}

var ff =displayItem("frating");


if(ff) { 
//alert(ff + 'DDDDDDDD');
//compose_html(0,ff,1);
}

////////////////////////////////////

