﻿function jsonp(url, callback, name, query) {
    if (url.indexOf("?") > -1) {
        url += "&jsonp=";
    }
    else {
        url += "?jsonp=";
    }
    url += name + "&";
    if (query)
        url += query + "&";
    url += new Date().getTime().toString(); // prevent caching
    var script = document.createElement("script");
    script.setAttribute("src", url);
    script.setAttribute("type", "text/javascript");
    document.body.appendChild(script);
}

function embed22(axres) {
    var ww22 = axres.emb;
    if (ww22.length > 0) {
        $("#ww22").html(ww22);
    }
    else {
        $("#ww22").css("display", "none");
        $("#ww22link").css("display", "none");
    }
}

function getwordwidget22(theword, thewidth, theapikey) {
    $("#ww22link").attr("target", "_blank");
    var baseurl = "http://www.22frames.com/dictionary/wordwidgetsvc.aspx";
    jsonp(baseurl, '', 'embed22', 'word=' + theword + '&width=' + thewidth + '&apikey=' + theapikey);
}

