﻿function ShowMapArea()
    {
        var mapImage = FindElement("mapDIV");  
     if (mapImage != null)
        { 
        mapImage.style.visibility = "visible";
       }
     
     var lbarea = FindElement("lb");  
     if (lbarea != null)
        {
        lbarea.style.visibility = "visible";
       }
       
     var rbarea = FindElement("rb");  
     if (rbarea != null)
        {
        rbarea.style.visibility = "visible";
       }
    }


/*
i added in calling out to Position.js, because this script couldn't get
the location of an element if it's position was not defined inline
*/

<!-- Paste this snippet into your script  -->


/* This script and many more are available free online at
The JavaScript Source :: http://javascript.internet.com
Created by: Robert Nyman :: http://www.robertnyman.com/ */

/*
  Example call of the function:
  
  getStyle(document.getElementById("container"), "font-size");
*/

// The regular version
function getStyle(oElm, strCssRule){
  var strValue = "";
  if(document.defaultView && document.defaultView.getComputedStyle){
    strValue = document.defaultView.getComputedStyle(oElm, "").getPropertyValue(strCssRule);
  }
  else if(oElm.currentStyle){
    strCssRule = strCssRule.replace(/\-(\w)/g, function (strMatch, p1){
      return p1.toUpperCase();
    });
    strValue = oElm.currentStyle[strCssRule];
  }
  return strValue;
}


 
function IsIE() {
    if (document.compatMode && document.all)  
        return true;
    else
        return false;
}

function IsFF()
{
    if (Array.every)
        return true;
        
    else
        return false;
}

var dragging = null;

function dragBegin(event, id) {

  var dragEl = document.getElementById(id);
  var x, y;

    if (IsIE())
    {
        x = window.event.clientX + document.documentElement.scrollLeft + document.body.scrollLeft;
        y = window.event.clientY + document.documentElement.scrollTop + document.body.scrollTop;
        
        dragEl.startX = x;
        dragEl.startY = y;
        dragEl.startLeft  = Position.get(id).left;
        dragEl.startTop   = Position.get(id).top;
        
        
        if (isNaN(dragEl.startLeft)) dragEl.startLeft = 0;
        if (isNaN(dragEl.startTop))  dragEl.startTop = 0;
            
        document.onmousemove = dragDo;
        document.onmouseup = dragEnd;
        window.event.cancelBubble = true;
        window.event.returnValue = false;
    }
    if (IsFF())
    {
        x = event.clientX + window.scrollX;
        y = event.clientY + window.scrollY;
        
        
        dragEl.startX = x;
        dragEl.startY = y;
        dragEl.startLeft  = Position.get(id).left;
        dragEl.startTop   = Position.get(id).top;
        
        document.onmousemove = dragDo;
        document.onmouseup = dragEnd;
        event.preventDefault();
     }
     
     dragging = dragEl;

}



function dragDo(event) {
  
  var dragEl = dragging;
  var x, y;

  // Get cursor position with respect to the page.

  
  if (IsIE()) 
  {
    x = window.event.clientX + document.documentElement.scrollLeft + document.body.scrollLeft;
    y = window.event.clientY + document.documentElement.scrollTop + document.body.scrollTop;
      
    dragEl.style.left = (dragEl.startLeft + x - dragEl.startX) + "px";
    dragEl.style.top  = (dragEl.startTop  + y - dragEl.startY) + "px";
    window.event.cancelBubble = true;
    window.event.returnValue = false;
  }
  if (IsFF()) 
  {
    x = event.clientX + window.scrollX;
    y = event.clientY + window.scrollY;
    
    dragEl.style.left = (dragEl.startLeft + x - dragEl.startX) + "px";
    dragEl.style.top  = (dragEl.startTop  + y - dragEl.startY) + "px";
    event.preventDefault();
  }

  // Move drag element by the same amount the cursor has moved.

}


function dragEnd(e) {

  // Stop capturing mousemove and mouseup events.

    document.onmousemove = null;
    document.onmouseup = null;

}

   
function ToggleSectionViewOrig(whichDiv)
{
    var elem = FindElement(whichDiv);
    if (elem != null)
    {
       
        if(elem.style.display=="none")
            {
                elem.style.display="block";
                elem.style.visibility="visible";
            }
        else
            {
                elem.style.display="none";
                elem.style.visibility="hidden";
                //elem.style.border.style="hidden";
                //map DIV border is still showing.  not sure why?
                //elem.style.height=0;
            }
    
   
    }
}




function ToggleSectionView(whichDiv)
{
 
        var elem = FindElement(whichDiv);
    if (elem != null)
        {
     
        if(elem.style.display=="none")
            {
                elem.style.display="block";
                elem.style.visibility="visible";
            }
        else
            {
                elem.style.display="none";
                elem.style.visibility="hidden";
              
            }
    

    
    }
}

function ToggleSectionViewTESTme(whichDiv)
{
 	        mapWHOLEAREA
			mapTITLEBARAREA
			mapTITLEAREA
			mapWORKAREA 
    var elem = FindElement(whichDiv);
    if (elem != null)
        {
     var displayText = "block";
    var visibilityText = "visible"; 
        if(elem.style.display!="none")
            {
                displayText = "none";
                visibilityText = "hidden"; 
            }
               elem = FindElement("MapControl1_Image");
                elem.style.display=displayText;
                elem.style.visibility=visibilityText;
                
               elem = FindElement("MapControl1");
                elem.style.display=displayText;
                elem.style.visibility=visibilityText;
               
            }
       
               
            }
    

 