﻿// JScript File

function find_tz_offset()
{
    var now = new Date();
    var offset = now.getTimezoneOffset();
    $get('ctl00_tz_offset').value = offset;
}

function showWait1() 
{ 
    hideDropDowns();
    
    var mp = document.getElementById('mainPanel');
    var windowHeight =      mp.clientHeight.toString() + "px"; 
    
    var iebody=(document.compatMode && document.compatMode != "BackCompat")? document.documentElement : document.body
    var scrollTop=document.all? iebody.scrollTop : pageYOffset
    
    document.getElementById('waitPanel').style.visibility = 'visible';
    document.getElementById('waitPanel').style.display = 'block';
    document.getElementById('waitPanel').style.top = (scrollTop + 100).toString() + "px";
            
    document.getElementById('waitPanelBlockOut').style.height =    mp.clientHeight.toString() + "px"; 
    document.getElementById('waitPanelBlockOut').style.visibility = 'visible';
    document.getElementById('waitPanelBlockOut').style.display = 'block';
    document.getElementById('waitPanelBlockOut').style.zIndex = '10000';
    document.getElementById('waitPanelBlockOut').style.top = '0';
}

function showWait2() 
{ 
    hideDropDowns();
    var mp = document.getElementById('mainPanel');
    document.getElementById('waitPanelBlockOut').style.height = mp.clientHeight.toString() + "px"; 
    document.getElementById('waitPanelBlockOut').style.visibility = 'visible';
    document.getElementById('waitPanelBlockOut').style.display = 'block';
    document.getElementById('waitPanelBlockOut').style.zIndex = '10000';
    document.getElementById('waitPanelBlockOut').style.top = '0';
}

function showWait (sim_type, mod_count, cur_part) 
{
    hideDropDowns();
    
//    if(cur_part == 'M3.2C') cur_part = 'M32C';
//    if(cur_part == 'M3.2U') cur_part = 'M32U';
//    
//    var target_id = 'ctl00_avg_' + cur_part + '_' + sim_type;
//    var estimated_time = Number(document.getElementById(target_id).value);
//    
//    estimated_time = (estimated_time * mod_count) + 1;
//    
//    var estimated_mins = Math.floor(estimated_time / 60);
//    var estimated_secs = Math.round(estimated_time - (estimated_mins * 60));
//    var estimated_time_div = document.getElementById('estimatedSimTime');
    
    var mp = document.getElementById('mainPanel');
    
    var iebody=(document.compatMode && document.compatMode != "BackCompat")? document.documentElement : document.body
    var scrollTop=document.all? iebody.scrollTop : pageYOffset
   
    document.getElementById('waitPanel').style.visibility = 'visible';
    document.getElementById('waitPanel').style.display = 'block';
    
    document.getElementById('waitPanelBlockOut').style.height = mp.clientHeight.toString() + "px";
    document.getElementById('waitPanelBlockOut').style.visibility = 'visible';
    document.getElementById('waitPanelBlockOut').style.display = 'block';
    
    if( document.embeds[0] != null) 
    {
        setTimeout('document.embeds[0].src="/Infineon/HighPower/images/flash/logo.swf"', 200); 
    }
    
    if (estimated_time_div) {
        if( estimated_mins != 0)
        {
            estimated_time_div.innerHTML = 'Estimated Simulation Time ' + estimated_mins + ' minutes and ' + estimated_secs + ' seconds.';
        }
        else
        {
            estimated_time_div.innerHTML = 'Estimated Simulation Time ' + estimated_secs + ' seconds. <br />';
        }
    }
    
     querySimStatus();
}


function hideDropDowns()
{
    for(var i = 0; i < document.forms[0].elements.length; i++) {
        try {
            var el = document.forms[0].elements[i];
            var s = el.type.toString();
            if (s.indexOf('select') > -1) {
                el.style.display = 'none';
            }
        } catch (e) { }
    }
}

