function RatingClass(){
	this.parentNodeName = document.getElementById("_parentNodeId").value;
	this.ratingString = document.getElementById("_ratingStringId").value;
	this.messageAry = document.getElementById("_message").value.split(",");
	this.startRatings = parseInt(document.getElementById("_startRatings").value);
	this.buttonId = document.getElementById("_buttonId").value;
	this.onButtonFlg = false;
	
	function load(){
		this.view(this.startRatings);
		this.setViewColor("hyoka");
	}
	function view(ratings){
		var childNodes = document.getElementById(this.parentNodeName).childNodes;
		for(var i = 0;i < childNodes.length;i++){
			if((i + 1) <= ratings){
				childNodes[i].innerHTML = "★";
			}else{
				childNodes[i].innerHTML = "☆";
			}
		}
		document.getElementById(this.ratingString).innerHTML = this.messageAry[ratings];
	}
	function setViewColor(className){
		var childNodes = document.getElementById(this.parentNodeName).childNodes;
		for(var i = 0;i < childNodes.length;i++){
			childNodes[i].className = className;
		}
	}
	function ratingStart(){
		if(!checkUseCookie()){
			alert("クッキーが有効ではないため、評価できません。");
			return;
		}
		this.setViewColor("do-hyoka");
		this.onButtonFlg = true;
		document.getElementById(this.buttonId).innerHTML = "Select";
	}
	function registRating(rating){
		if(this.onButtonFlg == false){
			return ;
		}
		var phpUrl = "./rating.php?tId=" + document.getElementById("_titleId").value + "&r=" + rating + "&PHPSESSID=" + document.getElementById("_sessionId").value;
		ratingSendData(phpUrl);
		this.setViewColor("hyoka");
		this.onButtonFlg = false;
		this.view(this.startRatings);
		document.getElementById(this.buttonId).innerHTML = "";
	}
	function onStars(star){
		if(this.onButtonFlg == false){
			return ;
		}
		this.view(star);
	}
	this.registRating = registRating;
	this.onStars = onStars;
	this.ratingStart = ratingStart;
	this.view = view;
	this.load = load;
	this.setViewColor = setViewColor;
}
function ratingSendData(url){
	try {
		createXMLHttpRequest();
	}catch(e) {
		alert("通信ができません。");
		return false;
	}
	if (httpObj != null){
		httpObj.onreadystatechange = dataLoaded;
		httpObj.open("GET",url,true);
		httpObj.send(null);
	}else{
		alert("アクセスができません。");
		return false;
	}
}
function dataLoaded(){
	if(httpObj.readyState == 4 && httpObj.status == 200){
			var textData = httpObj.responseText;
			alert(textData);
		}
	}

