﻿// JScript File

function resizeImage(which,imgHeight,imgWidth)
{
    which.style.display = "none";
    imageObj = new Image();
    imageObj.src = which.src;
    
    var hopeWidth = imgWidth;
    var hopeHeight = imgHeight;
    if (hopeWidth != null && hopeWidth > 0 )
    {
        var precentWidth = imageObj.width/hopeWidth;
        var precentHeight = imageObj.height/hopeHeight;
        var actWidth,actHeight;
        
        if (precentWidth > 1 || precentHeight > 1 )
        {
//            if (precentWidth > precentHeight)
//            {
                actWidth = hopeWidth;
                actHeight = imageObj.height/precentWidth;
//            }
//            else
//            {
//                actHeight = hopeHeight;
//                actWidth = imageObj.width/precentHeight;        
//            }
            which.height =   actHeight;
            which.width =    actWidth;
        }
    }
    which.style.display = "block";
}


function navigateURL(employeeID)
{
   window.location.href = "EmployeeDetail.aspx?EmployeeID="+ employeeID
}


window.onload = function()
{
    setPhotoTableWidth();
    pageInit();
    
}

function setPhotoTableWidth()
{
////////alert(document.getElementById(isphoto).value);
////// var ua = navigator.userAgent.toLowerCase();
////// var isOpera = (ua.indexOf('opera') != -1);
////// var isIE = (ua.indexOf('msie') != -1 && !isOpera); // not opera spoof
////// 
////// 
////// if (isIE)
////// {
//////    var havephoto = document.getElementById(isphoto);
//////    if (havephoto.value == 'hasphoto')
//////    {
//////        var e_all = document.all;
//////        for(var i=0;i<e_all.length;i++)
//////        {
//////            if (e_all[i].tagName == 'TABLE' && e_all[i].getAttribute('EmployeeGroupTable'))
//////            {
//////                var optionTR = e_all[i].firstChild;
//////                var optionTD = optionTR.firstChild; 
//////                //alert(optionTD.firstChild.innerHTML);     
//////                optionTD.firstChild.width = 90;
//////            }     
//////        }
//////      }
//////  }
//////  else
//////  {
//////    var havephoto = document.getElementById(isphoto);
//////    if (havephoto.value == 'hasphoto')
//////    {
//////        var All = document.getElementsByTagName( "*" );
//////        var Length = All.length;
//////        for(var I = 0; I < Length; I++)
//////        {
//////            if (All[I].tagName == 'TABLE' && All[I].getAttribute('EmployeeGroupTable'))
//////            {
//////                var optionTR = All[I].lastChild.firstChild;
//////                optionTR.childNodes[1].style.width = "90px";

//////            }
//////        }
//////    
//////    }
//////          
////////    var table = document.getElementById("table1");
////////    var tr = table.rows[0];
////////    var td = tr.cells[0];
//////          
//////  }
}
