﻿$jq.namespace('MatchCore');

MatchCore.AddMatchWord = function(newMatchWord) {
    var postData = {
        "matchWord": newMatchWord,
        "sid": MatchCore.Session.SID(),
        "theme": MatchCore.Session.ServerId()
    };
    $jq.ajax({
		type: 'POST',
		url: '/rest/MatchCoreService.ashx/InsertNewMatchWords',
		data: postData,
		dataType: 'json',
		async: false,
		success: function(response) {

		    switch (response.toString()) {
		        case '0':
		            document.getElementById(newMatchWord).className = "highlight";
		            break;
		        case '1':
		            alert("This word has been blacklisted");
		            break;
		        case '2':
		            alert("You have added too many MatchWords to your profile.  Please remove some MatchWords from your profile before adding more.");
		            break;
		        default:
		            alert("Error::193879");
		    }

        }
    });

};

