var Base64 = {
	//  Base64 : encode / decode : http://www.webtoolkit.info/

    // private property
    _keyStr : "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",

    // public method for decoding
    decode : function (input) {
        var output = "";
        var chr1, chr2, chr3;
        var enc1, enc2, enc3, enc4;
        var i = 0;

        input = input.replace(/[^A-Za-z0-9\+\/\=]/g, "");

        while (i < input.length) {

            enc1 = this._keyStr.indexOf(input.charAt(i++));
            enc2 = this._keyStr.indexOf(input.charAt(i++));
            enc3 = this._keyStr.indexOf(input.charAt(i++));
            enc4 = this._keyStr.indexOf(input.charAt(i++));

            chr1 = (enc1 << 2) | (enc2 >> 4);
            chr2 = ((enc2 & 15) << 4) | (enc3 >> 2);
            chr3 = ((enc3 & 3) << 6) | enc4;

            output = output + String.fromCharCode(chr1);

            if (enc3 != 64) {
                output = output + String.fromCharCode(chr2);
            }
            if (enc4 != 64) {
                output = output + String.fromCharCode(chr3);
            }

        }

        output = Base64._utf8_decode(output);

        return output;

    },

    // private method for UTF-8 decoding
    _utf8_decode : function (utftext) {
        var string = "";
        var i = 0;
        var c = c1 = c2 = 0;

        while ( i < utftext.length ) {

            c = utftext.charCodeAt(i);

            if (c < 128) {
                string += String.fromCharCode(c);
                i++;
            }
            else if((c > 191) && (c < 224)) {
                c2 = utftext.charCodeAt(i+1);
                string += String.fromCharCode(((c & 31) << 6) | (c2 & 63));
                i += 2;
            }
            else {
                c2 = utftext.charCodeAt(i+1);
                c3 = utftext.charCodeAt(i+2);
                string += String.fromCharCode(((c & 15) << 12) | ((c2 & 63) << 6) | (c3 & 63));
                i += 3;
            }
        }

        return string;
    }

}

var streamy_id = Base64.decode( document.getElementById( "streamy_nominate" ).src.split( "?" )[1] );
var streamy_nominee = streamy_id.split( ":" )[1];
var streamy_aCats = new Array( "Best Comedy Series", "Best Drama Series", "Best Reality or Doc Series", "Best News Series", "Best New Series", "Best Companion Series", "Best Animated Series", "Best Branded Series", "Best Foreign Series", "Best Experimental Series", "Best Hosted Series", "Best Directing (Comedy)", "Best Directing (Drama)", "Best Writing (Comedy)", "Best Writing (Drama)", "Best Actor (Comedy)", "Best Actress (Comedy)", "Best Actor (Drama)", "Best Actress (Drama)", "Best Cast", "Best Guest Star", "Best Host", "Best Vlogger", "Best Editing", "Best Cinematography"," Best Art Direction", "Best Sound Design","Best VFX","Best Animation","Best Music","Best Product Integration","Best Live Production","Best Interactive Exp.","Best Mobile Exp." );
var streamy_cat = streamy_aCats[ parseInt( streamy_id.split( ":" )[0], 10 ) - 1 ];
document.write( "<a href='http://streamys.org/submit/' style='text-decoration:none;'><div style='width:125px; height:125px; margin:0; padding:0; background:url(http://watch.streamys.org/badge/images/streamys-badge-nom.png)'>" +
	"<span style='width:125px; float:left; font-size:12px; font-weight:bold; color:#ffffff; width:100%; margin-top:35px; text-transform:capitalize;	position:relative; text-align:center; font-family:Verdana;'>" + streamy_nominee + "</span>" +
	"<span style='width:125px; float:left; margin-top:5px; width:100%;	text-align:center; padding:0px;	font-size:9px; font-weight:500; color:#b92346; text-transform:capitalize; font-family:Arial;'>" + streamy_cat + "</span>" +
	"</div></a>" );
