if(!google_adnum) {
    var google_adnum = 0;
}
function GetLang(name) {
    name = name.replace(/\//,"");
    switch (name){
        // 繁體中文
        case "zh-tw" :
            name = "zh-TW";
            break;
        // 簡體中文
        case "zh-cn" :
            name = "zh-CN";
            break;
        // 預設值為(英文版)
        default :
            name = "en";
            break;
    }
    //alert(name);
    return (name) ? name : null;
}

/*
 * 定義內容連播網頻道
 */
 /*
function GetChannel(value) {
    var this_url   = window.location.href;
    var channel = "";

    if (value != "") {
        channel = value
    }else{
        var this_url   = window.location.href;
        var host = 'www.b2bchinasources.com';
        var str1 = host+'/new-online.php';
        var str2 = host+'/latest-update.php';
        var str3 = host+'/viewtopic.php';

        //-- New Online --
        if( this_url.indexOf(str1) != -1 ) {
            var match = new RegExp("f=([^&]+)","i").exec(location.search);
            // Products
            if (match && match[1] == "P") {
                channel = "1086039266";
            // Companies
            }else{
                channel = "6098595421";
            }

        //-- Latest Update Page --
        }else if( this_url.indexOf(str2) != -1 ) {
            channel = "2662169276";

        //-- 主題頁 --
        }else if( this_url.indexOf(str3) != -1 ) {
            var match = new RegExp("mod=([^&]+)","i").exec(location.search);
            // Buying leads
            if (match && match[1] == "buying_leads") {
                channel = "8271575948";
            // Selling leads
            }else if (match && match[1] == "selling_leads") {
                channel = "0592733947";
            }else{
                channel = "0616448373";
            }
        }
    }
    return (channel) ? channel : null;
}*/

function google_ad_request_done(google_ads) {
    /*
    * This function is required and is used to display
    * the ads that are returned from the JavaScript
    * request. You should modify the document.write
    * commands so that the HTML they write out fits
    * with your desired ad layout.
    */
    var s = '';
    var i;
    /*
    * Verify that there are actually ads to display.
    */
    if (google_ads.length == 0) {
        if(google_obj_id && document.getElementById(google_obj_id)) {
            document.getElementById(google_obj_id).style.display = 'none';
            document.getElementById('ga_ad_w1_title').style.display = 'none';
        }
        return;
    }

    var copyright = '<div class="by_goole"><a href="http://services.google.com/feedback/online_hws_feedback"  style="text-decoration:none" target="_blank">Sponsored Results</a></div>';
    /*
    * If an image or flash ad is returned, display that ad.
    * Otherwise, build a string containing all of the ads and
    * then use a document.write() command to print that string.
    */
    //alert(google_ads[0].type);
    // 傳回Flash廣告
    if (google_ads[0].type == "flash") {
        s +='<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"' +
            ' codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,0,0" WIDTH="' +
            google_ad.image_width + '" HEIGHT="' +
            google_ad.image_height + '"> <PARAM NAME="movie" VALUE="' +
            google_ad.image_url + '">' +
            '<PARAM NAME="quality" VALUE="high">' +
            '<PARAM NAME="AllowScriptAccess" VALUE="never">' +
            '<EMBED src="' +
            google_ad.image_url + '" WIDTH="' +
            google_ad.image_width + '" HEIGHT="' +
            google_ad.image_height +
            '" TYPE="application/x-shockwave-flash"' +
            ' AllowScriptAccess="never" ' +
            ' PLUGINSPAGE="http://www.macromedia.com/go/getflashplayer"></EMBED></OBJECT>';
    // 傳回圖片廣告
    } else if (google_ads[0].type == "image") {
        s += '<a href="' +
            google_ads[0].url + '" target="_blank" title="go to ' +
            google_ads[0].visible_url + '" onmouseout="window.status=\'\'" onmouseover="window.status=\'go to ' +
            google_ads[0].visible_url + '\';return true"><img border="0" src="' +
            google_ads[0].image_url + '"width="' +
            google_ads[0].image_width + '"height="' +
            google_ads[0].image_height + '"></a>';

    // 傳回HTML廣告
    } else if (google_ads[0].type == "html") {
           s += google_ads[0].snippet;
    } else {
        if (google_ads.length > 0) {
            for(i = 0; i < google_ads.length; ++i) {
                switch (google_text_type){
                    case 'ty1':
                        s += '<span>';
                        s += '<a target="_blank" href="'+google_ads[i].url+'">';
                        s += '<div class="gaad_h3">'+google_ads[i].line1+'</div>';
                        s += '</a>';
                        s += '</span>';
                        break;

                    case 'ty2':
                        s += '<span>';
                        s += '<a target="_blank" href="'+google_ads[i].url+'">';
                        s += '<div class="gaad_h3">'+google_ads[i].line1+'</div>';
                        s += '<div class="gaad_url">' + google_ads[i].visible_url + '</div>';
                        s += '</a>';
                        s += '</span>';
                        break;

                    case 'ty3':
                        s += '<span>';
                        s += '<a target="_blank" href="'+google_ads[i].url+'">';
                        s += '<div class="gaad_h3">' + google_ads[i].line1 + '</div>';
                        s += '<div class="gaad_txt">' + google_ads[i].line2  + '</div>';
                        s += '<div class="gaad_url">' + google_ads[i].visible_url + '</div>';
                        s += '</a>';
                        s += '</span>';
                        break;

                    default :
                        s += '<span>';
                        s += '<a target="_blank" href="'+google_ads[i].url+'">';
                        s += '<div class="gaad_h3">'+google_ads[i].line1+'</div>';
                        s += '<div class="gaad_txt">' + google_ads[i].line2;
                        if (typeof(google_ads[i].line3) != 'undefined' && google_ads[i].line3 != "" ) {
                             s += ' - ' + google_ads[i].line3 ;
                        }
                        s += '</div>';
                        s += '<div class="gaad_url">' + google_ads[i].visible_url + '</div>';
                        s += '</a>';
                        s += '</span>';
                        break;
                }

                /* insert this snippet for each ad call */
                if (google_ads[i].bidtype == "CPC") {
                    google_adnum = google_adnum + 1;
                }
            }
        }
    }
    //alert(google_adnum);
    if (s != '') {
        //s = copyright+'<a href=\"'+ google_info.feedback_url +'\"><strong>Ads by Google</strong></a><br><br>'+s ;
        document.write(copyright + s);
    }
    return;
}

//google_adtest      = 'on';
google_ad_client   = 'pub-0852387203100265';
//google_ad_channel  = GetChannel('');
google_ad_output   = 'js';
google_max_num_ads = '2';
google_ad_type     = 'text'; // 'text,image,flash,html'
google_feedback    = 'on';
google_language    = 'en';  // 語系
google_encoding    = 'utf8';
google_safe		   = 'high';
//google_ad_section	= 'default';
google_feedback    = 'on';
google_image_size  = '728x90';
/*
728x90
468x60
336x280
300x250
250x250
200x200
160x600
120x600
*/
/* google_skip 參數僅略過每次點擊成本 (CPC) 廣告；如果您的廣告傳回每千次展示成本 (CPM) 廣告，則 google_skip 參數會被忽略。*/
/* insert this snippet for each ad call */
google_skip        = google_adnum;

/** 自定文字樣式 **/
google_text_type   = '';