nereidFadeObjects = new Object();
nereidFadeTimers = new Object();

function nereidFade(object, destOp, rate, delta){
	if (!document.all) return
	if (object != "[object]"){
		setTimeout("nereidFade("+object+","+destOp+","+rate+","+delta+")",0);
		return;
	}

	clearTimeout(nereidFadeTimers[object.sourceIndex]);

	diff = destOp-object.filters.alpha.opacity;
	direction = 1;
	if (object.filters.alpha.opacity > destOp){
		direction = -1;
	}
	delta=Math.min(direction*diff,delta);
	object.filters.alpha.opacity+=direction*delta;

	if (object.filters.alpha.opacity != destOp){
		nereidFadeObjects[object.sourceIndex]=object;
		nereidFadeTimers[object.sourceIndex]=setTimeout("nereidFade(nereidFadeObjects["+object.sourceIndex+"],"+destOp+","+rate+","+delta+")",rate);
	}
}
	   
	   
function MM_validateForm() { //v4.0
  var i,p,q,nm,test,num,min,max,errors='',args=MM_validateForm.arguments;
  for (i=0; i<(args.length-2); i+=3) { test=args[i+2]; val=MM_findObj(args[i]);
    if (val) { nm=val.name; if ((val=val.value)!="") {
      if (test.indexOf('isEmail')!=-1) { p=val.indexOf('@');
	if (p<1 || p==(val.length-1)) errors+='- '+nm+' must contain an e-mail address.\n';
      } else if (test!='R') {
	if (isNaN(val)) errors+='- '+nm+' must contain a number.\n';
	if (test.indexOf('inRange') != -1) { p=test.indexOf(':');
	  min=test.substring(8,p); max=test.substring(p+1);
	  if (val<min || max<val) errors+='- '+nm+' must contain a number between '+min+' and '+max+'.\n';
    } } } else if (test.charAt(0) == 'R') errors += '- '+nm+' is required.\n'; }
  } if (errors) alert('The following error(s) occurred:\n'+errors);
  document.MM_returnValue = (errors == '');
 }
 
 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;
}

// Added from header.inc.php
/* 
 function MM_validateForm() { //v4.0
	  var i,p,q,nm,test,num,min,max,errors="",args=MM_validateForm.arguments;
	  for (i=0; i<(args.length-2); i+=3) { test=args[i+2]; val=MM_findObj(args[i]);
	    if (val) { nm=val.name; if ((val=val.value)!="") {
	      if (test.indexOf("isEmail")!=-1) { p=val.indexOf("@");
		if (p<1 || p==(val.length-1)) errors+="- "+nm+" must contain an e-mail address.\n";
	      } else if (test!="R") {
		if (isNaN(val)) errors+="- "+nm+" must contain a number.\n";
		if (test.indexOf("inRange") != -1) { p=test.indexOf(":");
		  min=test.substring(8,p); max=test.substring(p+1);
		  if (val<min || max<val) errors+="- "+nm+" must contain a number between "+min+" and "+max+".\n";
	    } } } else if (test.charAt(0) == "R") errors += "- "+nm+" is required.\n"; }
	  } if (errors)  alert("The following error(s) occurred:\n"+errors); 

	if(errors==""){
	var mailerResult=window.open("empty.html","mailerResult","width=200,height=35,alwaysRaised,scrollbars=yes,location=no,directories=no,status=no,menubar=no,toolbar=no,resizable=yes");  mailerResult.focus();
	setTimeout("submitForm()",3000);
	}
	}
	 
	 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 submitForm(){
	 document.forms[0].target="mailerResult"
	 document.forms[0].submit();
	}

	function assignBlink(el) {
	el.runtimeStyle.visibility = "visible";
	setInterval(function() {
	el.runtimeStyle.visibility = (el.currentStyle.visibility == "visible") ? "hidden": "visible";
	}, 500);
	}

	 function showFloorplan(obj){
	 if(obj[obj.selectedIndex].value){
	  var floorplanwin=window.open("/main/external.php?file=data/floorplans/" + obj[obj.selectedIndex].value ,"floorplanwin","width=800,height=600,alwaysRaised,scrollbars=yes,location=no,directories=no,status=no,menubar=no,toolbar=no,resizable=yes");
	  floorplanwin.focus();
	 }
	 }

	 function showVirtualTour(obj){
	 if(obj[obj.selectedIndex].value){
	  document.location.href="info.php?id=<? echo $id ?>&vt=" + obj[obj.selectedIndex].value
	 }
	 }

	var isNav, isIE, isNav5
	isIE = isNav5 = isNav = false
	if (navigator.appName.indexOf("Microsoft") != -1)
	{
		isIE = true
	}
	else
	{
		isNav5 = (parseInt(navigator.appVersion) >= 5)
		isNav != isNav5
	}

	function DoAutorotationStart() {
	        document.ptviewer.startAutoPan( 0.5, 0.0, 1.0 );
	}
	function DoAutorotationStop() {
	        document.ptviewer.stopAutoPan();
	}
	function DoZoomIn() {
		document.ptviewer.startAutoPan( 0.0, 0.0, 0.5/0.53 );
	}
	function DoZoomOut() {
		document.ptviewer.startAutoPan( 0.0, 0.0, 1.03 );
	}


	function PopupCenter(pageURL, title, w, h, options) {
	var left = (screen.width/2)-(w/2);
	var top = (screen.height/2)-(h/2);
	var xyz = 'width='+w+', height='+h+', top='+top+', left='+left+', ';
	var defaultOptions = 'toolbar=no, location=no, directories=no, status=no, menubar=no, scrollbars=no, resizable=no, copyhistory=no';

	if (options=='') options=defaultOptions;

	var targetWin = window.open (pageURL, title, xyz + options );
	targetWin.focus();
	}
