var urlServer="http://www.jusbrasil.com.br";function browserCheck(){ie=false;ie6=false;try{var a=navigator.appName;if(a=="Microsoft Internet Explorer"){ie=navigator.userAgent.indexOf("MSIE")>-1;var d=new String(navigator.userAgent);var e=d.substring(d.indexOf("MSIE"));ie6=parseInt(e.substring(5,e.indexOf(";")))<=6}}catch(c){}}function getScroll(){var a=0,b=0;if(typeof(window.pageYOffset)=="number"){a=window.pageYOffset;b=window.pageXOffset}else{if(document.body&&(document.body.scrollLeft||document.body.scrollTop)){a=document.body.scrollTop;b=document.body.scrollLeft}else{if(document.documentElement&&(document.documentElement.scrollLeft||document.documentElement.scrollTop)){a=document.documentElement.scrollTop;b=document.documentElement.scrollLeft}}}return new Array(b,a)}function getWinSize(){var b=0,a=0;if(typeof(window.innerWidth)=="number"){a=window.innerWidth;b=window.innerHeight}else{if(document.documentElement&&(document.documentElement.clientWidth||document.documentElement.clientHeight)){a=document.documentElement.clientWidth;b=document.documentElement.clientHeight}else{if(document.body&&(document.body.clientWidth||document.body.clientHeight)){a=document.body.clientWidth;b=document.body.clientHeight}}}return new Array(a,b)}function getURLFeed(a,b){return urlServer+"/atualiza?user="+feedID+(a?"&noticia="+a:"")+"&view=true"+(!isNaN(parseInt(b))?"&page="+b:"")}function requestFeeds(a){if(!feedID){return}var b=getURLFeed(null,a);requestRemoteData(b,function(d){var c=document.getElementById("jusfeeds");if(c){c.innerHTML=d}})}function showFeedItem(a,b){var c=getURLFeed(a,b);requestRemoteData(c,function(e){var d=document.getElementById("jusfeeds");if(d){d.innerHTML=e}})}function openPopupFeedItem(a){if(!feedID||!a){return}var b=getURLFeed(a);createDarkDiv();requestRemoteData(b,function(c){showPopupFeedItem(feedID,c)})}function showPopupFeedItem(i,e){var k=500;var f=400;var j=document.createElement("div");j.innerHTML=e;j.style.border="1px solid #ccc";j.style.padding="3px";j.style.overflowY="auto";j.style.height=(f-8)+"px";j.style.width=(k-8)+"px";var c="popup_feed_"+i;var a=document.createElement("div");a.setAttribute("id",c);a.style.border="8px solid #f1f1f1";a.style.backgroundColor="#fff";a.style.position="absolute";a.style.width=k+"px";a.style.height=f+"px";a.style.zIndex="11000";a.style.marginTop=-f/2+"px";a.style.marginLeft=-k/2+"px";var g=getWinSize(),b=getScroll();a.style.top=(g[1]/2+b[1])+"px";a.style.left=(g[0]/2+b[0])+"px";a.appendChild(j);var d=document.getElementById(c);if(d){d.parentNode.removeChild(d)}removeLoading();document.body.appendChild(a)}var elementsChanged=new Array();function closePopupFeedItem(){var d=document.getElementById("popup_feed_"+feedID);if(d){d.parentNode.removeChild(d)}var a=document.getElementById("darkDiv");if(a){a.parentNode.removeChild(a)}if(ie6){var c=document.getElementsByTagName("select");do{var b=elementsChanged.shift();b.style.visibility="hidden"}while(elementsChanged.length)}if(!ie6){document.body.style.overflowY="";document.body.setAttribute("scroll","")}}function createDarkDiv(){var f=document.createElement("div");var a=0;var c=0;if(ie){c=(document.documentElement.clientHeight>document.body.offsetHeight?document.documentElement.clientHeight:document.body.offsetHeight);a=(document.documentElement.clientWidth>document.body.offsetWidth?document.documentElement.clientWidth:document.body.offsetWidth)}else{c=(window.innerHeight>document.body.offsetHeight?window.innerHeight:document.body.offsetHeight);a=(window.innerWidth>document.body.offsetWidth?window.innerWidth:document.body.offsetWidth)}f.id="darkDiv";f.onclick=closePopupFeedItem;var d="height:"+c+"px;";d+="width:"+a+"px;";d+="overflow: hidden;";d+="display: block;";d+="background: black;";d+="position: absolute;";d+="top: 0px;";d+="left: 0px;";d+="z-index: 10000;";if(ie){d+="filter:alpha(opacity=50);";f.style.setAttribute("cssText",d,0)}else{d+="opacity: 0.5;";d+="-moz-opacity:0.5;";f.setAttribute("style",d)}var e=document.createElement("div");e.id="atualizaLoading";e.style.position="absolute";e.style.top="49%";e.style.left="49%";e.innerHTML="<img src='"+urlServer+"/imagens/loading.gif' border='0'/>";if(ie6){var g=document.getElementsByTagName("select");for(var b=0;b<g.length;b++){ele=g[b];ele.style.visibility="hidden";elementsChanged.push(ele)}}if(!ie6){document.body.style.overflowY="hidden";document.body.setAttribute("scroll","no")}document.body.appendChild(f);document.body.appendChild(e)}function removeLoading(){var a=document.getElementById("atualizaLoading");a.parentNode.removeChild(a)}function requestRemoteData(a,b){new Ajax.Request(a,{method:"GET",crossSite:true,onLoading:function(){},onSuccess:function(c){b(results)},onFailure:function(){}})}browserCheck();
