// Style colors that are dynamically allocated

	// Defined Style colors for the mouseover/mouseout functions for the tabs
	// May be overwritten on a page if required.
	var G_TabMouseOverColor='#6699FF';
	var G_TabMouseOutColor='aliceblue';
	var G_TabTextOverColor='#FFFFFF';
	var G_TabTextOutColor='#336699';
	var SupportURL = "../../cgi-bin/t2m_support.cgi";

	function ShowPage(xiCurrentPage)
	{
		if (ActivePage != "")
			HidePage(ActivePage);
	
		ActivePage=xiCurrentPage
		// Make the page look disabled
		DisPage();
		document.getElementById(xiCurrentPage).style.display="";
	}

	function HidePage(xiCurrentPage)
	{
		document.getElementById(xiCurrentPage).style.display="none";
		ActivePage="";
		EnPage();
	}
	
	function DisPage()
	{
		// IE 6 Work round for disabled page size
		document.getElementById('div_DisabledPage').style.height=window.screen.availHeight;
		document.getElementById('div_DisabledPage').style.width=window.screen.availWidth;

		document.getElementById("div_DisabledPage").style.display=""
		O3_FadeOpacity("div_DisabledPage", .5, 800);
	}

	function EnPage()
	{
		document.getElementById("div_DisabledPage").style.display="none"
		O3_SetOpacity("div_DisabledPage", 0);
	}

function floatButtons(iX,iY,id,xiD){

	var nn=(navigator.appName.indexOf("Netscape")!=-1);
	var dH=xiD.html,dB=xiD.body,px=xiD.layers?'':'px';
	var L=xiD.getElementById?xiD.getElementById(id):xiD.all?xiD.all[id]:xiD.layers[id];
		
	this[id+'O']=L;
	if(xiD.layers)L.style=L;
	L.nX=L.iX=iX;
	L.nY=L.iY=iY;
	L.P=function(x,y)
	{
		this.style.left=x+px;
		this.style.top=y+px;
	};
	L.Fm=function()
	{
		var pX, pY;	
		pX=(this.iX >=0)?0:nn?innerWidth:nn&&dH.clientWidth?dH.clientWidth:dB.clientWidth;	
		pY=nn?pageYOffset:nn&&dH.scrollTop?dH.scrollTop:dB.scrollTop;	
		if(this.iY<0)pY+=nn?innerHeight:nn&&dH.clientHeight?dH.clientHeight:dB.clientHeight;	
		this.nX+=.1*(pX+this.iX-this.nX);this.nY+=.1*(pY+this.iY-this.nY);this.P(this.nX,this.nY);
		setTimeout(this.id+'O.Fm()',5);
	};

	if(xiD.getElementById("Cmd_Delete_img"))
	{
		xiD.getElementById("Tool_Delete_img").style.display="";
		xiD.getElementById(id).width+=40;
	}
	
	if(xiD.getElementById("Cmd_Edit_img"))
	{
		xiD.getElementById("Tool_Edit_img").style.display="";
		xiD.getElementById(id).width+=40;
	}	
	return L;}



function command_active(CommandName, Active)
{
	element = document.getElementById('Cmd_' + CommandName + '_text');
	
	if (!(element))
			return ;
	
	if(Active)
	{
		element.style.textDecoration = 'underline';
	}
	else
	{
		element.style.textDecoration = 'none';
	}
}

function row_active(RowName, Active)
{
	element = document.getElementById('Row_' + RowName);
	if(Active)
	{
		element.style.backgroundColor = '#FFFFCC';
	}
	else
	{
		element.style.backgroundColor = 'aliceblue';
	}
}

//Perform the Mouse Over / Mouse Out functions
function TabMouseOver(xiTab,xiFloat)
{
	// Set the tab color
	document.getElementById(xiTab).style.backgroundColor=G_TabMouseOverColor;	
	document.getElementById(xiTab).style.color=G_TabTextOverColor;	
	
	// If the float tab is passed in the show it.
	if (xiFloat)
	{
		document.getElementById(xiFloat).style.display="";

	}
}

function TabMouseOut(xiTab,xiFloat)
{
	// Set the tab color
	document.getElementById(xiTab).style.backgroundColor=G_TabMouseOutColor;	
	document.getElementById(xiTab).style.color=G_TabTextOutColor;	
	
	// If the float tab is passed in the show it.
	if (xiFloat)
		document.getElementById(xiFloat).style.display="none";
}


function SelectMode_set(SelectID, State)
{
	Img_SelectEdit = document.getElementById('Img_' + SelectID + '_SelectEdit');
	Img_SelectView = document.getElementById('Img_' + SelectID + '_SelectView');
	
	if(State == 'Edit')
	{
		Img_SelectEdit.src = '../_T2M_img/Buttons_Metal/SelectEditOn.gif';
		Img_SelectView.src = '../_T2M_img/Buttons_Metal/SelectViewOff.gif';
	}
	else
	{
		Img_SelectEdit.src = '../_T2M_img/Buttons_Metal/SelectEditOff.gif';
		Img_SelectView.src = '../_T2M_img/Buttons_Metal/SelectViewOn.gif';
	}
	document.getElementById(SelectID + '_SelectMode').value = State;
}

	function SortInd_set(xi_OrderField, xi_OrderDirn)
	{
		if(Img_SortInd = document.getElementById('Sort_' + xi_OrderField))
		{
			Img_SortInd.src = '../_T2M_img/Graphics/Sort_' + xi_OrderDirn + '.gif';
		}
		if(Img_SortInd = document.getElementById('Sort_' + xi_OrderField + '_icon'))
		{
			Img_SortInd.src = '../_T2M_img/Graphics/Sort_' + xi_OrderDirn + '.gif';
		}
	}


	function goSupport()
	{
		// Build the URL
		var URL=SupportURL;
		var  MobileNumber ="";
		var  CountryID="";
		var URLJoin='?';
		
		if ( document.getElementById('CountryID'))
			CountryID=document.getElementById('CountryID').value;
		
		// If the mobile number is there ...use it
		// otherwise look for National Number and fudge the Mobile Number.. 
		// Otherwise they'll just have to enter it.	
		if ( document.getElementById('MobileNumber'))
		{
			MobileNumber=document.getElementById('MobileNumber').value
		}
		else			
		{	
			if (document.getElementById('CountryID').value == 'AU')
			{
				if (document.getElementById('NationalNumber'))
				 MobileNumber='0'+document.getElementById('NationalNumber').value;
			}
			
		}

		if ( CountryID.length > 0 )
		{
			URL += '?CountryID='+document.getElementById('CountryID').value
			URLJoin='&';
		}
		
		if (MobileNumber.length > 0)
		{
			URL += URLJoin
			URL +='MobileNumber='+MobileNumber
		}
		
		// Go Support	
		window.open(URL);
	}

	function T2MSetSize()
	{
		if (screen.width <= 1024)
		{
			if (document.getElementById('div_MainPage'))
				document.getElementById('div_MainPage').style.width='800px';		
		}
		if (screen.height <= 768)
		{
			if (document.getElementById('div_SubBrowseRows'))
				document.getElementById('div_SubBrowseRows').style.height='9.5em';
				
			if (document.getElementById('div_WorkArea'))
				document.getElementById('div_WorkArea').style.height='300px';	
		}

	}
	



