//          +++++++++++++++++++++++++++++++++++
//         (C) Copyright 2003 - 2010 Niro Solutions Pty Limited ABN 89 106 967 140
//			+++++++++++++++++++++++++++++++++++
//			Version: 4.0.0
//			+++++++++++++++++++++++++++++++++++
//			Original author: Miles Glisovic
//			Last update completed by: Bruce Sun
//			Modification date: 20/12/10
//			+++++++++++++++++++++++++++++++++++

var cCol="";
var numberOfTabs = 4
var fcs=false



function cursorH(e)
{
	e.style.cursor = "pointer";
}
function cursorA(e)
{
	e.style.cursor = "default";
}					












function selectCmb(field)
{
	field.focus()
}

function pctOrDollar()
{
	var f=document.forms.frmName
	if(f.rdMemberCont[0].checked)
	{
		f.txtPctOfSalary.disabled = false
		//f.txtPctOfSalary.className=''
		//document.getElementById("ccc2").className='';
		//document.getElementById("ccc3").className='';
		select(f.txtPctOfSalary)

		f.txtDollarAmount.value = ""
		f.txtDollarAmount.disabled = true
		//f.txtDollarAmount.className='InputBorderGray'
		//document.getElementById("ccc0").className='CellDimmed';
		//document.getElementById("ccc1").className='CellDimmed';
		f.cmbDollarAmountFreq.disabled = true
	}
	else
	{
		f.txtDollarAmount.disabled = false
		//f.txtDollarAmount.className=''
		f.cmbDollarAmountFreq.disabled = false
		//document.getElementById("ccc0").className='';
		//document.getElementById("ccc1").className='';
		select(f.txtDollarAmount)
		$("#slider_savings").slider( "value", 0 );
		f.txtPctOfSalary.value = ""
		f.txtPctOfSalary.disabled = true
		//f.txtPctOfSalary.className='InputBorderGraySmall'
		//document.getElementById("ccc2").className='CellDimmed';
		//document.getElementById("ccc3").className='CellDimmed';
	}
}
	
function selectRD(i)
{
	document.forms.frmName.rdMemberCont[i].click()
}

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))
	{
	    calcResults(f)
		showTab(tabNumber);
	}
}

function goToStep4(e,tabNumber)
{
	var f=document.forms.frmName
	if(validStep1(f))
	{
	    calcResults(f)
		showTab(tabNumber);
	}
}

function loadAndShow()
{   
   // ajaxManager('start_up')
   
 	//preLoadImages(3)
	initialise();
	//setSiteStuff();
	
	// showTab(1);
	

	
	
    
}

function preLoadImages(noOfTabs)
{
	var i;
    var p = "images/calculators/"

	for(i=1;i<=noOfTabs;i++)
	{
		eval("ctab"+i+"on = new Image();")
		eval("ctab"+i+"on.src = '"+p+"menu_"+i+"g.gif';")
		eval("ctab"+i+"off = new Image();")
		eval("ctab"+i+"off.src = '"+p+"menu_"+i+".gif';")
	}
		eval("gtabl = new Image();")
		eval("gtabl.src = '"+p+"menu_gtab-left.gif';")
		eval("gtabr = new Image();")
		eval("gtabr.src = '"+p+"menu_gtab-right.gif';")

		eval("wtabl = new Image();")
		eval("wtabl.src = '"+p+"menu_wtab-left.gif';")
		eval("wtabr = new Image();")
		eval("wtabr.src = '"+p+"menu_wtab-right.gif';")
		
}


function openInMain(page1)
{
    try
    {
	    (window.opener).location=page1
	    window.opener.focus()
    }
    catch(e)
    {
	    msgWindow1=null;
	    msgWindow1=window.open(page1,'mainWindow');
	    self.close()
    }
}

function cursorHU(e)
{
	e.style.cursor = "pointer";
}

function cursorHU0(e)
{
	//window.event.srcElement.className='hrHoover0';
}

function setLarge()
{
	txtsize1.className='largeTextSize';
	txtsize2.className='fullRow';
	txtsize3.className='fullRow';
}

function setSmall()
{
	txtsize1.className='bodytext';
	txtsize2.className='middleRow';
	txtsize3.className='middleRow';
}

function openPrintWnd()
{
    window.print()
}

function showTab(tabNumber)
{

		/*  disable all DIVs */
		$('#ul_t1').hide();
		$('#ul_t2').hide();
		$('#ul_t3').hide();
		$('#ul_t4').hide();
                        	
		switch (tabNumber)
		{	
		
			case 1 :
				
				$('.slideshow').cycle(0);
				setTimeout("$('#txtAge').focus()",1300);				
				$('#ul_t1').show();
				if(fcs)
				{
					window.location.href="#top1"
					select(document.forms.frmName.txtGrossIncome)
				}
				break;
			case 2 :
				
				$('.slideshow').cycle(1); 
				$('#ul_t2').show();
				break;
			case 3 :
			
				$('.slideshow').cycle(2); 
				$('#ul_t3').show();
				break;
				case 4 :
				
				$('.slideshow').cycle(3); 
				$('#ul_t4').show();
				break;
		}
		if(tabNumber!=1) window.location.href="#top1"
		}

		
function ToggleInfo(strSection)
    {
        SectionTitle=document.getElementById(strSection+'title')
        SectionText=document.getElementById(strSection+'text')

        if (SectionText.style.display=='none')
        {
            SectionText.style.display='block';
            SectionTitle.className='botinfo_title_exp';
        }
        else
        {
            SectionText.style.display='none';
            SectionTitle.className='botinfo_title_col';
        }
    }
function winclose()
    {
		var win
			win = window.parent.document.getElementById("frmSalSac")
			win.src = ""
			win.style.display = "none"
}
var msgWindow = null; // hold a reference to new window

function openPrintFriendlyWnd(f) {
    if (validStep1(f)) {
        cleanUp()
        msgWindow = window.open('awm_salsac_pfv.htm', "PFVResults", "menubar=no,scrollbars=yes,resizable=yes,width=897,height=400,top=10,left=100");
    }
}
function cleanUp() {
    if (msgWindow != null) {
        if (!msgWindow.closed) {
            msgWindow.close();
            msgWindow = null;
        }
        else {
            msgWindow = null;
        }
    }
}

