function RatingComponent()
{
	this.maxStars = 5;
	
	SRC_FULL = sitelink+"/style/starfullstyle1.gif";
	SRC_NONE = sitelink+"/style/starnonestyle1.gif";
	SRC_HALF = sitelink+"/style/starhalfstyle1.gif";
	
	
	this.var1;
	this.var2;
	this.quote;
	
	this.first;
	this.last;
	this.author;
	
	this.dob;
	this.dod;
	this.doblink;
	this.dodlink;
	
	
	this.profession=new Array()
	
	
	this.firstname;
	this.lastname;
	this.country;
	
	this.quote_id;
	this.userVote;
	this.showauthor = showauthor;
	this.showStars = showStars;
	this.outStars = outStars;
	this.setStars = setStars;
	this.postUrl = postUrl;
	
	this.setAuthor = setAuthor;
	this.setValues = setValues;
	
	this.showStars2 = showStars2;
	this.outStars2 = outStars2;
	
	

return this;
        }

function setAuthor(first, last){
	this.first = first;
	this.last = last;
	this.author = first+ ' ' + last;
	this.firstname = first.replace(' ', "_");
    this.lastname = last.replace(' ',"_");

}

function setValues(var1, var2, quote, quote_id, dob, doblink, dod, dodlink, country)
{
	this.var1 = var1;
	this.var2 = var2;
	this.quote = quote;

	this.dob = dob;
	this.dod = dod;
	this.doblink = doblink;
	this.dodlink = dodlink;
	
	
	var dobarr = dob.split(' ');
	var dodarr = dod.split(' ');
	
	
	
	var doblink = '';
	var dodlink = '';
	
	
	/*
	for(i = 0;i < dobarr.length;i++){
		if(i!=0)
		{
		doblink = doblink + '_' + dobarr[i] ;
		dodlink = dodlink + '_' + dodarr[i] ;
		}
		else
			{
			doblink = dobarr[i] ;
			dodlink = dodarr[i] ;
			}
		}
	
	this.doblink = doblink;
	this.dodlink = dodlink; */
	
	
	
	
	this.country = country;
	
	this.quote_id = quote_id;
	
	
	
	
	}

function showStars(starNum) {
	
	if(this.userVote != 1)
	{

		this.starCount = starNum;
	  
		for (var i=0; i < this.maxStars; i++)
			if (i < this.starCount)
				document.getElementById('star__'  + (i+1)).src = SRC_FULL; 
			else
				document.getElementById('star__'  + (i+1)).src = SRC_NONE;
				
	}

}

function outStars(starNum, halfNum){
	this.starCount = starNum;
	this.halfCount = halfNum;
	if(this.userVote != 1)
	for(var i=0; i< this.maxStars; i++){
		if(i<this.starCount){
			
			
			document.getElementById('star__'  + (i+1)).src = SRC_FULL;
			
			
		}
		else{
			if(this.halfCount != 0)
			{
			document.getElementById('star__' + (i+1)).src = SRC_HALF;
			this.halfCount = 0;
			}
			else{
			document.getElementById('star__'  + (i+1)).src = SRC_NONE;}
		}
		
	}
	
}

function setStars(starNum, quote_id)
{
this.starNum = starNum;
	if(this.userVote != 1){
		sendQuery(this.starNum, quote_id);
		outStars(this.starNum, 0);
		this.userVote =1;
		}

	}
	
	
function sendQuery(starNum, quote_id)
{

	data = "star-" + quote_id + "-" + starNum;
	postUrl(sitelink+"/ajaxsend.php?data=" +data, data, 'true', outStars(starNum,0));

}

function showStars2(starNum) {
	
	if(this.userVote != 1)
	{

		this.starCount = starNum;
	  
		for (var i=0; i < this.maxStars; i++)
			if (i < this.starCount)
				document.getElementById('star_' + this.quote_id + '_' + (i+1)).src = SRC_FULL; 
			else
				document.getElementById('star_' + this.quote_id + '_' + (i+1)).src = SRC_NONE;
				
	}

}

function outStars2(starNum, halfNum){
	this.starCount = starNum;
	this.halfCount = halfNum;
	
	
	
	for(var i=0; i< this.maxStars; i++){
		if(i<this.starCount){
			
			
			document.getElementById('star_' + this.quote_id + '_' + (i+1)).src = SRC_FULL;
			
			
		}
		else{
			if(this.halfCount != 0)
			{
			document.getElementById('star_' + this.quote_id + '_' + (i+1)).src = SRC_HALF;
			this.halfCount = 0;
			}
			else{
			document.getElementById('star_' + this.quote_id + '_' + (i+1)).src = SRC_NONE;}
		}
		
	}
	
	
}
