function MontaPeca(Settings, Chave, URLWEBSERVICE) {
        var peca = new String();
        var numHtml = Math.floor(Math.random() * Settings[0]);
        if (numHtml == 0) numHtml = 1;
        var nocache = Math.floor(Math.random() * 1000000)
        peca = '<iframe id="frameWatzSalesServer' + Chave + '" name="frameWatzSalesServer' + Chave + '" src="' + URLWEBSERVICE + Chave + '/' + Chave + '.' + numHtml + '.html?no_cache=' + nocache + '" frameborder="0" scrolling="no" style="width:' + Settings[1] + 'px; height:' + Settings[2] + 'px; padding:0px; margin:0px;" />';
        AdicionaContent(Chave);
        jQuery("#WatzSalesServer-content" + Chave).html(peca);
}
function AdicionaContent(Chave) {
        var newcontent;
        newcontent = document.getElementById('WatzSalesServer-content-' + Chave);
        if (newcontent == undefined) {
            var newcontent = document.createElement('div');
            newcontent.id = 'WatzSalesServer-content' + Chave;
        }
        var item;
        jQuery("script[type*=javascript]").each(function() {
            if (this.id == "WatzSalesServer") {
                var posicao = this.text.indexOf(Chave, 0);
                if (posicao > 0) {
                    this.id = Chave;
                    this.parentNode.insertBefore(newcontent, this);
                    return;
                }
            }
        });
}
function FillWatzSalesServer(Chave) {
    jQuery(document).ready(function() {
        var URLWEBSERVICE = "http://www.internetpro.com.br/WatzSS/XML/";
        //ADICIONA DIV QUE RECEBERA A PECA
        var Settings;
        jQuery.getJSON(URLWEBSERVICE + Chave + '.asp?jsoncallback=?',
          function(data, textstatus) {
              Settings = data.dados.split(';');
              MontaPeca(Settings, Chave, URLWEBSERVICE);
          });
    });
}
