﻿var currentWindowHeight = 0;
var currentWindowWidth = 0;
var separatorPosition = 0;
var separatorPositionNew = 0;
var separatorPressed = false;
var thirdseparatorPressed = false;
var closeClicked = false;

var contentHeightOffset = -105;  //Previous  -125;
var contentSeparatorTopOffset = 35;
var secondaryContentTopOffset = 60;
var secondaryContentHeightOffset = -130;
var thirdcontentSeparatorTopOffset = 35;
var thirdContentTopOffset = 60;
var thirdContentHeightOffset = -130;

var maxclick=0;
var maxclick1=0;
function CheckAllRef(obj)
    {
        alert(obj.checked);
        obj.checked=true;
    }


function getRelatedElement(reference,name)
 {
 	if (reference.id) 
	{
		var matches=reference.id.match(/([a-zA-Z0-9]+_)+/);
		if (matches) {
			var aspid=matches[0];
			var result=document.getElementById(aspid+name);
			if (result) return result;
		}
	}
    if (reference.parentNode) return getRelatedElement(reference.parentNode,name);
    return null;
}

function selectValue(select) {
	return select.options[select.selectedIndex].value;
}

function getScrollTop(section) {
	if (navigator.userAgent.match(/Safari/i)) {
		return self.pageYOffset;
	} else {
		return document.getElementById(section).scrollTop;
	}
}

function getWindowHeight() {
	var windowHeight=window.innerHeight;
	if (!windowHeight) windowHeight=document.documentElement.clientHeight;
	if (!windowHeight) windowHeight=document.body.clientHeight;
	
	return windowHeight;
}

function getWindowWidth() {
	var windowWidth=window.innerWidth;
	if (!windowWidth) windowWidth=document.documentElement.clientWidth;
	if (!windowWidth) windowWidth=document.body.clientWidth;
	
	return windowWidth;
}

//function adjustScroll() { 
//    if((currentWindowHeight != getWindowHeight()) || (currentWindowWidth != getWindowWidth()) || closeClicked)
//    {
//	    var content = document.getElementById("content");
//	    var secondarycontent = document.getElementById("secondarycontent");
//	    var contentseparator = document.getElementById("contentseparator");
//	    var leftbar = document.getElementById("leftbar");
//	    var footer = document.getElementById("footer");
//	    var topbar = document.getElementById("topbar");
//	    var menubar = document.getElementById("menubar");
//	    
//	    currentWindowHeight = getWindowHeight();
//	    currentWindowWidth = getWindowWidth();
//    	
//    	content.style.width = (getWindowWidth()-content.offsetLeft-44) + "px"
//    	
//	    if(secondarycontent && secondarycontent.style.display == "block")
//	    {
//	        secondarycontent.style.width = content.style.width;
//	        
//	        content.style.height = ((getWindowHeight()/2)+contentHeightOffset) + "px";
//    	   
//	        secondarycontent.style.top = ((getWindowHeight()-(getWindowHeight()/2))+secondaryContentTopOffset) + "px";
//	        secondarycontent.style.height = ((getWindowHeight()/2)+secondaryContentHeightOffset) + "px";
//        	    
//	        contentseparator.style.top = ((getWindowHeight()-(getWindowHeight()/2))+contentSeparatorTopOffset) + "px";
//	        
//	        if(currenthit)
//	        {   
//	            if(Summaryhit==true)
//	            {
//	                window.location.hash = currenthit;
//	            }
//	            else
//	            {
//	                window.location.hash = "hit" + currenthit;
//	            }
//	        }
//	    }
//	    else
//	    {
//	        content.style.height = (getWindowHeight()-167) + "px";  //Previous -184
//	    }
//    	
//	    leftbar.style.height = (getWindowHeight()-144) + "px";
//    	
//	    topbar.style.width = (getWindowWidth()-62) + "px"
//	    if (menubar) menubar.style.width = (getWindowWidth()-226) + "px"
//    	
//	    footer.style.top = (getWindowHeight()-26) + "px";
//	    
//	    closeClicked = false;
//	}
//	
//	setTimeout("adjustScroll();",500);
//}

function adjustScroll() { 
    if((currentWindowHeight != getWindowHeight()) || (currentWindowWidth != getWindowWidth()) || closeClicked)
    {
	    var content = document.getElementById("content");
	    var secondarycontent = document.getElementById("secondarycontent");
	    var contentseparator = document.getElementById("contentseparator");
	    var thirdcontent = document.getElementById("thirdcontent");
	    var thirdseparator = document.getElementById("thirdseparator");
	    var leftbar = document.getElementById("leftbar");
	    var footer = document.getElementById("footer");
	    var topbar = document.getElementById("topbar");
	    var menubar = document.getElementById("menubar");
	    
	    currentWindowHeight = getWindowHeight();
	    currentWindowWidth = getWindowWidth();
    	
    	content.style.width = (getWindowWidth()-content.offsetLeft-44) + "px"
    	
	    if((secondarycontent && secondarycontent.style.display == "block") || (thirdcontent && thirdcontent.style.display == "block"))
	    {
	            if((secondarycontent && secondarycontent.style.display == "block") && (thirdcontent && thirdcontent.style.display == "block"))
                {	 
                      
                     if(maxclick==1)
                      {
	
	                contentHeightOffset = -105;
    	            contentSeparatorTopOffset =117;
                    secondaryContentTopOffset = 142;
                    secondaryContentHeightOffset = -212;
                    contentseparator.style.top = ((getWindowHeight()-(getWindowHeight()))+contentSeparatorTopOffset) + "px";
                    secondarycontent.style.top = ((getWindowHeight()-(getWindowHeight()))+secondaryContentTopOffset) + "px";
                    secondarycontent.style.height = ((getWindowHeight())+secondaryContentHeightOffset) + "px";
                      thirdcontent.style.width = content.style.width;
    	              thirdcontent.style.top = ((getWindowHeight()-(getWindowHeight()))+secondaryContentTopOffset + 130) + "px";
                      thirdcontent.style.height = ((getWindowHeight())+secondaryContentHeightOffset - 130) + "px";
                      thirdseparator.style.top = ((getWindowHeight()-(getWindowHeight()))+contentSeparatorTopOffset + 130) + "px";
                      
                      
                      }
                      else
                      {
                      thirdcontent.style.width = content.style.width;
                      
    	              thirdcontent.style.top = ((getWindowHeight()-(getWindowHeight()/2))+secondaryContentTopOffset + 130) + "px";
                      thirdcontent.style.height = ((getWindowHeight()/2)+secondaryContentHeightOffset - 130) + "px";
                      thirdseparator.style.top = ((getWindowHeight()-(getWindowHeight()/2))+contentSeparatorTopOffset + 130) + "px";
                      secondarycontent.style.height = ((getWindowHeight()/2)+secondaryContentHeightOffset - thirdcontent.offsetHeight-25) + "px";
                      
                      secondarycontent.style.top = ((getWindowHeight()-(getWindowHeight()/2))+secondaryContentTopOffset) + "px";
	                  contentseparator.style.top = ((getWindowHeight()-(getWindowHeight()/2))+contentSeparatorTopOffset) + "px";
	          
                      }
	          
	          
	          if(maxclick==1)
                      {}
                      else
                      {
                      
                        if(maxclick1==1)
                      {
	    
	                contentHeightOffset = -105;
    	            contentSeparatorTopOffset =117;
                    secondaryContentTopOffset = 142;
                    secondaryContentHeightOffset = -212;
                     thirdcontent.style.width = content.style.width;
                    thirdcontent.style.top = ((getWindowHeight()-(getWindowHeight()))+contentSeparatorTopOffset) + "px";
                    thirdcontent.style.top = ((getWindowHeight()-(getWindowHeight()))+secondaryContentTopOffset) + "px";
                    thirdcontent.style.height = ((getWindowHeight())+secondaryContentHeightOffset) + "px";
                      
                      }
                      else
                      {
                      thirdcontent.style.width = content.style.width;
                      
    	              thirdcontent.style.top = ((getWindowHeight()-(getWindowHeight()/2))+secondaryContentTopOffset + 130) + "px";
                      thirdcontent.style.height = ((getWindowHeight()/2)+secondaryContentHeightOffset - 130) + "px";
                      thirdseparator.style.top = ((getWindowHeight()-(getWindowHeight()/2))+contentSeparatorTopOffset + 130) + "px";
                      secondarycontent.style.height = ((getWindowHeight()/2)+secondaryContentHeightOffset - thirdcontent.offsetHeight-25) + "px";
                      
                      secondarycontent.style.top = ((getWindowHeight()-(getWindowHeight()/2))+secondaryContentTopOffset) + "px";
	                  contentseparator.style.top = ((getWindowHeight()-(getWindowHeight()/2))+contentSeparatorTopOffset) + "px";
	          
                      }
                      
                      }
	          
	          
                      
    	         }
	            else if(secondarycontent && secondarycontent.style.display == "block")
	            {
    	        
    	            if(maxclick==1)
                      {
	
	                contentHeightOffset = -105;
    	            contentSeparatorTopOffset =117;
                    secondaryContentTopOffset = 142;
                    secondaryContentHeightOffset = -212;
                    contentseparator.style.top = ((getWindowHeight()-(getWindowHeight()))+contentSeparatorTopOffset) + "px";
                    secondarycontent.style.top = ((getWindowHeight()-(getWindowHeight()))+secondaryContentTopOffset) + "px";
                    secondarycontent.style.height = ((getWindowHeight())+secondaryContentHeightOffset) + "px";
                      
                      
                      
                      }
                      else
                      {
    	        
    	        
    	            contentHeightOffset = -105;
    	            contentSeparatorTopOffset = 35;
                    secondaryContentTopOffset = 60;
                    secondaryContentHeightOffset = -130;

	                secondarycontent.style.width = content.style.width;
	                
	                content.style.height = ((getWindowHeight()/2)+contentHeightOffset) + "px";
            	    secondarycontent.style.top = ((getWindowHeight()-(getWindowHeight()/2))+secondaryContentTopOffset) + "px";
	                
	                secondarycontent.style.height = ((getWindowHeight()/2)+secondaryContentHeightOffset) + "px";
                	    
	                contentseparator.style.top = ((getWindowHeight()-(getWindowHeight()/2))+contentSeparatorTopOffset) + "px";
        	        }
        	        
	                if(currenthit)
	                {
	                    window.location.hash = "hit" + currenthit;
	                }
	            } 
	            else if(thirdcontent && thirdcontent.style.display == "block")
	            {
	                
	                contentHeightOffset = -105;
    	            thirdcontentSeparatorTopOffset = 35;
                    thirdContentTopOffset = 60;
                    thirdContentHeightOffset = -130;
	                
//	                thirdcontent.style.width = content.style.width;
//                    content.style.height = ((getWindowHeight()/2)+contentHeightOffset) + "px";
//                    
//	                thirdcontent.style.top = ((getWindowHeight()-(getWindowHeight()/2))+thirdContentTopOffset) + "px";
//	                thirdcontent.style.height = ((getWindowHeight()/2)+thirdContentHeightOffset) + "px";
//	                thirdseparator.style.top = ((getWindowHeight()-(getWindowHeight()/2))+thirdcontentSeparatorTopOffset) + "px";
	            if(maxclick1==1)
                      {
	    
	                contentHeightOffset = -105;
    	            contentSeparatorTopOffset =117;
                    secondaryContentTopOffset = 142;
                    secondaryContentHeightOffset = -212;
                     thirdcontent.style.width = content.style.width;
                    thirdcontent.style.top = ((getWindowHeight()-(getWindowHeight()))+contentSeparatorTopOffset) + "px";
                    thirdcontent.style.top = ((getWindowHeight()-(getWindowHeight()))+secondaryContentTopOffset) + "px";
                    thirdcontent.style.height = ((getWindowHeight())+secondaryContentHeightOffset) + "px";
                      
                      }
                      else
                      {
                      thirdcontent.style.width = content.style.width;
                       content.style.height = ((getWindowHeight()/2)+contentHeightOffset+130) + "px";
    	              thirdcontent.style.top = ((getWindowHeight()-(getWindowHeight()/2))+secondaryContentTopOffset + 130) + "px";
                      thirdcontent.style.height = ((getWindowHeight()/2)+secondaryContentHeightOffset - 130) + "px";
                      thirdseparator.style.top = ((getWindowHeight()-(getWindowHeight()/2))+contentSeparatorTopOffset + 130) + "px";
                   
	                  contentseparator.style.top = ((getWindowHeight()-(getWindowHeight()/2))+contentSeparatorTopOffset) + "px";
	          
                      }
	           
	            }
	            else
	            {
    	            content.style.height = (getWindowHeight()-167) + "px";  //Previous -184
	            }
	    }
	    else
	    {
	        content.style.height = (getWindowHeight()-167) + "px";  //Previous -184
	    }
    	
	    leftbar.style.height = (getWindowHeight()-144) + "px";
	    topbar.style.width = (getWindowWidth()-62) + "px"
	    if (menubar) menubar.style.width = (getWindowWidth()-226) + "px"
	    footer.style.top = (getWindowHeight()-26) + "px";
	    closeClicked = false;
	}
	
	setTimeout("adjustScroll();",500);
}

function getSeparatorPosition(mouse)
{ 
	separatorPressed = true;
	separatorPosition = mouse.clientY;
} 

//function resizeDivs(mouse)
//{ 
//    if(separatorPressed)
//    {
//        var content = document.getElementById("content");
//	    var secondarycontent = document.getElementById("secondarycontent");
//	    var contentseparator = document.getElementById("contentseparator");
//	
//	    separatorPositionNew = mouse.clientY;
//	    
//	    // Calculate the mouse movement in pixels
//	    var movePerPixels = parseInt(separatorPositionNew - separatorPosition);
//	    
//	    if((contentHeightOffset + movePerPixels < 30) && (contentHeightOffset + movePerPixels > -275))
//	    {
//	        contentHeightOffset += movePerPixels;
//	        secondaryContentTopOffset += movePerPixels;
//	        secondaryContentHeightOffset -= movePerPixels;
//	        contentSeparatorTopOffset += movePerPixels;
//    	    
//	        content.style.height = ((getWindowHeight()/2)+contentHeightOffset) + "px";
//    	   
//	        secondarycontent.style.top = ((getWindowHeight()-(getWindowHeight()/2))+secondaryContentTopOffset) + "px";
//	        secondarycontent.style.height = ((getWindowHeight()/2)+secondaryContentHeightOffset) + "px";
//        	    
//	        contentseparator.style.top = ((getWindowHeight()-(getWindowHeight()/2))+contentSeparatorTopOffset) + "px";
//    	    
//	        separatorPosition = mouse.clientY;
//	    }
//	}
//}


function resizeDivs(mouse)
{ 
    if(separatorPressed)
    {
        var content = document.getElementById("content");
	    var secondarycontent = document.getElementById("secondarycontent");
	    var contentseparator = document.getElementById("contentseparator");
	    var thirdcontent = document.getElementById("thirdcontent");
	  
	
	    separatorPositionNew = mouse.clientY;
	    content.style.width = (getWindowWidth()-content.offsetLeft-44) + "px"
	    // Calculate the mouse movement in pixels
	    var movePerPixels = parseInt(separatorPositionNew - separatorPosition);
	       if((contentHeightOffset + movePerPixels < -40) && (contentHeightOffset + movePerPixels > -275) && (secondarycontent.offsetHeight-movePerPixels > 45))
	        {
 	            contentHeightOffset += movePerPixels;
	            secondaryContentTopOffset += movePerPixels;
	            secondaryContentHeightOffset -= movePerPixels;
	            contentSeparatorTopOffset += movePerPixels;
        	    
	            content.style.height = ((getWindowHeight()/2)+contentHeightOffset) + "px";
	            
	            
	            
	          if(maxclick==1)
          {
          
              secondarycontent.style.top = ((getWindowHeight()-(getWindowHeight()))+secondaryContentTopOffset) + "px";
	            contentseparator.style.top = ((getWindowHeight()-(getWindowHeight()))+contentSeparatorTopOffset) + "px";
	            if(thirdcontent && thirdcontent.style.display == "block")
	            {
	                secondarycontent.style.height = ((getWindowHeight())+secondaryContentHeightOffset - thirdcontent.offsetHeight-25) + "px";    
	            }
	            else
	            {
	                secondarycontent.style.height = ((getWindowHeight())+secondaryContentHeightOffset) + "px";
	            }
	            separatorPosition = mouse.clientY;
          
          
          
                    
          }
            else
             {
	            secondarycontent.style.top = ((getWindowHeight()-(getWindowHeight()/2))+secondaryContentTopOffset) + "px";
	            contentseparator.style.top = ((getWindowHeight()-(getWindowHeight()/2))+contentSeparatorTopOffset) + "px";
	            if(thirdcontent && thirdcontent.style.display == "block")
	            {
	                secondarycontent.style.height = ((getWindowHeight()/2)+secondaryContentHeightOffset - thirdcontent.offsetHeight-25) + "px";    
	            }
	            else
	            {
	                secondarycontent.style.height = ((getWindowHeight()/2)+secondaryContentHeightOffset) + "px";
	            }
	            separatorPosition = mouse.clientY;
	            
	            
	      }
	        }
	}
	
	
	if(thirdseparatorPressed)   
	{
        
        var content = document.getElementById("content");
	    var secondarycontent = document.getElementById("secondarycontent");
	    var thirdcontent = document.getElementById("thirdcontent");
	    var thirdseparator = document.getElementById("thirdseparator");
	    var content = document.getElementById("content");
	 
	    separatorPositionNew = mouse.clientY;
	    
	    // Calculate the mouse movement in pixels
	    var movePerPixels = parseInt(separatorPositionNew - separatorPosition);
	    
	  if(secondarycontent && secondarycontent.style.display == "block")
	   {
	           if((secondarycontent.offsetTop < thirdcontent.offsetTop-70 + movePerPixels) && (thirdcontent.offsetHeight-movePerPixels > 50)) 
               { 
                    thirdContentTopOffset += movePerPixels;
                    thirdContentHeightOffset -= movePerPixels;
                    thirdcontentSeparatorTopOffset += movePerPixels;
                    
                    secondarycontent.style.width = content.style.width;
                    thirdcontent.style.width = content.style.width;
                    thirdcontent.style.top = ((getWindowHeight()-(getWindowHeight()/2))+thirdContentTopOffset + 130) + "px";
                    thirdcontent.style.height = ((getWindowHeight()/2)+thirdContentHeightOffset - 130) + "px";
                    thirdseparator.style.top = ((getWindowHeight()-(getWindowHeight()/2))+thirdcontentSeparatorTopOffset + 130) + "px";
                    secondarycontent.style.height = ((getWindowHeight()/2)-thirdContentHeightOffset -content.offsetHeight - 150) + "px";
                    separatorPosition = mouse.clientY;
               }
	   }
	   else
	   {
               if((thirdContentHeightOffset + movePerPixels < 30) && (thirdContentHeightOffset + movePerPixels > -175))
	           {
                    contentHeightOffset += movePerPixels;
                    thirdContentHeightOffset -= movePerPixels;
                    thirdContentTopOffset += movePerPixels;
                    thirdcontentSeparatorTopOffset += movePerPixels;
                    content.style.height = ((getWindowHeight()/2)+contentHeightOffset) + "px";
                    thirdcontent.style.top = ((getWindowHeight()-(getWindowHeight()/2))+thirdContentTopOffset) + "px";
                    thirdcontent.style.height = ((getWindowHeight()/2)+thirdContentHeightOffset) + "px";
                    thirdseparator.style.top = ((getWindowHeight()-(getWindowHeight()/2))+thirdcontentSeparatorTopOffset) + "px";
                    separatorPosition = mouse.clientY;
               } 
	   }  
	}
}

	

//function closeSecondaryContent()
//{
//    document.getElementById("secondarycontent").innerHTML = "";
//    document.getElementById("secondarycontent").style.display = "none";
//    document.getElementById("contentseparator").style.display = "none";
//    document.getElementById("spanHitNavR").style.display = "none";
//    document.getElementById("spanHitNavL").style.display = "none";
//    
//    closeClicked = true;
//}


function closeSecondaryContent()
{maxclick=0;
    document.getElementById("secondarycontent").innerHTML = "";
    document.getElementById("secondarycontent").style.display = "none";
    document.getElementById("contentseparator").style.display = "none";
    document.getElementById("spanHitNavR").style.display = "none";
    document.getElementById("spanHitNavL").style.display = "none";
    closeClicked = true;
    contentSeparatorTopOffset = 35;
    secondaryContentTopOffset = 60;
    secondaryContentHeightOffset = -130;
    thirdcontentSeparatorTopOffset = 35;
    thirdContentTopOffset = 60;
    thirdContentHeightOffset = -130;
    contentHeightOffset =0 ;
     document.getElementById("Minwindow").style.display='none'; 
	              document.getElementById("Maxwindow").style.display='block'; 
    
}

function closeThirdContent()
{maxclick1=0;
    document.getElementById("thirdcontent").innerHTML = "";
    document.getElementById("thirdcontent").style.display = "none";
    document.getElementById("thirdseparator").style.display = "none";
    closeClicked = true;
    contentSeparatorTopOffset = 35;
    secondaryContentTopOffset = 60;
    secondaryContentHeightOffset = -130;
    thirdcontentSeparatorTopOffset = 35;
    thirdContentTopOffset = 60;
    thirdContentHeightOffset = -130;
    contentHeightOffset = 0;
    
     document.getElementById("Minwindow1").style.display='none'; 
	              document.getElementById("Maxwindow1").style.display='block'; 
}

function getthirdSeparatorPosition(mouse)
{ 
	thirdseparatorPressed = true;
	separatorPosition = mouse.clientY;
}

function createHttpRequest()
{
    var httpRequest;
    
    if (window.XMLHttpRequest) // Mozilla, Safari, ...
    { 
        httpRequest = new XMLHttpRequest();
        
        if (httpRequest.overrideMimeType) 
        {
            httpRequest.overrideMimeType('text/xml');
        }
    } 
    else if (window.ActiveXObject) // IE
    { 
        try 
        {
            httpRequest = new ActiveXObject("Msxml2.XMLHTTP");
        } 
        catch (e) 
        {
            try 
            {
                httpRequest = new ActiveXObject("Microsoft.XMLHTTP");
            } 
            catch (e) {}
        }
    }
    
    return httpRequest;
}

function printDiv(id)
{
    var content = document.getElementById(id).innerHTML;
    
    var printwindow = window.open('','printwin','left=100,top=100,width=500,height=400,scrollbars=yes');
    printwindow.document.write('<html>\n<head>\n');
    printwindow.document.write('<title>Print Page</title>\n');
    printwindow.document.write('<link rel="stylesheet" type="text/css" href="/includes/print.css" />\n');
    printwindow.document.write('<script type="text/javascript" language="javascript">\n');
    printwindow.document.write('function print_win(){\n');
    printwindow.document.write('    window.print();\n');
    printwindow.document.write('    window.close();\n');
    printwindow.document.write('}\n');
    printwindow.document.write('function showpopup(a,text){}\n');
    printwindow.document.write('function hidepopup(a,text){}\n');
    printwindow.document.write('<\/script>\n');
    printwindow.document.write('</head>\n');
    printwindow.document.write('<body class="content" onload="print_win()">\n');
    printwindow.document.write(content);
    printwindow.document.write('</body>\n');
    printwindow.document.write('</html>\n');
    printwindow.document.close();
}

function showUserLink(url)
{
    window.open(url, '', 'location=yes,menubar=yes,resizable=yes,scrollbars=yes,status=yes,titlebar=yes,toolbar=yes');
    return false;
}

function showNotesLink(url)
{
    window.open(url, 'notes', 'resizable=yes,scrollbars=yes,status=yes,width=500,height=400');
    return false;
}

function initPage() {
	adjustScroll();
	if (window.location.hash && document.getElementById(window.location.hash.replace("#",""))) {
		document.getElementById(window.location.hash.replace("#","")).scrollIntoView();
		
		if (window.location.hash.match(/^#?hit[0-9]+$/)) {
			goToHitNumber(window.location.hash.match(/^#?hit([0-9]+)/)[1]);
		}
	}
	
	if (window.hits) {
		var hit=window.location.hash.match(/^#?(.*)/)[1].toLowerCase();
		for (var i=0; i<hits.length; i++) {
			if (hits[i].toLowerCase().indexOf(hit)>=0) {
				goToHitNumber(i+1);
				break;
			}
		}
	}
}

function onQuickSearchKey(e) {
	var key=e.keyCode || e.which;
	if (key==13) {
		setTimeout(quicksearchpostbackstring,0);
	}
}

function HTMLDecode(string) {
	var div=document.createElement("div");
	div.innerHTML=string;
	if (div.firstChild) return div.firstChild.nodeValue; else return "";
}

function showStatutePopup(a) {
	var statutePopup=document.getElementById("statutePopup");
	var top=0;
	var left=0;
	
	var item=a;
	while (item) {
		top+=item.offsetTop;
		left+=item.offsetLeft;
		item=item.offsetParent;
	}
	
	statutePopup.style.left=(left-140) + "px";
	statutePopup.style.width=(a.offsetWidth+180-10) + "px";
	statutePopup.style.top=(top-64) + "px";
	
	var highlight;
	
	var current;
	if (document.getElementById("strLong")) current=document.getElementById("strLong").value;
	if (!current) current=decodeURIComponent(window.location.search.match(/cite=([^&]*)/)[1]).replace("+"," ");
	
	current=current.replace(/(^[ §]+|[ §]+$)/,"");
	
	for (var i=0; i<statutePopupLookup.length; i++) {
		if (HTMLDecode(statutePopupLookup[i][0]).replace(/(^[ §]+|[ §]+$)/,"")==current) {
			statutePopupLookup[i][1].className="current";
			highlight=statutePopupLookup[i][1];
		} else {
			if (statutePopupLookup[i][1].className=="current") statutePopupLookup[i][1].className="";
		}
	}
	
	statutePopup.style.display="block";
	
	if (highlight) {
		statutePopup.scrollTop=highlight.offsetTop+highlight.offsetHeight/2-statutePopup.offsetHeight/2;
	}
}

var hidingStatutePopup=true;

function onStatutePopupMouseOut(statutePopup) {
	hidingStatutePopup=true;
	setTimeout("hideStatutePopup();",1000);
}

function onStatutePopupMouseOver(statutePopup) {
	hidingStatutePopup=false;
}

function hideStatutePopup() {
	if (hidingStatutePopup) {
		var statutePopup=document.getElementById("statutePopup");
		statutePopup.style.display="none";
	}
}

var lastMenu;
var hidingMenu;

function showMenu(link,menuName) {
	var menuDiv=document.getElementById(menuName);
	
	var top=0;
	var left=0;
	
	var item=link;
	while (item) {
		top+=item.offsetTop;
		left+=item.offsetLeft;
		item=item.offsetParent;
	}
	
	menuDiv.style.top=(top+link.offsetHeight+5)+"px";
	menuDiv.style.left=(left+10)+"px";
	menuDiv.style.display="block";	
	
	if (lastMenu && lastMenu!=menuDiv) {
		hidingMenu=true;
		doHideMenu();
	}
	
	lastMenu=menuDiv;
	
	hidingMenu=false;
}

function hideMenu(menu) {
	hidingMenu=true;
	setTimeout("doHideMenu();",1000);
}

function doHideMenu() {
	if (hidingMenu) {
		lastMenu.style.display="none";
	}
}

//****************** IE6 Selection issue fix****************
if (window.createPopup && document.compatMode && document.compatMode=="CSS1Compat")
{
 document.onreadystatechange = onresize = function fixIE6AbsPos()
 {
   if (!document.body) return;
   if (document.body.style.margin != "0px") 
   document.body.style.margin = 0;
   onresize = null;
   document.body.style.height = 0;
   setTimeout(function(){ document.body.style.height = 
   document.documentElement.scrollHeight+'px'; }, 1);
   setTimeout(function(){ onresize = fixIE6AbsPos; }, 100);
 }
}
//*********

function syncsummary()
{
var link= document.getElementById('strJumplink').value;

window.location='summary.aspx?jumplink='+link+'#'+link;
}


function Minimizewin()
{
 maxclick=0;
    document.getElementById("secondarycontent").style.display = "none";
    document.getElementById("contentseparator").style.display = "none";
    document.getElementById("spanHitNavR").style.display = "none";
    document.getElementById("spanHitNavL").style.display = "none";
    closeClicked = true;
    contentSeparatorTopOffset = 35;
    secondaryContentTopOffset = 60;
    secondaryContentHeightOffset = -130;
    thirdcontentSeparatorTopOffset = 35;
    thirdContentTopOffset = 60;
    thirdContentHeightOffset = -130;
    contentHeightOffset =0;
       var content = document.getElementById("content");
	    var secondarycontent = document.getElementById("secondarycontent");
	    var thirdcontent = document.getElementById("thirdcontent");
	    var thirdseparator = document.getElementById("thirdseparator");
	
	      var contentseparator = document.getElementById("contentseparator");
	    contentseparator.style.display='block';
	  
	   
	     contentHeightOffset = -105;
	     
	     
	     var browserName  = navigator.userAgent;
	     if(browserName.indexOf("MSIE")>=0)
	     {
	      contentSeparatorTopOffset =359;//IE
	     }else if(browserName.indexOf("Firefox")>=0)
	     {
	     contentSeparatorTopOffset =350;//Mozila
	     }
	     else
	     {
	    
	     contentSeparatorTopOffset =403;//Chrome
	     
	     }

    	   //         contentSeparatorTopOffset =357;//IE
    	            //contentSeparatorTopOffset =345;//Mozila
         
         
         
           secondaryContentTopOffset = 60;
                    secondaryContentHeightOffset = -130;
	           contentseparator.style.top = ((getWindowHeight()-(getWindowHeight()/2))+contentSeparatorTopOffset) + "px";
	            document.getElementById("Minwindow").style.display='none'; 
	              document.getElementById("Maxwindow").style.display='block'; 

}

function Maximizewin()
{
maxclick=1;
       var content = document.getElementById("content");
	    var secondarycontent = document.getElementById("secondarycontent");
	    var thirdcontent = document.getElementById("thirdcontent");
	    var thirdseparator = document.getElementById("thirdseparator");
	  
	      var contentseparator = document.getElementById("contentseparator");
	     secondarycontent.style.display='block';
	     contentHeightOffset = -105;
    	            contentSeparatorTopOffset =117;
                    secondaryContentTopOffset = 142;
                    secondaryContentHeightOffset = -212;
 
 contentseparator.style.top = ((getWindowHeight()-(getWindowHeight()))+contentSeparatorTopOffset) + "px";
secondarycontent.style.top = ((getWindowHeight()-(getWindowHeight()))+secondaryContentTopOffset) + "px";
//	                
                secondarycontent.style.height = ((getWindowHeight())+secondaryContentHeightOffset) + "px";
                	    
	                 document.getElementById("Maxwindow").style.display='none';  
	              document.getElementById("Minwindow").style.display='block'; 
	            

}


function Restorewin()
{maxclick=0;
	    var secondarycontent = document.getElementById("secondarycontent");
	    var thirdcontent = document.getElementById("thirdcontent");
	    var thirdseparator = document.getElementById("thirdseparator");
	      var contentseparator = document.getElementById("contentseparator");
	     secondarycontent.style.display='block';
	     contentHeightOffset = -105;
    	            contentSeparatorTopOffset =35;
                    secondaryContentTopOffset = 60;
                    secondaryContentHeightOffset = -130;
  secondarycontent.style.top = ((getWindowHeight()-(getWindowHeight()/2))+secondaryContentTopOffset) + "px";
	                secondarycontent.style.height = ((getWindowHeight()/2)+secondaryContentHeightOffset) + "px";
                contentseparator.style.top = ((getWindowHeight()-(getWindowHeight()/2))+contentSeparatorTopOffset) + "px";
                document.getElementById("Minwindow").style.display='none'; 
	              document.getElementById("Maxwindow").style.display='block'; 

}


function Maximizewin1()
{
maxclick1=1;
       var content = document.getElementById("content");
	    var secondarycontent = document.getElementById("secondarycontent");
	    var thirdcontent = document.getElementById("thirdcontent");
	    var thirdseparator = document.getElementById("thirdseparator");
	  
	     
	     secondarycontent.style.display='block';
	     contentHeightOffset = -105;
    	            contentSeparatorTopOffset =117;
                    secondaryContentTopOffset = 142;
                    secondaryContentHeightOffset = -212;
 
 thirdseparator.style.top = ((getWindowHeight()-(getWindowHeight()))+contentSeparatorTopOffset) + "px";
thirdcontent.style.top = ((getWindowHeight()-(getWindowHeight()))+secondaryContentTopOffset) + "px";
//	                
                thirdcontent.style.height = ((getWindowHeight())+secondaryContentHeightOffset) + "px";
                	    
	              document.getElementById("Maxwindow1").style.display='none';  
	              document.getElementById("Minwindow1").style.display='block'; 
	            
	        

}

function Restorewin1()
{

         maxclick1=0;
	    var secondarycontent = document.getElementById("secondarycontent");
	    var thirdcontent = document.getElementById("thirdcontent");
	    var thirdseparator = document.getElementById("thirdseparator");
	      var contentseparator = document.getElementById("contentseparator");
	     secondarycontent.style.display='block';
	     contentHeightOffset = -105;
    	            contentSeparatorTopOffset =35;
                    secondaryContentTopOffset = 60;
                    secondaryContentHeightOffset = -130;
                    
                    
                    if(maxclick==0)
                    {
             thirdcontent.style.top = ((getWindowHeight()-(getWindowHeight()/2))+secondaryContentTopOffset+ 130) + "px";
	                thirdcontent.style.height = ((getWindowHeight()/2)+secondaryContentHeightOffset) + "px";
                thirdseparator.style.top = ((getWindowHeight()-(getWindowHeight()/2))+contentSeparatorTopOffset+ 130) + "px";
                }
                else
                {
                
	                contentHeightOffset = -105;
    	            contentSeparatorTopOffset =117;
                    secondaryContentTopOffset = 142;
                    secondaryContentHeightOffset = -212;
                    contentseparator.style.top = ((getWindowHeight()-(getWindowHeight()))+contentSeparatorTopOffset) + "px";
                    secondarycontent.style.top = ((getWindowHeight()-(getWindowHeight()))+secondaryContentTopOffset) + "px";
                    secondarycontent.style.height = ((getWindowHeight())+secondaryContentHeightOffset) + "px";
                      thirdcontent.style.width = content.style.width;
    	              thirdcontent.style.top = ((getWindowHeight()-(getWindowHeight()))+secondaryContentTopOffset + 130) + "px";
                      thirdcontent.style.height = ((getWindowHeight())+secondaryContentHeightOffset - 130) + "px";
                      thirdseparator.style.top = ((getWindowHeight()-(getWindowHeight()))+contentSeparatorTopOffset + 130) + "px";

                     }


                document.getElementById("Minwindow1").style.display='none'; 
	              document.getElementById("Maxwindow1").style.display='block'; 
	               

}

