// Copyright UK Internet Sites Limited

function ClearQuickJoin(fieldValue) {

if (fieldValue == 'your email address here'){
document.qjoin.emailaddress.value = "";
}

}

function BookmarkSite() {

title = "UK Bingo Expert";
url = location.href;

var done = 0;

if (window.sidebar) { // Mozilla Firefox Bookmark
window.sidebar.addPanel(title, url,"");
done = 1;
} else if( window.external ) { // IE Favorite
window.external.AddFavorite( url, title);
done = 1;
}else if(window.opera && window.print) { // Opera Hotlist	
return true;
done = 1;
}

if (! done){
alert("Sorry. Netscape and Mac Safari users must bookmark the pages manually by hitting <Ctrl-D>");
}

}

function HomePage() {
window.location = "http://www.ukbingoexpert.com/";
}

function RateBingoSite(rating, bingoID) {

eval("formName = document.bingoRate"+bingoID+";");

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

html = "";

if (indexPageMode){
html = '<img src="/images/submiting-vote-30px.gif" height="30" width="120">';
} else {
html = '<img src="/images/submitting-vote-wht-small.gif" height="12" width="80">';
}

fieldName = "bingo" + bingoID;   
document.getElementById(fieldName).innerHTML = html;

url = "/cgi-bin/rate-site.pl?bingo_id=" + bingoID + "&rating=" + rating + "&indexPage=" + indexPageMode;

  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 = "bingo" + bingoID;   
temp = self.xmlHttpReq.responseText;
document.getElementById(fieldName).innerHTML = temp;

        }
    }

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

}

function ShowRating(rating, bingoID) {

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

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

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

}

fieldName = "votePrompt" + bingoID;

if (rating != ''){
document.getElementById(fieldName).style.visibility = 'visible';
} else {
document.getElementById(fieldName).style.visibility = 'hidden';
}

eval("document.bingoRate"+bingoID+".drop_rating.value = "+rating+";");

}

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

function PickRating(bingoID, rating) {

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

}

indexPageMode = 0;
commentDB = new Array;

function RatingForm(bingoID, indexPage, commentCount) {

if (indexPage){
indexPageMode = 1;
commentDB[bingoID] = commentCount;
}

RatingHTML(bingoID, '', 0);
}

function RatingHTML(bingoID, rating, voteButton) {
html = "";

if (indexPageMode){

html = '<form name="bingoRate'+bingoID+'" style="padding:0px;margin:0px;border:0px;"><Table bgcolor="#ffffff" border="0" cellpadding="0" cellspacing="0"><tr><td>';

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

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

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

}

html += '</td><td width="5"></td><td>|</td><td width="5"></td><td><select onchange="javascript:PickRating('+bingoID+', this.value);" style=" font-size: 11px;width:90px;" 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>';

html += '</tr><tr>';

if (rating != ''){
voteButtonStyle = "visibility:visible;";
} else {
voteButtonStyle = "visibility:hidden;";
}


html += '<td colspan="5" align="center"><div name="votePrompt' + bingoID + '" id="votePrompt' + bingoID +'" style="'+voteButtonStyle+'"><Table bgcolor="#ffffff" border="0" cellpadding="0" cellspacing="0"><tr><td><a href="javascript:RateBingoSite(\'\', '+bingoID+');" style="text-decoration:underline;">vote now</a></td></tr></table></div></td>';

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

} else {

html = '<form name="bingoRate'+bingoID+'" style="padding:0px;margin:0px;border:0px;"><Table bgcolor="#ffffff" border="0" cellpadding="0" cellspacing="0"><tr><td><select onchange="javascript:PickRating('+bingoID+', this.value);" style=" font-size: 11px;width:110px;" 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>';


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

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

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

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

}

html += '</td>';

if (rating != ''){
voteButtonStyle = "visibility:visible;";
} else {
voteButtonStyle = "visibility:hidden;";
}


html += '<td width="5"></td><td><div name="votePrompt' + bingoID + '" id="votePrompt' + bingoID +'" style="'+voteButtonStyle+'"><Table bgcolor="#ffffff" border="0" cellpadding="0" cellspacing="0"><tr><td>|</td><td width="5"></td><td><a href="javascript:RateBingoSite(\'\', '+bingoID+');" style="text-decoration:underline;">vote now</a></td></tr></table></div></td>';

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

}

fieldName = "bingo" + bingoID;

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.gif';");
} else {
eval("document."+fieldName+".src = '/images/star-null-24x24.gif';");
}
}

}

