﻿
function FilterState(sel) {
  var masterTable = $find(PropertiesGridId).get_masterTableView();
  var state = sel.options[sel.selectedIndex].value;
  
  if (state == -1) {
    masterTable.filter('State', '', Telerik.Web.UI.GridFilterFunction.NoFilter);
  } else {
    
    masterTable.filter('State', state, Telerik.Web.UI.GridFilterFunction.EqualTo);
  }
}

function FilterPopulation(sel) {
  var masterTable = $find(PropertiesGridId).get_masterTableView();
  var price = sel.options[sel.selectedIndex].value;

  masterTable.filter('TotalPop5', sel.options[sel.selectedIndex].value, Telerik.Web.UI.GridFilterFunction.Between);
}

function FilterPrice(sel) {
  var masterTable = $find(PropertiesGridId).get_masterTableView();
  var price = sel.options[sel.selectedIndex].value;

  masterTable.filter('Price', sel.options[sel.selectedIndex].value, Telerik.Web.UI.GridFilterFunction.Between);
}

function FilterName(input) {

  //pausecomp(1000);
  
  var masterTable = $find(PropertiesGridId).get_masterTableView();
  var name = input.value;
  
  if (name.length > 0) {
    masterTable.filter('Title', name, Telerik.Web.UI.GridFilterFunction.StartsWith);
  } else {
    masterTable.filter('Title', '', Telerik.Web.UI.GridFilterFunction.NoFilter);
  }
}

function FilterFastFood(input) {
  var masterTable = $find(PropertiesGridId).get_masterTableView();

  if (input.checked == true) {
    masterTable.filter('AttribFastFood', true, Telerik.Web.UI.GridFilterFunction.EqualTo);
  } else {
    masterTable.filter('AttribFastFood', '', Telerik.Web.UI.GridFilterFunction.NoFilter);
  }
}

function FilterCorner(input) {
  var masterTable = $find(PropertiesGridId).get_masterTableView();

  if (input.checked == true) {
    masterTable.filter('AttribCornerLot', true, Telerik.Web.UI.GridFilterFunction.EqualTo);
  } else {
    masterTable.filter('AttribCornerLot', '', Telerik.Web.UI.GridFilterFunction.NoFilter);
  }
}

function FilterOutParcel(input) {
  var masterTable = $find(PropertiesGridId).get_masterTableView();

  if (input.checked == true) {
    masterTable.filter('AttribOutParcel', true, Telerik.Web.UI.GridFilterFunction.EqualTo);
  } else {
  masterTable.filter('AttribOutParcel', '', Telerik.Web.UI.GridFilterFunction.NoFilter);
  }
}

function FilterCasual(input) {
  var masterTable = $find(PropertiesGridId).get_masterTableView();

  if (input.checked == true) {
    masterTable.filter('AttribCasualDining', true, Telerik.Web.UI.GridFilterFunction.EqualTo);
  } else {
  masterTable.filter('AttribCasualDining', '', Telerik.Web.UI.GridFilterFunction.NoFilter);
  }
}

function FilterSurplus(input) {
  var masterTable = $find(PropertiesGridId).get_masterTableView();

  if (input.checked == true) {
    masterTable.filter('AttribSurPlus', true, Telerik.Web.UI.GridFilterFunction.EqualTo);
  } else {
  masterTable.filter('AttribSurPlus', '', Telerik.Web.UI.GridFilterFunction.NoFilter);
  }
}

function FilterCorporate(input) {
  var masterTable = $find(PropertiesGridId).get_masterTableView();
  
  if (input.checked == true) {
    masterTable.filter('AttribCorporate', true, Telerik.Web.UI.GridFilterFunction.EqualTo);
  } else {
  masterTable.filter('AttribCorporate', '', Telerik.Web.UI.GridFilterFunction.NoFilter);
  }
}

function FilterLandDevelopment(input) {
  var masterTable = $find(PropertiesGridId).get_masterTableView();
  
   if (input.checked == true) {
    masterTable.filter('AttribLandDevelopment', true, Telerik.Web.UI.GridFilterFunction.EqualTo);
  } else {
  masterTable.filter('AttribLandDevelopment', '', Telerik.Web.UI.GridFilterFunction.NoFilter);
  }
}

function pausecomp(millis) {
  var date = new Date();
  var curDate = null;

  do { curDate = new Date(); }
  while (curDate - date < millis);
} 

function DisableOtherCheckBox(sender, args)
{
  document.getElementById("SearchExpand").style.display='none';
  
 
  
  
}

function EnableOtherCheckBox(sender, args)

{
  document.getElementById("SearchExpand").style.display='';
 
  
  
}

