﻿
function ToggleSelectedItem(htmlId) {
    var CurrentImg = document.getElementById(htmlId).src;
    if (CurrentImg.indexOf("/checked.png") > -1) {
        document.getElementById(htmlId).src = "Images/publishingService/unchecked.png";
    }
    else {
        document.getElementById(htmlId).src = "Images/publishingService/checked.png";
    }

//    jQuery('a[rel*=facebox]').facebox();
}

function doPublish() {
    // do swich image
    var publishVals = new Array();
    var index = 0;
    
    for (i = 1; i < 8; i++) {
        htmlId = "check" + i;
        var CurrentImg = document.getElementById(htmlId).src;
        if (CurrentImg.indexOf("/checked.png") > -1) {
            publishVals[index] = i;
            index++;
        }
    }

    if (index > 0) {
        var userId = document.getElementById('htmlUserId').getAttribute('value');
        ret = PublishingService.DoPublish(userId, publishVals, onCompleteDoPublish);
        return (true);
    }
    else {
        alert("Please select at least one Box.");
    }    
}

function onCompleteDoPublish(arg) {
    if (arg=="1")
        window.location = "http://twitteranalyzer.com/Oauth.aspx";
}

function ShowStats() {
    document.getElementById('PublishService').style.display = "none";
    document.getElementById('flashcontent').style.display = "block";
}
