﻿function PicFilter(obj, intType) {
    //避免無法判斷的錯誤造成無窮迴圈, 僅執行一次onerror事件
    obj.onerror = '';

    var iWidth = obj.width

    switch (iWidth) {
        case 75:
            strChkSrc = '/images/prepare_75x55.jpg'; ;
            break;
        case 90:
            strChkSrc = '/images/prepare_90x65.jpg';
            break;
        case 95:
            strChkSrc = '/images/prepare_95x70.jpg';
            break;
        case 100:
            strChkSrc = '/images/prepare_100x75.jpg';
            break;
        case 115:
            strChkSrc = '/images/prepare_115x85.jpg';
            break;
        case 128:
            strChkSrc = '/images/prepare_128x93.jpg';
            break;
        case 150:
            strChkSrc = '/images/prepare_150x110.jpg';
            break;
        case 400:
            strChkSrc = '/images/prepare_400x300.jpg';
            break;
        default:
            strChkSrc = '/images/pict_making.gif';
    }
}
function PicFilter2(obj, owidth) {
    //避免無法判斷的錯誤造成無窮迴圈, 僅執行一次onerror事件
    obj.onerror = '';

    var iWidth=owidth

    switch (iWidth) {
        case 75:
            strChkSrc = '/images/prepare_75x55.jpg'; ;
            break;
        case 90:
            strChkSrc = '/images/prepare_90x65.jpg';
            break;
        case 95:
            strChkSrc = '/images/prepare_95x70.jpg';
            break;
        case 100:
            strChkSrc = '/images/prepare_100x75.jpg';
            break;
        case 115:
            strChkSrc = '/images/prepare_115x85.jpg';
            break;
        case 128:
            strChkSrc = '/images/prepare_128x93.jpg';
            break;
        case 150:
            strChkSrc = '/images/prepare_150x110.jpg';
            break;
        case 400:
            strChkSrc = '/images/prepare_400x300.jpg';
            break;
        default:
            strChkSrc = '/images/pict_making.gif';
    }

//    var strChkSrc = '';
//    var strSrcSlash = '';
//    var strPicSize = '';
//    var strSrc = '';
//    var imgSrc = obj.src;

//    switch (intType) {
//        case 0:
//            strChkSrc = 'http://cdn.housefun.com.tw/housepic/';
//            strPicSize = imgSrc.toLowerCase().replace(strChkSrc, '');
//            strPicSize = strPicSize.substring(0, strPicSize.indexOf('/'));
//            strSrc = strChkSrc + strPicSize + '/construction' + strPicSize + '.jpg';
//            break;
//        case 1:
//            strChkSrc = 'http://cdn.housefun.com.tw/agent/';
//            strChkSrc = strChkSrc + imgSrc.toLowerCase().replace(strChkSrc, '').substring(0, imgSrc.toLowerCase().replace(strChkSrc, '').indexOf('/') + 1);
//            strPicSize = imgSrc.toLowerCase().replace(strChkSrc, '');
//            strPicSize = strPicSize.substring(0, strPicSize.indexOf('/'));
//            strSrc = strChkSrc + strPicSize + '/construction' + strPicSize + '.jpg';
//            break;
//        case 2:
//            strChkSrc = '/ycutupload/wiki/building/';
//            strPicSize = imgSrc.toLowerCase().substring(imgSrc.indexOf(strChkSrc) + strChkSrc.length);
//            strPicSize = strPicSize.substring(strPicSize.lastIndexOf('_') + 1, strPicSize.lastIndexOf('.'));
//            strSrc = strChkSrc + 'construction' + strPicSize + '.jpg';
//            break;
//        case 3:
//            strChkSrc = '/upload/psshopimg/';
//            strPicSize = '100x75';
//            strSrc = 'http://cdn.housefun.com.tw/shop/construction' + strPicSize + '.jpg';
//            break;
//        default:
//            strChkSrc = '/images/pict_making.gif';
//    }
    //strChkSrc = '/images/pict_making.gif';
    obj.src = strChkSrc;
//    if (strChkSrc != '' && imgSrc != '' && imgSrc != null) {
//        var tmpSrc = imgSrc ? imgSrc.toLowerCase() : "";
//        if (tmpSrc.indexOf(strChkSrc) >= 0) {
//            if (strPicSize.indexOf("x") > 0) {
//                obj.src = strSrc;
//            }
//        }
//    }
}
