$(function(){
	
	$('a#fechar_arraia').click(function(){$('#arraia').slideToggle('slow'); return false;});
	$('#botaobanner').click(function(){$('#flash_banner').slideToggle('slow'); return false;});
});

$().ready(function() {
$('#adcionarimagem').click (function() {
		$('#novopost').fadeIn(1000, function() {
		
			$('#novopost').css ('display', 'block');
		}); 
	});

$('#loginForm').validate({
        // define regras para os campos
        rules: {
            matricula: {
                required: true,
                minlength: 2
            },
			senha: "required"
        },
        messages: {
            matricula: "Preencha o seu n&uacute;mero de Matr&iacute;cula MP",
			senha: "Informe sua senha",
        }
    });
});

function nova_janela(obj) {
	   if (obj.value!='0'){
		  window.open(obj.value);
	   }
	}

// Esta função "chama" todas as funções usadas em um documento.
function init() {
	createExternalLinks();
}

function createExternalLinks() {
    if(document.getElementsByTagName) {
        var anchors = document.getElementsByTagName('a');
        for(var i=0; i<anchors.length; i++) {
            var anchor = anchors[i];
            if(anchor.getAttribute("href") && anchor.getAttribute('rel')=='externo') { // <-- É necessário inserir rel="externo" no link
                anchor.target = '_blank';
                var title = anchor.title + ' (Este link abre uma nova janela)'; // <-- Insere este texto no final do Title do link
                anchor.title = title;
            }
        }
    }
}

//........................................................................
//........................................................................


// Esta função "chama" todas as funções usadas em um documento.
//========================================================
// Event Listener by Scott Andrew - http://scottandrew.com
// edited by Mark Wubben, <useCapture> is now set to false
//http://simon.incutio.com/archive/2004/05/26/addLoadEvent
//========================================================
function addEvent(obj, evType, fn){
    if(obj.addEventListener){
        obj.addEventListener(evType, fn, false);

        return true;

    } else if (obj.attachEvent){
        var r = obj.attachEvent('on'+evType, fn);

        return r;

    } else {
        return false;

    }
}

addEvent(window, "load", init);



//-->

var now = new Date();
var hours = now.getHours();
var minutes = now.getMinutes();
var timeValue = "" + ((hours >12) ? hours -12 :hours)
timeValue += ((minutes < 10) ? ":0" : ":") + minutes
timeValue += (hours >= 12) ? " PM" : " AM"
timerRunning = true;

mydate = new Date();
myday = mydate.getDay();
mymonth = mydate.getMonth();
myweekday= mydate.getDate();
weekday= myweekday;
myyear= mydate.getYear();
year = myyear

if(myday == 0)
day = " Domingo, "

else if(myday == 1)
day = " Segunda, "

else if(myday == 2)
day = " Ter&ccedil;a, "

else if(myday == 3)
day = " Quarta, "

else if(myday == 4)
day = " Quinta, "

else if(myday == 5)
day = " Sexta, "

else if(myday == 6)
day = " S&aacute;bado, "

if(mymonth == 0)
month = " de Janeiro de "

else if(mymonth ==1)
month = " de Fevereiro de "

else if(mymonth ==2)
month = " de Mar&ccedil;o de "

else if(mymonth ==3)
month = " de April de "

else if(mymonth ==4)
month = " de Maio de "

else if(mymonth ==5)
month = " de Junho de "

else if(mymonth ==6)
month = " de Julho de "

else if(mymonth ==7)
month = " de Agosto de "

else if(mymonth ==8)
month = " de Setembro de "

else if(mymonth ==9)
month = " de Outubro de "

else if(mymonth ==10)
month = " de Novembro de "

else if(mymonth ==11)
month = " de Dezembro de "