//helppane.js Version 1.8
//Only minimal adaption for use in the NTC project - GMM
//added DoGlossary for special NTC glossary direct call behaviour - MWT
//nb that Glossary behaviour requires mods to helppane.aspx as well
//added DoSpecificHelp(sTopic,nHelpType,sHelpPath) to allow override of
//relative path to help file by caller (fixing bugs 4,894,1007) - MWT
//Fixed path bug in DoSpecificHelp -DJB 

var H_URL_BASE='',H_TOPIC='',H_KEY='',L_H_TEXT='',H_FILTER='',H_BRAND='',bSearch=false;
var H_CONFIG='',L_H_APP='',L_CONTACTUS_URL='';
var H_BURL='./Help/helppane.aspx',H_TARG='',H_VER='1.7'; //Remove SMP/ when deploying 
var h_win,H_OTHER='',bResize=true;
var childOpen = false;

function DoGlossary(sKeyword)
{
	DoHelp('Glossary'+ sKeyword);
}

function DoFAQ(sKeyword)
{
	DoHelp('FAQ'+ sKeyword);
}

//wrapper for help allowing the page author to call help
//with a specific path rather than the default specified in
//H_BURL. sHelpPath overrides H_BURL with a new relative path
//to the help caller page

function DoSpecificHelp(sTopic,nHelpType,sHelpPath)
{
	H_BURL=sHelpPath; 
	DoHelp(sTopic,nHelpType)
}

function DoHelp(sTopic,nHelpType) 
{
	var sQP='?',W,H,sWD,sc=screen.width,bIE4PC;
	var agent = navigator.userAgent.toLowerCase();
	var app = navigator.appName.toLowerCase();		
	
	sQP+='H_VER='+H_VER;
	
	if (H_BRAND!='') 
		sQP+='&BrandID='+H_BRAND
	
	if (H_FILTER!='') 
		sQP+='&Filter='+H_FILTER 
	sQP+=(bSearch) ? '&SEARCHTERM='+escape(H_KEY)+'&S_TEXT='+escape(L_H_TEXT):'&helpTopic='+sTopic
	
	if (+nHelpType != null)
	{
		sQP+='&helpType='+nHelpType;
	}
	
	if (typeof(v1)!="undefined") 
		sQP+='&v1='+escape(v1)
	else 
		sQP+='&v1='+escape(document.location.protocol + "//" + document.location.hostname)
		
    sQP+='&v2='+escape(document.location.search);
    
    if (typeof(H_CONFIG) != "undefined" && (self.name == null || self.name == "" || self.name == "msnMain")) 
		self.name = H_CONFIG.substring(0,H_CONFIG.indexOf("."));
    
    sQP+='&tmt='+escape(window.name);
	
	if (sc<=800) 
		sQP+="&sp=1";
	
	W=(sc<= 800 && agent.indexOf("mac")==-1)?180:230;
	
	H=(agent.indexOf("windows")>0 && agent.indexOf("aol")>0) ? screen.availHeight-window.screenTop-22:screen.availHeight//*AOL

	sWD="toolbar=0,status=0,menubar=0,width="+W+",height="+H+",left="+(sc-W)+",top=0,resizable=1";
	bResize=false;
	bIE4PC = agent.indexOf("msie 4")>0 && agent.indexOf("aol")<0 && agent.indexOf("mac")<0

	if (H_TARG=='') 
		H_TARG = (bIE4PC)?'_help17':'_help';

	//if (iNm != null) 
	//	H_TARG+=iNm;

	if (bIE4PC && h_win!=null && !h_win.closed) 
		h_win.location.replace( H_BURL + sQP );
	else 
		h_win=window.open('/'+H_BURL+sQP,H_TARG,sWD); 
		
	//alert(H_BURL+sQP,H_TARG,sWD);
	
	if (h_win && agent.indexOf("mac")<0 && app.indexOf("netscape")<0) 
		h_win.opener=self//*IE5+PC


 
	childOpen = true;		
}

function UpdateChild()
{
	//Only if child window is still open, set the parentOpen property
	if (childOpen == true)
	{
		if (h_win && !h_win.closed)
			h_win.parentOpen = false
	}
}

window.onunload = UpdateChild;



