//mod service globals
//these pop windows defined here because interval timers are here
//but they are fired from the clsModule
var w3c_popup
var w3c_popup_id
var chatwin
var chatwin_id
var global_module_debug=false 
var debugmode=false

//global var below must be globals to share with state_Change() function
var xmlhttp
var srcObj
var bDivFlag
var xmlErrMsg="ERROR: Problem retrieving data. STATUS : "

//get os
try{var os=GetCookie("os")}
catch(e){if (!os){os="windows"}}



//----------------------------------------------------------------------
//The following functions are required by the module class used either
// as direct calls or calls from built in module functions
//----------------------------------------------------------------------

function GetMouseCoordsByElement(evt)
{
var elem=(evt.target)? evt.target : evt.srcElement
var coords={left:0,top:0}
coords.left=evt.clientX
coords.top=evt.clientY
evt.cancelBubble=true
return coords
}
//////////////////////////////////////////////////////////////////////////
/// CRITICAL NEW FUNCTION FIRED FROM clsModules5.asp - ShowRoundedPopup...
/// AND FIRED FOR ALL POPUP VIDEOS - PlayVideoInOverlay()
/// CREATES A SIMULATED 'MODAL' PAGE UNERNEATH THE POPUP
/// NOT TRUE MODAL SINCE CODE EXECUTION IS NOT HALTED
/// BUT USEFUL TO PREVENT UNWANTED CLICKS ON PAGE UNTIL MESSAGE IS RETIRED
//////////////////////////////////////////////////////////////////////////
//--------------------------------------------------------------
function CreateModalPage(inState)
{
try
	{	
	var docObj=GetDocument(activeFrameId)
	if (docObj)
		{
		var bodyObj=docObj.body
		if (inState)
			{
			var modalDivObj=document.createElement("div")
			modalDivObj.id="modal_div"
			modalDivObj.style.position="absolute"
			modalDivObj.style.top="0px"
			modalDivObj.style.left="0px"
			modalDivObj.style.width=bodyObj.scrollWidth+100
			//modalDivObj.style.height = bodyObj.clientHeight + 200
			modalDivObj.style.height =window.screen.availHeight
			modalDivObj.style.backgroundColor="black"
			modalDivObj.style.opacity="0.6"
			modalDivObj.style.filter="Alpha(Opacity=60)"
			modalDivObj.style.zIndex="2000"
			bodyObj.appendChild(modalDivObj)
			bodyObj.style.overflow="hidden"
			}
		else
			{
			var modalDivObj=docObj.getElementById("modal_div")
			if (modalDivObj)
				{
				bodyObj.removeChild(modalDivObj)
				bodyObj.style.overflow="auto"
				bodyObj.disabled=false
				}
			}
		}	
	}
catch(e){}			
}

//---------------------------------------------------------------
function GetTextFromServer(url,inObj,bASync) 
{
//set globals
xmlhttp=null;

//need a global so onreadystate handler knows source object
srcObj=inObj

//check object type
var objName=srcObj.tagName.toLowerCase()
if (objName=="input"){bDivFlag=false}
else{bDivFlag=true}    

//default for eprep is synchronous download
if (bASync=="undefined"){bASync=false}

//test for browser version
if (window.XMLHttpRequest){xmlhttp=new XMLHttpRequest()}
else if (window.ActiveXObject){xmlhttp=new ActiveXObject("Microsoft.XMLHTTP")}

//get the url data
if (xmlhttp!=null)
  {
  
  //fix for firefox - doesn't recognize onreadystatechange
  //bAsync=asynchonous true or false
  //if bASync=false then script waits until response is received
  //in that case w3c browser do not call the onreadystatechange

  if (document.all)
	{
	xmlhttp.onreadystatechange=state_Change;
	xmlhttp.open("GET",url,bASync);
	/* retain for ref but doesn't work 
	xmlhttp.setRequestHeader("Content-Type","text/html;charset=UTF-8")
	*/
	xmlhttp.send(null);
	}
  else
	{		
	//full relative path now sent from module
	xmlhttp.open("GET",url,bASync);
	xmlhttp.send(null);

	//check status
	if (xmlhttp.status==200 )
		{
		var retval=xmlhttp.responseText
		if (!bDivFlag){srcObj.value=retval}
		else{srcObj.innerHTML=retval}
		}
	else
		{
		if (!bDivFlag){srcObj.value=xmlErrMsg+xmlhttp.statusText}
		else {srcObj.innerHTML=xmlErrMsg+xmlhttp.statusText}    
		}	   
    }      
  }
else
  {
    if (!bDivFlag){srcObj.value="ERROR: Your browser does not support XMLHTTP."}
    else{srcObj.innerHTML="ERROR: Your browser does not support XMLHTTP."}
  }
}
//----------------------------------------------------------
function state_Change()
{
if (xmlhttp.readyState==4)
  {
  if (xmlhttp.status==200)
    {
    var retval=xmlhttp.responseText
    if (!bDivFlag){srcObj.value=retval}
    else{srcObj.innerHTML=retval}    
    }
  else
    {
    if (!bDivFlag){srcObj.value=xmlErrMsg+xmlhttp.statusText}
    else{srcObj.innerHTML=xmlErrMsg+xmlhttp.statusText}    
    }
  }
}


//-------------------------------------------------------
//new help popup code for ie and firefox
//-------------------------------------------------------
function _ShowHelpPopup(inText,inLanguage,inColor)
{
var outObj=new Object()
outObj.top=10
outObj.left=10
outObj.fontsize="8pt"
outObj.hdrfontsize="12pt"
outObj.showicon=true
outObj.isHelpPopup=true
outObj.showcloseicon=true
outObj.closeBtn=false
var apWidth=parseInt(document.body.clientWidth*.5)
if (inLanguage=="english"){var apTitle="Quick Help"}
else{var apTitle="Aide rapide"}
var apContent=inText
var apTextColor="black"
var apBackColor="white"
var apBorderColor=inColor
persistOverlayMsg=true

//call back to mod function function
ShowRoundedOverlayMsg(outObj,apWidth,apTitle,inText,apTextColor,apBackColor,apBorderColor)
}

//-------------------------------------------------------
//standard cookie functions called in module class
//-------------------------------------------------------
function GetCookie(name)
{
var result=null;
var myCookie=" "+document.cookie+";";
var searchName=" "+name+"=";
var startOfCookie=myCookie.indexOf(searchName)
var endOfCookie;
if (startOfCookie!=-1)
	{
	startOfCookie+=searchName.length;
	endOfCookie=myCookie.indexOf(";",startOfCookie);
	result=unescape(myCookie.substring(startOfCookie,endOfCookie));
	}
return result;
}

//--------------------------------------------
function SetPermanentCookie(name,value)
{
var expires=new Date("30 Dec 2020")
expires=expires.toGMTString()
document.cookie=name+"="+escape(value)+";expires="+expires+";path=/"
}

//--------------------------------------------
function SetCookie(name,value)
{
document.cookie=name+"="+escape(value)+";path=/";
}
//--------------------------------------------
function ClearCookie(name)
{
var ThreeDays=3*24*60*60*1000;
var expDate=new Date();
expDate.setTime(expDate.getTime()-ThreeDays)
document.cookie=name+"=exit;path=/;expires="+expDate.toGMTString();
}

//--------------------------------------------------------------
//Automatically fired when browser sized below button bar width
//--------------------------------------------------------------
function ShowResizeMsg(inLanguage)
{
//new code to set and read a cookie
var appid=document.getElementById("app_id").value
var cookieName="RZ-"+appid
var cookieValue=GetCookie(cookieName)
if (cookieValue){return}

var inText
switch(inLanguage)
	{
	case "english":
	inText="<img src='images/msgbox.gif' style='float:left;margin-right:10px'>"
	inText+="Your browser viewing area is now sized so that some of the topic or lesson selector tabs may be completely or partially hidden."
	inText+="<P>To move the desired tab into view... </p>" 
	inText+="<ul><li>Click anywhere on the <b>tab strip</b> to give it the focus and then...</li>"
	inText+="<li>Repeatedly press the <b>LEFT arrow key</b> on your keyboard until hidden tabs are visible.</li>"
	inText+="<li>Press the <b>HOME key</b> or <b>RIGHT arrow key</b> to restore the tabs to their original position.</li></ul>"
	inText+="<p style='text-align:center;font-weight:bold;color:red;font-size:8pt'>This advisory message will not appear again during this session.</p>"
	break
		
	case "french":
	inText="<img src='images/msgbox.gif' style='float:left;margin-right:10px'>"
	inText+="La taille de la zone d’affichage de votre navigateur est maintenant réglée de sorte que certains onglets de leçon ou de sujet soient entièrement ou partiellement cachés."
	inText+="<P>Pour rendre visible un onglet que vous souhaitez consulter...</p>"
	inText+="<ul><li>Cliquez n’importe où sur l’onglet afin de signaler la cible de saisie, puis…</li>"
	inText+="<li>Appuyez plusieurs fois sur la <b>flèche GAUCHE</b> du pavé numérique jusqu’à ce que l’onglet caché soit visible.</li>"
	inText+="<li>Appuyez sur la touche <b>DÉBUT (HOME)</b> ou la <b>flèche DROITE</b> afin que l’onglet revienne à sa position initiale.</li></ul>"
	inText+="<p style='text-align:center;font-weight:bold;color:red;font-size:8pt'>Ce message ne réapparaîtra pas au cours de cette session.</p>"   
	break
	}

//create alternate object instead of event
try
	{
	var evt=new Object
	evt.top=10
	evt.left=10
	evt.fontsize="10pt" 
	evt.hdrfontsize="12pt"
	evt.showicon=false
	evt.showcloseicon=false
	evt.closeBtn=false
	if (document.body.offsetWidth<400){var apWidth=document.body.offsetWidth*.8}
	else{var apWidth=document.body.offsetWidth*.75}
		
	//show the popup
	persistOverlayMsg=true
	ShowRoundedOverlayMsg(evt,apWidth,"Important",inText,"black","white","red")
	
	//set the cookie so it doesn't re-appear for this app
	SetCookie(cookieName,"viewed")
	}
catch(e){return}	
}


//----------------------------------------------
//timer for lesson or module passwords
//not sure of these yet
//----------------------------------------------
function CheckPasswordPopup()
{
win_pw_id=setInterval("PasswordFocus()",10)
}

function PasswordFocus()
{
try
	{
	if(win_pw){win_pw.focus()}
	else {window.clearInterval(win_pw_id);win_pw_id=null}
	}
catch(e){return}
}

//----------------------------------------------
//timer for w3cdom popup windows to maintain focus
function CheckPopup()
{
w3c_popup_id=setInterval("PopupFocus()",10)
}

function PopupFocus()
{
try
	{
	if (w3c_popup){w3c_popup.focus()}
	else{window.clearInterval(w3c_popup_id);w3c_popup_id=null}
	}
catch(e){return}
}

//----------------------------------------------
//Module Class direct calls and callbacks
//----------------------------------------------
function _Resizer(inWidth,inHeight)
{
try
	{
	if (!document.all)
		{
		var refresh_url=document.location.href
		document.location.href=refresh_url
		}
	else
		{	
		lastressize=0
		document.execCommand("refresh")
		}
		
	//move it
	var w_top=parseInt((window.screen.height-inHeight)/2)
	var w_left=parseInt((window.screen.width-inWidth)/2)
	window.moveTo(w_left,w_top)
	}
catch(e){}
}

//------------------------------------------------
function _MouseOverBody(evt)
{
var posX
var posY
try
	{
	evt=(evt) ? evt :((window.event) ? event : null)

	if (evt)
		{
		//get coords of event
		if (document.all){posX=evt.x;posY=evt.y}
		else{posX=evt.pageX;posY=evt.pageY}
		
		//get min Y
		var minY=document.getElementById("header").offsetHeight+document.getElementById("btn_table").offsetHeight+50	
		var minX=document.getElementById('res_extras').offsetWidth
		if (posY>minY && posX>minX){document.body.style.cursor="e-resize"}
		else{document.body.style.cursor="default"}	
		}
	}
catch(e){document.body.style.cursor="default"}	
}

//-----------------------------------------------------
function _MouseDown(evt)
{
evt=(evt) ? evt :((window.event) ? event : null)

if (evt)
	{
	var hdrht
	var bbarht
	var respane=document.getElementById('res_extras')
	var source
	if (!document.all){source=evt.target.tagName}
	else{source=evt.srcElement.tagName}	

	source=source.toLowerCase()
	if (respane.style.visibility=='visible' && source=='body')
		{
		if (document.all)
			{
			hdrht=document.getElementById('header').offsetHeight
			bbarht=document.getElementById('btn_table').offsetHeight
			}
		else
			{
			hdrht=document.getElementById('header').scrollHeight
			bbarht=document.getElementById('btn_table').scrollHeight
			}	

		var totalhdrht=hdrht+bbarht+10
		var sliderleft=respane.offsetWidth
		var sliderright=sliderleft+15
		var posx
		var posy 
		if (document.all){posx=evt.x;posy=evt.y}
		else{posx=evt.pageX;posy=evt.pageY}	
		
		if (posy>totalhdrht && posx>sliderleft && posx<sliderright)
			{
			with (sizer)
				{
				style.position='absolute'
				style.left=posx-8
				
				if (document.all)
					{
					style.width='14px'
					style.top=respane.offsetTop+2
					style.height=respane.offsetHeight-5
					}
				else
					{
					style.width='12px'
					style.top=respane.offsetTop+1
					style.height=respane.scrollHeight-8
					}
				//style.border='outset white 2px'
				style.border='dotted black 2px'
				style.backgroundColor='gray'
				style.visibility='visible'
				style.display='inline'
				style.cursor='e-resize'
				style.zIndex=10
				}
			bResMoveActive=true
			}
		else
			{
			sizer.style.visibility='hidden'
			sizer.style.display='none'
			bResMoveActive=false
			}
		}
	}
}

//----------------------------------------------
function _MouseUp(evt)
{
evt=(evt) ? evt :((window.event) ? event : null)
if (evt)
	{
	var frames=document.getElementsByTagName('iframe')
	var iCount=frames.length-1
	var respane=frames[0]
	var respanewidth
	var viewpaneleft
	var viewpanewidth
	var i
	if (bResMoveActive)
		{
		if (document.all)
			{
			respane.style.posWidth=evt.x
			lastressize=evt.x
			respanewidth=respane.offsetWidth
			viewpaneleft=respanewidth+4
			viewpanewidth=(document.body.offsetWidth-viewpaneleft)-4
			for (i=1;i<=iCount;i++)
				{
				frames[i].style.left=viewpaneleft
				frames[i].style.width=viewpanewidth
				}
			bResMoveActive=false
			sizer.style.visibility='hidden'
			sizer.style.display='none'
			}
		else
			{
			respane.style.width=evt.pageX
			lastressize=evt.pageX
			respanewidth=respane.scrollWidth
			viewpaneleft=respanewidth+4
			viewpanewidth=(document.body.scrollWidth-viewpaneleft)-4
			for (i=1;i<=iCount;i++)
				{
				frames[i].style.left=viewpaneleft
				frames[i].style.width=viewpanewidth
				}
			bResMoveActive=false
			sizer.style.visibility='hidden'
			sizer.style.display='none'
			
			//required for mozilla to clear messy button bar effect
			document.getElementById('topicbar').style.zIndex=-10
			document.getElementById('topicbar').style.zIndex=0
			document.getElementById('header').scrollIntoView(true)
			}	
		}
	}
return false		
}

//----------------------------------------------
function _MouseMove(evt)
{
evt=(evt) ? evt :((window.event) ? event : null)
if (evt)
	{
	var sizerpos
	if (document.all)
		{
		sizerpos=evt.x
		if (sizerpos>100 && sizerpos<document.body.offsetWidth-100){sizer.style.posLeft=sizerpos-8}
		}
	else
		{
		sizerpos=evt.pageX
		if (sizerpos>100 && sizerpos<document.body.scrollWidth-100){sizer.style.left=sizerpos-8}
		}		
	}	
}

//----------------------------------------------
function _MouseOut(evt,inMsg)
{
evt=(evt) ? evt :((window.event) ? event : null)
if (evt)
	{
	if (bResMoveActive)
		{
		sizer.style.backgroundColor='red'
		window.status=inMsg
		}
	else
		{window.status=''}
	}	
}

//----------------------------------------------
function _MouseOver(inMsg)
{
window.status=inMsg
sizer.style.backgroundColor='gray'
}

//----------------------------------------------
function _SlideFromButton()
{
document.getElementById('btn_table').style.position='relative'
var tblwidth=document.getElementById('btn_table').offsetWidth
var winwidth=document.body.offsetWidth
var diff=tblwidth-winwidth
if (diff>0)
	{
	var btn=document.getElementById('slider_btn')
	if (btn.title=='More')
		{
		var tleft=document.getElementById('btn_table').offsetLeft-(diff+10)
		document.getElementById('btn_table').style.left=tleft;
		btn.innerHTML='&lt;&lt;&lt;'
		btn.title='Back';
		}
	else
		{
		document.getElementById('btn_table').style.left=0;
		btn.innerHTML='&gt;&gt;&gt;'
		btn.title='More'
		}
	}
else
	{
	//if buttons are hidden then this is now required for neg values
	document.getElementById('btn_table').style.left=0
	document.getElementById('slider_btn').style.visibility='hidden'
	document.getElementById('slider_btn').style.display='none'
	}
}

//----------------------------------------------
function _SlideByMouse(evt)
{
//deprecated in version 5
return false
evt=(evt) ? evt :((window.event) ? event : null)
if (evt)
	{
	if (document.getElementById('tabs_exist').value=='y')
		{
		//get source id of the mouse click
		var source
		if (document.all){source=evt.srcElement.id}
		else {source=evt.target.id}
		source=source.toLowerCase()

		//only response to clicks on header - ignore buttons
		if (bBorderVisible && source=='header')
			{
			document.getElementById('btn_table').style.position='relative'
									
			var mousebtn=evt.button
			var tleft
			switch (mousebtn)
				{
				//mozilla returns zero
				case 0 :
				document.getElementById('header').style.cursor='e-resize'
				tleft=document.getElementById('btn_table').offsetLeft-50
				document.getElementById('btn_table').style.left=tleft+"px"
				window.status='<---'
				break;
				
				//ie returns 1
				case 1 :
				document.getElementById('header').style.cursor='e-resize'
				tleft=document.getElementById('btn_table').offsetLeft-50
				document.getElementById('btn_table').style.left=tleft+"px"
				window.status='<---'
				break;
				
				//both return 2
				case 2 :
				document.getElementById('header').style.cursor='w-resize'
				tleft=document.getElementById('btn_table').offsetLeft+50
				document.getElementById('btn_table').style.left=tleft+"px"
				window.status='--->'
				break;
				}
			}
		}
	
	}	
}

//----------------------------------------------
function _SlideByKeystroke(evt)
{
//prevent any action if sized correctly
//bBorderVisible variable now resued as flag to indicate if viewing are is undersized
//it is set in _CheckMinWidth when undersize conditions are met
if (!bBorderVisible)
	{
	try{if (!document.all){evt.preventDefault()}}
	catch(e){}
	return false
	}

//parse event
evt=(evt) ? evt :((window.event) ? event : null)

//key action
if (evt)
	{
	document.getElementById('btn_table').style.position='relative'
	var key=evt.keyCode
	//alert(key)
	var tleft
	switch (key)
		{
		case 35 :
		if (allowAPIView=="y"){ShowVersionInfo()}
		if (!document.all){_Resizer()}
		break
		
		case 36 :
		document.getElementById('btn_table').style.left=0;
		ShowFrame(1)
		break
		
		case 37 :
		tleft=document.getElementById('btn_table').offsetLeft-50
		document.getElementById('btn_table').style.left=tleft
		break
		
		case 39 :
		
		//version 5 fix now only left arrow is used - simpler and clearer
		if (!document.all)
			{
			evt.preventDefault()
			document.getElementById('btn_table').style.left="0px";
			ShowFrame(1)
			}
		else
			{
			document.getElementById('btn_table').style.left=0;
			ShowFrame(1)
			}
		break
		
		case 40 :
		if (allowAPIView=="y")
			{
			var features="menubar=no,toolbar=no,statusbar=no,resizable=yes,scrollbars=yes,top=0,left=0,width=600,height=600"
			var apiWin=window.open('../../includes/clsAPI.htm','api',features)
			try{if (apiWin.document){apiWin.focus();apiWin.document.title="API Page Calls"}}catch(e){}
			}
		break
		}
	}
	return false
}

//----------------------------------------------
function _ShowChat(inLang)
{
//convert inLang to chat format
var chatlang=inLang.substr(0,2).toLowerCase()

//create chat url / can be hard coded as shown
chatUrl="../../chat/chat44/conquerchat/default.asp?language="+chatlang

//size popup window
var ph=window.screen.height*.65
var pw=window.screen.width*.5
var pleft=window.screen.width*.4
var sFeatures="menubar=n,toolbar=n,resizeable=n,top=0,left="+pleft+",width="+pw+",height="+ph

//open window
chatwin=window.open(chatUrl,"chatter",sFeatures)

/*
code provided below to make chat window modal but I'm not sure this is
a good idea - chatters may want to keep chat open from module to module
so provisions for minimizing or closing are not actived here or i clsModules
chatwin_id=setInterval("ChatWinFocus()",10000)
*/

}
//chat popup window check to maintain focus
/*
function ChatWinFocus()
{
try{
if (chatwin){chatwin.focus()}
else{window.clearInterval(chatwin_id);chatwin=null}
}
catch(e){return}
}
*/	

//-------------------------------------------------------
function _SetAllButtons(inType,inColor,inHdrHeight,inTile)
{

//assign default value
if (!inType){inType="button"}

//set scroll to top
if (!document.all){window.scroll(0,0)}

//size toolbar button widths
var pics=document.images

//get heights for table height computation
var pic_height=parseInt(pics[0].height)
var tbl_height=parseInt(inHdrHeight)

//set button picture widths
debugmode=global_module_debug
var btn,cell
for (var i=0;i<pics.length;i++)
	{
	if(pics[i].name.indexOf("img_")!=-1)
		{
		btn=pics[i].parentNode
		btn.style.width=pics[i].width+10
		btn.style.visibility="visible"
		btn.style.display="block"
		if (debugmode)
			{
			btn.style.border="solid black 2px"
			cell=btn.parentNode
			cell.style.border="solid red 2px"
			}
		}
	}

//title cell action
var title_cell=document.getElementById('td_title')
title_cell.style.width="100%"
if (debugmode){title_cell.style.border="solid red 2px"}

//make header table visible
var header=document.getElementById('header')
header.style.display='block'
header.style.visibility='visible'
header.style.margin="0px"
header.style.width="100%"

if (!document.all){header.style.width="100%"}

//override header height for firefox
if (!document.all)
	{
	if (pic_height>=tbl_height)
		{header.style.height='auto'}
	else
		{
		try{
						
			//new code 13 feb 2008 forces header height to pic height if pic height is greater
			var home_cell=document.getElementById('home_cell')
			home_cell.style.height=(tbl_height-12)
			}
		catch(e){}
		}	
	}	

//debug mode table border
if (debugmode){header.style.border="solid green 3px"}

//get table object and preset table height
var tbl=document.getElementById("btn_table")

//size a div mask behind the topic selector table space
//that allows a unique color to be assigned to button bar
try 
	{

	var div=document.getElementById("topicbar")
	with(div)
		{
		style.position="absolute"
		if (document.all)
			{
			style.top=(tbl.offsetTop-1)+"px"
			style.left=(tbl.offsetLeft)+"px"
			style.height=(tbl.offsetHeight)+"px"
			}
		else
			{
			style.top=(tbl.offsetTop-1)+"px"
			style.left=(tbl.offsetLeft)+"px"
			style.height=(tbl.scrollHeight-1)+"px"
			}	
		style.width="100%"
		style.backgroundColor=inColor
		
		if (debugmode){div.title=style.height}
				
		//note code for possible tile on topic bar can be 20-24 pixels high depending on selected font
		try
			{if (inTile){style.backgroundImage="url(images/"+inTile+")"}}
		catch(e){}	
		
		style.zIndex=0
		style.visibility="visible"
		style.display="inline"
		}
	}

catch(e){document.body.style.backgroundColor=inColor;div.style.display="none"}			

//change font size for 800x600
if (window.screen.width<1024){document.getElementById("header_text").style.fontSize="14pt"}
else{document.getElementById("header_text").style.fontSize="16pt"}


return true
}

//--------------------------------------------
//used when custom button used for mcqs
//--------------------------------------------
function _AutoMCQ()
{
ToolbarButtonVisibleFromChild(false,'extras','')
ToolbarButtonVisibleFromChild(false,'custom','')
ToolbarButtonVisibleFromChild(false,'search','')
ToolbarButtonVisibleFromChild(false,'help','')
HideTopicBar(TopicCount)
}

//-----------------------------------------------
function _CheckMinWidth(inLang)
{
//deactivate for frameset usage
try
	{
	var fr=GetHomeFrame()
	if (fr.name=="FRAME_MAIN"){return}
	}
catch(e){return}	

//handle case where tabs extend off the page when not in frameset	
if (document.getElementById("tabs_exist").value=='y' && bMaxMsg==false)
	{
	if (document.body.offsetWidth<window.screen.width)
		{
				
		//check if last tab is hidden
		try
			{
			var lastTab=document.getElementById("tabstrip_row").cells[TopicCount-1]
			if (lastTab.style.visibility=="hidden"){var lastTabWidth=lastTab.offsetWidth}
			else {var lastTabWidth=0}
			}
		catch(e){var lastTabWidth=0}
		//alert("bt="+btn_table.offsetWidth+",lt="+lastTabWidth+",bw="+document.body.offsetWidth)
		if (document.getElementById("btn_table").offsetWidth-lastTabWidth>document.body.offsetWidth)
			{
			//deprecated in version 5 - now just left arrow key is active
			//document.getElementById('header').style.borderBottom='dashed red 3px'
			document.getElementById('header').focus()
			bBorderVisible=true
			ShowResizeMsg(inLang)
			bMaxMsg=true
			}
		}
	}	

}

//-------------------------------------------------
function _ShowPopupError(inLanguage)
{
var popup_msg
if (inLanguage=="english")
	{
	popup_msg="This application uses popup windows for a variety of display purposes.\n\nPlease ensure your popup blocker is disabled so that application popups can be viewed."
	popup_msg+="\n\nWe warrant that application popups are not for advertising purposes."
	}
else
	{
	popup_msg="Cette application fait appel à des fenêtres éclairs pour accéder à divers types d'affichage.\n\nVeuillez vous assurer que votre bloqueur de fenêtres publicitaires est désactivé afin de visualiser les fenêtres de l'application."
	popup_msg+="\n\nNous garantissons que les fenêtres de l'application ne sont pas destinées à des fins de publicité."
	}
alert (popup_msg)
return
}

//---------------------------------------------------
function GetHomeFrame()
{
try
	{
	var parentFrames=window.parent.frames
	if (parentFrames){return parentFrames[1]}
	}
catch(e){return null}
}		
	
