function MyGetObjectById(id)
{
	var el;
	
	var o;
	o = document;
	el = o.getElementById(id);

	if (el == null)
		el = o.all[id];

	return el;
}

function Make_Visible(myDiv)
{
	if (myDiv != null)
	{
		myDiv.style.display='Block';
		myDiv.style.visibility = "visible";
	}
}

function Make_InVisible(myDiv)
{
	if (myDiv != null)
	{
		myDiv.style.display='None';
		myDiv.style.visibility = "hidden";
	}
}

function Set_Visibility(myDiv, visibilityFlag)
{
	if (visibilityFlag == false)
		Make_InVisible(myDiv);
	else
		Make_Visible(myDiv);
}


function MakeMyHomePage(obj, url)
{
	if (IsMicrosoft())
	{
		try
		{
			obj.setHomePage(url);
		}
		catch(e)
		{
			alert("There was a problem trying to set your home page.  Please try manually.\n" + e.message);
		}
	  
	}
	else
	{
		if (IsMozilla()) 
		{
			try
			{
				netscape.security.PrivilegeManager.enablePrivilege("UniversalPreferencesWrite");
				navigator.preference('browser.startup.homepage',url);
			}
			catch(e)
			{
				alert("There was a problem trying to set your home page.  Please try manually.");
			}
		}
		else 
		{ 
			alert('Sorry, you can only add set your home page if you are '+
					'running IE 4.0+, Netscape 6 or Mozilla.');
		}
		
	}
}

function BookMarkSite(title, url)
{
	if (IsMicrosoft())
	{
		try
		{
		   window.external.AddFavorite(url, title);
		 }
		catch(e)
		{
			if (e.message == "Permission denied")
				alert("Security setting prevent adding a favourite.  Please try manually.");
			else
				alert("There was a problem adding the favourite.  Please try manually.");
		}
	}	
	else 
		if (IsMozilla())
		{
			try 
			{
				window.sidebar.addPanel(title, url, ''); 
			}
			catch (e) 
			{
				alert('An error occurred when trying to add our tab to your '+
					'Sidebar. This is most likely the result of a known bug '+
					'(see Bugzilla #97016) in some Netscape6/Mozilla versions. '+
					'You should be able to click the add tab link again now '+
					'and it should work properly.\n\n'+
					'If you continue to have problems, try opening your sidebar '+
					'first, and then click the add tab link.');
			}
		} 
		else 
		{ 
			alert('Sorry, you can only add the favourite if you are '+
					'running IE 4.0+, Netscape 6 or Mozilla.');
		}
	
}

function PrintThisPage(printFlag)
{
	var currenturl;
	
	currenturl = document.URL;

	var PBar;
	
	PBar = MyGetObjectById('Header_divPrintBar');
	Set_Visibility(PBar, printFlag); 
	
	PBar = MyGetObjectById('toolbar');
	Set_Visibility(PBar, !printFlag); 
	PBar = MyGetObjectById('header');
	Set_Visibility(PBar, !printFlag); 
	PBar = MyGetObjectById('footerright');
	Set_Visibility(PBar, !printFlag); 
	PBar = MyGetObjectById('footerleft');
	Set_Visibility(PBar, !printFlag); 
	PBar = MyGetObjectById('footer');
	Set_Visibility(PBar, !printFlag); 
	PBar = MyGetObjectById('leftcolumn');
	Set_Visibility(PBar, !printFlag); 
		
	PBar = MyGetObjectById('wrap');
	if (PBar != null)
	{
	
		if(printFlag)
		{
			PBar.style.width = '822px';
			
			PBar = MyGetObjectById('leftgutter');

			if (PBar != null)
			{
				if (IsMozilla()==false)
					PBar.style.styleFloat = 'left';
				else
					PBar.style.cssFloat = 'left';
			}
		}
		else
		{
			PBar.style.width = '972px';

			PBar = MyGetObjectById('leftgutter');
			
			if (PBar != null)
			{
				if (IsMozilla()==false)
					PBar.style.styleFloat = 'right';
				else
					PBar.style.cssFloat = 'right';
	
			}
		}
	}
	PBar = MyGetObjectById('promorow');
	Set_Visibility(PBar, !printFlag); 
	PBar = MyGetObjectById('breadcrumb');
	Set_Visibility(PBar, !printFlag); 
}

function PerformPrintThisPage(printFlag)
{
	var PBar;

	PBar = MyGetObjectById('Header_divPrintBar');
	Set_Visibility(PBar, false); 

	window.print();
	
	Set_Visibility(PBar, true); 
}

function IsMicrosoft()
{
	if (window.navigator.appName.toLowerCase().indexOf("microsoft") > -1)
		return true;
	else
		return false;
}

function IsMozilla()
{
	if (window.sidebar)
		return true;
	else
		return false;
}

function HandCursor(cell)
{
	if(navigator.userAgent.indexOf('MSIE 5') == -1 ) 
		cell.style.cursor='pointer';
	else 
		cell.style.cursor='hand';
}

