//-- Slider
$( function(){

    $('#slider-home ul')
    //.before('<div id="pager">')
    .cycle({
        
        fx: 'fade',
        speed: 2000,
        timeout: 7000,
        next: '#next',
        prev: '#prev',
        pager: '#pager'
    })
    
} )


//--Parceiros
$( function(){

    $('#home-parceiros ul')
    //.before('<div id="pager">')
    .cycle({
        
        fx: 'scrollLeft',
        speed: 1000,
        timeout: 0,
        next: '.next',
        prev: '.prev'
    })
    
} )


//-- Accordion
$(function(){
    $('#accordion').accordion({
        header: 'h3',
        autoHeight: true,
        navigation: true
    });
});

//-- Cursos & Normas
$(function(){
        // Accordion
        $("#cursos").accordion({ 
            header: "h3" ,
            autoHeight: false,
            navigation: true
        });
});


//------------------ Jquery Carousel
jQuery(document).ready(function() {

        jQuery('#mycarousel').jcarousel();
});


//-- Print
function print( id )	{
	
      newwindow = window.open("/printNoticia.php?id=" + id, "beneficios", "width=550,height=450,scrollbars=yes");		
}


//-- Formulário Contato
$(document).ready(function(){
    
    $("#txtDdd").mask("(99)");
    $("#txtTelefone").mask("9999-9999")              
})

function enviaContato( post ){

$.ajax({
            type: "POST",
            url: "enviaContato.php",
            data: {
                post : post
            },
            beforeSend : function(){
                $( "#dialog" ).html('Enviando..');
                $( "#dialog" ).dialog( "open" );
            },
            success: function(data){
                
                if(data != "Mensagem enviada com sucesso. <br /> Obrigado!") {
                    $( "#dialog" ).html(data);
                    $( "#dialog" ).dialog( "open" );
                } else {
                    $( "#dialog" ).html(data);
                    $( "#dialog" ).dialog( "open" );
                    $("#frmContato").slideToggle();
                    setTimeout(function(){window.location = "http://www.colegiomaryward.com.br";}, 3000);
                }
            },
            error : function(){
                $("#contato-dtr").html("Erro no envio!");
            }
        });
}

$.fx.speeds._default = 1000;
$(function() {
        $( "#dialog" ).dialog({
                autoOpen: false,
                drag: true,
                show: "blind",
                hide: "blind"
        });
        $( "#dialog" ).dialog( "option", "height", 100 );
        $( "#dialog" ).dialog( "option", "title", 'Atenção!' );

        $( "#btnEnviar" ).click(function() {
            
                var form = [];
                form[0] = $("#txtNome").val();
                form[1] = $("#txtEmail").val();
                form[2] = $("#txtDdd").val();
                form[3] = $("#txtTelefone").val();
                form[4] = $("#txtAssunto").val();
                form[5] = $("#txtMensagem").val();
                
                enviaContato(form);
                return false;                
        });
});

//--------------------------------------------------------------------



