over = function() {
	var sfEls = document.getElementById("nav").getElementsByTagName("LI");
	for (var i=0; i<sfEls.length; i++) {
		sfEls[i].onmouseover=function() {
			this.className+=" over";
		}
		sfEls[i].onmouseout=function() {
			this.className=this.className.replace(new RegExp("over"), "");
		}
	}
}
if (window.attachEvent) window.attachEvent("onload", over);


var d=document; 
 
 function SetCookie( Name, Value, Expire ) 
 { 
 document.cookie = Name + "=" + escape( Value ) ; 
 } 
 
 function WriteCookies() 
 { 
var d=document; 

SetCookie( "Category", d.getElementById('Category').value ); 
SetCookie( "Incentives", d.getElementById('Incentives').value ); 
SetCookie( "Price_gt",  d.getElementById('Price_gt').value ); 
SetCookie( "Price_lt",  d.getElementById('Price_lt').value ); 
SetCookie( "Bedrooms",  d.getElementById('Bedrooms-gt').value ); 
SetCookie( "Property_Type",  d.getElementById('Property_Type').value ); 




 } 
 
  
 function GetValue( Offset ) 
 { 
 var End = document.cookie.indexOf (";", Offset); 
 if( End == -1 ) 
 End = document.cookie.length; 
  
 return unescape( document.cookie.substring( Offset, End) ); 
 } 
  
 function GetCookie( Name ) 
 { 
 var Len = Name.length; 
  
 var i = 0; 
 while( i < document.cookie.length ) 
 { 
 var j = i + Len + 1; 
 if( document.cookie.substring( i, j) == (Name + "=") ) 
 return GetValue( j ); 
 i = document.cookie.indexOf( " ", i ) + 1; 
 if( i == 0) 
 break; 
 } 
 var a = ""; 
 return a; 
 } 
 
function GetCookies() 
 { 
 var tmpCategory = GetCookie( "Category" ); 
 var tmpIncentives = GetCookie( "Incentives" ); 
 var tmpPrice_gt = GetCookie( "Price_gt" ); 
 var tmpPrice_lt = GetCookie( "Price_lt" ); 
 var tmpBedrooms = GetCookie( "Bedrooms" ); 
 var tmpProperty_Type = GetCookie( "Property_Type" ); 

 
 if (tmpCategory) {  
 d.getElementById('Category').value = tmpCategory; 
 }
  if (tmpIncentives) { 
 d.getElementById('Incentives').value = tmpIncentives; 
 } 
 if (tmpPrice_gt) { 
 d.getElementById('price_gt').value = tmpPrice_gt; 
 } 
 if (tmpPrice_lt) { 
 d.getElementById('price_lt').value = tmpPrice_lt; 
 } 

 if (tmpBedrooms) { 
 d.getElementById('Bedrooms-gt').value = tmpBedrooms; 
 } 

 if (tmpProperty_Type) { 
 d.getElementById('Property_Type').value = tmpProperty_Type; 
 } 


   
 }






/* Modified to support Opera */
function bookmarksite(title,url){
if (window.sidebar) // firefox
	window.sidebar.addPanel(title, url, "");
else if(window.opera && window.print){ // opera
	var elem = document.createElement('a');
	elem.setAttribute('href',url);
	elem.setAttribute('title',title);
	elem.setAttribute('rel','sidebar');
	elem.click();
} 
else if(document.all)// ie
	window.external.AddFavorite(url, title);
}





/*
 *This JavaScript takes an input number and adds commas in the proper places.
 *As needed by its original purpose, also adds a dollar.
 *Copyright 1998, David Turley <dturley@pobox.com>
 *Feel free to use and build on this code as long as you include this notice.
 *Last Modified March 3, 1998
*/





function commify(pricetopass) {
    var Num = pricetopass;
    var newNum = "";
    var newNum2 = "";
    var count = 0;
    
    //check for decimal number
    if (Num.indexOf('.') != -1){  //number ends with a decimal point
        if (Num.indexOf('.') == Num.length-1){
            Num += "00";
        }
        if (Num.indexOf('.') == Num.length-2){ //number ends with a single digit
            Num += "0";
        }
        
        var a = Num.split("."); 
        Num = a[0];   //the part we will commify
        var end = a[1] //the decimal place we will ignore and add back later
    }
    else {var end = "";}  
 
    //this loop actually adds the commas   
    for (var k = Num.length-1; k >= 0; k--){
      var oneChar = Num.charAt(k);
      if (count == 3){
        newNum += ",";
        newNum += oneChar;
        count = 1;
        continue;
      }
      else {
        newNum += oneChar;
        count ++;
      }
   }  //but now the string is reversed!
   
  //re-reverse the string
  for (var k = newNum.length-1; k >= 0; k--){
      var oneChar = newNum.charAt(k);
      newNum2 += oneChar;
  }
   
   // add dollar sign and decimal ending from above
   newNum2 =  newNum2 + "" + end;
 return newNum2;
}




