function AddToFaves_hp(){
/*	var is_4up = parseInt(navigator.appVersion);
	var is_mac   = navigator.userAgent.toLowerCase().indexOf("mac")!=-1;
	var is_ie   = navigator.userAgent.toLowerCase().indexOf("msie")!=-1;*/
	var thePage = location.href;
	if (thePage.lastIndexOf('#')!=-1)
		thePage = thePage.substring(0,thePage.lastIndexOf('#'));
	//if (is_ie && is_4up && !is_mac) 
	if (typeof(window.external) != 'undefined')
		window.external.AddFavorite(thePage,document.title);
	else {//if (is_ie || document.images)
		booker_hp = window.open(thePage,'booker_','menubar,width=325,height=100,left=140,top=60');
		booker_hp.focus();
	}
}

if (window.name == 'booker_') {
	document.write(
		"<style>#outsideContainer { display:none; } body { background-color;#DBDBDB; width:325px;height:100px;}</style>"
		+"<div style=\"background-image:url(http://www.bka.co.nz/focus/images/img-nsfavbg.gif); background-repeat:no-repeat; text-align: left; height:101px; padding-top:60px; padding-left:14px; font: 11px Verdana, Arial, Helvetica, sans-serif; color: #1F679A	; \">Press CTRL/D to bookmark this page.<br /><a href=\"#\" style=\"color: #1F679A\" onclick=\"window.close()\">Click here</a> to close this window</div>"
	);
}

function MM_callJS(jsStr) { //v2.0
  return eval(jsStr)
}

function MM_openBrWindow(theURL,winName,features, myWidth, myHeight, isCenter) { //v3.0
  if(window.screen)if(isCenter)if(isCenter=="true"){
    var myLeft = (screen.width-myWidth)/2;
    var myTop = (screen.height-myHeight)/2;
    features+=(features!='')?',':'';
    features+=',left='+myLeft+',top='+myTop;
  }
  window.open(theURL,winName,features+((features!='')?',':'')+'width='+myWidth+',height='+myHeight);
}

function MM_findObj(n, d) {
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 && d.getElementById) x=d.getElementById(n); return x;
}

function getRequestedImage() {
	var queryStr = window.location.search.substring(1);
	var vars = queryStr.split("&");
	for (var i = 0; i < vars.length; i++) {
		var pair = vars[i].split("=");
		if (pair[0] = "img")
			return pair[1];
	}
	return "";
}

function getImage() {
	img = MM_findObj("image");
	if (!img)
		return;
		
	var imgFile = getRequestedImage();
	if (imgFile == "") {
		img.src = "images/noimage.gif";
		return;	
	}
	if (imgFile.indexOf("/") != -1) {
		img.src = "images/noimage.gif";
		return;
	}
	var parts = imgFile.split(".");
	if (parts[1] != "gif" && parts[1] != "jpg") {
		img.src = "images/noimage.gif";
		return;
	}

	img.src = "images/" + imgFile;
	
	window.focus();
}

function on(objID) {
	obj = MM_findObj(objID);
	obj.className = 'formField-tf-red';
}
function off(objID) {
	obj = MM_findObj(objID);
	obj.className = 'formField-tf';
}

var projects = new Array();
projects[0] = "prj-fonterra.lbi";
projects[1] = "prj-caldwell.lbi";
projects[2] = "prj-fairfax.lbi";
projects[3] = "prj-wood.lbi";

var numProjects = 4;

function getFeaturedProject() {
	obj = MM_findObj('featuredProjectDiv');	
	
	x = Math.floor(Math.random() * numProjects);

	content = LoadFile('Library/' + projects[x]);
	content = content.replace(/\.\.\//g, "");	
	obj.innerHTML = content;
}

function LoadFile(filename) {
	oxmlhttp = null;
	try {
		oxmlhttp = new XMLHttpRequest();
		oxmlhttp.overrideMimeType("text/xml");
	} catch(e) {
		try {
			oxmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
		} catch(e) {
			return null;
		}
	}
	if (!oxmlhttp)
		return null;
	try {
		oxmlhttp.open("GET",filename,false);
		oxmlhttp.send(null);
	} catch(e) {
		return null;
	}
	return oxmlhttp.responseText;
}