﻿//This will add an entry into a competition
//Need two divs, one with id InitCompetition, the other id FinalCompetition
// These contain the initial text for competition the other will contain the text after competition has been completed
var finalId,initId
function AddToCompetition(compid,email,name,iid,fid) {
    finalId = fid;
    initId = iid;
    var wRequest = new Sys.Net.WebRequest;
    wRequest.set_url('/scripts/competition.aspx');
    wRequest.set_httpVerb('POST');
    var body = 'compid=' + compid + '&email=' + email + '&name=' + name;
    wRequest.set_body(body);
    wRequest.get_headers()["Content-Length"] = body.length;
    wRequest.add_completed(OnRequestCompleted);
    wRequest.invoke();
}

function OnRequestCompleted(executor, eventargs) {
    document.getElementById(initId).innerHTML = '';
    document.getElementById(initId).style.display = 'none';
    document.getElementById(finalId).style.display = '';   
}
