function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function MM_findObj(n, d) { //v4.0
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && document.getElementById) x=document.getElementById(n); return x;
}

function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}

var ieX = (navigator.appName.indexOf("Microsoft") != -1);

var ns4 = (document.layers);
var ie4 = (document.all && !document.getElementById);
var ie5 = (document.all && document.getElementById);
var ns6 = (!document.all && document.getElementById);

/* workaround for netscape 4 resize bug: http://www.webreference.com/dhtml/diner/resize/ */
if(ns4){origWidth=innerWidth;origHeight=innerHeight;onresize=function(){if(innerWidth!=origWidth||innerHeight!=origHeight)location.reload()}}

function pageload() {
	loaded = true;
}

function getElement(id,doc) {
	if (!doc) { doc = document; }
	if (ie5||ns6)
		return(doc.getElementById(id));
	else if (ie4)
		return(doc.all[id]);
	else if (ns4)
		return(doc.layers[id]);
	else
		return null;
}

function getDivDocument(d) {
	if (ns6)
		return d.ownerDocument;
	else
		return d.document;
}

function styleObject(e) {
	return (ns4 ? e : e.style);
}

function showElement(e,force) {
	so = styleObject(e);
	so.visibility = "visible";
	if (force) { so.zIndex = 999; }
}

function hideElement(e,force) {
	so = styleObject(e);
	so.visibility = "hidden";
	if (force) { so.zIndex = -999; }
}

function w(t) { document.write(t); }

function changeContent(e,t) {
	if (!ns4) {
		if (e.innerHTML != t) {
			e.innerHTML = t;
		}
	}
	else if (document.layers) {
		e.document.open();
		e.document.write(t);
		e.document.close();
	}
}

function expandDiv(divName) {
	var e = getElement(divName);
	var s = styleObject(e);
	s.height = "auto";
}

function toggleDiv(divName,defaultHeight,newHeight) {
	var e = getElement(divName);
	if (!e) { return; }
	
	var s = styleObject(e);
	
	if (!s.height || s.height == defaultHeight +"px") {
		if (newHeight)
			s.height = newHeight +"px";
		else
			s.height = "auto";
	}
	else
		s.height = defaultHeight +"px";
}

// flash stuff
function flashGetMovie(movieName) {
	return (ieX ? window[movieName] : window.document[movieName]);
}
function flashIsLoaded(flashMovie) { return (typeof flashMovie == "undefined" ? false : flashMovie.PercentLoaded() == 100); }

function makeHomepage(link) {
	try {
		link.style.behavior = 'url(#default#homepage)';
		link.setHomePage('http://www.oxigenfitness.com.au/');
	}
	catch (e) {
		alert("Sorry, your browser won't let me set your home page for you.\n\nPlease manually set your home page to www.oxigenfitness.com.au");
	}
}
