/* google analytics script */

  var _gaq = _gaq || [];
  _gaq.push(['_setAccount', 'UA-21486398-1']);
  _gaq.push(['_trackPageview']);

  (function() {
    var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
    ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
    var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
  })();


/* end analytics */

function PopUp(url, w, h)
{
	if ( width != '' || height != ''){
		var width = w;
		var height = h;
	} else {    
		var width = 300;
		var height = 500;
	}

	window.open(url, 'PopUp_Window', 'width='+width+',height='+height+',toolbar=no,location=no,status=no,menubar=no,scrollbars=no,resizable=no');

};

$(document).ready(function(){


	$('input[type=submit]').click(function(){
		return true;
	});

	$('a[rel="blank"]').click(function(){
		window.open($(this).attr('href'));
		return false;
	});

    $("input[type=text]").focus(function(){
    if (this.value == this.defaultValue){
        this.value = "";
    }
    if (this.value != this.defaultValue) {
        this.select();
    }

    });
   
	$("a.fancy").fancybox({
				'opacity'		: true,
				'overlayShow'	: false,
				'transitionIn'	: 'elastic',
				'transitionOut'	: 'elastic'
	});
    
    $("#tabs > ul").tabs().tabs("rotate", 8000);


    $('#Newsletter').submit(function(e){
	    var nome     = $('#nome').val();
        var email    = $('#email').val();

		e.preventDefault();
		$.post('pages/interna-submit-newsletter.php', { nome: nome, email: email }, function (data){
			$.jnotifica(data);			
			});
	});  

	$("#cell_f").mask("(99) 9999-9999");
	$("#house_f").mask("(99) 9999-9999");
    $("#cell").mask("(99) 9999-9999");
	$("#house").mask("(99) 9999-9999");
	$("#fone_f").mask("(99) 9999-9999");


	$('#form_contact').submit(function(e){
        var subjt_f   = $('#subjt_f').val();
		var name_f    = $('#name_f').val();
		var email_f   = $('#email_f').val(); 
		var house_f   = $('#house_f').val();
		var cell_f    = $('#cell_f').val();
        var city_f    = $('#city_f').val(); 
		var message_f = $('#message_f').val();

		e.preventDefault();
		$.post('http://www.mariozeferino.com.br/pages/interna-submit.php', { subjt_f: subjt_f, name_f: name_f, email_f: email_f, cell_f: cell_f, house_f: house_f, city_f: city_f, message_f: message_f }, function (data){
			$.jnotifica(data);			
		});
	}); 

	$('#form_ouvidoria').submit(function(e){
        var subjt   = $('#subjt').val();  
		var name    = $('#name').val();
		var email   = $('#form_ouvidoria input[name=email]').val();
		var cell    = $('#cell').val();
		var house   = $('#house').val();
		var city    = $('#city').val();
		var message = $('#message').val();

		e.preventDefault();
		$.post('pages/interna-submit-ouvidoria.php', { subjt: subjt, name: name, email: email, cell: cell, house: house, city: city, message: message }, function (data){
			$.jnotifica(data);			
		});
	});
	$('#form_desafio').submit(function(e){

		var name_f    		= $('#name_f').val();
		var email_f   		= $('#email_f').val(); 
		var fone_f   		= $('#fone_f').val();
		var cell_f    		= $('#cell_f').val();
        var city_f    		= $('#city_f').val(); 
        var twitter_f    	= $('#twitter_f').val(); 
        var facebook_f    	= $('#facebook_f').val(); 
        var idade_f    		= $('#idade_f').val(); 
		var sexo_f 			= $('#sexo_f').val();



		e.preventDefault();
		$.post('http://www.mariozeferino.com.br/pages/interna-submit-desafio.php', { nome: name_f,
													 email: email_f,
													 fone: fone_f,  
													 celular: cell_f,													 
													 cidade: city_f, 
													 sexo: sexo_f,  
													 twitter: twitter_f,													 
													 facebook: facebook_f, 
													 idade: idade_f
													 }, function (data){
			$.jnotifica(data);			
		});
	});

    


});

