function open_sort( arg )
{
  location.href = '/front/php/category.php?cate_no=' + arg + '&sort_method='+frm.sort_method.selectedIndex ;
}

function add_basket(product_no)
{
	window.open('/Front/Product/?url=Listbasket&product_no='+product_no, 'list_basket', 'width=405px,height=500px,resizable=yes,scrollbars=yes');
}

/**
 * 상품비교 체크 및 submit
 * 
 * @param max_view_cnt
 * @return
 */
function prdCompareChk(max_view_cnt)
{
    var total_checked = 0;
    var compchk = document.getElementsByName('prdt_comp_list[]');
    
    for(var i=0; i<compchk.length; i++) {
        if(compchk[i].checked) {
            total_checked++;
        }
    }

    if(!total_checked) {
        alert('비교 할 상품을 선택 해주세요.');
        return false;
    }
    if(max_view_cnt < total_checked) {
        alert('상품비교는 '+max_view_cnt+'개 까지 선택이 가능합니다.');
        return false;
    }
    
    for(var i=0; i<compchk.length; i++) {
        if(compchk[i].checked) {
            add_checkbox(compchk[i].value);
        }
    }
    
    var hidden_form = null;
    
    hidden_form = document.createElement('input') ;
    hidden_form.type = 'hidden';
    hidden_form.name = 'url';
    hidden_form.value = 'Compare';
    
    this.f.appendChild(hidden_form);

    this.f.submit();
}

/**
 * 상품비교 체크 폼 생성
 * 
 * @return
 */
function init_form()
{
    if(this.f) {
        this.f.innerHTML = '';
        return this.f;
    }
    this.f = document.createElement('FORM');
    this.f.style.display = 'none';
    this.f.method = 'get';
    this.f.action = '/Front/Product/';
    document.body.appendChild(this.f);
}

/**
 * 상품비교 체크 상품 정리
 * 
 * @param val
 * @return
 */
function add_checkbox(val)
{
    if(!this.f) init_form();
    var check_form = null;
    
    check_form = document.createElement('input') ;
    check_form.type = 'checkbox';
    check_form.name = 'prdt_comp_list[]';
    check_form.value = val;
    
    this.f.appendChild(check_form);    
    check_form.checked = true ;
}