// UK Strip Clubs
// Copyright UK Internet Sites Limited.

function RateClub(rating, clubID) {

eval("formName = document.club"+clubID+";");

if (rating == ''){
rating = formName.drop_rating.value;
}

html = "";
html = '<img src="/images/vote-submit-animlong.gif" height="12">';

fieldName = "club" + clubID;   
document.getElementById(fieldName).innerHTML = html;

url = "/cgi-bin/rate-club.pl?club_id=" + clubID + "&rating=" + rating;

  var xmlHttpReq = false;
    var self = this;
    // Mozilla/Safari
    if (window.XMLHttpRequest) {
        self.xmlHttpReq = new XMLHttpRequest();
    }
    // IE
    else if (window.ActiveXObject) {
        self.xmlHttpReq = new ActiveXObject("Microsoft.XMLHTTP");
    }

    self.xmlHttpReq.onreadystatechange = function() {
        if (self.xmlHttpReq.readyState == 4) {

fieldName = "club" + clubID;   
temp = self.xmlHttpReq.responseText;
document.getElementById(fieldName).innerHTML = temp;

        }
    }

self.xmlHttpReq.open("GET", url, true) 
self.xmlHttpReq.send(null);

}

function ShowRating(rating, clubID) {

for (var j = 1; j <= 5; j++) {

imgField = "c" + clubID + "i" + j;

if (j <= rating){
eval("document."+imgField+".src = '/images/star-12x12_on.gif';");
} else {
eval("document."+imgField+".src = '/images/star-12x12_off.gif';");
}

}

eval("document.club"+clubID+".drop_rating.value = "+rating+";");

}

function ResetRating(clubID) {
//reset to default
}

function PickRating(clubID, rating) {

if (rating == ''){
RatingHTML(clubID, rating, 0);
} else {
RatingHTML(clubID, rating, 1);
}

}


function RatingForm(clubID) {
RatingHTML(clubID, '', 0);
}

function RatingHTML(clubID, rating, voteButton) {
html = "";
html = '<form name="club'+clubID+'" style="padding:0px;margin:0px;border:0px;"><Table border="0" cellpadding="0" cellspacing="0"><tr><td><select onchange="javascript:PickRating('+clubID+', this.value);" style=" font-size: 11px;width:150px;" name="drop_rating">';
html += '<option value="">Select Rating';

for (var j = 0; j <= 5; j++) {
if (j == rating && rating != ''){
html += '<option value="'+j+'" selected>'+j+'/5';
} else {
html += '<option value="'+j+'">'+j+'/5';
}
}

html += '</select></td>';

if (rating != ''){
html += '<td width="5"></td><td>|</td><td width="5"></a><td><a href="javascript:RateClub(\'\', '+clubID+');" style="text-decoration:underline;">vote now</a></td>';
}

html += '<td width="5"></td><td>|</td><td width="5"></td><td>';

for (var j = 1; j <= 5; j++) {

imgField = "c" + clubID + "i" + j;

if (j<=rating){
html += '<a href="javascript:RateClub('+j+', '+clubID+');" onmouseover="javascript:ShowRating('+j+', '+clubID+');" onmouseout="javascript:ResetRating('+clubID+');"><img src="/images/star-12x12_on.gif" width="12" height="12" border="0" name="'+imgField+'" alt="'+j+'/5 Rating"></a>';
} else {
html += '<a href="javascript:RateClub('+j+', '+clubID+');" onmouseover="javascript:ShowRating('+j+', '+clubID+');" onmouseout="javascript:ResetRating('+clubID+');"><img src="/images/star-12x12_off.gif" width="12" height="12" border="0" name="'+imgField+'" alt="'+j+'/5 Rating"></a>';
}

}

html += '</td></tr></table></form>'; 

fieldName = "club" + clubID;

document.getElementById(fieldName).innerHTML = html;

}








function ResetFeedbackRating() {
SelectRating(document.feedback.drop_down_rating.value);
}

function FeedbackRating (rating) {
fixedFeedback = rating;
document.feedback.drop_down_rating.value = rating;
SelectRating(rating)
}

function SelectRating(rating) {

for (var j = 1; j <= 5; j++) {
fieldName = "feedback" + j;
if (j <= rating){
eval("document."+fieldName+".src = '/images/star-24x24_on.gif';");
} else {
eval("document."+fieldName+".src = '/images/star-24x24_off.gif';");
}
}

}
