﻿$(document).ready(JT_init);
function JT_init(){
$("a.jTip").hover(function(){
    JT_show(this.href,this.id,this.rel)
}
,function(){
    $("#JT").remove()
}
).click(function(){
return false
}
)
}
function JT_show(B,I,G){
if(G==false){
G="&nbsp;"
}
var H=document.documentElement;
var J=self.innerWidth||(H&&H.clientWidth)||document.body.clientWidth;
var E=J-getAbsoluteLeft(I);
var D=getAbsoluteTop(I)-3;
var A=B.replace(/^[^\?]+\??/,"");
var C=parseQuery(A);

if(C.width===undefined){
C.width=250
}
if(C.link!==undefined){
    $("#" + I).bind("click", function() {

        var S = "";
        if (C.secaoId !== undefined)
            S = "secaoId=" + C.secaoId + "&";

        var N = "letra=" + C.letra;
        var L = C.link.replace(/#.*/, "");
        var M = C.link.replace(L, "");

        window.location = L + "?" + S + N + M
    }
);
$("#"+I).css("cursor","pointer")
}
if(E>((C.width*1)+75)){
$("body").append("<div id='JT' style='width:"+C.width*1+    "px'><div id='JT_arrow_left'></div><div id='JT_close_left'>"+G+"</div><div id='JT_copy'><div class='JT_loader'><div></div></div>");
var K=getElementWidth(I)+11;
var F=getAbsoluteLeft(I)+K
}
else{
$("body").append("<div id='JT' style='width:"+C.width*1+"px'><div id='JT_arrow_right' style='left:"+((C.width*1)+1)+"px'></div><div id='JT_close_right'>"+G+"</div><div id='JT_copy'><div class='JT_loader'><div></div></div>");
var F=getAbsoluteLeft(I)-((C.width*1)+15)
}
$("#JT").css({
left:F+"px",top:D+"px"
}
);
$("#JT").show();
$("#JT_copy").load(B)
}
function getElementWidth(A){
x=document.getElementById(A);
return x.offsetWidth
}
function getAbsoluteLeft(A){
o=document.getElementById(A);
oLeft=o.offsetLeft;
while(o.offsetParent!=null){
oParent=o.offsetParent;
oLeft+=oParent.offsetLeft;
o=oParent
}
return oLeft
}
function getAbsoluteTop(A){
o=document.getElementById(A);
oTop=o.offsetTop;
while(o.offsetParent!=null){
oParent=o.offsetParent;
oTop+=oParent.offsetTop;
o=oParent
}
return oTop
}
function parseQuery(D){
var E=new Object();
if(!D){
return E
}
var A=D.split(/[;&]/);
for(var C=0;
C<A.length;
C++){
var G=A[C].split("=");
if(!G||G.length!=2){
continue
}
var B=unescape(G[0]);
var F=unescape(G[1]);
F=F.replace(/\+/g," ");
E[B]=F
}
return E
}
function blockEvents(A){
if(A.target){
A.preventDefault()
}
else{
A.returnValue=false
}

}
;
