﻿

function ChangeDisplay(o) {
    GetElementByID(o).style.display = (GetElementByID(o).style.display == "none") ? _dspSty : "none"; 
}

function ShowOrHideDetail(id)
{   
    try
    {
        ChangeDisplay("dIncText" + id);
        GetElementByID("dIncClick" + id).innerHTML = GetElementByID("dIncText" + id).style.display=="none" ? "Click here to view details." : "Click here to hide details.";
    }
    catch(e){alert(e.message + " -- TcFn31");}
}
 
/*
Every time a page_load event gets fired in Default.aspx page, we will set the location of these viewers' pages.
*/
function LoadIncidentViewerPage() {

    try
    {
        if (document.frames) {
            document.frames("ifInc").window.location.href =_incidentViwerPage;
        } else {
           GetElementByID('ifInc').contentWindow.location.href =_incidentViwerPage;
        }
    }
    
    catch(e){alert(e.message + " -- LoadIncidentViewerPage");}

} 

function LoadWeatherViewerPage(){
    
    try {
        
        if(document.frames){
            document.frames("ifWtr").window.location.href = _weatherViewerPage;
        }else {
            GetElementByID('ifWtr').contentWindow.location.href = _weatherViewerPage;
        }
    }
    catch(e){alert(e.message + " --  LoadWeatherViewerPage");}
} 


function SetWidgetByViewerType(viewerType)
{
    var i='imgTg' +viewerType;
    viewerType='d' +viewerType;
    var maxHt=540;
    var htAdj=0;

    ChangeDisplay(viewerType);
    
    if(GetElementByID('dInc').style.display!="none")
        htAdj+=1;
    if (GetElementByID('dWtr').style.display != "none")
        htAdj+=1;
          
        
    maxHt=htAdj>0?(maxHt/htAdj):maxHt;
    
    if(GetElementByID('dInc').style.display!="none"){
        GetElementByID('dInc').style.height=maxHt + "px";
        GetElementByID("ifInc").style.height=maxHt + "px";
    }

    if (GetElementByID('dWtr').style.display != "none") {
        GetElementByID('dWtr').style.height = maxHt + "px";
        GetElementByID("ifWtr").style.height = maxHt + "px";
    } 
   
 }

 function DisplayViewerType(viewerType) {

     var maxHt = 540;
     var htAdj = 2;
     
     maxHt = htAdj > 0 ? (maxHt / htAdj) : maxHt;
     GetElementByID('d' + viewerType).style.display = _dspSty; //set it to block

     GetElementByID('d' + viewerType).style.height = maxHt + "px";
     GetElementByID("if" + viewerType).style.height = maxHt + "px";
 }
