$(function() {
	/* Banner Home */		
	$('ul#slide').innerfade({
		speed: 1000,
		timeout: 3000,
		type: 'sequence',
		containerheight: '180px'
	});					
	/* Banner Home */
	
	/* Aba Specialties Solutions */
	$('first-specialties, .second-specialties, .third-specialties, .fourth-specialties, .five-specialties').hide();
	
	$("#content-tab-specialties .tab-ul-specialties li a").click(function(){
		var self = $(this);
		var rel = self.attr("rel");
		
		$("#tab-wrap-specialties>div").each(function(){
			$(this).fadeOut('fast');
		});
		$("#content-tab-specialties .tab-ul-specialties li a").removeClass("current");
		self.addClass("current");
		
		setTimeout(function(){
			$("." + rel).fadeIn('slow', function(){
			});
		},500);
	});
	/* End Aba Specialties Solutions */
	
	/* Images Team */
	$('.second-info, .third-info').hide();
	
	$("#content-tab-team .tab-ul-team li a").click(function(){
		var self = $(this);
		var rel = self.attr("rel");
		
		$("#tab-wrap-team div").each(function(){
			$(this).fadeOut('fast');
		});
		$("#content-tab-team .tab-ul-team li a").removeClass("current");
		self.addClass("current");
		
		setTimeout(function(){
			$("." + rel).fadeIn('slow', function(){
			});
		},300);
	});
	
	/* End Images Team */
	
	/* Display Inputs Fomulários */
	$('.form_restrito input[type="text"], .form_restrito input[type="password"], .form_restrito textarea').each(function(index) {
        var valor_previous = $(this).val();
        $(this).focusin(function() {
            var self = $(this);
            var valor = self.val();
            if(valor == valor_previous){
                self.val("");
            }
            
        }).focusout(function() {
            var valor = $(this).val();
            if(valor == ''){
                $(this).val(valor_previous);
            }
        });
    });
    
    setTimeout(hideAlert,4000);
    $("#alert-message").click(function(){
        hideAlert();
    });
    function hideAlert(){
        if ($("#alert-message")[0]) { $("#alert-message").slideUp('fast'); }
    }
    
    /* Input File */
    onchange="document.getElementById('file-falso').value = this.value;"
    /* End Input File */
    
    /* Target Blank */ 
	$('.target-blank').click(function(){
        $(this).attr('target', '_blank').click();
        return false;
    });
    /* End Target Blank */
    
    /* Twitter */
    jQuery(document).ready(function($) {
      $(".tweet").tweet({
        join_text: "auto",
        username: "tecsaudenews",
        avatar_size: 48,
        count: 5,
        auto_join_text_default: "", 
        auto_join_text_ed: "we",
        auto_join_text_ing: "we were",
        auto_join_text_reply: "we replied",
        auto_join_text_url: "we were checking out",
        loading_text: "loading tweets..."
      });
      $("#query").tweet({
        avatar_size: 32,
        count: 4,
        query: "tweet.tecsaudenews.com",
        loading_text: "searching twitter..."
      });
      $("#userandquery").tweet({
        count: 3,
        query: "from:tecsaudenews http",
        loading_text: "searching twitter..."
      });
      $("#fromtwo").tweet({
        avatar_size: 32,
        count: 4,
        username: ["tecsaudenews", "laughingsquid"],
        loading_text: "searching twitter...",
        refresh_interval: 10
      });
      $("#list").tweet({
        avatar_size: 32,
        count: 4,
        username: "twitter",
        list: "team",
        loading_text: "loading list..."
      });
      $("#empty").tweet({
        avatar_size: 32,
        count: 4,
        query: "cieR8oog",
        loading_text: "searching twitter..."
      }).bind("empty", function() { $(this).append("No matching tweets found"); });
    })
    /* End Twitter */
});

$(function() {
  var v = $("#contact-form").jcheck({language: 'pt-br'});
  v.validates("nome", {presence: true});
  v.validates("email", {format: {"with": "email", message: "Utilize um e-mail válido"}});
  v.validates("assunto", {presence: true});
  v.validates("mensagem", {length: {minimum: 1, maximum: 2550}});
});

$(function() {
  var v = $("#work-form").jcheck({language: 'pt-br'});
  v.validates("name", {presence: true});
  v.validates("email", {format: {"with": "email", message: "Utilize um e-mail válido"}});
  v.validates("hospital", {presence: true});
  v.validates("file", {presence: true});
  v.validates("message", {length: {minimum: 1, maximum: 2550}});
});
