﻿
var hoverTimeout;

function splashPage(){
    var mapDiv = dojo.byId("ViewerFrame");
    var splashDiv = dojo.byId("PopupWarning");
    
    var headerheight = 101; // from framework style
    var splashTop = Math.round(mapDiv.offsetTop + (mapDiv.offsetHeight / 2) - (splashDiv.clientHeight / 2)) + headerheight + "px";
    var splashLeft = Math.round(mapDiv.offsetLeft + (mapDiv.offsetWidth / 2) - (splashDiv.clientWidth / 2)) + "px";
    splashDiv.style.top = splashTop;
    splashDiv.style.left = splashLeft;
}

function closeSplash(){
    var elem = document.getElementById("PopupWarning");
    elem.style.display = "none";
}

/* Set the cursor style over the map when tool is activated */
function SetMapCursor(cursorStyle)
{
    currentMapCursor = cursorStyle;
    dojo.byId("ViewerFrame_container").style.cursor = currentMapCursor;
}

function mapExtentChange(){
  
    window.clearTimeout(hoverTimeout);
    
    // reset the map cursor because the API seems to switch it to default after every operation
    window.setTimeout("SetMapCursor(currentMapCursor)", 100);
    
    dojo.byId("infoDiv").style.display = "none";
    
    hoverTimeout = window.setTimeout("PerformHoverQuery()", 1000);  
}
      
function resizeMap() {
    if (map != null) {
        map.resize();
    }
}
	 
/* Sliding the dataframe in and out */	 	  
var showDataframe = true;
function slideDataframe(){  
  var show = dojo.fx.slideTo({node: dojo.query(".DataFrame")[0], duration: 500, left: 0, top:0});
  var hide = dojo.fx.slideTo({node: dojo.query(".DataFrame")[0], duration: 500, left: -250, top:0});
  
  var action;   
  showDataframe = !showDataframe; 
  if(showDataframe){
    action = show;
  }else{
    action = hide;
  }
  action.play();    
}

function InitUI()
{
    var elem = document.getElementById("loadingDiv");
    elem.style.display = "none";
}    

function closemytabs(){
    var elem = dojo.byId("mytabs");
    elem.style.display = "none";

}

function closemyResults(){
    var elem = dojo.byId("myResults");
    elem.style.display = "none";

}

function ClearGraphics() {
	map.graphics.clear();
}