﻿// JScript 文件

function checkSearchText()
{
  var searchText = "";
  var txtKey = document.getElementById("txtKey").value;
  var lineType1 = document.getElementById("lineType1").value;
  var txtPrice1 = document.getElementById("txtPrice1").value;
  var txtPrice2 = document.getElementById("txtPrice2").value;
  var reNum = /^\d+$/;
  if(txtKey != "")
    searchText = searchText + "&key=" + txtKey;
  if(lineType1 != "")
    searchText = searchText + "&type=" + lineType1;
  if(txtPrice1!="" && reNum.test(txtPrice1))
    searchText = searchText + "&ps=" + txtPrice1;
  if(txtPrice2!="" && reNum.test(txtPrice2) && parseInt(txtPrice2)>parseInt(txtPrice1))
    searchText = searchText + "&pt=" + txtPrice2;
  if(searchText.length>0)
    window.open('Lines/Lines.aspx?' + encodeURI(searchText.substr(1)));
  else
    window.open('Lines/Lines.aspx');

  return false;
  
  reNum = null;
  txtPrice2 = null;
  txtPrice1 = null;
  lineType1 = null;
  txtKey = null;
  searchText = null;
  CollectGarbage();
}
