var rotat = 1;
var liNumBanner = 1;
var tmtint = 0;


$(document).ready(function() {
    $("#telefone").mask("(99) 9999-9999");
    $("#DataAniversario").mask("99/99/9999");
    
    $(".imagembanner ul li").each(function() {
        $(this).attr("rel", "alinb"+liNumBanner);
        $(".botoesbanner ul").append($('<li rel="linb'+liNumBanner+'"><a href="#">&nbsp;&nbsp;&nbsp;</a></li>'));
        liNumBanner++;
    });
    $(".botoesbanner ul li").click(function() {
        numero = parseInt($(this).attr("rel").toString().replace("linb", ""));
        goHorse(--numero);
        return false;
    });
    $(".botoesbanner ul li[rel=alinb1] a").addClass("current");
    tmtint = setTimeout(function() {
        goHorse();
    }, 5000);
});

function goHorse(nrotat) {
    clearTimeout(tmtint);
    if(nrotat!==undefined) {
        rotat = nrotat;
    }
    margtop=(rotat*-1)*233;
    rotats = rotat;
    rotats++;
    $(".botoesbanner ul li a").removeClass("current");
    $(".botoesbanner ul li[rel=linb"+rotats+"] a").addClass("current");
    $(".textobanner[rel!=text"+rotats+"]").fadeOut('slow',function() {
        $(".textobanner[rel=text"+rotats+"]").fadeIn(2000);
    });
        
    if($(".imagembanner ul li").length-1<=rotat) {
        rotat =0;
    } else {
        rotat++;
    }
    $(".imagembanner ul").animate({
        "marginTop": margtop+"px"
    }, 1000);
    
    tmtint = setTimeout(function() {
        goHorse();
    }, 5000);
}
/*
// JavaScript Document
var _officeItemListCombobox = null;
var _cssStyleSelectJQ = null;
var _animationTypeSelectJQ = null;
var _animationType = "slide";

$(
    function()
    {
        var comboboxSettings = {
            animationSpeed: 200
        };
				
        // Create the example combobox
        setupCombobox();
				
        // Create the different styles combobox
        _cssStyleSelectJQ = $(".cssStyleSelect").combobox({}, comboboxSettings);
        // Combobox has its own onChange event, but the onChange of the Select element can be used as well.
        // changeAnimation works in this manner.
        _cssStyleSelectJQ.combobox.onChange =
        function()
        {
            changeStyle();
        };
				
        // Create the Animation types combobox
        // Note: There is no need to configure the onChange event as the event is defined in the html
        //	<select id="animationTypeSelect" onchange="changeAnimation()">
        _animationTypeSelectJQ = $("#animationTypeSelect").combobox({}, comboboxSettings);
    });
			
// create a jquery combobx and set the Css class styles
function setupCombobox()
{
    _officeItemListCombobox = $('#officeItemList').combobox(
    {
        comboboxContainerClass: "comboboxContainer",
        comboboxValueContentContainerClass: "comboboxValueContainer",
        comboboxValueContentClass: "comboboxValueContent",
        comboboxDropDownClass: "comboboxDropDownContainer",
        comboboxDropDownButtonClass: "comboboxDropDownButton",
        comboboxDropDownItemClass: "comboboxItem",
        comboboxDropDownItemHoverClass: "comboboxItemHover",
        comboboxDropDownGroupItemHeaderClass: "comboboxGroupItemHeader",
        comboboxDropDownGroupItemContainerClass: "comboboxGroupItemContainer"
    },
    {
        animationType: _animationType,
        width: 250
    });
}
			
function changeStyle()
{
			
    var cssStyleSelectJQ = $(".cssStyleSelect");
    var selectedStyle = cssStyleSelectJQ.val();
    selectedStyle = "style/screen/" + selectedStyle + ".css";
				
    _officeItemListCombobox.combobox.remove()
				
    $("link[@title='combobox']").attr("href", selectedStyle);
				
    // Time delay required for the new css stylesheet to be processed by the Browser,
    // otherwise, jquery.combobox cannot calculate the correct layout for the new styles
    setTimeout(setupCombobox, 1);
}
			
function changeAnimation()
{
    var animationTypeSelectJQ = $(".animationTypeSelect");
    _animationType = animationTypeSelectJQ.val();
				
    _officeItemListCombobox.combobox.remove();
    setupCombobox();
}
			
// Example to show the dynamic insertion of data directly into the original Select element
// and then calling the jQuery combobox to synchronise by calling update().
function updateCombobox()
{
    var officeItemListSelectJQ = $("#officeItemList");
    var currentDate = Date();
    officeItemListSelectJQ.append("<option value='" + currentDate + "'>" + currentDate + "</option>");

    _officeItemListCombobox.combobox.update();
}
 */
