/* instantiate our ratings class which will be used to add ratings. */
oddity.ratings = new Object();

/* Sub-object oddity.ratings functions and variables are defined below. */
oddity.ratings.svpath = '/_oddity_javascript/sv_rating.php';
oddity.ratings.da_id = null;
oddity.ratings.da_type = null;

function whatthe()
{
	alert('hello');
}

oddity.ratings.save_rating = function(id,rate,type) {
		var parameters = 'id='+id+'&rate='+rate+'&type='+type;
		oddity.ratings.da_id = id;
		oddity.ratings.da_type = type;
		oddity.http = oddity.get_httpobject();
		oddity.http.onreadystatechange = oddity.ratings.notify;
		oddity.http.open('POST', oddity.ratings.svpath, true);
		oddity.http.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
		oddity.http.setRequestHeader("Content-length", parameters.length);
		oddity.http.setRequestHeader("Connection", "close");
		oddity.http.send(parameters);
}
oddity.ratings.notify = function() {
	if ((oddity.http.readyState==4) && (oddity.http.status==200)) {
		var result = oddity.http.responseText;
		/* alert(result); */
		res_array = result.split('|',2);
		var da_rate  = res_array[1];
		var was_applied = res_array[0];
		var da_ul_str = oddity.ratings.da_id + '_' + oddity.ratings.da_type; 
		var da_ul = document.getElementById(oddity.ratings.da_id+'_'+oddity.ratings.da_type);
		var da_li = document.getElementById('rate_'+oddity.ratings.da_id+'_'+oddity.ratings.da_type); 
		var da_new = (da_rate/10)*100;
		var da_applied = parseInt(was_applied);
		if(da_applied>0){
			da_ul.className = 'star-blue small-blue'; 
			da_li.style.width = da_new +'%';			
		} 
		/*console.log(result); */           
	}
}

