/*
ua.js 2001-12-05

Contributor(s): Bob Clary, Netscape Communications, Copyright 2001

Netscape grants you a royalty free license to use or modify this
software provided that this copyright notice appears on all copies.
This software is provided "AS IS," without a warranty of any kind.
*/

function xbDetectBrowser()
{
  //var oldOnError = window.onerror;
  var element = null;

  //window.onerror = null;
  
  // work around bug in xpcdom Mozilla 0.9.1
  window.saveNavigator = window.navigator;

  navigator.OS    = '';
  navigator.version  = parseFloat(navigator.appVersion);
  navigator.org    = '';
  navigator.family  = '';

  var platform;
  if (typeof(window.navigator.platform) != 'undefined')
  {
    platform = window.navigator.platform.toLowerCase();
    if (platform.indexOf('win') != -1)
      navigator.OS = 'win';
    else if (platform.indexOf('mac') != -1)
      navigator.OS = 'mac';
    else if (platform.indexOf('unix') != -1 || platform.indexOf('linux') != -1 || platform.indexOf('sun') != -1)
      navigator.OS = 'nix';
  }
 
  var i = 0;
  var ua = window.navigator.userAgent.toLowerCase();
 
  if (ua.indexOf('opera') != -1)
  {
    i = ua.indexOf('opera');
    navigator.family  = 'opera';
    navigator.org    = 'opera';
    navigator.version  = parseFloat('0' + ua.substr(i+6), 10);
  }
  else if ((i = ua.indexOf('msie')) != -1)
  {
    navigator.org    = 'microsoft';
    navigator.version  = parseFloat('0' + ua.substr(i+5), 10);
    
    if (navigator.version < 4)
      navigator.family = 'ie3';
    else
      navigator.family = 'ie4'
  }
  else if (ua.indexOf('gecko') != -1)
  {
    navigator.family = 'gecko';
    var rvStart = navigator.userAgent.indexOf('rv:') + 3;
    var rvEnd = navigator.userAgent.indexOf(')', rvStart);
    var rv = navigator.userAgent.substring(rvStart, rvEnd);
    var decIndex = rv.indexOf('.');
    if (decIndex != -1)
    {
      rv = rv.replace(/\./g, '')
      rv = rv.substring(0, decIndex-1) + '.' + rv.substr(decIndex)
    }
    navigator.version = parseFloat(rv);

    if (ua.indexOf('netscape') != -1)
      navigator.org = 'netscape';
    else if (ua.indexOf('compuserve') != -1)
      navigator.org = 'compuserve';
    else
      navigator.org = 'mozilla';
  }
  else if ((ua.indexOf('mozilla') !=-1) && (ua.indexOf('spoofer')==-1) && (ua.indexOf('compatible') == -1) && (ua.indexOf('opera')==-1)&& (ua.indexOf('webtv')==-1) && (ua.indexOf('hotjava')==-1))
  {
    var is_major = parseFloat(navigator.appVersion);
    
    if (is_major < 4)
      navigator.version = is_major;
    else
    {
      i = ua.lastIndexOf('/')
      navigator.version = parseFloat('0' + ua.substr(i+1), 10);
    }
    navigator.org = 'netscape';
    navigator.family = 'nn' + parseInt(navigator.appVersion);
  }
  else if ((i = ua.indexOf('aol')) != -1 )
  {
    // aol
    navigator.family  = 'aol';
    navigator.org    = 'aol';
    navigator.version  = parseFloat('0' + ua.substr(i+4), 10);
  }
  else if ((i = ua.indexOf('hotjava')) != -1 )
  {
    // hotjava
    navigator.family  = 'hotjava';
    navigator.org    = 'sun';
    navigator.version  = parseFloat(navigator.appVersion);
  }

  //window.onerror = oldOnError;
}

function topperspan(spanid)
{
	if ((myplatform.indexOf('Mac') != -1) && (navigator.version < 5))
	{
		document.write ('<span id=' + spanid)
		document.write (' style="position:absolute;top:10px;left:150;z-Index:39;width:170;">')
	}
	else
	{
		document.write ('<span id=' + spanid)
		document.write (' style="position:absolute;top:10px;left:364;z-Index:39;width:170;">')
		
	}		
}
function topperspan2(spanid, propcount, tcount)
{
	document.write ('<style>')
	mypostop = ((parseInt(propcount) - 1) * 100) - 157 + (312 * parseInt(tcount) + 100)
	if ((myplatform.indexOf('Mac') != -1) && (navigator.version < 5))
	{
		document.write ('.cltopper2' + propcount)
		document.write ('{position:absolute;')
		document.write ('top:' + mypostop + ';')
		document.write ('left:170;')
		document.write ('z-Index:39;}')
		document.write ('</style>')
		document.write ('<span id=' + spanid + ' class="cltopper2' + propcount + '">')
		//document.write ('<span id=' + spanid)
		//document.write (' style="position:absolute;top:' + mypostop + ';left:170;z-Index:39">')
	}
	else if ((myplatform.indexOf('Mac') != -1) && (navigator.version >= 5))
	{
		document.write ('.cltopper2' + propcount)
		document.write ('{position:absolute;')
		//if(tcount == 1){
			document.write ('top:55;')
		//}else{
			//document.write ('top:0;')
		//}
		document.write ('left:364;')
		document.write ('width:170;')
		document.write ('z-Index:39;')
		document.write ('</style>')
		document.write ('<span id=' + spanid + ' class="cltopper2' + propcount + '">')
		//document.write ('<span id=' + spanid)
		//document.write (' style="position:absolute;top:' + mypostop + ';left:170;z-Index:39">')
	}
	else if ((myplatform.indexOf('Mac') != -1) && (navigator.appName == "Netscape"))
	{
		document.write ('.cltopper2' + propcount)
		document.write ('{position:absolute;')
		document.write ('top:' + mypostop + ';')
		document.write ('left:364;')
		document.write ('z-Index:39;}')
		document.write ('</style>')
		document.write ('<span id=' + spanid + ' class="cltopper2' + propcount + '">')
		//document.write ('<span id=' + spanid)
		//document.write (' style="position:absolute;top:' + mypostop + ';left:364;z-Index:39">')
	}
	else
	{
		document.write ('.cltopper2' + propcount)
		document.write ('{position:absolute;')
		document.write ('top:' + mypostop + ';')
		document.write ('left:364;')
		document.write ('z-Index:39;}')
		document.write ('</style>')
		document.write ('<span id=' + spanid + ' class="cltopper2' + propcount + '">')
		//document.write ('<span id=' + spanid)
		//document.write (' style="position:absolute;top:' + mypostop + ';left:364;z-Index:39">')
		
	}		
}


function spanbwrite(spanid, propcount, tcount, mytop, citycount, breakcount)
{	
	mypostop = parseInt(mytop) + (parseInt(citycount) * 25) + ((parseInt(propcount) - 1) * 100) + 100 + (175 * parseInt(tcount)) + (parseInt(breakcount) * 75)
	
	if ((myplatform.indexOf('Mac') != -1) && (navigator.version < 5))
	{
		document.write ('<style>')
		document.write ('.clspanb' + propcount)
		document.write ('{position:absolute;')
		document.write ('top:' + mypostop + ';')
		document.write ('left:227;')
		document.write ('height:100')
		document.write ('z-Index:45;')
		document.write ('width:280;}')
		document.write ('</style>')
		document.write ('<span id=' + spanid + ' class="clspanb' + propcount + '">')
		//document.write ('<span id=' + spanid)
		//document.write (' style="position:absolute;top:' + mypostop + ';left:227;z-Index:45;width:280;">')		
	}
	else if ((myplatform.indexOf('Mac') != -1) && (navigator.version >= 5))
	{
		//mypostop = parseInt(mytop) + ((parseInt(propcount) - 1 - ((4 + tcount) * tcount)) * 100);
		document.write ('<style>')		
		if (parseInt(tcount) == 0)
		{
			mypostop = 100 * (parseInt(propcount) - 1) + (parseInt(citycount) * 25)
		}
		if (parseInt(tcount) == 1)
		{
			mypostop = 100 * (parseInt(propcount) - ((4 * parseInt(tcount)) + parseInt(tcount))) + (parseInt(citycount) * 25)
		}
		if (parseInt(tcount) == 2)

		{
			mypostop = 100 * (parseInt(propcount) - ((5 * parseInt(tcount)) + parseInt(tcount))) + 100 + (parseInt(citycount) * 25)
		}
		document.write ('.clspanb' + propcount)
		document.write ('{position:absolute;')
		document.write ('top:' + mypostop + ';')
		document.write ('left:365;')
		document.write ('z-Index:45;')
		document.write ('width:280;}')
		document.write ('</style>')
		document.write ('<span id=' + spanid + ' class="clspanb' + propcount + '">')		
	}
	else if ((myplatform.indexOf('Mac') != -1) && (navigator.appName == "Netscape"))
	{
		document.write ('<span id=' + spanid + ' style="position:absolute;top:' + mypostop + ';left:365;z-Index:45;width:280;">')		
	}
	else
	{
		//document.write ('<style>')
		//document.write ('.clspanb' + propcount)
		//document.write ('{position:absolute;')
		//document.write ('top:' + mypostop + ';')
		//document.write ('left:365;')
		//document.write ('z-Index:45;')
		//document.write ('width:280;')
		//document.write ('</style>')
		//document.write ('<span id=' + spanid + ' class="clspanb' + propcount + '">')		
		document.write ('<span id=' + spanid + ' style="position:absolute;top:' + mypostop + 'px;left:365;z-Index:45;width:280;">')
	}		
	//document.write ('</style>')
}
function leasepopup(newURL)
{
	newWindow = window.open(newURL, "lease", "statusbar,resizable,scrollbars,menubar=0,height=740,width=525,top=10,left=10")
	newWindow.focus();
}
function homerpopup()
{
	newWindow = window.open('/homerinfo.asp', "homer", "statusbar,resizable,scrollbars,menubar=0,height=600,width=585")
	newWindow.focus();	
	
}
function myfirstsearch()
{
	newWindow = window.open('/firstsearch.asp', "", "statusbar,resizable,menubar=0,height=200,width=375")
	newWindow.focus();

}
function resizeWin(){
	if(navigator.platform == "MacPPC" && navigator.version >= 5){		
		window.resizeTo(800, 600);
	}
}
function printPage(){
	window.print();
	window.close();
}
//new code start
function popuprefine(newURL)
{
newWindow = window.open(newURL, "refer", "statusbar,scrollbars,menubar=0,height=590,width=800")
newWindow.focus();
}

function showrefine()
{
	var mystr = "mainpage=1&"
	var pagetype = "&pagetype=<% = pagetype %>"
	mystr = mystr + '<% = Request.ServerVariables("QUERY_STRING") & qsaddon %>'
	popuprefine('/refinesearch.asp?refpage=search&' + mystr + pagetype)
	
}
function showtables()
{
	//alert("hello")
	var ocoll = document.all
	for (i=0;i<ocoll.length;i++)
	{
		if (ocoll(i).tagName == "SPAN")
		{
			ocoll(i).style.display = "inline"
			
		}
	}
	document.all.main0.style.display = "inline"
}
function special()
{
	
}
function IEalertupdate(mycookie)
{
	var colla = document.myform.elements["save"];
	var ischecked = false;
	if (colla != null)
	{
		if (colla.length != null)
		{
			for (i=0;i<colla.length;i++)
			{
				if (colla[i].checked == true || colla[i].type == "hidden")
				{
					ischecked = true;
					break;
				}
			}
		}
		else
		{
			if (document.myform.save.checked == true || document.myform.save.type == "hidden")
			{
				ischecked = true;
			}
		}
	}		
	//alert(ischecked + "-" + showalert);
	//if ((mycookie != "1") && (showalert == true) && (!(isN4)))
	/*if ((ischecked == true) && (showalert == true))
	{
		//event.returnValue = "Note: If you save the choice(s) you are interested in \n(by clicking on the check box to the left of the picture)\nyou will be able to review them at any time and schedule appointments online."
		//newWindow = window.open('firstsearch.asp?tryleave=1', "", "statusbar,resizable,scrollbars,menubar=0,height=200,width=300")
		newWindow = window.open('savealert.asp',"save","statusbar,scrollbars,resizable,menubar=0,height=350,width=400")
		newWindow.focus();
		showalert = false;
		window.location.href = 'javascript:void(0)';
	}*/
}
function printWindow2()
{
	newWindow2 = window.open('/processsearchprint.asp?<% = Request.ServerVariables("QUERY_STRING") & qsaddon %>',"print","statusbar,scrollbars,menubar=yes,height=10,width=370");
}
function makeappt()
{
	var ustr = "";
	var goappt = false;
	var colla = document.myform.elements["save"];
	if (colla != null)
	{
		if (colla.length != null)
		{
			for (i=0;i<colla.length;i++)
			{
				mypropid = colla[i].value;
				if (colla[i].type == "checkbox" && colla[i].checked == true)
				{
					goappt = true;
					ustr = ustr + '&user=' + mypropid
					//break
				}
				if ((colla[i].type == "hidden") && (!isNaN(parseInt(colla[i].value))))
				{
					goappt = true;
					ustr = ustr + '&user=' + mypropid
				}	
			}
		}
		else
		{
			if (document.myform.save.type == "checkbox" && document.myform.save.checked == true)
			{
				goappt = true;
				ustr = '&user=' + document.myform.save.value
			}
		}
	}
	if (goappt == true)
	{
		window.location.href='/scheduler/calframe.asp?mode=renter&Beds=<% = Beds %>&Baths=<% = Baths %>&Dog=<% = Dog %>&Cat=<% = Cat %>&MoveDate=<% = savedate %>&MinRent=<% = MinRent %>&MaxRent=<% = MaxRent%>' + ustr + '<% = critstr %>'
	}
	else
	{
		myalert('/psalert.asp?action=appt')
	}
}
function freerent()
{
	
	myheight = screen.height - 150;
	mywidth = 680;
	mystr = "statusbar,scrollbars,menubar,height=" + myheight + ",width=" + mywidth + ",top=50,left=20";
	//newWindow = window.open("winfreerent.asp", "freerent", mystr)
	newWindow = window.open("/renterperks.asp", "freerent", mystr)
	newWindow.focus();

}