﻿var thumbsDownSettings = new Array();
var thumbsUpSettings = new Array();

function ThumbsUp_MouseOver(linkID) {
    thumbsUpSettings[linkID] = $('thumbsUp_' + linkID).src;
    $('thumbsUp_' + linkID).src = '/images/thumbsUp_on.gif';
}
function ThumbsUp_MouseOut(linkID) {
    if (thumbsUpSettings[linkID] != null) $('thumbsUp_' + linkID).src = thumbsUpSettings[linkID];
    else $('thumbsUp_' + linkID).src = '/images/thumbsUp_off.gif';
}

function ThumbsDown_MouseOver(linkID) {
    thumbsDownSettings[linkID] = $('thumbsDown_' + linkID).src;
    $('thumbsDown_' + linkID).src = '/images/thumbsDown_on.gif';
}
function ThumbsDown_MouseOut(linkID) {
    if (thumbsDownSettings[linkID] != null) $('thumbsDown_' + linkID).src = thumbsDownSettings[linkID];
    else $('thumbsDown_' + linkID).src = '/images/thumbsDown_off.gif';
}

function ProcessRating(linkID, thumbsUp) {
    if (thumbsUp == 1) {
        thumbsUpSettings[linkID] = '/images/thumbsUp_on.gif';
        thumbsDownSettings[linkID] = '/images/thumbsDown_off.gif';

        $('thumbsUp_' + linkID).src = '/images/thumbsUp_on.gif';
        $('thumbsDown_' + linkID).src = '/images/thumbsDown_off.gif';
    } else {
        thumbsUpSettings[linkID] = '/images/thumbsUp_off.gif';
        thumbsDownSettings[linkID] = '/images/thumbsDown_on.gif';

        $('thumbsUp_' + linkID).src = '/images/thumbsUp_off.gif';
        $('thumbsDown_' + linkID).src = '/images/thumbsDown_on.gif';
    }

    var url = '/ajax/processRating.aspx?id=' + linkID + '&up=' + thumbsUp;
    ExecuteCall(url, Callback);
}
function Callback() {
    try {
        //readyState of 4 or 'complete' represents that data has been returned 
        if (xmlHttp.readyState == 4 || xmlHttp.readyState == 'complete') {
            var response = xmlHttp.responseText;
        }
    }
    catch (e) { }
}
