function 		clearFocus(elmt,val) {
  if (elmt.value==val) {
    elmt.value = '';
    elmt.setAttribute('class','blackentry');
    elmt.setAttribute('className','blackentry');	
  }
}

function 		blurFocus(elmt,val) {
  if (elmt.value=='') {
    elmt.value=val; 
    elmt.setAttribute('class','grayentry');
    elmt.setAttribute('className','grayentry');	
  };
}

function searchFormReset(elmt) {
  if (elmt[elmt.selectedIndex].text == 'Commercial' || elmt[elmt.selectedIndex].text == 'Land') {
    document.getElementById('bed_li').style.display = 'none';
    document.getElementById('bath_li').style.display = 'none';
    document.getElementById('car_li').style.display = 'none';
    document.getElementById('placeholder_li').style.display = 'block';
  } else {
    document.getElementById('bed_li').style.display = 'block';
    document.getElementById('bath_li').style.display = 'block';
    document.getElementById('car_li').style.display = 'block';
    document.getElementById('placeholder_li').style.display = 'none';
  };
}

var xmlhttp;
function ajax(id,url) {
  xmlhttp=null;
  if (window.XMLHttpRequest) {									
    xmlhttp=new XMLHttpRequest();
  } else if (window.ActiveXObject) {									
    xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
  }
  xmlhttp.open("GET",url,false);		
  xmlhttp.send(null);
  if (xmlhttp.status==200) {								
	document.getElementById(id).innerHTML = xmlhttp.responseText;
  }
}

function get(url) {
  xmlhttp=null;
  if (window.XMLHttpRequest) {									
    xmlhttp=new XMLHttpRequest();
  } else if (window.ActiveXObject) {									
    xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
  }
  xmlhttp.open("GET",url,false);		
  xmlhttp.send(null);
  if (xmlhttp.status==200) {								
	return xmlhttp.responseText;
  } else {
    return '';
  }
}

function setInnerHTML(objeto,innerHTML){
    objeto.innerHTML = ""
    var selTemp = document.createElement("micoxselect")
    var opt;
    selTemp.id="micoxselect1"
    document.body.appendChild(selTemp)
    selTemp = document.getElementById("micoxselect1")
    selTemp.style.display="none"
    if(innerHTML.toLowerCase().indexOf("<option")<0){
        innerHTML = "<option>" + innerHTML + "</option>"
    }
    innerHTML = innerHTML.toLowerCase().replace(/<option/g,"<span").replace(/<\/option/g,"</span")
    selTemp.innerHTML = innerHTML
      
    
    for(var i=0;i<selTemp.childNodes.length;i++){
  var spantemp = selTemp.childNodes[i];
  
        if(spantemp.tagName){     
            opt = document.createElement("OPTION")
    
   if(document.all){ //IE
    objeto.add(opt)
   }else{
    objeto.appendChild(opt)
   }       
    
   //getting attributes
   for(var j=0; j<spantemp.attributes.length ; j++){
    var attrName = spantemp.attributes[j].nodeName;
    var attrVal = spantemp.attributes[j].nodeValue;
    if(attrVal){
     try{
      opt.setAttribute(attrName,attrVal);
      opt.setAttributeNode(spantemp.attributes[j].cloneNode(true));
     }catch(e){}
    }
   }
   //getting styles
   if(spantemp.style){
    for(var y in spantemp.style){
     try{opt.style[y] = spantemp.style[y];}catch(e){}
    }
   }
   //value and text
   opt.value = spantemp.getAttribute("value")
   opt.text = spantemp.innerHTML
   //IE
   opt.selected = spantemp.getAttribute('selected');
   opt.className = spantemp.className;
  } 
 }    
 document.body.removeChild(selTemp)
 selTemp = null
}

function setSelectValue(SelectName, Value) {
  var SelectObject = document.getElementById(SelectName);
  for(index = 0; 
    index < SelectObject.length; 
    index++) {
   if(SelectObject[index].value == Value)
     SelectObject.selectedIndex = index;
   }
}

function generatePrice(mode) {
  var result
  if (mode=='e') {
    result = '<option value=""></option>';
    for (price=200; price < 1000; price = price + 50) {
	  result = result + '<option value="'+price+'">$'+price+'</option>';
	}
    for (price=0; price <= 5; price = price + 1) {
	  result = result + '<option value="1'+price+'00">$1,'+price+'00</option>';
	}
  } else {
    result = '<option value=""></option>';
    for (price=200; price < 1000; price = price + 50) {
	  result = result + '<option value="'+price+'000">$'+price+',000</option>';
	}
    result = result + '<option value="1000000">$1,000,000</option>';
    for (price=100; price < 1000; price = price + 100) {
	  result = result + '<option value="1'+price+'000">$1,'+price+',000</option>';
	}
    result = result + '<option value="2000000">$2,000,000</option>';
  }
  return result; 
}
