var im, proto, theme;

function setIM(im_id) {
    im = im_id.value;

    if (undefined == im || 0 >= im.length) {
        alert("Please enter IM identificator field");
    } else if (proto != undefined && theme != undefined) {
        genCode(im, proto, theme);
    }
}

function setTheme(proto_name, theme_name) {
    proto = proto_name;
    theme = theme_name;

    if (undefined == im || 0 >= im.length) {
        alert("Please enter IM identificator field");
    } else {
        genCode(im, proto, theme);
    }
}

function genCode(im, proto, theme) {
    var box = eval("document.indicator.code");
    box.value = '<a href="http://www.imwrapper.com/" title="'+proto+' online status"><img src="http://www.imwrapper.com/'+proto+'/'+im+'/'+theme+'" alt="'+ proto +' status" title="'+ proto +' online indicator" border="0" /></a>\n';
}

function CopyToClipBoard(id) {
    txt = document.getElementById(id).innerText;
    window.clipboardData.setData('Text', txt);
}


