/* ---------------------------
' (C) Copyright 2007
' Niro Solutions Pty Limited
' ABN 89 106 967 140
' ---------------------------
' Revision: 2.0.0
' Author: Miles Glisovic
' Modtime: 09/08/07
' --------------------------- */
var numberOfTabs = 4
// parameter STRINGS to be retreived from DB and used in initialise()

var MIN_SALARY=10000//p.a.
var MAX_SALARY=554938

var MIN_PRETAX=1
var MAX_PRETAX=999999
var MAX_PRETAX_pctg=1.0


var TAX_RATE = 0.15;


var CONCCONT50000=50000

var cCol="";
var fcs=false
var msgW=null
var navigator_appName=""
function pctOrDollar() {
    var f = document.forms.frmName
    if (f.rdMemberCont[0].checked) {
        f.txtPctOfSalary.disabled = false
        f.txtPctOfSalary.className = ''
        document.getElementById("ccc2").className = '';
        select(f.txtPctOfSalary)

        f.txtDollarAmount.value = ""
        f.txtDollarAmount.disabled = true
        f.txtDollarAmount.className = 'InputBorderGray'
        document.getElementById("ccc0").className = 'CellDimmed';
        document.getElementById("ccc01").className = 'CellDimmed';

        f.cmbDollarAmountFreq.disabled = true
        f.cmbDollarAmountFreq.selectedIndex = 3
    }
    else {
        f.txtDollarAmount.disabled = false
        f.txtDollarAmount.className = ''
        f.cmbDollarAmountFreq.disabled = false
        document.getElementById("ccc0").className = '';
        document.getElementById("ccc01").className = '';
        select(f.txtDollarAmount)

        f.txtPctOfSalary.value = ""
        f.txtPctOfSalary.disabled = true
        f.txtPctOfSalary.className = 'InputBorderGray'
        document.getElementById("ccc2").className = 'CellDimmed';
    }
}
function showDIV_CSRF(myDIV, noOfTabs)
{
	var setDIV = myDIV.getAttribute("ID");
	for(i=1;i<=noOfTabs;i++)
	{
		// disable all DIVs
		eval("divTab"+i+".style.display = 'none';")
		// change element's class to another class:
		eval("tabStep"+i+".className='tabOff';")
	}
	myDIV.style.display = "";
	for(i=1;i<=noOfTabs;i++)
	{
		eval("if(setDIV == 'divTab"+i+"')	{	tabStep"+i+".className='tabOn';}")
	}
}
function cursorH(e)
{
	e.style.cursor = "pointer";
}
function cursorA(e)
{
	e.style.cursor = "default";
}							
function doChanges(e)
{
	// get this 'e' element's table and set backgroundColor
	// of rows to cCol
	var rr = getMyTable(e);
	for(i=0;i<rr.rows.length-3;i++)
		rr.rows[i].style.backgroundColor=cCol
	e.style.backgroundColor = "#efefef";
}
function restore(e)
{
	var rr = getMyTable(e);
	for(i=0;i<rr.rows.length-3;i++)
		rr.rows[i].style.backgroundColor=cCol
	e.style.backgroundColor = cCol;
}
function select(field)
{
if((navigator.appName).toUpperCase()!="NETSCAPE")
{
	try
	{
		field.focus()
		field.select()
	}
	catch(e)
	{
		;//alert(e)
	}
}
}
function getMyDIV(x)
{
	// start with an element and go up through the tree trying to find
	// a <DIV> HTML element;
	// return a reference to an object of type <DIV>
	// or, if not found, return null
	if(x!=null && x.tagName!="DIV")
		return (getMyDIV(x.parentNode));
	else
		return x;
}
function getMyTable(x)
{
	if(x!=null && x.tagName!="TABLE")
		return (getMyTable(x.parentNode));
	else
		return x;
}
function switchToDIV(field)
{
	var rr = getMyDIV(field);
	if(rr.style.display=="none")
		showDIV_CSRF(rr,numberOfTabs)
}

function goToStep2(e,tabNumber)
{
	var f=document.forms.frmName
	if(validStep1(f))
	{
		calcResults(f)
		showTab(tabNumber);
	}
}

function goToStep3(e,tabNumber)
{
	var f=document.forms.frmName
	if(validStep1(f))
	{
			showTab(tabNumber);
	}
}
function showImages()
{
	document.images.btnClose.style.display = "";
}
function showTab(tabNumber)
{
	if(!fcs)
		stopGIF(true);
showImages()
		document.getElementById("divPreLoad").style.display = "none";
		document.getElementById("divIntro").style.display = "";
		document.getElementById("divMain").style.display = "";
		document.getElementById("divAssumption").style.display = "";
		document.getElementById("divDisclaimer").style.display = "";
		document.getElementById ('tabStep1').className=''
		document.getElementById ('tabStep2').className=''
		document.getElementById ('tabStep3').className=''
		/*  disable all DIVs */
		document.getElementById("divTab1").style.display = "none";
		document.getElementById("divTab2").style.display = "none";
		document.getElementById("divTab3").style.display = "none";
		switch (tabNumber)
		{
			case 1 :
				document.getElementById ('tabStep1').className='active'
				document.getElementById("divTab1").style.display = "";
				if(fcs)
				{
					window.location.href="#top1"
					select(document.forms.frmName.txtGrossIncome)
				}
				break;
			case 2 :
				document.getElementById ('tabStep2').className='active'
				document.getElementById("divTab2").style.display = "";
				window.location.href="#top1"
				break;
			case 3 :
				document.getElementById ('tabStep3').className='active'
				document.getElementById("divTab3").style.display = "";
				window.location.href="#top1"
				break;
		}
}


//function initialise()
//{
//try
//{
//	var f=document.forms.frmName
//	f.txtGrossIncome.value=(isInt(initGrossSalary))?initGrossSalary:""
//	if(initGrossSalaryFreq!="") f.cmbGrossIncomeFreq.selectedIndex=getCmbIndex(f.cmbGrossIncomeFreq,initGrossSalaryFreq.charAt(0))
	//etc.
//}
//catch(e)
//{
//	alert(e)
//}
//}
function openInMain(page1)
{
try
{
	(window.opener).location=page1
	window.opener.focus()
}
catch(e)
{
	msgWindow1=null;
	msgWindow1=window.open(page1,'mainWindow');
	self.close()
}
}

function openWin(page1)
{
try
{
		msgW.close()
		msgW=null
}
catch(e)
{}

try
{
	msgW=null;
	msgW=window.open(page1,'CSF_Window');
	msgW.focus()
}
catch(e)
{}
}
function setCursorHand(e)
{
	e.style.cursor = "pointer";
}
function setActiveTab(e,s)
{
	if(e.className == 'active')
		e.className='active hov'
	else
		e.className='hov'
	setCursorHand(e);
	showStatus(s)
}
function setInactiveTab(e)
{
	if((e.className).indexOf("active") < 0)
		e.className=''
	else
		e.className='active'
	showStatus('')
}
function showStatus(s)
{
	window.status=s;
	return true;
}
function showDIV1()
{
document.forms.frmName.rdMemberCont[0].click()
showTab(1)
fcs=true
}

function stopGIF(stopIt)
{
if(stopIt)
{
document.getElementById("loading").style.display = "none";
document.getElementById("loading").src = null;
}
else
{
;
}
}

function selectRD(i)
{
	document.forms.frmName.rdMemberCont[i].click()
}







