home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
DOS/V Power Report 2003 August
/
VPR0308.ISO
/
ANTI_VIR
/
NAV2003
/
NVJP30TD.EXE
/
NAV
/
SWPlugin.dll
/
HTML
/
BUTTONS.JS
< prev
next >
Wrap
Text File
|
2001-08-13
|
6KB
|
182 lines
/*********************************************************************************/
// THIS FUNCTION IS USED TO SET THE BUTTON TEXT, StopScan, ReScan OR Fix.
function Set_Button_Text(IsScanning)
{
if(IsScanning)
{
if(parent.TotalNumErrors > 0)
{
MultiPurposeButton.value = parent.GetString("BTN_STARTFIX", "", "");
parent.ButtonState = START_Fix;
}
else
{
MultiPurposeButton.value = parent.GetString("BTN_RESCAN", "", "");
parent.ButtonState = START_Scan_OR_Rescan;
}
}
else
{
MultiPurposeButton.value = parent.GetString("BTN_RESCAN", "", "");
parent.ButtonState = START_Scan_OR_Rescan;
}
}
/*********************************************************************************/
// This function is used to set the button text when it is first created.
function SetButtonStartText()
{
parent.LoadRes();
MultiPurposeButton.value = parent.GetString("BTN_STARTSCAN", "", "");
}
function DisableButton()
{
MultiPurposeButton.disabled = true;
}
function EnableButton()
{
MultiPurposeButton.disabled = false;
}
/*********************************************************************************/
function Update_ProgressBar(Status)
{
var Increment = 0;
switch(Status)
{
case SCAN_Idle: // set the progress bar to zero
parent.percent_complete = 0;
ProgressBar.width = 0 + "%";
PBar_div.style.visibility = 'hidden';
ProgressBar.style.visibility = 'hidden';
break;
case START_Scan_OR_Rescan: // increase the progress bar for Scanning
Increment = parent.MAXIMUM_ProgressBar_Width/parent.NumberOfScanners;
if (parent.percent_complete <= parent.MAXIMUM_ProgressBar_Width)
{
ProgressBar.style.visibility = 'visible';
parent.percent_complete += Increment;
ProgressBar.width = parent.percent_complete + "%";
}
else
ProgressBar.width = parent.MAXIMUM_ProgressBar_Width + "%";
break;
case START_Fix: // set the progress bar for fixing erros
if(parent.TotalNumErrors > 0)
{
Increment = parent.MAXIMUM_ProgressBar_Width/parent.TotalNumErrors;
ProgressBar.style.visibility = 'visible';
if((parent.MAXIMUM_ProgressBar_Width-parent.percent_complete)>= (parent.Errors_before_another_scan*Increment))
{
parent.percent_complete += parent.Errors_before_another_scan*Increment;
ProgressBar.width = parent.percent_complete + "%";
}
else
ProgressBar.width = parent.MAXIMUM_ProgressBar_Width + "%";
}
break;
}
}
/*********************************************************************************/
// COMMAND HANDLER FOR THE BUTTON IN ANY STATE i.e. BeginScan,StopScan, ReScan, Fix OR StopFix.
function MultiPurposeButton_onclick()
{
parent.scanners_frame.document.all.scanners_list.style.display = 'block';
parent.scanners_frame.document.all.welcome.style.display = 'none';
document.all.hover_mouse_message.style.visibility = 'visible';
switch(parent.ButtonState)
{
case START_Scan_OR_Rescan:
parent.Set_Defaults();
if (parent.StartScanUpdateUI())
{
scan_complete_message.innerText = parent.ScannerNumber + parent.GetString("OF", "", "") + parent.NumberOfScanners + parent.GetString("SCAN_COMPLETE_MESSAGE", "", "");
PBar_div.style.visibility = 'visible';
MultiPurposeButton.value = parent.GetString("BTN_STOPSCAN", "", "");
parent.ButtonState = STOP_Scan;
parent.Run_Scanner();
}
break;
case STOP_Scan:
DisableButton();
parent.object_coll(parent.Wrappers[parent.ScannerNumber]).StopScan();
Update_ProgressBar(SCAN_Idle);
parent.StopScanUpdateUI();
parent.Update_Image(parent.ScannerNumber,0);
Set_Button_Text(true);
parent.IsOBCFinished = true;
break;
case START_Fix:
Update_ProgressBar(SCAN_Idle);
if (parent.StartFixUpdateUI())
{
parent.ScannerIndex = 0;
parent.IsOBCFinished = false;
MultiPurposeButton.value = parent.GetString("BTN_STOPFIX", "", "");
PBar_div.style.visibility = 'visible';
parent.Fix_Errors();
parent.ButtonState = STOP_Fix;
}
break;
case STOP_Fix:
DisableButton();
parent.object_coll(parent.Wrappers[parent.Scanner_With_Errors[parent.ScannerIndex]]).StopFix();
parent.StopFixUpdateUI();
parent.IsOBCFinished = true;
parent.TotalNumErrors = 0;
Update_ProgressBar(SCAN_Idle);
parent.Update_Image(parent.Scanner_With_Errors[parent.ScannerIndex],2);
MessageString = parent.GetString("STOP_FIX_ERRORS", "", "");
parent.Update_Error(parent.Scanner_With_Errors[parent.ScannerIndex],MessageString,"Red",false);
parent.UpdateErrorMessages();
Set_Button_Text(false);
parent.TotalScanners_With_Errors = 0;
parent.ScannerIndex = 0;
break;
}
}
/*********************************************************************************/
function MultiPurposeButton_onmousedown()
{
// event.button values of 1, 3, 5, 7 all indicate the left button is down
// If the left mouse button is down (ie. check for an odd value)
if (event.button % 2 == 1)
{
if (MultiPurposeButton.disabled == false)
MultiPurposeButton.style.backgroundImage = "url(button_dn.gif)";
}
}
function MultiPurposeButton_onmouseup()
{
// event.button values of 1, 3, 5, 7 all indicate the left button is down
// If the left mouse button is down (ie. check for an odd value)
if (event.button % 2 == 1)
{
if (MultiPurposeButton.disabled == false)
MultiPurposeButton.style.backgroundImage = "url(button_up.gif)";
}
}
function MultiPurposeButton_onmouseout()
{
if (MultiPurposeButton.style.backgroundImage != "url(button_up.gif)")
MultiPurposeButton.style.backgroundImage = "url(button_up.gif)";
}