//--------------------------------------------------
//Rating AJAX
//--------------------------------------------------
	//Global Functions
	function findhandler(){
		var xmlHTTP;

			//Setup HTTP Handler
			try{
				//FF Other Major Browsers
				xmlHTTP=new XMLHttpRequest();
			}
			catch(e){
				try{
					//Internet Explorer
					xmlHTTP=new ActiveXObject("Msxml2.XMLHTTP");
				}
				catch(e){
					try{
						xmlHTTP=new ActiveXObject("Microsoft.XMLHTTP");
					}
					catch(e){
						alert("Your browser doest not support AJAX.");
						return false;
					}
				}
			}
			
		return xmlHTTP;
	}

	function getNodeValue(obj,tag)
	{
		return obj.getElementsByTagName(tag)[0].firstChild.nodeValue;
	}

	function clearElement(id){
		while(document.getElementById(id).firstChild){
			document.getElementById(id).removeChild(document.getElementById(id).firstChild);
		}
	}

	xmlHTTP = findhandler();
	//End Global Functions
	
	//Do Rating
	function gameRate(value,id,uid){
	
		xmlHTTP.onreadystatechange=function(){
				if(xmlHTTP.readyState==1){
						//Clear Element
						clearElement("game-rating");
						
						//Create Elements
						newDiv = document.createElement("div");
						newDiv.className = "rating-ajax-loading";
						newImg = document.createElement("img");
						newImg.src = site_url+"images/loading.gif";
						//newImg.width = "130";
						
						//Build Table
						newDiv.appendChild(newImg);
						
						//Write
						document.getElementById("game-rating").appendChild(newDiv);
				}
				if(xmlHTTP.readyState==4){
					//Clear Element
					clearElement("game-rating");
					
					var message = xmlHTTP.responseXML.getElementsByTagName("message");
					div = document.createElement("div");
					div.className = "rating-ajax";
					div.appendChild(document.createTextNode(getNodeValue(message[0],"text")));
					
					document.getElementById("game-rating").appendChild(div);
				}
		}
		
		//Send AJAX Request
		url=site_url+"sources/ajax/rating.php";
		url=url+"?id="+id+"&rate="+value+'&uid='+uid;
		xmlHTTP.open("GET",url,true);
		xmlHTTP.send(null);	
	}
	
		window.addEvent('domready', function(){
			var mySlide = new Slider($('rbox'), $('knob'), {
				steps: 10,
				onChange: function(step){
					$('rateval').setHTML(step);
					$('urating').setProperty('value',step);
					var colwidth = Math.round((step/10)*100);
					$('color_rate').setStyle('width',colwidth);
				}
			}).set(5);
		});