var Wnd;
///////////////////////////////////////////////////////////////////////////////////////////////////////
// window open common function
function OpenWin(cw, ch, win_id, url)
{
    //새창의 크기
//    var cw=600;
//    var ch=400;

    //스크린의 크기
    var sw=screen.availWidth;
    var sh=screen.availHeight;

    //열 창의 포지션
    var px=(sw-cw)/2;
    var py=(sh-ch)/2;

    //창을 여는부분
    Wnd = window.open(url, win_id, 'width='+cw+',height='+ch+',left='+px+',top='+py+',toolbar=no,location=no,status=no,statusbar=0,menubar=0,locationbar=0,scrollbars=yes,resizable=yes');
    Wnd.focus();

}

function OpenWin1(cw, ch, win_id, url, sb, rs)
{
    //새창의 크기
//    var cw=600;
//    var ch=400;

    //스크린의 크기
    var sw=screen.availWidth;
    var sh=screen.availHeight;

    //열 창의 포지션
    var px=(sw-cw)/2;
    var py=(sh-ch)/2;

    //창을 여는부분
    Wnd = window.open(url, win_id, 'width='+cw+',height='+ch+',left='+px+',top='+py+',toolbar=no,location=no,status=no,statusbar=0,menubar=0,locationbar=0,scrollbars='+sb+',resizable='+rs);
    Wnd.focus();

}

///////////////////////////////////////////////////////////////////////////////////////////////////////
// search country
function SetCountry(ctl_id)
{
    var Country = document.getElementById(ctl_id).value;

    var url = 'Common/FindCountry.aspx?Country='+Country+'&ctl_id=' + ctl_id;
    OpenWin(600, 400, "FindCountry", url);
    return false;
    
}

///////////////////////////////////////////////////////////////////////////////////////////////////////
// search zipcode
function SetZip(zip_id, city_id, state_id)
{
    var zip = document.getElementById(zip_id).value;
    var state = document.getElementById(state_id).value;
    var city = document.getElementById(city_id).value;

    var url = 'Common/FindUSZip.aspx?zip='+zip+'&state='+state+'&city='+city+'&ctl_zip='+zip_id+'&ctl_city='+city_id+'&ctl_state='+state_id;
    OpenWin(600, 400, "FindUSZip", url);
    return false;
    
}

///////////////////////////////////////////////////////////////////////////////////////////////////////
// Open Purchase Order Print
function OpenPOPrint(OrderID, rptSvrUrl)
{
    var url = rptSvrUrl+'Common/PrintPO2.aspx?OrderID='+OrderID;
    OpenWin(950, 980, "PrintPO", url);
    return false;
    
}

function OpenPOPrint2(OrderID, rptSvrUrl)
{
    var url = 'Common/PrintPO3.aspx?OrderID='+OrderID;
    OpenWin(800, 800, "PrintPO", url);
    return false;
    
}

// open edit item 
function OpenEditItem(ProductID, CateID)
{
    var url = 'Common/EditItem.aspx?CateID='+CateID+'&ProductID='+ProductID;
    OpenWin(1000, 700, 'EditItem', url);    
    return false;
    
}

// open edit item's color
function OpenEditColor(ProductID)
{
    var url = 'Common/EditColor.aspx?ProductID='+ProductID;
    OpenWin(1000, 700, 'EditColor', url);
    return false;
}

///////////////////////////////////////////////////////////////////////////////////////////////////////
// open edit customer 
function OpenCust(RetailerID)
{
    var url = 'Common/CustomerDetail.aspx?RetailerID='+RetailerID;
    OpenWin(800, 600, 'CustomerDetail', url);
    return false;
}


///////////////////////////////////////////////////////////////////////////////////////////////////////
// Open Vendor Rating
function OpenVendorRating(WholeSalerID)
{    
    var url = 'Common/ViewVendorRating.aspx?WholeSalerID='+WholeSalerID;
    OpenWin(900, 600, 'ViewVendorRating', url);
    return false;
    
}

///////////////////////////////////////////////////////////////////////////////////////////////////////
// Open Retailer Rating
function OpenRetailerRating(RetailerID, CompanyName)
{    
    var url = 'Common/ViewRetailerRating.aspx?RetailerID='+RetailerID+'&CompanyName='+CompanyName;
    OpenWin(900, 600, 'ViewRetailerRating', url);
    return false;
    
}

///////////////////////////////////////////////////////////////////////////////////////////////////////
// view retailer credit notice
function OpenCreditNotice(RetailerID) {
    var url = "Common/CreditNotice.aspx?RetailerID="+RetailerID;
    OpenWin(900, 500, 'CreditNotice', url);
    return false;    
}

///////////////////////////////////////////////////////////////////////////////////////////////////////
// catalogue view
function OpenCatalogueView(WholeSalerID) {
    var url = '/Admin/Common/CatalogueView.aspx?WholeSalerID='+WholeSalerID;
    OpenWin(860, 1070, 'CatalogueView', url);
    return false;
}

///////////////////////////////////////////////////////////////////////////////////////////////////////
// Open Notice Detail
function OpenNoticeDetail(NewsID) {
    var url = "Common/NoticeDetail.aspx?NewsID="+NewsID;
    OpenWin(800, 600, 'NoticeDetail', url);
    return false;
    
}

///////////////////////////////////////////////////////////////////////////////////////////////////////
// open view product large image 
function OpenLargeView(ProductID)
{
    var url = "common/ProductLargeView.aspx?ProductID="+ProductID;
    OpenWin(400, 400, "ProductLargeView", url);
    return false;
}

///////////////////////////////////////////////////////////////////////////////////////////////////////
// Open vendor return policy
function OpenReturnPolicy(WholeSalerID)
{
    var url = 'Common/ViewReturnPolicy.aspx?WholeSalerID='+WholeSalerID;
    OpenWin(640, 480, 'ViewReturnPolicy', url);
    return false;
}    

///////////////////////////////////////////////////////////////////////////////////////////////////////
// Open Excel Export
function OpenExcelExport(PageID)
{
    var url = 'Common/ExcelExport.aspx?PageID='+PageID;
    OpenWin(800, 600, 'ExcelExport', url);
//    Wnd.close();
    return false;
    
}