﻿//-----------------------------------------------------------------------------
// $Id: ViewerWindow.js,v 1.1 2009-04-08 23:00:27 imams Exp $
// Copyright © 2009 TransCore ITS, LLC, All Rights Reserved
//
// PROPRIETARY
// THIS SOURCE CODE IS THE PROPERTY OF TRANSCORE. IT MAY BE USED BY RECIPIENT
// ONLY FOR THE PURPOSE FOR WHICH IT WAS TRANSMITTED AND MUST BE RETURNED UPON
// REQUEST OR WHEN NO LONGER NEEDED BY RECIPIENT. IT MAY NOT BE COPIED OR
// COMMUNICATED WITHOUT THE WRITTEN CONSENT OF TRANSCORE.
//-----------------------------------------------------------------------------

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 SetWidgetByViewerType(viewerType)
{
    var i='imgTg' +viewerType;
    viewerType='d' +viewerType;
    var maxHt=250;
    var htAdj=0;

    ChangeDisplay(viewerType);
    
    if(GetElementByID('dInc').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";
    }
   
 }

 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";
 }
