// ********************************************************************
// Copyright (C) 2001 Microsoft Corporation. All rights reserved.
//
//	IMPORTANT.  Please read the legal.txt file, located in the 
//	"<CMS Install Directory>\Server\httpexec\WBC\Internals" 
//	directory, governing the use of this internal file."
// ********************************************************************

var IDS_PAGEREVISION_OPTIONDLG_URL = "./PageRevisionOptions.asp?";
var IDS_WIN_COMPARE_RESULT_FRAME_NAME = "WBC_frameCompareResult";
var IDS_PAGEREVISION_COMPARERESULT_URL = "./PageRevisionCompareResult.asp?";

var g_pFormPageRevisionInfo;
var g_strCompareResultURL;

// go back to the Page Revision Report when the user clicks the link in compare result dialog
function WBC_openPageRevisionDlg() {
	
	if (top.opener) {
		top.opener.focus();
	}
}

// update the lower frame when launch
function WBC_onLoadCompareInfo( strCompareResultURL ) {
	// get the submit form
	g_pFormPageRevisionInfo = document.WBC_formPageRevisionInfo;
	g_strCompareResultURL = strCompareResultURL;
	
	// do a form submit to compare result
	g_pFormPageRevisionInfo.target = IDS_WIN_COMPARE_RESULT_FRAME_NAME;
	g_pFormPageRevisionInfo.action = g_strCompareResultURL;
	g_pFormPageRevisionInfo.submit();
	window.focus();
}


// update the upper frame (i.e., compare information) in compare result dialog 
// when user clicks the tab to re-configure the options
function WBC_onClickTab( strStateURL ) {

	// do a form submit to compare result
	g_pFormPageRevisionInfo.target= "_self";
	g_pFormPageRevisionInfo.action = strStateURL;
	g_pFormPageRevisionInfo.submit();
}


// open the option dialog when the user click on the "Set Display Options" button
function WBC_openOptionDlg() {

	WBC_openWindowOnFocus( IDS_PAGEREVISION_OPTIONDLG_URL, IDS_WIN_PAGEREVISION_OPTION_NAME, IDS_WIN_PAGEREVISION_OPTION_FEATURES );
}


// retrieve the current Insertion option
function WBC_getInsertionOption() {
	return g_pFormPageRevisionInfo.WBC_inhidInsertion.value;
}


// retrieve the current Deletion option
function WBC_getDeletionOption() {
	return g_pFormPageRevisionInfo.WBC_inhidDeletion.value;
}

// update the latest Insertion and Deletion option when the user close the "Set Display Option" dialog
// this function will do a form submit to itself in order to store the latest option into cookie and
// update the compare result page base on the current options
function WBC_updateOptions( strInsertionOption, strDeletionOption ) {
	
	// update the hidden field of the Insertion and Deletion options
	g_pFormPageRevisionInfo.WBC_inhidInsertion.value = strInsertionOption;
	g_pFormPageRevisionInfo.WBC_inhidDeletion.value = strDeletionOption;
	
	//do a form submit to compare result
	g_pFormPageRevisionInfo.target= "_self";
	g_pFormPageRevisionInfo.action = g_pFormPageRevisionInfo.WBC_inhidInsertionURL.value;
	g_pFormPageRevisionInfo.submit();
}
			
			