//This is the CommandProxy class,
// it queues the command and fire them to the server in order,
// one at a time.
if(com==null) {
	var com=new Object();
	com.fps=new Object();
	com.fps.ajax=new Object();
}

//This is the component that will let user rate the media
// it will show the feed back information in the htmlObj
com.fps.ajax.CurrentUserInfo=function(owner){
	this.owner=owner;
}
// call back function, when the response is returned
//the request is XMLHttpRequest with it's response back
	com.fps.ajax.CurrentUserInfo.prototype
	.callbackFunc=function(request) {
		var xmlDoc=request.responseXML;
		//window.alert(xmlDoc);
		//find out if ie
		if((! xmlDoc) || xmlDoc.firstElement==null){
			xmlDoc=request.responseText;
			xmlDoc=parseXML(xmlDoc);
		}
		var userName=null;
		var userUrl=null;
		if(xmlDoc){
			//we new userName node
			var userNameNode=xmlDoc.getElementsByTagName("userName")[0];
			var urlNode=xmlDoc.getElementsByTagName("url")[0];
			
			try{
				userName=userNameNode.textContent?userNameNode.textContent : userNameNode.text;
			}catch(e) {}
			
			//get the new rating
			try{
				userUrl=urlNode.textContent?urlNode.textContent : urlNode.text;
				if(newRating && newRating!="undefined")
					this.ratingDiv.innerHTML=newRating;
			}catch(e) {}
		}
		//we have the user info now, display it
		//crate a div, position it to the same to the bar, same size
		if(userName!=null){
			this.owner.innerHTML="<a href=\""+userUrl+"\"><b style='color:#5B5AFF'>"+userName+"</b></a>";
		}
	}
//hide the display div
	com.fps.ajax.CurrentUserInfo.prototype
	.hideDisplayDiv=function(){
		hideNode(this.msgDiv);
	}
// when the click happened, this method should be called.
	com.fps.ajax.CurrentUserInfo.prototype
	.loadsInfo=function() {
		var pN=new Array();//parameter names
//		pN.append("rate");
//		pN.append("mediaId");
		var pP=new Array();//parameter values
//		pP.append(rate);
//		pP.append(mediaId);
		var cmd=new com.fps.ajax.Command("getCurrentUserInfo","/ajaxService",pN,pP);
		//overwrites the callback function
		var thisCurrentUserInfo=this;
		cmd.callbackFunc=function(request) {
			thisCurrentUserInfo.callbackFunc(request);
		}
		// call the proxy
		var proxy=getCommandProxy();
		proxy.sendRequest(cmd);
		proxy.fireRequest();
	}
// ============================================
// every thing should be before this two lines.
if (typeof loaded_scripts != 'object') loaded_scripts = new Object();
loaded_scripts["com.fps.ajax.CurrentUserInfo.js"] = true;
