<!--

///////////////////////////////

var div_name  = "display_txt";
var img_dir   = "rate/img1/";

///////////////////////////////

var set=false;
var v=0;
var a;
function loadStars(){
star1 = new Image();
star1.src = img_dir+"star1.gif";
star2 = new Image();
star2.src = img_dir+"star2.gif";

var stars_r1 = "<img src='"+img_dir+"star1.gif' onmouseover='highlight(this.id)' onclick='setStar(this.id)' onmouseout='losehighlight(this.id)' id='1' class='simg' border='0'>";
var stars_r2 = "<img src='"+img_dir+"star1.gif' onmouseover='highlight(this.id)' onclick='setStar(this.id)' onmouseout='losehighlight(this.id)' id='2' class='simg' border='0'>";
var stars_r3 = "<img src='"+img_dir+"star1.gif' onmouseover='highlight(this.id)' onclick='setStar(this.id)' onmouseout='losehighlight(this.id)' id='3' class='simg' border='0'>";
var stars_r4 = "<img src='"+img_dir+"star1.gif' onmouseover='highlight(this.id)' onclick='setStar(this.id)' onmouseout='losehighlight(this.id)' id='4' class='simg' border='0'>";
var stars_r5 = "<img src='"+img_dir+"star1.gif' onmouseover='highlight(this.id)' onclick='setStar(this.id)' onmouseout='losehighlight(this.id)' id='5' class='simg' border='0'>";
document.getElementById('stars').innerHTML = stars_r1+stars_r2+stars_r3+stars_r4+stars_r5;

//Show set star amt ...
for (i=1;i<=rated;i++){
document.getElementById(i).src=star2.src;
};
};

function highlight(x){
if (set==false){
	y=x*1+1;
	switch(x){
		case "1": document.getElementById(x).src= star2.src;
		document.getElementById('vote').innerHTML="Ass Rocket";
		break;
		case "2":for (i=1;i<y;i++){
		document.getElementById(i).src= star2.src;
		};
		document.getElementById('vote').innerHTML="Not Bad";
		break;
		case "3":for (i=1;i<y;i++){
		document.getElementById(i).src= star2.src;
		};
		document.getElementById('vote').innerHTML="Prety Good";
		break;
		case "4":for (i=1;i<y;i++){
		document.getElementById(i).src= star2.src;
		};
		document.getElementById('vote').innerHTML="Verry Good";
		break;
		case "5":for (i=1;i<y;i++){
		document.getElementById(i).src= star2.src;
		};
		document.getElementById('vote').innerHTML="Top Notch";
		break;
		};
	};
};

function losehighlight(x){
if (set==false){
	for (i=1;i<6;i++){
		document.getElementById(i).src=star1.src;
		document.getElementById('vote').innerHTML="Please Vote!";
		};
	};
};

function getXMLHttp(){
var xmlHttp
try
{
//Firefox, Opera 8.0+, Safari
xmlHttp = new XMLHttpRequest();
}catch(e){
//Internet Explorer
try
{
xmlHttp = new ActiveXObject("Msxml2.XMLHTTP");
}catch(e){
try
{
xmlHttp = new ActiveXObject("Microsoft.XMLHTTP");
}catch(e){
alert("Your browser does not support AJAX!")
return false;
};
};
};
return xmlHttp;
};

function rate_req(){
var xmlHttp = getXMLHttp();
xmlHttp.onreadystatechange = function(){
if(xmlHttp.readyState == 4){
HandleResponse(xmlHttp.responseText);
};
};

var params = "id="+mid+"&rating="+a;
xmlHttp.open("GET", "processors/rating_process.php?"+params, true); 
xmlHttp.send(null);
};

function HandleResponse(response){
document.getElementById(div_name).innerHTML = response;
};
    
function setStar(x){
y=x*1+1;
if (set==false){
	switch(x){
		case "1": a="1";
        flash(a);
		break;
		case "2": a="2";
		flash(a);
		break;
		case "3": a="3"; 
		flash(a);
		break;
		case "4": a="4"; 
		flash(a);
		break;
		case "5": a="5"; 
		flash(a);
		break;
		};
	set=true;
	rate_req();//ajax reqest trigger ...
    document.getElementById('vote').innerHTML="Thank you for your vote!";
	};	
};

function flash(){
y=a*1+1;
switch(v){
	case 0:
	for (i=1;i<y;i++){
	document.getElementById(i).src= star1.src;
	};
	v=1;
	setTimeout(flash,200);
	break;
	case 1:	
	for (i=1;i<y;i++){
	document.getElementById(i).src= star2.src;
	};
	v=2;
	setTimeout(flash,200);
	break;
	case 2:
	for (i=1;i<y;i++){
	document.getElementById(i).src= star1.src;
	};
	v=3;
	setTimeout(flash,200);
	break;
	case 3:
	for (i=1;i<y;i++){
	document.getElementById(i).src= star2.src;
	};
	v=4;
	setTimeout(flash,200);
	break;
	case 4:
	for (i=1;i<y;i++){
	document.getElementById(i).src= star1.src;
	};
	v=5;
	setTimeout(flash,200);
	break;
	case 5:
	for (i=1;i<y;i++){
	document.getElementById(i).src= star2.src;
	};
	v=6;
	setTimeout(flash,200);
	break;
};
};

-->
