

doBibleSharedProgressWidget();

function getBibleSharedProgressString() {
    return "1111111111111111100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000";
}

function doBibleSharedProgressWidget() {

    var progress = getBibleSharedProgressString();
    var userID = "Ty4him";
    var fullWidth = 200; // Overall width (including borders)
    var containerWidth = fullWidth - 12; // Container width
    var pbWidth = containerWidth; // Progress bar width
    
    if (progress.length != 1189) {
    
        document.write("Could not fetch progress from BibleShared.com");
    
    } else {
           
        var pCursor = 0;
        var readCount = 0;
        
        for (pCursor = 0; pCursor < progress.length; pCursor++) {
        
            if (progress.substring(pCursor, pCursor + 1) == "1") {
                readCount++;
            }
        
        }
        
	    unReadCount = 1189 - readCount;
        
        document.write("<div id=\"bibleshared_progress_widgetcontainer\" style=\"border: 1px solid #293d56; padding: 5px; width: " + containerWidth + "px; background: #ffffff url(http://www.bibleshared.com/images/background.gif) repeat-x; font-family: \'Arial\',\'Verdana\',\'Helvetica\',\'Sans-Serif\'\">");
        document.write("<center><a href=\"http://www.bibleshared.com/\"><img src=\"http://www.bibleshared.com/images/logo.gif\" style=\"position: relative; left: -5px;\" border=\"0\" alt=\"BibleShared.com\" /></a></center>");
        document.write("<b><a href=\"http://www.bibleshared.com/idcard.asp?id=" + userID + "\" style=\"font-size: 12px; color: #940f04;\">" + userID + "</a><a href=\"http://www.bibleshared.com/notes/usernotes.asp?user=" + userID + "\"><img src=\"http://www.bibleshared.com/images/icons/notes.gif\" alt=\"View " + userID + "'s Notes\"  border=\"0\" height=\"16\" width=\"16\" /></a><a href=\"http://www.bibleshared.com/bible/progress.asp?user=" + userID + "\"><img src=\"http://www.bibleshared.com/images/icons/progress.gif\" alt=\"View Reading Progress\" border=\"0\" height=\"16\" width=\"16\" /></a></b><br />");
        document.write("<small style=\"font-size: 10px; color: #666666;\">" + readCount + " chapters read</small><br />");
        document.write("<table id=\"progressbar\" cellpadding=\"0\" cellspacing=\"0\" style=\"border: 1px solid #222222; width: " + pbWidth + "px;\"><tr>");
	    
	    if (readCount != 0) {
	        document.write("<td width=\"" + Math.floor((readCount / 1189) * pbWidth) + "\" bgcolor=\"#293d56\"><img src=\"http://www.bibleshared.com/images/spacer.gif\" height=\"15\" width=\"1\" /></td>");
    	}
    	
	    if (unReadCount != 0) {
		    document.write("<td width=\"" + Math.floor((unReadCount / 1189) * pbWidth) + "\" bgcolor=\"#ffffff\"><img src=\"http://www.bibleshared.com/images/spacer.gif\" height=\"15\" width=\"1\" /></td>");
	    }

	    document.write("</tr>");
        document.write("</table>");
        document.write("<small><small style=\"font-size: 10px; color: #666666;\">" + Math.floor((readCount / 1189) * 100) + "% complete</small></small>");
        document.write("</div>");

    }
}