function overImage(id,image){
   document.getElementById(id).style.background = 'URL(images/btn_'+image+'.png) no-repeat';
}

function outImage(id,image){
    document.getElementById(id).style.background = 'URL(images/btn_'+image+'.png) no-repeat';
}

function openSubMenu(){

}

function arrayFormInsc(idForm,page, tipo){
    
    $("#"+idForm).submit(function(){
        
               var valid = $("#"+idForm).validate().form();
              //var valid = true;

                if(valid){

                    $.post(page,{results : $("#"+idForm).serializeArray()},function(res){

                    //alert(res);
                         if(tipo == 1){
                            if(res == 'true'){
                                $('#conteudo_formulario_nota').css('display','block');
                                $('#conteudo_formulario_cadastro').css('display','none');
                            }else{
                                alert(res);
                            }

                        }if(tipo == 2){
                               //alert(res);
                                alert('Dados cadastrados com sucesso, verifique seu e-mail para mais detalhes!');

                                if(res != "") {
                                    
                                    alert('Clique no link do Pagseguro para efetuar o pagamento.');
                                    
                                    $("#botao_inscricao_notafiscal").hide();
                                    $("#instituicaonotafiscal").attr('disabled','disabled');
                                    $("#sigla").attr('disabled','disabled');
                                    $("#nomerazaosocialnotafiscal").attr('disabled','disabled');
                                    $("#cpfcnpjnotafiscalnotafiscal").attr('disabled','disabled');
                                    $("#inscestnotafiscal").attr('disabled','disabled');
                                    $("#emailnotafiscal").attr('disabled','disabled');
                                    $("#endereconotafiscal").attr('disabled','disabled');
                                    $("#bairronotafiscal").attr('disabled','disabled');
                                    $("#numeronotafiscal").attr('disabled','disabled');
                                    $("#complementonotafiscal").attr('disabled','disabled');
                                    $("#caixapostalnotafiscal").attr('disabled','disabled');
                                    $("#cepnotafiscal").attr('disabled','disabled');
                                    $("#cidadenotafiscal").attr('disabled','disabled');
                                    $("#ufnotafiscal").attr('disabled','disabled');
                                    $("#telfixonotafiscal").attr('disabled','disabled');
                                    $("#telcelularnotafiscal").attr('disabled','disabled');
                                    $("#telfaxnotafiscal").attr('disabled','disabled');
                                    $("#sitenotafiscal").attr('disabled','disabled');
                                    $("#descontofinal").attr('disabled','disabled');

                                    $("#retorno").html(res);
                                    
                                } else {
                                    window.location.href='verificar_insc.php';
                                }

                                
                                

                        }
                    })
                }
    return false;
    });
}

function arrayForm(idForm,page,reset,reload,showScreen){

    if(typeof reset == 'undefined' || reset == "")
        reset = false;

    if(typeof reload == 'undefined' || reload == "")
        reload = false;
    
    $("#"+idForm).submit(function(){

        var valid = $("#"+idForm).validate().form();
        
        if(valid){
            
           $.post(page,{results : $("#"+idForm).serializeArray()},function(res){

           if (showScreen) {
                $("#result").html(res);
           } else {
                alert(res);
           }

           if(reset){

                 $(':input','#'+idForm)
                 .not(':button, :submit, :reset, :hidden')
                 .val('')
                 .removeAttr('checked')
                 .removeAttr('selected');
           }

           if(reload){

              
               
           }




                });

        }


    
    });
    

    return false;
}



