
// TechArticle_v3.js

// Chris Day	02 Oct 2003		Create
// Chris Day	05 Jan 2004		addMyLibrary() added
// Randeep Chahal 23/06/2004	added calls to log info to the webabacus arrays
// Randeep Chahal 07 Jul 2004	Added array resetting for web reporting
// Randeep Chahal 25 Aug 2004	Events now added via function call held in
//								RMVirtual/clientscript/WebReporting/SetWACustomVars.js
// General Scripts for Knowledge Library articles

function printWindow() {

	bV = parseInt(navigator.appVersion)
	if (bV >= 4) {
		window.print();
		
		// ******************************* DO NOT REMOVE ****************************************
		// Add the print event to the webabacus arrays so that they get posted back to the
		// server. Only for Javascript 1.3 so we get no errors in IE4
		if(browserJavascript >= '1.3') {
			setWACustomVars('eventtype', 'printWindow', true, true);
		}
		//***************************************************************************************
	
	} else {
		alert('Sorry, your browser does not support this feature. \n\nPlease use the browsers Print button.')
	}
   
}


// Handle submission of 'Log Call' requests from document footer or 'Can't Find It' page

function logCall() {

	if (window.opener) {
	
		// if we're in a popup window, submit to parent and give it focus
				
		window.opener.top.name = 'winParent';
		document.frmQuizSubmit.target = 'winParent';
		document.frmQuizSubmit.submit();
		
		window.opener.focus();
		
		return false;
		
	} else {
	
		// otherwise just submit form in current window
		
		document.frmQuizSubmit.target = "_top";	
		document.frmQuizSubmit.submit();
		
	}

}


// Handle adding of current document to user's My Library

function addMyLibrary(pbLoggedIn) {

	if (pbLoggedIn=='True') {

		alert('This document will now be added to the root of your "My Library" structure.\n\nClick on the "My Library" tab from within the Support site to view it.');
	
		document.frmResponse.action = '/Support/AddArticleToMyLibrary.asp';
		document.frmResponse.submit();
		
		// ******************************* DO NOT REMOVE ****************************************
		// Add the add my library event to the webabacus arrays so that they get posted back to the
		// server. Only for Javascript 1.3 so we get no errors in IE4
		if(browserJavascript >= '1.3') {
			setWACustomVars('eventtype', 'addMyLibrary', true, true);
		}
		//***************************************************************************************
		
	} else {
	
		alert('You must be logged in to add a document to "My Library"')
	
	}

}