
window.onload=function(){
 resetFontSize(defFontSize);

}
// This script will change the size of fonts within the content area of the page
// To make it change other areas just add an appropriate document.getElementByID command
// may not work as expected in ie5.5 but it theoretically should work fine

// Note that defFontSize is defined as a global variable
var defFontSize;
if (!getCookie("aecFontSize")){
		defFontSize=100;
		setCookie( "aecFontSize", defFontSize, 60, "/" );
		} else {
		defFontSize=parseInt(getCookie("aecFontSize"));
		}
function setFontSize(size)
	{
	var percentSize;

	// This if sets the max size of the font
	if (size >0 && defFontSize < 200){
		defFontSize += size;
		percentSize = defFontSize + "%";
		}
	// This if sets the min size of the font
	if (size <0 && defFontSize > 50){
		defFontSize += size;
		percentSize = defFontSize + "%";
		}
	
	// Changes all the font sizes of all elements contained inside the div id="bodyHold" tag
	document.getElementById("bodyHold").style.fontSize=percentSize;
	setCookie( "aecFontSize", defFontSize, 60, "/" );
}



function resetFontSize(dfs) {
if (!dfs) {dfs=100;}
		defFontSize = dfs;
		document.getElementById("bodyHold").style.fontSize=dfs+"%";
		setCookie( "aecFontSize", defFontSize, 60, "/" );

}

/*********************************************************************************
  cookie functions for www.dyn-web.com
  Recycled from various sources 
**********************************************************************************/

// Modified from Bill Dortch's Cookie Functions (hidaho.com) 
// (found in JavaScript Bible)
function setCookie(name,value,days,path,domain,secure) {
  var expires, date;
  if (typeof days == "number") {
    date = new Date();
    date.setTime( date.getTime() + (days*24*60*60*1000) );
		expires = date.toGMTString();
  }
  document.cookie = name + "=" + escape(value) +
    ((expires) ? "; expires=" + expires : "") +
    ((path) ? "; path=" + path : "") +
    ((domain) ? "; domain=" + domain : "") +
    ((secure) ? "; secure" : "");
}

// Modified from Jesse Chisholm or Scott Andrew Lepera ?
// (found at both www.dansteinman.com/dynapi/ and www.scottandrew.com/junkyard/js/)
function getCookie(name) {
  var nameq = name + "=";
  var c_ar = document.cookie.split(';');
  for (var i=0; i<c_ar.length; i++) {
    var c = c_ar[i];
    while (c.charAt(0)==' ') c = c.substring(1,c.length);
    if (c.indexOf(nameq) == 0) return unescape( c.substring(nameq.length, c.length) );
  }
  return null;
}

// from Bill Dortch's Cookie Functions (hidaho.com) 
function deleteCookie(name,path,domain) {
  if (getCookie(name)) {
    document.cookie = name + "=" +
      ((path) ? "; path=" + path : "") +
      ((domain) ? "; domain=" + domain : "") +
      "; expires=Thu, 01-Jan-70 00:00:01 GMT";
  }
}

// Clear any text field
function clearAnyField(formName, fieldName) {
		getvalue=eval('document.'+formName+'.'+fieldName+'');
		getvalue.value = "";
}

function checkCheckBox(f){
var reMatch4 = /\d{4}/g;
	if (!f.postcode.value.match(reMatch4)) {
	alert("Please enter your four digit postcode");
	f.postcode.select();
	return false;
	}
	//Grab postcode value and append to the URL
	//window.location= "http://appstest/eSearch/divisiondetails.aspx?postcode=" + f.postcode.value;
	window.location= "http://apps.aec.gov.au/eSearch/divisiondetails.aspx?postcode=" + f.postcode.value;
	return false;
}




