function getTickerObj(movieName){
	if (navigator.appName.indexOf("Microsoft") != -1) {
		return window[movieName]; 
	}else{ 
		if(document[movieName].length != undefined){
			return document[movieName][1]; 
		}
		return document[movieName]; 
	} 
}
var checkInt = setInterval(check,250);
function check(){
	try{
		var flash = getTickerObj("ticker");
		if(flash.GetVariable("$version")){
			flash.SetVariable("/final:_visible", "0");
			clearInterval(checkInt);
			if(flash.Movie){
				var querystring = flash.Movie;
			}else{	
				var querystring = flash.src;
			}
			var vars_qs = querystring.split("?");
			flash.LoadMovie(0,'http://www.plannerweb.com.au/ticker/ticker.swf?'+vars_qs[1]+'&sp=10');
		}
	}
	catch(err){}
}


/************************** DUMMY FACTS CALCS *****************************************

- Description - renders a dummy image page with a link to plannerweb calcs for display.

- Required files - 'factsCalc.jpg' - to be in the sites images directory.

- Activation Code String - <script>write_dummyCalcs();</script>

- Inputs - none.

*/
function write_dummyCalcs(){
document.write('<div style="float:left;width:50px;"><p style="color:#FF0000;padding-top:5px;"><strong>NOTE*</strong></div>');	
document.write('<div style="float:left;width:360px;"><p style="color:#FF0000;padding-top:5px;">This page is currently disabled &amp; is only for display purposes.<br>When your website is uploaded this feature will be enabled.</p></div>');	
document.write('<div style="float:left;width:200px;"><p style="color:#FF0000;padding-top:5px;"><a href="http://acctweb.factsonline.com.au/Default.aspx?part=VRK1L3HSpSY=" target="_blank" style="color:#FF0000;">Please click here if you would<br>like to see a demonstration &gt;</a></div>');	
document.write('<div style="text-align:center;float:left;width:100%;padding-top:10px;"><img src="templates/wwwcabotsquarecomauindexphp/images/factsCalc.jpg" width="655" height="407" /></div>');	
}

/************************** CURRENT DATE *****************************************

- Description - renders Current date.

- Required files - none.

- Activation Code String - <div id='clock'>
	<script>
		currentDate('#aea375','#ffffff','bold','right','none');
	</script>
</div>

- Inputs - (backgroundColor,Color,Bold,align,border)

*/

function currentDate(bg,tc,fw,ta,b){
var timer;
var days = new Array("Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday");
var months = new Array("January","February","March","April","May","June","July","August","September","October","November","December");
var d = new Date();
dayValue = d.getDay();
dateValue = d.getDate();
monthValue = d.getMonth();
minuteValue = d.getMinutes();
hourValue = d.getHours();
secValue = d.getSeconds();	

	if(secValue < 10)secValue = '0'+secValue;
	if(minuteValue < 10)minuteValue = '0'+minuteValue;
	if(hourValue < 10)hourValue = hourValue;
	//alert(hourValue);
	if(hourValue > 11){
		suffix = 'pm';
		if(hourValue > 12){
			hourValue = hourValue-12;
		}
	}else{
		suffix = 'am';
		if(hourValue == 0){
			hourValue = 12;
		}
	}

	if(navigator.appName.indexOf('Microsoft') != -1)year = (0000 + d.getYear());
	if (navigator.appName.indexOf('Netscape') != -1)year = (1900 + d.getYear());
	if(!document.getElementById("dateTime")){
		this.displayArea = document.createElement("input");
		this.displayArea.id = 'dateTime';
		var appendDisplayArea = document.getElementById("clock");
		appendDisplayArea.appendChild(displayArea);
		
		this.displayArea.style.backgroundColor = bg;
		this.displayArea.style.fontFamily = 'Verdana, Arial, Helvetica, sans-serif';
		this.displayArea.style.color = tc;
		this.displayArea.style.fontSize = '9px';
		this.displayArea.style.fontWeight = fw;
		this.displayArea.style.textAlign = ta;
	 	this.displayArea.style.border = b;
		this.displayArea.style.width = '220px';
		//this.displayArea.size = 38;
	}
	//write the clock content string
	this.clockContent = hourValue+':'+minuteValue+':'+secValue+' '+suffix+' - '+days[dayValue]+' '+dateValue+' '+months[monthValue]+' '+year;
	// set date
	this.displayArea.value = clockContent;
	// do it all again*/
	timer = setTimeout("currentDate()", 1000);
}

/************************** PRINT PAGE *****************************************

- Description - Creates a new window, formats 'body' of document, adds logo and address as footer, automatic print.

- Required files - none.

- Activation Code String - <div id='clock'>
	<script>
		write_print("logo_print.jpg","<strong>PEAK Wealth Management</strong><br>Phone: 02 6239 7988 | Fax: 02 6239 6336 | Mail: PO Box 4246, Kingston, ACT, 2604","#000000");
	</script>
</div>

- Inputs - (logo,address(no quotes),Color)

*/

function write_print(a,b,tc){
	document.write('<div style="float:right;width:80px;height:20px;padding-top:3px;font-weight:bold;"><a href="javascript:void(0);" onClick="javascript:printPage(\''+a+'\',\''+b+'\');" style="color:'+tc+';font-size:10px;font-weight:bold;text-decoration:none;" class="printMenu" ><strong>&#8226; Print Page</strong></a></div>');
}

/************************** TEXT SIZER *****************************************

- Description - Renders the components for the text resizer.

- Required files - none.

- Activation Code String - <div id='clock'>
	<script>
		write_textSize("#000000");
	</script>
</div>

- Inputs - (Color)

*/

function write_textSize(tc){
	document.write('<div style="color:'+tc+';float:right;width:20px;height:20px;"><a href="javascript:void(0);" title="reduce text" id="minus" onclick="textSize(\'-\');" style="color:'+tc+';font-size:16px;display:none;vertical-align:middle;padding-right:5px;text-decoration:none;font-weight:bold;" class="textMenu">-</a></div>');
	document.write('<div style="color:'+tc+';float:right;width:20px;height:20px;"><a href="javascript:void(0);" title="enlarge text" id="plus" onclick="textSize(\'+\');" style="color:'+tc+';font-size:16px;display:block;vertical-align:middle;padding-left:5px;text-decoration:none;font-weight:bold;" class="textMenu">+</a></div>');
	document.write('<div style="color:'+tc+';font-size:10px;float:right;font-weight:bold;width:65px;height:20px;padding-top:3px;" id="textSize" class="textMenu" >| Text Size</div>');
}






/*

the functions below are called by the above 

*/


function printPage(a,b){
	var page =  document.getElementById("contentTable");
	var popup;
	printPage = window.open('','Acctweb','width=660,height=750,titlebar=0,toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=1,resizable=0,copyhistory=0');
	var content = printPage.document;
	content.write('<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">\n');
	content.write('<html xmlns="http://www.w3.org/1999/xhtml">\n');
	content.write('<head>\n');
	content.write('<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />\n');
	content.write('<title>Acctweb - Web Print</title>\n');
	content.write('<link href="templates/wwwcabotsquarecomauindexphp/site.css" rel="stylesheet" type="text/css">\n');
	content.write('</head>\n');
	content.write('<body leftmargin="10" topmargin="10" marginwidth="10" marginheight="10" style="font-size:11px;" onLoad="print()" onBlur="window.close()">\n');
	if(a.length > 2){
		content.write('<img src="images/'+a+'" alt="Logo" border="0" />\n');
	}
	content.write('<div id="printPage" style="text-align:left;width:600px;">'+page.innerHTML+'<br><br>'+b+'</div>\n');
	content.write('</body>\n');
	content.write('</html>\n');
	content.close();
}  

function textSize(a){
var tagsArray = 'P H1 H2 H3 H4 H5 H6 LI UL EM A';
var contentaArea = document.getElementById("contentTable");
var elements = contentaArea.getElementsByTagName("*");
	for(i=0;i<elements.length;i++){
		if (tagsArray.match(elements[i].tagName)){
			if(!elements[i].style.fontSize){
				elements[i].style.fontSize = "10pt";
			}
			if(a=="+"){
				elements[i].style.fontSize = elements[i].style.fontSize = (parseInt(elements[i].style.fontSize)+1+"pt");
			}else if(a=="-"){
				elements[i].style.fontSize = elements[i].style.fontSize = (parseInt(elements[i].style.fontSize)-1+"pt");
			}
			if(parseInt(elements[i].style.fontSize) == 13){
				image = document.getElementById("plus");
				image.style.display = "none";
			}else if(parseInt(elements[i].style.fontSize) == 9){		
				image = document.getElementById("minus");
				image.style.display = "none";
			}else{
				image = document.getElementById("minus");
				image.style.display = "block";
				image = document.getElementById("plus");
				image.style.display = "block";
			}
		}
	}
}

function toggle(link, divId) {
var o;
var t;
var text;
var symbol;
	for(i=1;i<=20;i++){
		// GET LINK - to find out what bg image is being shown
		if(document.getElementById(i+"_link")){
			item_link = document.getElementById(i+"_link");
			// GET DIV HOLDER
			if(document.getElementById(i+"_holder")) item_holder = document.getElementById(i+"_holder");
			//alert(item_link.style.background);
			if(item_link.style.background == ""){
				if((divId == i)&&(item_link.style.background != "url(images/mainMenu_btn_sub_open.gif)")&&(item_link.style.background != "")){
					item_link.style.background = "url(images/mainMenu_btn_sub_open.gif)";
					item_holder.style.display = 'block';	
				} else {
					item_link.style.background = "url(images/mainMenu_btn_sub.gif)";
					item_holder.style.display = 'none';
				}
			}
		}
	}
}