﻿function AJAX_markSongSubmissionAsViewed(submissionID, fileLocation) 
{
   var sBody = "submissionID=" + submissionID;

    var oXmlHttp = zXmlHttp.createRequest();
    oXmlHttp.open("post", "markSubmissionViewed.asp", true);
    oXmlHttp.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
    
    oXmlHttp.onreadystatechange = function () 
    {
        if (oXmlHttp.readyState == 4) 
        {
            if (oXmlHttp.status == 200) 
            {
                checkAJAXResult(oXmlHttp.responseText);
                if(fileLocation != undefined)
                {
                    document.location.href = fileLocation;
                }
            } 
            else 
            {
                checkAJAXResult("An error occurred: " + oXmlHttp.statusText);
            }
        }            
    };
    
    oXmlHttp.send(sBody);        
}

function checkAJAXResult(sMessage) 
{
    if (sMessage != "true")
    {
        alert(sMessage);            
    }  
}
