﻿$(function(){

if(document.getElementById("ddominio")){
var dominio = document.getElementById("ddominio");
dominio.value = "seudominio";
dominio.style['color'] = '#999';
dominio.onfocus = function(){
if(this.value == 'seudominio'){
dominio.value = "";
dominio.style['color'] = '';
}
}
}



var login = document.getElementById("clogin");
var senha = document.getElementById("csenha");

login.value = "seulogin";
senha.value = "******";
login.style['color'] = '#999';
senha.style['color'] = '#999';

login.onfocus = function(){
if(this.value == 'seulogin'){
this.value = "";
this.style['color'] = '';
}}

senha.onfocus = function(){
if(this.value == '******'){
this.value = "";
this.style['color'] = '';
}
}






$("#CentralAssinante").submit( function(){

var login = document.getElementById("clogin").value;
var senha = document.getElementById("csenha").value;

var retorno = true;

if(login == "seulogin" || login == ""){
retorno = false;
}

if(senha == "******" || senha == ""){
retorno = false;
}

if(retorno == false){
alert("Por favor, preencha um Login e uma Senha!");
}

return retorno;

})







if($("#contato").html()){
$("input[@name=contato_fone]").each(function(){

  this.value = '(xx) xxxx.xxxx';
  this.onselect = function(){this.value = "("; return false;};


  this.onfocus = function(){
    if(this.value ==  '(xx) xxxx.xxxx' | this.value ==  ''){
        this.value = '('};
    };

  this.onkeyup = function(){
  if(this.value.length == 0){
          this.value = this.value + '(';
          return false
      }



      if(this.value.length == 3){
          this.value = this.value + ') ';
          return false
      }
      if(this.value.length == 9){
          this.value = this.value + '-';
          return false
  }}


})


$("#contato form").submit(function(){
if(this.contato_fone){
if(this.contato_fone.value == '(xx) xxxx.xxxx'){
this.contato_fone.value = '';
}
}
})



var Valor = document.getElementById('setor_confirmar_pagamento').valor_depositado;
Valor.value = 'R$ ';
$("#setor_confirmar_pagamento").submit(function(){
if(Valor.value == 'R$ '){
Valor.value = '';
}
})




$("#setor_confirmar_pagamento").validate();
$("#setor_comercial").validate();
$("#setor_suporte").validate();
$("#setor_financeiro").validate();
$("#setor_marketing").validate();
$("#setor_outros").validate();



function defaultt(id){
$("#contato form").css({display: 'none'});
$("#setor").css({display: 'block'});
$(id).css({display: 'block'});
}



if(location.hash == '#confirmar_pagamento'){
defaultt("#setor_confirmar_pagamento");
$("#cp").attr({selected: 'selected'});
} else {
defaultt("#setor_comercial");
}


$("#optSetor").change(function(){
defaultt("#"+this.value)
})


$("#selectMetodo").change(function(){
$(".banco").css({display: 'block'});
$(".banco").addClass("{required:true}");
if(this.value == "Pago via boleto"){
 $(".banco").css({display: 'none'});
 $(".banco").removeClass("{required:true}");
}
})

$("#pagamentos a").click(function(){
defaultt("#setor_confirmar_pagamento");
$("#cp").attr({selected: 'selected'});
})
}









})
