// MODIFY THE FOLLOWING LINE IF THIS VERSION OF BOOKTOR IS *NOT* INSTALLED AT THE ROOT DIRECTORY
// for instance:  if you extracted this package to a directory called "test" (accessible at http://www.booktor.com/test) then
// change the following line to
//
// $baseDocsDir = '/test/';
//
// NOTE:  make sure the last character is always a / character.  Otherwise all hell will break loose!
//
//DocumentRoot = '/booktor/';
DocumentRoot = '';

VotingSystem = { };

VotingSystem.vote = function (id) {
    var currentVal = parseInt(jQuery('#td'+id).html());
    
    jQuery.post(DocumentRoot + "voting/dovote.php", { tid : id }, function (data) {
        if (data == 'THANKYOU') {
            // everything went OK
            jQuery('#td'+id).html(currentVal+1);
            alert('Thank you for voting!');
        } else if (data == 'NOTLOGGEDIN') {
            // user wasn't logged in
            alert('You need to login to vote for this travel deal.');
        } else if (data == 'ALREADYVOTED') {
            // user already voted.
            alert('You have already voted for this travel deal.');
        }
    });
}
