top.importt("js.alertbox.AlertBox");

top.EnviarVagaBox = function EnviarVagaBox() {

  this.id = "enviarVaga";
  this.cssArqName  = "DefaultMetroRio";
  this.codVaga = 0;

  this.alertBoxHTML = "";
  this.alertBoxHTML += "<table cellpadding='0' cellspacing='0' class='table_alertBox'>";
  this.alertBoxHTML += "<tr>";
  this.alertBoxHTML += "<td id='alertBoxTitle" + this.id + "' class='td_alertBoxTitle' onmousedown='top.activateEnviarVagaBox(event);'>&nbsp;</td>";
  this.alertBoxHTML += "</tr>";
  this.alertBoxHTML += "<tr>";
  this.alertBoxHTML += "<td class='td_alertBox'>";
  this.alertBoxHTML += "<table cellpadding='0' cellspacing='0' class='table_alertBoxMsg'>";
  this.alertBoxHTML += "<tr>";
  this.alertBoxHTML += "<td class='td_alertBoxMsg'>";
  this.alertBoxHTML += "<div id='alertBoxMsg" + this.id + "' class='div_alertBoxMsg'>&nbsp;</div>";
  this.alertBoxHTML += "</td>";
  this.alertBoxHTML += "</tr>";
  this.alertBoxHTML += "<tr>";
  this.alertBoxHTML += "<td class='td_promptBoxTxt'>";
  this.alertBoxHTML += "<form id='enviarOportunidade' name='enviarOportunidade' action='../view/branco.asp' method='post'>";
  this.alertBoxHTML += "<table cellspacing='1' cellpadding='3' border='0' class='fill'>";
  this.alertBoxHTML += "<tr>";
  this.alertBoxHTML += "<td class='campoLabel' nowrap><li>" + top.Messages.enviaNome + "</li></td>";
  this.alertBoxHTML += "<td class='campo'><input type='text' name='NOME' validation='required' label='" + top.Messages.enviaNome + "'></td>";
  this.alertBoxHTML += "</tr>";
  this.alertBoxHTML += "<tr>";
  this.alertBoxHTML += "<td class='campoLabel' nowrap><li>" + top.Messages.enviaEmail + "</li></td>";
  this.alertBoxHTML += "<td class='campo'><input type='text' name='EMAIL' validation='required,email' label='" + top.Messages.enviaEmail + "'></td>";
  this.alertBoxHTML += "</tr>";
  this.alertBoxHTML += "<tr>";
  this.alertBoxHTML += "<td class='campoLabel' nowrap><li>" + top.Messages.enviaNomeAmigo + "</li></td>";
  this.alertBoxHTML += "<td class='campo'><input type='text' name='NOME_AMIGO' validation='required' label='" + top.Messages.enviaNomeAmigo + "'></td>";
  this.alertBoxHTML += "</tr>";
  this.alertBoxHTML += "<tr>";
  this.alertBoxHTML += "<td class='campoLabel' nowrap><li>" + top.Messages.enviaEmailAmigo + "</li></td>";
  this.alertBoxHTML += "<td class='campo'><input type='text' name='EMAIL_AMIGO' validation='required,email' label='" + top.Messages.enviaEmailAmigo + "'></td>";
  this.alertBoxHTML += "</tr>";
  this.alertBoxHTML += "</table>";
  this.alertBoxHTML += "</form>";
  this.alertBoxHTML += "</td>";
  this.alertBoxHTML += "</tr>";
  this.alertBoxHTML += "<tr>";
  this.alertBoxHTML += "<td class='td_alertBoxButton'>";
  this.alertBoxHTML += "<img id='alertBoxButton' src='../images/" + top.Messages.imgFolder + "/bt_cancelar.gif' onclick='top.closeEnviarVagaBox();'>&nbsp;<img src='../images/" + top.Messages.imgFolder + "/bt_enviar.gif' onclick='top.enviarVaga();'>"
  this.alertBoxHTML += "</td>";
  this.alertBoxHTML += "</tr>";
  this.alertBoxHTML += "</table>";
  this.alertBoxHTML += "</td>";
  this.alertBoxHTML += "</tr>";
  this.alertBoxHTML += "</table>";

  this.vaga = function(msg, title, cod) {
    if(!cod) {
      cod = title;
    }
    this.codVaga = cod;
    this.alert(msg, title);
  }

  this.enviarVaga = function() {
    if(!top.formcheck(top.getObj("enviarOportunidade", top.mainFrame), true, "../actions/enviaEmailVaga.asp?c=" + this.codVaga, top.submitFrame.name)) {
      return;
    }
    this.closeAlert();
  }

}
top.EnviarVagaBox.prototype.extendss("AlertBox");
top.EnviarVagaBox.instance = null;
top.EnviarVagaBox.getInstance = function() {
  if(this.instance == null) {
    this.instance = new top.EnviarVagaBox();
  }
  return this.instance;
}

top.enviarvagabox = function enviarvagabox(msg, title, cod) {
  top.EnviarVagaBox.getInstance().vaga(msg, title, cod);
}
top.activateEnviarVagaBox = function (e) {
  top.EnviarVagaBox.getInstance().activateAlertBox(e);
}
top.closeEnviarVagaBox = function() {
  top.EnviarVagaBox.getInstance().closeAlert();
}
top.enviarVaga = function() {
  top.EnviarVagaBox.getInstance().enviarVaga();
}