// Bank of Queensland

function getHeight( elem )
{
	var height = 0;
	
	if(elem.offsetHeight){ 
		height=elem.offsetHeight; 
	} 
	else if(elem.style.pixelHeight)	{ 
		height=elem.style.pixelHeight;
	} 	
	return height;
}

function getY(obj)
{
	var curtop = 0;
	if (obj.offsetParent){
		while (obj.offsetParent){
			curtop += obj.offsetTop
			obj = obj.offsetParent;
		}
	}
	else if (obj.y)
		curtop += obj.y;
	return curtop;
}	

var rhsOffset = 236;

function updateRHSPromobarHeight()
{
	var page_end = document.getElementById( "page_end_outer" );
	var promobar_content = document.getElementById( "rhs_promobar_content" );		
	var bottom = getY( page_end );			
	promobar_content.style.height =  (bottom - rhsOffset) + "px";
}

function doResize()
{
//	updateRHSPromobarHeight();
}

function rhsInitSpotlight()
{
	rhsOffset = 116;
	updateRHSPromobarHeight();
}

function loadIB() 
{
   var resize = '';
   var titlebar = '';
   var wvalue = screen.width - 7;
   var hvalue = screen.height - 75;
   var ibWin = window.open('https://www.boq.com.au/EDS.IB.Presentation/','', 'top=0,left=0,toolbar=no,location=no,directories=no,status=yes,menubar=no,scrollbars=yes,resizable=yes,width=' + wvalue + ',height=' + hvalue + resize + titlebar + ',hotkeys=0');  
}

function setTagFontSize(tag, fontSize, rootElem) 
{
	var i, elem;
	if( rootElem == null ) rootElem = document;
    for(i=0; (elem = rootElem.getElementsByTagName(tag)[i]); i++) 
	{
		if( elem != null ) 
		{
			elem.style.fontSize = fontSize;
		}
    }
}

function setIdFontSize( id, fontSize )
{
	var elem = document.getElementById( id )
	if( elem != null )
	{
		elem.style.fontSize = fontSize;
	}
}

function setIdTagFontSize( id, tag, fontSize )
{
	var elem = document.getElementById( id )
	if( elem != null )
	{
		setTagFontSize( tag, fontSize, elem );
	}	
}


function setFontSizeSmall()
{
	setTagFontSize("td", "xx-small");
	setTagFontSize("th", "xx-small");
	setIdFontSize("content", "xx-small");
	setIdTagFontSize("content", "td", "xx-small" );
	setIdTagFontSize("content", "th", "xx-small" );
	setTagFontSize("h1", "medium");
	setTagFontSize("h2", "x-small");
	setTagFontSize("h3", "x-small");
	setIdTagFontSize("toolbar","a", "xx-small");	
	setIdFontSize("rhs_promobar_content", "xx-small");
	setIdTagFontSize("rhs_promobar_content", "h1", "xx-small" );
	setIdFontSize("footer", "xx-small");	
	setIdFontSize("page_disclaimer", "xx-small");	
	setIdFontSize("lhs_nav", "xx-small");	
}

function setFontSizeNormal()
{
	setTagFontSize("td", "small");
	setTagFontSize("th", "small");
	setIdFontSize("content", "small");
	setIdTagFontSize("content", "td", "x-small" );
	setIdTagFontSize("content", "th", "x-small" );	
	setTagFontSize("h1", "large");
	setTagFontSize("h2", "small");
	setTagFontSize("h3", "small");
	setIdTagFontSize("toolbar","a", "x-small");	
	setIdFontSize("rhs_promobar_content", "x-small");
	setIdTagFontSize("rhs_promobar_content", "h1", " x-small" );
	setIdFontSize("footer", "x-small");	
	setIdFontSize("page_disclaimer", "xx-small");	
	setIdFontSize("lhs_nav", "x-small");	
}

function setFontSizeLarge()
{
	setTagFontSize("td", "medium");
	setTagFontSize("th", "medium");
	setIdFontSize("content", "medium");
	setIdTagFontSize("content", "td", "small" );
	setIdTagFontSize("content", "th", "small" );		
	setTagFontSize("h1", "x-large");
	setTagFontSize("h2", "medium");
	setTagFontSize("h3", "medium");
	setIdTagFontSize("toolbar","a", "small");	
	setIdFontSize("rhs_promobar_content", "small");
	setIdTagFontSize("rhs_promobar_content", "h1", " small" );
	setIdFontSize("footer", "small");	
	setIdFontSize("page_disclaimer", "x-small");	
	setIdFontSize("lhs_nav", "small");	
}

function addBookmark(url,bookmarkText)
{
	if(bookmarkText=='')bookmarkText=url;
	if (document.all)window.external.AddFavorite(url,bookmarkText);
	else alert('Press CTRL and D to add a bookmark to:\n"'+url+'".');
}

function bookmarkThisPage()
{
	addBookmark( self.location.href , document.title );	 
}

function doQuickLink( selectName )
{
	var theSelect = document.getElementById( selectName );
	window.location=theVal = theSelect.options[theSelect.selectedIndex].value;	
}

function doOnlineServices( valIndex )
{
	for( var i=0; i < document.Form1.onlineservices_radiobtn.length; i++ )
	{
		if( document.Form1.onlineservices_radiobtn[i].checked )
		{
			var val_array = document.Form1.onlineservices_radiobtn[i].value.split("|");
			var target = val_array[valIndex];
			if( target.length > 11 )
			{
				if( target.substring(0,11) == "javascript:" )
				{
					eval(target);
				}
				else
					window.location=target;
			}
			else
				window.location=target;
		}
	}
}

function doOnlineSignIn() 
{
	doOnlineServices( 0 );
}

function doOnlineMoreInfo()
{
	doOnlineServices( 1 );
}

function doSearch()
{
	var searchTerm = document.Form1.search.value;
	if( searchTerm.length > 0 )
		window.location  = "http://www.boq.com.au/search.aspx?search=" + searchTerm;
	else
		window.location = "http://www.boq.com.au/search.htm"
}

function Launch(page) {
OpenWin = this.open(page, "NewWin", "toolbar=yes,menubar=yes,location=yes,scrollbars=yes,resizable=yes,width=800,height=600");
}

function LaunchWindow(page, settings)
{
OpenWin = this.open(page, "NewWin", settings);
}

function launchPopup(page) {
OpenWin = this.open(page, "CtrlWindow", "toolbar=no,menubar=no,location=no,scrollbars=no,resizable=no,width=500,height=400");
}

function SearchKeyDownHandler(btn)
{				
	// process only the Enter key
	if (event.keyCode == 13)
	{
		// cancel the default submit
		event.returnValue=false;
		event.cancel = true;
		// submit the form by programmatically clicking the specified button
		doSearch();
	}
}

function launchStreamXWindow(page) 
{
   var resize = '';
   var titlebar = 'no';
   var wvalue = 768;
   var hvalue = 485;
   strmx = window.open(page,'', 'top=0,left=0,toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=no,width=' + wvalue + ',height=' + hvalue + resize + titlebar + ',hotkeys=0');					
}

