 var startY=-10;
 var startX=0;
 function showvrthm(id,lastitem) {
   document.getElementById('tour'+lastitem).style.display = 'none';
   document.getElementById('tour'+id).style.display = 'block';
   lastviewed = id;
  }
 function launchApp()
  {
   var webapp = window.open("about:blank","webapp","width=800,height=580,status=no,directories=no,toolbar=no,scrollbars=yes,resizeable=no");
   document.getElementById('rentapp').submit();
   webapp.focus();
  }
 function referafriend()
  {
   var referral = window.open("/Referral.html","referral","width=820,height=620,status=no,directories=no,toolbar=no,scrollbars=no,resizeable=no");
   referral.focus();
  }
 function View360(name)
  {
   if (name != 0) w360 = window.open("ViewFloorplan.html?name=" + name,"_blank","width=828,height=700,status=no,directories=no,toolbar=no,resizeable=no,scrollbars=auto");
   else w360 = window.open("ViewFloorplan.html","_blank","width=828,height=700,status=no,directories=no,toolbar=no,scrollbars=auto,resizeable=no");
   w360.focus;
  }
 function showRotator(thisRotator,width,height)
  {
   document.write('<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" width="'+width+'" height="'+height+'" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab" id="'+ thisRotator + '">');
   document.write('  <param name="movie" value="/js/jpgRotator.swf?file=/js/' + thisRotator + '" />');
   document.write('  <param name="wmode" value="transparent" />');
   document.write('  <param name="swLiveConnect" value="true"');
   document.write('  <embed name="' + thisRotator + '" width="'+width+'" height="'+height+'" swLiveConnect="true" src="/js/jpgRotator.swf?file=/js/' + thisRotator + '" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" wmode="transparent" />');
   document.write('</object>');
  }
 function swap(id,img)
  {
   document.getElementById(id).src = img;
  }
 function xmlhttpPost(outputTo,strURL,params) 
  {
   if (document.getElementById(outputTo).innerHTML != '' && params=='')
     document.getElementById(outputTo).innerHTML = '';
   else
    {
     document.getElementById(outputTo).innerHTML = 'Loading...';
     var xmlHttpReq = false;
     var self = this;
     if (window.XMLHttpRequest)        // Mozilla/Safari
       self.xmlHttpReq = new XMLHttpRequest();
     else if (window.ActiveXObject)    // IE
       self.xmlHttpReq = new ActiveXObject("Microsoft.XMLHTTP");
     self.xmlHttpReq.open('POST', strURL, true);
     self.xmlHttpReq.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
     self.xmlHttpReq.onreadystatechange = function() 
      { 
       if (self.xmlHttpReq.readyState == 4) 
        updatePage(outputTo, self.xmlHttpReq.responseText); 
      }
     self.xmlHttpReq.send('activeDiv=' + outputTo + '&' + params);
    }
  }

 function updatePage(outputTo,value)
  {
   document.getElementById(outputTo).innerHTML = value;
  }
 function ajaxSubmit(fobj,submitTo,outputTo)
  {
   var getstr = '';
   for (i=0; i < fobj.elements.length; i++) 
    {
     var el = fobj.elements[i];
     switch(el.type)
      {
       case "textarea":
       case "hidden":
       case "text":
       case "password":
         getstr += encodeURIComponent(el.name) + "=" + encodeURIComponent(el.value) + "&";
         break;
       case "select-one":
         getstr += encodeURIComponent(el.name) + "=" + encodeURIComponent(el.options[el.selectedIndex].value) + "&";
         break;
       case "select-multiple":
         var selLen = el.options.length;
         for (var j=0; j < selLen; j++)
           if (el.options[j].selected)
             getstr += encodeURIComponent(el.name+"[]") + "=" + encodeURIComponent(el.options[j].value) + "&";
         break;
       case "checkbox":
       case "radio":
         if(el.checked)
           getstr += encodeURIComponent(el.name) + "=" + encodeURIComponent(el.value) + "&";
         break;                
      }
    }
   xmlhttpPost(outputTo,submitTo,getstr);
  }

// Virtual Tour Functions

 function hotspot(thisVirtual)
  {
   document.getElementById('VRWindow').style.display = 'block';
   document.getElementById('VRWindow').style.height = '800px';
   document.getElementById('panospot').innerHTML = '<iframe id="vframe" allowtransparency="true" style="background: transparent; width: 99%; height: 520px; margin: 4px auto" src="/include/vr/360.php?filename=' + 
                                                   thisVirtual  + '&viewer=' + document.getElementById('viewer').value + '" frameborder="0" scrolling="no"></iframe>';
  }
 function hidewindow()
  {
   document.getElementById('VRWindow').style.display = 'none';
   document.getElementById('panospot').innerHTML = '';
  }
