function goKeywordSearch(search_type){
  
  if(search_type == "") search_type = 'grid';
  
  if(document.getElementById('directory').value == "" && document.getElementById('insearch').value == ""){
    alert('キーワードをご入力ください。');
    return false;
  }

//  if( document.getElementById('insearch').value == ""){
//    alert('キーワードをご入力ください。');
//    return false;
//  }

  
  var query = '/'+search_type+".php?";

  var q = document.getElementById('insearch').value;
  var reg=new RegExp("&","g");
  q=q.replace(reg,"＆"); 
  //q=q.replace("&","＆");
  q = encodeURI(q);
  if(q.length > 0){
    query += '&q='+q;
  }
  if(document.getElementById('directory').value != ''){
    query += "&dir="+document.getElementById('directory').value;
  }
  query += '&sort=best&start=1';
  location.href=query;

}

function goPriceSearch(search_type){

  var min_price = document.getElementById('min_price').value;
  var max_price = document.getElementById('max_price').value;
  
  var q = encodeURI(document.getElementById('fltr_q').value);
  var fltr_category = encodeURI(document.getElementById('fltr_category').value);
  var directory = encodeURI(document.getElementById('fltr_dir').value);
  
  var query = '/'+search_type+".php?";
 
  if(q.length > 0){
    query += '&q='+q;
  }
  if(fltr_category.length > 0){
    query += '&fltr_category='+fltr_category;
  }
  if(directory.length > 0){
    query += '&dir='+directory;
  }

  if(min_price.length > 0 && max_price.length > 0 ){
    query += '&min_price='+min_price;
    query += '&max_price='+max_price;
  }
  else if(min_price.length > 0 && max_price.length ==  0 ){
    query += '&fltr_price='+min_price+',0';
  }
  else if(min_price.length == 0 && max_price.length >  0 ){
    query += '&fltr_price=0,'+max_price;
  }
  else if (document.price_form.elements.length) {
    for(i = 0; i < document.price_form.elements.length; i++) {
      if(document.price_form.elements[i].type=="checkbox"){
        if(document.price_form.elements[i].checked==true){
          query += '&fltr_price=' + document.price_form.elements[i].value;
        }
      }
    }
  }    
   query += '&sort=best&start=1';
   
   
  location.href=query;

}

function goPage(actionPath){
    document.forms["gotoPage"].action = actionPath;
	document.forms["gotoPage"].submit();
}


//-------------goods用js  start------------------
function goKeywordSearch2(){
  
  if(document.getElementById('insearch').value == ""){
    alert('キーワードをご入力ください。');
    return false;
  }

  var query = "/item_goods/";

  var q = document.getElementById('insearch').value;
  var reg=new RegExp("&","g");
  q=q.replace(reg,"＆");
  q=q.replace(new RegExp("#","g"),"＃");
  q=q.replace(new RegExp("/","g"),"／");

  q = encodeURIComponent(q);
  //q = encodeURI(q);
  
  if(q.length > 0){
    query += q+".html";
  }
  location.href=query;

}
//-------------goods用js  over------------------