var imagens_destaque = new Array();
var pos_destaque = 1;

function getSelectedText(){
	if(window.getSelection){
		return window.getSelection().toString();
	} else if(document.getSelection){
		return document.getSelection();
	} else if(document.selection){
		return document.selection.createRange().text;
	}
};

$(document).ready(function(){

	if (imagens_destaque.length > 1) {
		$.interval(mudarFotoDestaque, 2000);
	}

	function mudarFotoDestaque() {
		$('#imagem_destaque').attr('src',imagens_destaque[pos_destaque++]);
		if (pos_destaque >= imagens_destaque.length) {
			pos_destaque = 0;
		}
	}

   if ($.browser.msie && $.browser.version < 7){
     $(".noticias-foto").css("margin","0 5px");
    }

	$(".noticias-corpo").hoverIntent({
		interval: 0,
		timeout: 200,
		over: function(){
			$(this).animate({"backgroundColor":"#e4f4ff"},"fast");
		},
		out: function(){
			$(this).animate({"backgroundColor":"#fff"},"fast");
		}
	});

	$(".noticias-corpo").click(function(){
		var link = $(this).find(".noticias-texto p a").attr("href");
		if(link != "" && getSelectedText() == ""){
			if($(this).attr("class") == "ext"){
				window.open(link);
				return false;
			} else {
				window.location = link;
			}
		}
	});
});
