function killerrors(){
	return true;
	}
window.onerror = killerrors;
function findObj(theObj, theDoc)
{
  var p, i, foundObj;
  
  if(!theDoc) theDoc = document;
  if( (p = theObj.indexOf("?")) > 0 && parent.frames.length)
  {
    theDoc = parent.frames[theObj.substring(p+1)].document;
    theObj = theObj.substring(0,p);
  }
  if(!(foundObj = theDoc[theObj]) && theDoc.all) foundObj = theDoc.all[theObj];
  for (i=0; !foundObj && i < theDoc.forms.length; i++) 
    foundObj = theDoc.forms[i][theObj];
  for(i=0; !foundObj && theDoc.layers && i < theDoc.layers.length; i++) 
    foundObj = findObj(theObj,theDoc.layers[i].document);
  if(!foundObj && document.getElementById) foundObj = document.getElementById(theObj);
  
  return foundObj;
}
function calmenuleft(imgid){
	var LL = findObj(imgid)
	var xPos = eval(LL).offsetLeft;
	var tempEl = eval(LL).offsetParent;
  	while (tempEl != null) {
  		xPos += tempEl.offsetLeft;
  		tempEl = tempEl.offsetParent;
  	}
	return xPos;
}
function calmenutop(imgid){
	var TT = findObj(imgid)
	var yPos = eval(TT).offsetTop;
	var tempEl = eval(TT).offsetParent;
  	while (tempEl != null) {
  		yPos += tempEl.offsetTop;
  		tempEl = tempEl.offsetParent;
  	}
	return yPos;
}

function reposmenus(){
   top.location.reload();
}
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.01
  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 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];}
}
function MM_callJS(jsStr) { //v2.0
  return eval(jsStr)
}
function getwinsize() {
var photo = document.getElementById('photoinlay')
var myWidth = 0, myHeight = 0;
  if( typeof( window.innerWidth ) == 'number' ) {
    //Non-IE
    myWidth = window.innerWidth;
    myHeight = window.innerHeight;
  } 
  else if( document.documentElement && ( document.documentElement.clientWidth || document.documentElement.clientHeight ) ) {
    //IE 6+ in 'standards compliant mode'
    myWidth = document.documentElement.clientWidth;
    myHeight = document.documentElement.clientHeight;
  } else if( document.body && ( document.body.clientWidth || document.body.clientHeight ) ) {
    //IE 4 compatible
    myWidth = document.body.clientWidth;
    myHeight = document.body.clientHeight;
  }
  //alert(myHeight)
  if((document.title=="Bridgewater Village : Community") && (myHeight > 650)){
	  document.getElementById('photos').height=392
  }
   if((photo) && (myHeight > 650)){
	  document.getElementById('photoinlay').height=408
  }
  newheight = eval(myHeight-180)
  document.getElementById('Height_Adjuster').height=newheight
}
function MM_openBrWindow(theURL,winName,features) { //v2.0
  window.open(theURL,winName,features);
}
function close_window() {
    window.close();
}
function cleartxtfield(id){
	id.value=""
}
function MM_goToURL() { //v3.0
  var i, args=MM_goToURL.arguments; document.MM_returnValue = false;
  for (i=0; i<(args.length-1); i+=2) eval(args[i]+".location='"+args[i+1]+"'");
}
function tmt_formManager(f,c){
	if(MM_findObj(f)){eval("MM_findObj('"+f+"')."+c);}
}
function setmenu(str){
	document.getElementById(str).className="menu_active"
}
function contact(){
	window.opener.location.href="Contact_Us.php"
	close_window()
}
function testpopup(){
	var msgWindow = window.open();
	if(!msgWindow){
		alert("You currently have a pop-up blocker preventing this pop-up from launching. \n Please reconfigure your pop-up blocker to allow pop-ups \n to launch on the www.bridgewatervillage.co.nz domain")
	}else{
		msgWindow.close();
    }
}
function fastfacts(){
	var width="624", height="600";
    var left = (screen.width/2) - width/2;
    var top = (screen.height/2) - height/2;
    MM_openBrWindow('Fast_Facts.php','','top='+top+',left='+left+',width=624,height=600')
}
function locations(){
	var width="746", height="326";
    var left = (screen.width/2) - width/2;
    var top = (screen.height/3) - height/2;
    MM_openBrWindow('Location.php','','top='+top+',left='+left+',width=746,height=325')
}
function location_map(){
	var width="610", height="370";
    var left = (screen.width/2) - width/2;
    var top = (screen.height/3) - height/2;
    MM_openBrWindow('Location.php','','top='+top+',left='+left+',width=610,height=370')
}
function doplanpreview(str,lot,s){
	if(s==1){
		side="l"
	}
	if(s==2){
		side="r"
	}
	if(lot==0){
		lot="0"
	}
	var width="624", height="675";
    var left = (screen.width/2) - width/2;
    var top = (screen.height/2) - height/2;
	var popup = ("Site_plan_preview.php?id=" + str + "&lot=" + lot + "&s=" + side)
    MM_openBrWindow(popup,'','top='+top+',left='+left+',width=642,height=675')
}
//Link to Admin
function gotoadmin(){
	MM_goToURL('parent','Admin/Login.php');return document.MM_returnValue;
}
//End of Link to Admin