﻿
var reEmail3 = /^[\w-]+(\.[\w-]+)*@(([A-Za-z\d][A-Za-z\d-]{0,61}[A-Za-z\d]\.)+[A-Za-z]{2,6}|\[\d{1,3}(\.\d{1,3}){3}\])$/;
var reEmail = reEmail3;

function doEmail(pStr, pFmt) {
    eval("reEmail = reEmail" + pFmt);
    if (reEmail.test(pStr)) {
        return true;
    } else if (pStr != null && pStr != "") {
        return false;
    }
}

function vldFrm() {

    var mCheck = true;

    // validação de email - login
    if (($("#txtNews").val() == "") || (doEmail($("#txtNews").val(), 3) == false)) {
        if (!(mCheck == false)) {
            alert("Atenção, e-mail não está correto!");
            $("[id$='_txtNews']").focus();
        }
        mCheck = false;
    }

    return mCheck;

}



$(document).ready(function () {
    $("#slide-eventos ul").cycle({
        fx: 'fade',
        speedIn: 500,  // speed of the 'in' transition 
        speedOut: 500,  // speed of the 'out' transition   
        speed: 5000,
        prev: '#prev',
        next: '#next',
        pager: '#nav'
    });

    $("#bannerx").cycle({
        fx: 'fade',
        speedIn: 500,  // speed of the 'in' transition 
        speedOut: 500,  // speed of the 'out' transition                       
        speed: 5000
    });

    $("#jCarrosel").jcarousel();
        

    $("#cbInstituicao").change(function () {
        var i = $(this).val();
        if (i != "N") {
            $("#cbCurso").html("<option>Carregando...</option>");
            $.post("app/cursos.ashx", { id: i }, function (data) {
                $("#cbCurso").html(data);
            });
        } else { $("#cbCurso").html("<option>Cursos</option>"); }
    });

    $("#cbCurso").change(function () {
        window.location = $(this).val();
    });
});

