$(document).ready(function(){
	$("head").prepend('<style>.rounded {position:relative;}.lt,.lb,.rt,.rb {position:absolute;z-index:100;display:block;text-indent:-9999px;height:14px;width:7px;background-repeat:no-repeat}.lt {left:0;top:0;background-position:left top}.lb {left:0;bottom:0;background-position:left bottom}.rt {right:0;top:0;background-position:right top}.rb {right:0;bottom:0;background-position:right bottom}.top, .bottom {position:absolute;display:block;left:0;z-index:100;text-indent:-9999px;height:10px;width:100%;background-repeat:no-repeat;}.top {top:0;background-position:left top;}.bottom {bottom:0;background-position:left bottom;}</style>');
    $(".rounded").append('<span class="lt" /><span class="rt" /><span class="rb" /><span class="lb" />');
	$(".top-bottom").append('<span class="top" /><span class="bottom" />');
	$("div.size").attr("style","display:block;");
	var abas = $("ul.abas li a");
    abas.click(function() {
        var css = $(this).attr("class").split(' ');

        $(".box-content").hide();
        $("." + css[1]).show();

        $.each(abas, function(index, item) {
            var current = $(item).attr("class");
            $(item).attr("class", current.replace("on", "off"));
        });

        $(this).attr("class", css.join(" ").replace("off", "on"))
        return false;
    });
    
	var abasVideos = $("ul.aba-videos li a");
    abasVideos.click(function() {
        var css = $(this).attr("class").split(' ');

        $(".box-content-sidebar").hide();
        $("." + css[1]).show();

        $.each(abasVideos, function(index, item) {
            var current = $(item).attr("class");
            $(item).attr("class", current.replace("on", "off"));
        });

        $(this).attr("class", css.join(" ").replace("off", "on"))
        return false;
    });
	
	$(".campo").addClass("idleField");
	$(".campo").focus(function() {
		$(this).removeClass("idleField").addClass("focusField");
		if (this.value == this.defaultValue){ 
			this.value = '';
		}
		if(this.value != this.defaultValue){
			this.select();
		}
	});
	$(".campo").blur(function() {
		$(this).removeClass("focusField").addClass("idleField");
		if ($.trim(this.value) == ''){
			this.value = (this.defaultValue ? this.defaultValue : '');
		}
	});
	
	// Increase Font Size
	$("a.aumentar").click(function(){
		var currentFontSize = $('html').css('font-size');
		var currentFontSizeNum = parseFloat(currentFontSize, 10);
		var newFontSize = currentFontSizeNum*1.2;
		$('html').css('font-size', newFontSize);
		return false;
	});
	// Decrease Font Size
	$("a.diminuir").click(function(){
		var currentFontSize = $('html').css('font-size');
		var currentFontSizeNum = parseFloat(currentFontSize, 10);
		var newFontSize = currentFontSizeNum*0.8;
		$('html').css('font-size', newFontSize);
		return false;
	});
});

function popUp(url,x,y,hasScroll) {
  window.open(url,'popUp','status=yes,resizable=no,width='+x+',height='+y+',scrollbars='+hasScroll);
}
