// ##############################################################################
// #													
// # Author:		Norbert Rixecker
// # Copyright:		Plan Software GmbH, Saarbrücken
// # 
// # Last Change:	2009.10.29
// #													
// ##############################################################################


function	WebUpdate_Init()
{

	WebUpdate_HideAll ();

	var strUpdateId = $('UPDATEID').value;
	
	if (strUpdateId != "")
	{
		WebUpdate_ShowStep3 ();
	}
	else
	{
		WebUpdate_ShowStep11 ();
	}

// alert (dialog.id);
}

function	WebUpdate_Action (strWhat)
{	
	// Wenn das Fenster nicht sichtbar ist, wird auch nichts gemacht
	var strDisplay = top.$('IF_WEBUPDATE').parentNode.style.display;

	if (strDisplay != "none")
	{
		// Dialog ist sichtbar (geht leider nicht mir visibility)
		if (strWhat == "IDC_WEBUPDATE_OK_1")
		{
			$('UPDATEID').value = "";
		}
		if (strWhat == "IDC_WEBUPDATE_OK_20")
		{
			$('IDC_IMG_20').hide();
		}
	
		if (strWhat == "IDC_WEBUPDATE_OK_30")
		{
			// Anfrage der Update-Größe, das machen wir mit Verzögerung
			strTimeOut = "ekSubmit ('IDC_WEBUPDATE_OK_30', 'isyiframe');";
			setTimeout(strTimeOut, 5000);
		}
		else
		{
			ekSubmit (strWhat, "isyiframe");
		}
	}
}


function WebUpdate_ShowImage (strImage)
{
	$(strImage).show();
}

function WebUpdate_SetEditText (strId, strText)
{
	dialog[strId].element.value = strText.replace("&apos;", "'");
}


function WebUpdate_SetUpdateId (strText)
{
	$('UPDATEID').value = strText;
}


function WebUpdate_HideAll ()
{
	
	$('IDC_IMG_10').hide();
	$('IDC_IMG_11').hide();
	$('IDC_IMG_12').hide();
	$('IDC_IMG_20').hide();
	$('IDC_IMG_30').hide();
	$('IDC_IMG_40').hide();

	dialog['IDC_GET_SERVER_FILE_LIST_TXT'].hide();
	dialog['IDC_COMPARE_FILE_LIST_TXT'].hide();
	dialog['IDC_CHECK_FILE_SYSTEM_TXT'].hide();

	dialog['IDC_VERSION_MISMATCH_EDIT'].hide();
	dialog['IDC_MISSING_FILES_EDIT'].hide();
	dialog['IDC_VERSION_MISMATCH_TXT'].hide();
	dialog['IDC_MISSING_FILES_TXT'].hide();
	dialog['IDC_VERSION_MISMATCH_SIZE_TXT'].hide();
	dialog['IDC_MISSING_FILES_SIZE_TXT'].hide();
	dialog['IDC_VERSION_MISMATCH_SIZE_EDIT'].hide();
	dialog['IDC_MISSING_FILES_SIZE_EDIT'].hide();

	dialog['IDC_REQUEST_BACKUP_TXT'].hide();
	dialog['IDC_WEBUPDATE_OK_2'].hide();
	dialog['IDC_CHECK_BACKUP_PRESENT_TXT'].hide();
	dialog['IDC_INSTALL_BACKUP_TXT'].hide();
}

function WebUpdate_ShowStep11 ()
{
	dialog['IDC_GET_SERVER_FILE_LIST_TXT'].show();
	dialog['IDC_COMPARE_FILE_LIST_TXT'].show();
	dialog['IDC_CHECK_FILE_SYSTEM_TXT'].show();
}

function WebUpdate_ShowStep12 ()
{
	dialog['IDC_VERSION_MISMATCH_EDIT'].show();
	dialog['IDC_VERSION_MISMATCH_TXT'].show();
	dialog['IDC_VERSION_MISMATCH_SIZE_EDIT'].show();
	dialog['IDC_VERSION_MISMATCH_SIZE_TXT'].show();
}

function WebUpdate_ShowStep13 ()
{
	dialog['IDC_MISSING_FILES_EDIT'].show();
	dialog['IDC_MISSING_FILES_TXT'].show();
	dialog['IDC_MISSING_FILES_SIZE_EDIT'].show();
	dialog['IDC_MISSING_FILES_SIZE_TXT'].show();
	dialog['CANCEL'].hide();
	dialog['OK'].show();
}

function WebUpdate_ShowStep2 ()
{

	WebUpdate_ShowStep11 ();
	WebUpdate_ShowStep12 ();
	WebUpdate_ShowStep13 ();
	
	$('IDC_IMG_10').show();
	$('IDC_IMG_11').show();
	$('IDC_IMG_12').show();

	dialog['IDC_REQUEST_BACKUP_TXT'].show();
	dialog['IDC_WEBUPDATE_OK_2'].show();
	dialog['IDC_CHECK_BACKUP_PRESENT_TXT'].show();
	dialog['IDC_INSTALL_BACKUP_TXT'].show();

	dialog['CANCEL'].show();
	dialog['OK'].hide();
	
}

function WebUpdate_ShowStep3 ()
{

	WebUpdate_ShowStep2 ();

	$('IDC_IMG_20').show();

	dialog['IDC_CHECK_BACKUP_PRESENT_TXT'].show();

}

function WebUpdate_ShowStep4 ()
{

	WebUpdate_ShowStep3 ();

	$('IDC_IMG_30').show();

}