﻿

var _strContentNews1;
var _strContentNews2;
var _strContentNews3;
var _typeNews1 = 'PushPost';
var _typeNews2 = '2';
var _typeNews3 = '7';
var _switchNews1 = true;
var _switchNews2 = true;
var _switchNews3 = true;

var _strContentBlogInfo1;
var _strContentBlogInfo2;
var _strContentBlogInfo3;
var _strContentBlogInfo4;
var _typeBlogInfo1 = '4';
var _typeBlogInfo2 = '5';
var _typeBlogInfo3 = 'newbook';
var _typeBlogInfo4 = '9';
var _switchBlogInfo1 = true;
var _switchBlogInfo2 = true;
var _switchBlogInfo3 = true;
var _switchBlogInfo4 = true;

var _typeRightContent1 = 'book';
var _typeRightContent2 = '6';
var _typeSubMsg = '星光部落';

var _strSubMsg;

var _portalDomain = 'www.bloggerads.net';
var _auhtorDomain = 'author.bloggerads.net';

function createMask(_maskElement, _switch, _listAnchor) {
    var _maskParent = _maskElement.parent();

    var _mask;
    $(_maskParent.children()).each(
                function() {
                    if ($(this).attr('id') == 'msk')
                        _mask = $(this);
                }
            );

    if (_mask == undefined || _mask.length == 0) {
        var _imgpath = '';
        _imgpath = 'http://'+LocationStr()+'/Images/loading.gif';

        _mask = $('<div/>').attr('id', 'msk').css({ width: '100%', height: '100%', float: 'left' });
        _mask.append($('<table/>').css({ width: '100%', height: '100%', float: 'left' }).append($('<tr/>').append($('<td/>').attr('align', 'center').append($('<img/>').attr('src', _imgpath).css({ width: '40', height: '40', position: 'relative' }).error(function() { this.src = 'http://'+ LocationStr() +'/Images/loading.gif' })))));
        $(_maskElement.parent()).append(_mask);
        _mask.css({ top: _maskElement.position().top + 'px', left: _maskElement.position().left + 'px', zIndex: '999', display: 'none' });
    }


    if (_switch != undefined && _switch == 'on') {
        _maskElement.hide();
        _mask.show();
    }
    else if (_listAnchor == null && _switch != null && _switch == 'off') {
        _mask.hide();
        _maskElement.show();
    }
    else if (_switch != undefined && _switch == 'off' && _listAnchor.is(".selected")) {
        _mask.hide();
        _maskElement.show();
    }
}

function changeNewsContent(_dataContent, _type, _callbackAction, _str, _cb, _switch, _cb2, _listAnchor) {
    createMask(_dataContent, 'on');
    if ((_str == undefined || _str.length == 0) && _switch) {
        if (/function/.test(typeof _cb2)) {
            _switch = false;
            _cb2.call(_cb2, _switch);
        }

        if (_type == _typeNews1) {
            $.ajax({ url: _callbackAction, dataType: 'json', data: { type: _type, cnt: 2 }, success: function(data) {
                if (data.length == 0) {
                    _str = '無資料';
                    _dataContent.html(_str);
                }
                else if (data.length == 1) {
                _str = '<ul><li class="rowNews2"><a href="http://' + LocationStr() + '/Portal/PostInfo/' + data[0].Id + '"><img src="' + (data[0].Thumb || 'http://' + LocationStr() + '/Images/writer_image.jpg') + '" width="125" height="95" class="picNews3" onerror="this.src=\'http://' + LocationStr() + '/Images/writer_image.jpg\';"></a><h3 class="w12_000"><a href="http://' + LocationStr() + '/Portal/PostInfo/' + data[0].Id + '" title="' + data[0].Title + '">' + ((data[0].Title.length > 16) ? (data[0].Title.substr(0, 16) + '...') : (data[0].Title)) + '&nbsp;<span style="color:#666666;font-size:11px">' + data[0].PostTime + '</span></a></h3><span style="line-height: 18px;" class="w12_3a3a3a"><a href="http://' + LocationStr() + '/Portal/PostInfo/' + data[0].Id + '">' + ReplaceTag(data[0].Body).substr(0, 50) + '</a>...&nbsp;<a href="http://' + LocationStr() + '/Portal/CaseList"><span class="w10_6eb92b">[更多活動案件]</span></a></span></li><li class="rowLine"><img src="http://'+LocationStr()+'/Images/line_370.jpg"></li></ul>';
                    _dataContent.html(_str);
                }
                else {
                    _str = '<ul><li class="rowNews2"><a href="http://' + LocationStr() + '/Portal/PostInfo/' + data[0].Id + '"><img src="' + (data[0].Thumb || 'http://' + LocationStr() + '/Images/writer_image.jpg') + '" width="125" height="95" class="picNews3" onerror="this.src=\'http://' + LocationStr() + '/Images/writer_image.jpg\';"></a><h3 class="w12_000"><a href="http://' + LocationStr() + '/Portal/PostInfo/' + data[0].Id + '" title="' + data[0].Title + '">' + ((data[0].Title.length > 16) ? (data[0].Title.substr(0, 16) + '...') : (data[0].Title)) + '&nbsp;<span style="color:#666666;font-size:11px">' + data[0].PostTime + '</span></a></h3><span style="line-height: 18px;" class="w12_3a3a3a"><a href="http://' + LocationStr() + '/Portal/PostInfo/' + data[0].Id + '">' + ReplaceTag(data[0].Body).substr(0, 50) + '</a>...&nbsp;<a href="http://' + LocationStr() + '/Portal/CaseList"><span class="w10_6eb92b">[更多活動案件]</span></a></span></li><li class="rowLine2"><img src="http://'+LocationStr()+'/Images/line_370.jpg"></li><li class="rowNews2"><a href="http://' + LocationStr() + '/Portal/PostInfo/' + data[1].Id + '"><img src="' + (data[1].Thumb || 'http://'+LocationStr()+'/Images/writer_image.jpg') + '" width="125" height="95" class="picNews3" onerror="this.src=\'http://'+LocationStr()+'/Images/writer_image.jpg\';"></a><h3 class="w12_000"><a href="http://' + LocationStr() + '/Portal/PostInfo/' + data[1].Id + '" title="' + data[1].Title + '">' + ((data[1].Title.length > 16) ? (data[1].Title.substr(0, 16) + '...') : (data[1].Title)) + '&nbsp;<span style="color:#666666;font-size:11px">' + data[1].PostTime + '</span></a></h3><span style="line-height: 18px;" class="w12_3a3a3a"><a href="http://' + LocationStr() + '/Portal/PostInfo/' + data[1].Id + '">' + ReplaceTag(data[1].Body).substr(0, 50) + '</a>...&nbsp;<a href="http://' + LocationStr() + '/Portal/CaseList"><span class="w10_6eb92b">[更多活動案件]</span></a></span></li></ul>';
                    _dataContent.html(_str);
                }

                if (/function/.test(typeof _cb))
                    _cb.call(_cb, _str);

                if (/function/.test(typeof _cb2)) {
                    _switch = true;
                    _cb2.call(_cb2, _switch);
                }

                createMask(_dataContent, 'off', _listAnchor);
            },
                error: function() {
                    _str = '無資料';
                    _dataContent.html(_str);
                    createMask(_dataContent, 'off', _listAnchor);
                } 
            });
        }
        else if (_type == _typeNews2) {
            $.ajax({ url: _callbackAction, dataType: 'json', data: { type: _type, cnt: 2 }, success: function(data) {
                if (data.length == 0) {
                    _str = '無資料';
                    _dataContent.html(_str);
                }
                else if (data.length == 1) {
                _str = '<ul style="margin:5px 15px;"><li class="rowNews"><h4 class="w12_light_orange"><a href="http://' + LocationStr() + '/Portal/NewsContent/' + data[0].Id + '">' + ((data[0].Title.length > 20) ? (data[0].Title.substr(0, 20) + '...') : (data[0].Title)) + '</a></h4>&nbsp;<img src="http://' + LocationStr() + '/Images/icon_news.jpg" width="21" height="14">&nbsp;<span style="color:#666666;font-size:11px">' + data[0].PostTime + '</span><br><span style="line-height: 18px;" class="w12_3a3a3a">' + ((ReplaceTag(data[0].Body).length > 59) ? (ReplaceTag(data[0].Body).substr(0, 59) + '...') : (ReplaceTag(data[0].Body))) + '</span><br><span style="line-height: 20px;" class="w12_light_green"><a href="http://' + LocationStr() + '/Portal/News">了解更多活動訊息>></a></span></li><li class="rowLine"><img src="http://'+LocationStr()+'/Images/line_370.jpg"></li>';
                    _dataContent.html(_str);
                }
                else {
                    _str = '<ul style="margin:5px 15px;"><li class="rowNews"><h4 class="w12_light_orange"><a href="http://' + LocationStr() + '/Portal/NewsContent/' + data[0].Id + '">' + ((data[0].Title.length > 20) ? (data[0].Title.substr(0, 20) + '...') : (data[0].Title)) + '</a></h4>&nbsp;<img src="http://' + LocationStr() + '/Images/icon_news.jpg" width="21" height="14">&nbsp;<span style="color:#666666;font-size:11px">' + data[0].PostTime + '</span><br><span style="line-height: 18px;" class="w12_3a3a3a">' + ((ReplaceTag(data[0].Body).length > 59) ? (ReplaceTag(data[0].Body).substr(0, 59) + '...') : (ReplaceTag(data[0].Body))) + '</span><br><span style="line-height: 20px;" class="w12_light_green"><a href="http://' + LocationStr() + '/Portal/News">了解更多活動訊息>></a></span></li><li class="rowLine"><img src="http://'+LocationStr()+'/Images/line_370.jpg"></li><ul><li class="rowNews"><h4 class="w12_light_orange"><a href="http://' + LocationStr() + '/Portal/News/' + data[1].Id + '">' + ((data[1].Title.length > 20) ? (data[1].Title.substr(0, 20) + '...') : (data[1].Title)) + '</a></h4>&nbsp;<img src="http://'+LocationStr()+'/Images/icon_news.jpg" width="21" height="14">&nbsp;<span style="color:#666666;font-size:11px">' + data[0].PostTime + '</span><br><span style="line-height: 18px;" class="w12_3a3a3a">' + ((ReplaceTag(data[1].Body).length > 59) ? (ReplaceTag(data[1].Body).substr(0, 59) + '...') : (ReplaceTag(data[1].Body))) + '</span><br><span style="line-height: 20px;" class="w12_light_green"><a href="http://' + LocationStr() + '/Portal/News" target="_blank">了解更多活動訊息>></a></span></li></ul>';
                    _dataContent.html(_str);
                }

                if (/function/.test(typeof _cb))
                    _cb.call(_cb, _str);

                if (/function/.test(typeof _cb2)) {
                    _switch = true;
                    _cb2.call(_cb2, _switch);
                }

                createMask(_dataContent, 'off', _listAnchor);
            },
                error: function() {
                    _str = '無回應';
                    _dataContent.html(_str);
                    createMask(_dataContent, 'off', _listAnchor);
                } 
            });
        }
        else if (_type == _typeNews3) {
            $.ajax({ url: _callbackAction, dataType: 'json', data: { type: _type, cnt: 1 }, success: function(data) {
                if (data.length == 0) {
                    _str = '無資料';
                    _dataContent.html(_str);
                }
                else {
                    _str = '<ul style="padding:10px 15px;"><li><a href="http://' + data[0].URL + '" target="_blank"><img src="http://' + data[0].Thumb + '" width="160" height="180" class="picNews2"></a><h4 class="w12_light_orange"><a href="http://' + data[0].URL + '" target="_blank">' + data[0].Title + '</a></h4>&nbsp;<img src="http://' + LocationStr() + '/Images/icon_news2.jpg" width="17" height="14"><br><span style="display: block; line-height: 18px; margin-top: 10px;" class="w12_3a3a3a">' + data[0].Body.substr(0, 58) + '...</span></li><br><span style="line-height: 20px;" class="w12_light_green"><a href="http://' + data[0].URL + '" target="_blank">前往部落格了解更多>></a></span></ul>';
                    _dataContent.html(_str);
                }

                if (/function/.test(typeof _cb))
                    _cb.call(_cb, _str);

                if (/function/.test(typeof _cb2)) {
                    _switch = true;
                    _cb2.call(_cb2, _switch);
                }

                createMask(_dataContent, 'off', _listAnchor);
            },
                error: function() {
                    _str = '無回應';
                    _dataContent.html(_str);
                    createMask(_dataContent, 'off', _listAnchor);
                } 
            });
        }
    }
    else {
        if (!($(_str).is(undefined)) || _str.length != 0) {
            createMask(_dataContent, 'off', _listAnchor);
        }
    }
}

function changeBlogInfoContent(_dataContent, _type, _callbackAction, _str, _cb, _switch, _cb2, _listAnchor) {
    createMask(_dataContent, 'on');
    if ((_str == undefined || _str.length == 0) && _switch) {
        if (/function/.test(typeof _cb2)) {
            _switch = false;
            _cb2.call(_cb2, _switch);
        }

        if (_type == _typeBlogInfo1) {
            $.ajax({ url: _callbackAction, dataType: 'json', data: { count: 4 }, success: function(_data) {
                var data = _data.Data;
                if (data.length == 0) {
                    _str = '無資料';
                    _dataContent.html(_str);
                }
                else if (data.length == 1) {
                    _str = '<ul><li class="rowBlogInfo"><a href="http://' + LocationStr() + '/Portal/ProductInfo/' + data[0].HitdoId + '" title="' + data[0].Name + '"><img class="picBlogInfo" src="http://' + data[0].Picture + '" width="75" height="75"></a><span style="line-height: 20px;" class="w12_000"><a href="http://' + LocationStr() + '/Portal/ProductInfo/' + data[0].HitdoId + '" title="' + data[0].Name + '">' + data[0].Name.substr(0, 9) + '...</a></span><br><span class="w12_3a3a3a"><a href="http://' + LocationStr() + '/Portal/ProductInfo/' + data[0].HitdoId + '">' + (ReplaceTag(data[0].Description)).substr(0, 50) + '</a>...&nbsp;<a href="http://' + LocationStr() + '/Portal/BlogProduct" style="color:#6eb92b">more</a></span></li>' +
                                           '<li class="rowBlogLine"><img src="http://' + LocationStr() + '/Images/line_490.jpg" width="489" height="4"></li></ul>';
                    _dataContent.html(_str);
                }
                else if (data.length == 2) {
                    _str = '<ul><li class="rowBlogInfo"><a href="http://' + LocationStr() + '/Portal/ProductInfo/' + data[0].HitdoId + '" title="' + data[0].Name + '"><img class="picBlogInfo" src="http://' + data[0].Picture + '" width="75" height="75"></a><span style="line-height: 20px;" class="w12_000"><a href="http://' + LocationStr() + '/Portal/ProductInfo/' + data[0].HitdoId + '" title="' + data[0].Name + '">' + data[0].Name.substr(0, 9) + '...</a></span><br><span class="w12_3a3a3a"><a href="http://' + LocationStr() + '/Portal/ProductInfo/' + data[0].HitdoId + '">' + (ReplaceTag(data[0].Description)).substr(0, 50) + '</a>...&nbsp;<a href="http://' + LocationStr() + '/Portal/BlogProduct" style="color:#6eb92b">more</a></span></li>' +
                                           '<li class="rowBlogInfo"><a href="http://' + LocationStr() + '/Portal/ProductInfo/' + data[1].HitdoId + '" title="' + data[1].Name + '"><img class="picBlogInfo" src="http://' + data[1].Picture + '" width="75" height="75"></a><span style="line-height: 20px;" class="w12_000"><a href="http://' + LocationStr() + '/Portal/ProductInfo/' + data[1].HitdoId + '" title="' + data[1].Name + '">' + data[1].Name.substr(0, 9) + '...</a></span><br><span class="w12_3a3a3a"><a href="http://' + LocationStr() + '/Portal/ProductInfo/' + data[1].HitdoId + '">' + (ReplaceTag(data[0].Description)).substr(0, 50) + '</a>...&nbsp;<a href="http://' + LocationStr() + '/Portal/BlogProduct" style="color:#6eb92b">more</a></span></li>' +
                                           '<li class="rowBlogLine"><img src="http://' + LocationStr() + '/Images/line_490.jpg" width="489" height="4"></li></ul>';
                    _dataContent.html(_str);
                }
                else if (data.length == 3) {
                    _str = '<ul><li class="rowBlogInfo"><a href="http://' + LocationStr() + '/Portal/ProductInfo/' + data[0].HitdoId + '" title="' + data[0].Name + '"><img class="picBlogInfo" src="http://' + data[0].Picture + '" width="75" height="75"></a><span style="line-height: 20px;" class="w12_000"><a href="http://' + LocationStr() + '/Portal/ProductInfo/' + data[0].HitdoId + '" title="' + data[0].Name + '">' + data[0].Name.substr(0, 9) + '...</a></span><br><span class="w12_3a3a3a"><a href="http://' + LocationStr() + '/Portal/ProductInfo/' + data[0].HitdoId + '">' + (ReplaceTag(data[0].Description)).substr(0, 50) + '</a>...&nbsp;<a href="http://' + LocationStr() + '/Portal/BlogProduct" style="color:#6eb92b">more</a></span></li>' +
                                           '<li class="rowBlogInfo"><a href="http://' + LocationStr() + '/Portal/ProductInfo/' + data[1].HitdoId + '" title="' + data[1].Name + '"><img class="picBlogInfo" src="http://' + data[1].Picture + '" width="75" height="75"></a><span style="line-height: 20px;" class="w12_000"><a href="http://' + LocationStr() + '/Portal/ProductInfo/' + data[1].HitdoId + '" title="' + data[1].Name + '">' + data[1].Name.substr(0, 9) + '...</a></span><br><span class="w12_3a3a3a"><a href="http://' + LocationStr() + '/Portal/ProductInfo/' + data[1].HitdoId + '">' + (ReplaceTag(data[0].Description)).substr(0, 50) + '</a>...&nbsp;<a href="http://' + LocationStr() + '/Portal/BlogProduct" style="color:#6eb92b">more</a></span></li>' +
                                           '<li class="rowBlogLine"><img src="http://' + LocationStr() + '/Images/line_490.jpg" width="489" height="4"></li>' +
                                           '<li class="rowBlogInfo"><a href="http://' + LocationStr() + '/Portal/ProductInfo/' + data[2].HitdoId + '" title="' + data[2].Name + '"><img class="picBlogInfo" src="http://' + data[2].Picture + '" width="75" height="75"></a><span style="line-height: 20px;" class="w12_000"><a href="http://' + LocationStr() + '/Portal/ProductInfo/' + data[2].HitdoId + '" title="' + data[2].Name + '">' + data[2].Name.substr(0, 9) + '...</a></span><br><span class="w12_3a3a3a"><a href="http://' + LocationStr() + '/Portal/ProductInfo/' + data[2].HitdoId + '">' + (ReplaceTag(data[0].Description)).substr(0, 50) + '</a>...&nbsp;<a href="http://' + LocationStr() + '/Portal/BlogProduct" style="color:#6eb92b">more</a></span></li>';
                    _dataContent.html(_str);
                }
                else {
                    _str = '<ul><li class="rowBlogInfo"><a href="http://' + LocationStr() + '/Portal/ProductInfo/' + data[0].HitdoId + '" title="' + data[0].Name + '"><img class="picBlogInfo" src="http://' + data[0].Picture + '" width="75" height="75"></a><span style="line-height: 20px;" class="w12_000"><a href="http://' + LocationStr() + '/Portal/ProductInfo/' + data[0].HitdoId + '" title="' + data[0].Name + '">' + data[0].Name.substr(0, 9) + '...</a></span><br><span class="w12_3a3a3a"><a href="http://' + LocationStr() + '/Portal/ProductInfo/' + data[0].HitdoId + '">' + (ReplaceTag(data[0].Description)).substr(0, 50) + '</a>...&nbsp;<a href="http://' + LocationStr() + '/Portal/BlogProduct" style="color:#6eb92b">more</a></span></li>' +
                                           '<li class="rowBlogInfo"><a href="http://' + LocationStr() + '/Portal/ProductInfo/' + data[1].HitdoId + '" title="' + data[1].Name + '"><img class="picBlogInfo" src="http://' + data[1].Picture + '" width="75" height="75"></a><span style="line-height: 20px;" class="w12_000"><a href="http://' + LocationStr() + '/Portal/ProductInfo/' + data[1].HitdoId + '" title="' + data[1].Name + '">' + data[1].Name.substr(0, 9) + '...</a></span><br><span class="w12_3a3a3a"><a href="http://' + LocationStr() + '/Portal/ProductInfo/' + data[1].HitdoId + '">' + (ReplaceTag(data[1].Description)).substr(0, 50) + '</a>...&nbsp;<a href="http://' + LocationStr() + '/Portal/BlogProduct" style="color:#6eb92b">more</a></span></li>' +
                                           '<li class="rowBlogLine"><img src="http://' + LocationStr() + '/Images/line_490.jpg" width="489" height="4"></li>' +
                                           '<li class="rowBlogInfo"><a href="http://' + LocationStr() + '/Portal/ProductInfo/' + data[2].HitdoId + '" title="' + data[2].Name + '"><img class="picBlogInfo" src="http://' + data[2].Picture + '" width="75" height="75"></a><span style="line-height: 20px;" class="w12_000"><a href="http://' + LocationStr() + '/Portal/ProductInfo/' + data[2].HitdoId + '" title="' + data[2].Name + '">' + data[2].Name.substr(0, 9) + '...</a></span><br><span class="w12_3a3a3a"><a href="http://' + LocationStr() + '/Portal/ProductInfo/' + data[2].HitdoId + '">' + (ReplaceTag(data[2].Description)).substr(0, 50) + '</a>...&nbsp;<a href="http://' + LocationStr() + '/Portal/BlogProduct" style="color:#6eb92b">more</a></span></li>' +
                                           '<li class="rowBlogInfo"><a href="http://' + LocationStr() + '/Portal/ProductInfo/' + data[3].HitdoId + '" title="' + data[3].Name + '"><img class="picBlogInfo" src="http://' + data[3].Picture + '" width="75" height="75"></a><span style="line-height: 20px;" class="w12_000"><a href="http://' + LocationStr() + '/Portal/ProductInfo/' + data[3].HitdoId + '" title="' + data[3].Name + '">' + data[3].Name.substr(0, 9) + '...</a></span><br><span class="w12_3a3a3a"><a href="http://' + LocationStr() + '/Portal/ProductInfo/' + data[3].HitdoId + '">' + (ReplaceTag(data[3].Description)).substr(0, 50) + '</a>...&nbsp;<a href="http://' + LocationStr() + '/Portal/BlogProduct" style="color:#6eb92b">more</a></span></li>';
                    _dataContent.html(_str);
                }

                if (/function/.test(typeof _cb))
                    _cb.call(_cb, _str);

                if (/function/.test(typeof _cb2)) {
                    _switch = true;
                    _cb2.call(_cb2, _switch);
                }

                createMask(_dataContent, 'off', _listAnchor);
            },
                error: function() {
                    _str = '無資料';
                    _dataContent.html(_str);
                    createMask(_dataContent, 'off', _listAnchor);
                }
            });
        }
        else if (_type == _typeBlogInfo2 || _type == _typeBlogInfo4) {
            $.ajax({ url: _callbackAction, dataType: 'json', data: { type: _type, cnt: 3 }, success: function(data) {
                if (data.length == 0) {
                    _str = '無資料';
                    _dataContent.html(_str);
                }
                else if (data.length == 1) {
                _str = '<ul><li><span class="w12_light_green"><a href="http://' + data[0].URL + '">' + data[0].Thumb + '</a></span><span style="font-size:8pt;color:#383839;">&nbsp;&nbsp;'+ data[0].PostTime +'</span><br><span class="w12_000"><a href="http://' + data[0].URL + '">' + data[0].Title + '</a></span><br><span style="line-height: 14px;" class="w12_3a3a3a">' + data[0].Body.substr(0, 75) + '...&nbsp;<a href="http://' + LocationStr() + '/Portal/BlogSales" style="color:#6eb92b">more</a></span></li>' +
                                       '<li class="rowBlogLine2"><img src="http://'+LocationStr()+'/Images/line_490.jpg"></li>' +
                                    '</ul>';
                    _dataContent.html(_str);
                }
                else if (data.length == 2) {
                _str = '<ul><li><span class="w12_light_green"><a href="http://' + data[0].URL + '">' + data[0].Thumb + '</a></span><span style="font-size:8pt;color:#383839;">&nbsp;&nbsp;' + data[0].PostTime + '</span><br><span class="w12_000"><a href="http://' + data[0].URL + '">' + data[0].Title + '</a></span><br><span style="line-height: 14px;" class="w12_3a3a3a">' + data[0].Body.substr(0, 75) + '...&nbsp;<a href="http://' + LocationStr() + '/Portal/BlogSales" style="color:#6eb92b">more</a></span></li>' +
                                       '<li class="rowBlogLine2"><img src="http://'+LocationStr()+'/Images/line_490.jpg"></li>' +
                                       '<li><span class="w12_light_green"><a href="http://' + data[1].URL + '">' + data[1].Thumb + '</a></span><span style="font-size:8pt;color:#383839;">&nbsp;&nbsp;' + data[1].PostTime + '</span><br><span class="w12_000"><a href="http://' + data[1].URL + '">' + data[1].Title + '</a></span><br><span style="line-height: 14px;" class="w12_3a3a3a">' + data[1].Body.substr(0, 75) + '...&nbsp;<a href="http://' + LocationStr() + '/Portal/BlogSales" style="color:#6eb92b">more</a></span></li>' +
                                       '<li class="rowBlogLine2"><img src="http://'+LocationStr()+'/Images/line_490.jpg"></li>' +
                                    '</ul>';
                    _dataContent.html(_str);
                }
                else {
                    _str = '<ul><li><span class="w12_light_green"><a href="http://' + data[0].URL + '">' + data[0].Thumb + '</a></span><span style="font-size:8pt;color:#383839;">&nbsp;&nbsp;' + data[0].PostTime + '</span><br><span class="w12_000"><a href="http://' + data[0].URL + '">' + data[0].Title + '</a></span><br><span style="line-height: 14px;" class="w12_3a3a3a">' + data[0].Body.substr(0, 75) + '...&nbsp;<a href="http://' + LocationStr() + '/Portal/BlogSales" style="color:#6eb92b">more</a></span></li>' +
                                       '<li class="rowBlogLine2"><img src="http://'+LocationStr()+'/Images/line_490.jpg"></li>' +
                                       '<li><span class="w12_light_green"><a href="http://' + data[1].URL + '">' + data[1].Thumb + '</a></span><span style="font-size:8pt;color:#383839;">&nbsp;&nbsp;' + data[1].PostTime + '</span><br><span class="w12_000"><a href="http://' + data[1].URL + '">' + data[1].Title + '</a></span><br><span style="line-height: 14px;" class="w12_3a3a3a">' + data[1].Body.substr(0, 75) + '...&nbsp;<a href="http://' + LocationStr() + '/Portal/BlogSales" style="color:#6eb92b">more</a></span></li>' +
                                       '<li class="rowBlogLine2"><img src="http://'+LocationStr()+'/Images/line_490.jpg"></li>' +
                                       '<li><span class="w12_light_green"><a href="http://' + data[2].URL + '">' + data[2].Thumb + '</a></span><span style="font-size:8pt;color:#383839;">&nbsp;&nbsp;' + data[2].PostTime + '</span><br><span class="w12_000"><a href="http://' + data[2].URL + '">' + data[2].Title + '</a></span><br><span style="line-height: 14px;" class="w12_3a3a3a">' + data[2].Body.substr(0, 75) + '...&nbsp;<a href="http://' + LocationStr() + '/Portal/BlogSales" style="color:#6eb92b">more</a></span></li>' +
                                    '</ul>';
                    _dataContent.html(_str);
                }

                if (/function/.test(typeof _cb))
                    _cb.call(_cb, _str);

                if (/function/.test(typeof _cb2)) {
                    _switch = true;
                    _cb2.call(_cb2, _switch);
                }

                createMask(_dataContent, 'off', _listAnchor);
            },
                error: function() {
                    _str = '無資料';
                    _dataContent.html(_str);
                    createMask(_dataContent, 'off', _listAnchor);
                } 
            });
        }
        else if (_type == _typeBlogInfo3) {
            $.ajax({ url: _callbackAction, dataType: 'json', success: function(data) {
                if (data.length == 0) {
                    _str = '無資料';
                    _dataContent.html(_str);
                }
                else if (data.length == 1) {
                    _str = '<ul><li><a href="http://' + LocationStr() + '/Portal/BlogNewBook/' + data[0].BookId + '" title="' + data[0].Name + '"><img src="http://' + data[0].Thumb + '" width="60" height="80" class="picBlogInfo2"></a><span class="w12_light_green"><a href="http://' + LocationStr() + '/Portal/BlogNewBook/' + data[0].BookId + '" title="' + data[0].Name + '">' + data[0].Name.substr(0, 30) + '</a></span><br><span class="w12_000">作者：' + data[0].Author + ' </span><br><span style="line-height:14px;" class="w12_3a3a3a"><a href="http://' + LocationStr() + '/Portal/BlogNewBook/' + data[0].BookId + '">' + ReplaceTag(data[0].Body).substr(0, 120) + '</a>...&nbsp;<a href="http://' + LocationStr() + '/Portal/BlogNewBook/' + data[0].BookId + '" style="color:#6eb92b">more</a></span></li><li class="rowBlogLine"><img src="http://'+LocationStr()+'/Images/line_370.jpg"></li></ul>';
                    _dataContent.html(_str);
                }
                else {
                    _str = '<ul><li><a href="http://' + LocationStr() + '/Portal/BlogNewBook/' + data[0].BookId + '" title="' + data[0].Name + '"><img src="http://' + data[0].Thumb + '" width="60" height="80" class="picBlogInfo2"></a><span class="w12_light_green"><a href="http://' + LocationStr() + '/Portal/BlogNewBook/' + data[0].BookId + '" title="' + data[0].Name + '">' + data[0].Name.substr(0, 30) + '</a></span><br><span class="w12_000">作者：' + data[0].Author + ' </span><br><span style="line-height:14px;" class="w12_3a3a3a"><a href="http://' + LocationStr() + '/Portal/BlogNewBook/' + data[0].BookId + '">' + ReplaceTag(data[0].Body).substr(0, 120) + '</a>...&nbsp;<a href="http://' + LocationStr() + '/Portal/BlogNewBook/' + data[0].BookId + '" style="color:#6eb92b">more</a></span></li>' +
                                       '<li class="rowBlogLine"><img src="http://'+LocationStr()+'/Images/line_490.jpg"></li>' +
                                       '<li><a href="http://' + LocationStr() + '/Portal/BlogNewBook/' + data[1].BookId + '" title="' + data[1].Name + '"><img src="http://' + data[1].Thumb + '" width="60" height="80" class="picBlogInfo2"></a><span class="w12_light_green"><a href="http://' + LocationStr() + '/Portal/BlogNewBook/' + data[1].BookId + '" title="' + data[1].Name + '">' + data[1].Name.substr(0, 30) + '</a></span><br><span class="w12_000">作者：' + data[1].Author + ' </span><br><span style="line-height:14px;" class="w12_3a3a3a"><a href="http://' + LocationStr() + '/Portal/BlogNewBook/' + data[1].BookId + '">' + ReplaceTag(data[1].Body).substr(0, 120) + '</a>...&nbsp;<a href="http://' + LocationStr() + '/Portal/BlogNewBook/' + data[1].BookId + '" style="color:#6eb92b">more</a></span></li>' +
                                       '</ul>';
                    _dataContent.html(_str);
                }

                if (/function/.test(typeof _cb))
                    _cb.call(_cb, _str);

                if (/function/.test(typeof _cb2)) {
                    _switch = true;
                    _cb2.call(_cb2, _switch);
                }

                createMask(_dataContent, 'off', _listAnchor);
            },
                error: function() {
                    _str = '無資料';
                    _dataContent.html(_str);
                    createMask(_dataContent, 'off', _listAnchor);
                } 
            });
        }
    }
    else {
        if (!($(_str).is(undefined)) || _str.length != 0) {
            createMask(_dataContent, 'off', _listAnchor);
        }
    }
}

function changeSubMsg(_dataContent, _type, _callbackAction, _str, _cb) {
    if (_str == undefined || _str.length == 0) {
        createMask(_dataContent, 'on');
        $.ajax({ url: _callbackAction, dataType: 'json', data: { type: _type, cnt: 4 }, success: function(data) {
            var _data = data.data;
            if (_data.length == 0) {
                _str = '<li>無資料</li>';
            }
            else {
                _str = '';
                for (_idx in _data) {
                    _str += '<li><img class="pic" src="http://photo.bloggerads.net/' + _data[_idx].Thumb + '.gif" style="width:65px;height:65px;" onerror="this.src=\'http://'+LocationStr()+'/Images/BlogNoSnap.gif\'"><h2 class="w12_000"><a href="http://' + _data[_idx].Address + '" target="_blank" title="' + _data[_idx].Name + '">' + _data[_idx].Name.substr(0, 7) + '...</a></h2><h3 class="w10_6eb92b">' + _data[_idx].Channels + '</h3><span class="w12_3a3a3a">' + _data[_idx].Description.substr(0, 17) + '...</span></li>';
                }
            }

            _dataContent.html(_str);

            createMask(_dataContent, 'off');
            if (/function/.test(typeof _cb))
                _cb.call(_cb, _str);
        },
            error: function() {
                _str = '<li>無資料</li>';
                _dataContent.html(_str);
                createMask(_dataContent, 'off');
            }
        });
    }
    else {
        _dataContent.html(_str);
    }
}

function tabSwitch(_dataContent, _type, _callBackAction, _listAnchor) {
    if (_type == _typeNews1)
        changeNewsContent(_dataContent, _type, _callBackAction, _strContentNews1, function() { _strContentNews1 = arguments[0]; }, _switchNews1, function() { _switchNews1 = arguments[0] }, _listAnchor);
    else if (_type == _typeNews2)
        changeNewsContent(_dataContent, _type, _callBackAction, _strContentNews2, function() { _strContentNews2 = arguments[0]; }, _switchNews2, function() { _switchNews2 = arguments[0] }, _listAnchor);
    else if (_type == _typeNews3)
        changeNewsContent(_dataContent, _type, _callBackAction, _strContentNews3, function() { _strContentNews3 = arguments[0]; }, _switchNews3, function() { _switchNews3 = arguments[0] }, _listAnchor);

    if (_type == _typeBlogInfo1)
        changeBlogInfoContent(_dataContent, _type, _callBackAction, _strContentBlogInfo1, function() { _strContentBlogInfo1 = arguments[0]; }, _switchBlogInfo1, function() { _switchBlogInfo1 = arguments[0] }, _listAnchor);
    else if (_type == _typeBlogInfo2)
        changeBlogInfoContent(_dataContent, _type, _callBackAction, _strContentBlogInfo2, function() { _strContentBlogInfo2 = arguments[0]; }, _switchBlogInfo2, function() { _switchBlogInfo2 = arguments[0] }, _listAnchor);
    else if (_type == _typeBlogInfo3)
        changeBlogInfoContent(_dataContent, _type, _callBackAction, _strContentBlogInfo3, function() { _strContentBlogInfo3 = arguments[0]; }, _switchBlogInfo3, function() { _switchBlogInfo3 = arguments[0] }, _listAnchor);
    else if (_type == _typeBlogInfo4) {
        changeBlogInfoContent(_dataContent, _type, _callBackAction, _strContentBlogInfo4, function() { _strContentBlogInfo4 = arguments[0]; }, _switchBlogInfo4, function() { _switchBlogInfo4 = arguments[0] }, _listAnchor);
    }
}

function changeRightContent(_dataContent, _type, _callbackAction,_orderby,_hide) {
    createMask(_dataContent, 'on');
    if (_type == _typeRightContent1) {
        $.ajax({ url: _callbackAction, dataType: 'json', data: { type: _type, cnt: 4, OrderBy: _orderby }, success: function(jdata) {
            var _str = '';
            var data = jdata.data;
            if (data.length > 0) {
                for (_i = 0; _i < data.length && _i < 4; _i++) {
                    if (_orderby == 'PostDate') {
                        if (_i % 2 == 0)
                            _str += '<div class="cont01"><h1><a href="http://' + data[_i].PostUrl + '" target="_blank" onclick="AddRecommendImpr(' + data[_i].Id + ')">' + ((data[_i].Title.length > 11) ? (data[_i].Title.substr(0, 10) + '...') : data[_i].Title) + '</a></h1><h2><a href="http://' + data[_i].PostUrl + '" target="_blank" onclick="AddRecommendImpr(' + data[_i].Id + ')">' + ((data[_i].Body.length > 39) ? (data[_i].Body.substr(0, 38) + '...') : data[_i].Body) + '</a></h2><h3>' + data[_i].PostDate + '</h3></div>';
                        else
                            _str += '<div class="cont02"><h1><a href="http://' + data[_i].PostUrl + '" target="_blank" onclick="AddRecommendImpr(' + data[_i].Id + ')">' + ((data[_i].Title.length > 11) ? (data[_i].Title.substr(0, 10) + '...') : data[_i].Title) + '</a></h1><h2><a href="http://' + data[_i].PostUrl + '" target="_blank" onclick="AddRecommendImpr(' + data[_i].Id + ')">' + ((data[_i].Body.length > 39) ? (data[_i].Body.substr(0, 38) + '...') : data[_i].Body) + '</a></h2><h3>' + data[_i].PostDate + '</h3></div>';
                    }
                    else {
                        if (_i % 2 == 0)
                            _str += '<div class="cont01"><h1><a href="http://' + data[_i].PostUrl + '" target="_blank" onclick="AddRecommendImpr(' + data[_i].Id + ')">' + ((data[_i].Title.length > 11) ? (data[_i].Title.substr(0, 10) + '...') : data[_i].Title) + '</a></h1><h2><a href="http://' + data[_i].PostUrl + '" target="_blank" onclick="AddRecommendImpr(' + data[_i].Id + ')">' + ((data[_i].Body.length > 39) ? (data[_i].Body.substr(0, 38) + '...') : data[_i].Body) + '</a></h2><h3>人氣：' + data[_i].Impr + '</h3></div>';
                        else
                            _str += '<div class="cont02"><h1><a href="http://' + data[_i].PostUrl + '" target="_blank" onclick="AddRecommendImpr(' + data[_i].Id + ')">' + ((data[_i].Title.length > 11) ? (data[_i].Title.substr(0, 10) + '...') : data[_i].Title) + '</a></h1><h2><a href="http://' + data[_i].PostUrl + '" target="_blank" onclick="AddRecommendImpr(' + data[_i].Id + ')">' + ((data[_i].Body.length > 39) ? (data[_i].Body.substr(0, 38) + '...') : data[_i].Body) + '</a></h2><h3>人氣：' + data[_i].Impr + '</h3></div>';
                    }
                    //_str += '<li class="' + ((_i % 2 == 0) ? 'rowA' : 'rowB') + '"><h2 class="w12_000"><a href="http://' + data[_i].PostURL + '" target="_blank" title="' + data[_i].Title + '" style="color:#000000;text-decoration:none;">' + ((data[_i].Title.length > 9) ? (data[_i].Title.substr(0, 9) + '...') : (data[_i].Title)) + '</a></h2><p class="w12_8d8a84"><a href="http://' + data[_i].PostURL + '" target="_blank" title="' + data[_i].Title + '" style="color:#000000;text-decoration:none;">' + data[_i].Body.substr(0, 25) + '...</a></p></li>';
                    //if (_i != (data.length - 1))
                    //    _str += '<li class="rowC"><img src="http://'+LocationStr()+'/Images/line_185.jpg" onerror="this.src=\'../http://'+LocationStr()+'/Images/line_185.jpg\'"></li>';
                }
            }
            else {
                _str = '<div class="cont01">無資料</div><div class="cont02">無資料</div><div class="cont01">無資料</div><div class="cont02">無資料</div>';
            }

            _str += '<div class="cont03"><span style="vertical-align:middle;">現有' + jdata.count + '則文章..</span><a href="http://' + LocationStr() + '/Portal/BlogRecommend"><img src="http://' + LocationStr() + '/Images/commend/more.jpg" border="0"  style="vertical-align:middle;" /></a></div>';
            _dataContent.html(_str);
            createMask(_dataContent, 'off');
        },
            error: function() {
                _str = '<div class="cont01">無資料</div><div class="cont02">無資料</div><div class="cont01">無資料</div><div class="cont02">無資料</div>';
                _str += '<div class="cont03"><a href="#"><img src="images/commend/more.jpg" border="0" /></a></div>';
                _dataContent.html(_str);
                createMask(_dataContent, 'off');
            },
            complete: function() {
                if (_hide)
                    _dataContent.css('display', 'none');
            }
        });
    }
    else if (_type == _typeRightContent2) {
        $.ajax({ url: _callbackAction, dataType: 'json', data: { type: _type, cnt: 3 }, success: function(data) {
            var _str = '';
            if (data.length > 0) {
                for (_i = 0; _i < data.length && _i < 3; _i++) {
                    _str += '<li><h2 class="' + ((_i % 2 > 0) ? 'w12_e49815' : 'w12_387310') + '" style="word-break:break-all;"><a href="http://' + data[_i].URL + '" title="' + data[_i].Title + '" target="_blank"><img class="pic" src="http://' + data[_i].Thumb + '" style="width:53px;height:53px"></a><a href="http://' + data[_i].URL + '" title="' + data[_i].Title + '" target="_blank">' + ((data[_i].Title.length > 9) ? (data[_i].Title.substr(0, 9) + '...') : (data[_i].Title)) + '</a></h2><span class="w12_959595" style="word-break:break-all;"><a href="http://' + data[_i].URL + '" title="' + data[_i].Title + '" target="_blank">' + ((data[_i].Body.length > 30) ? (data[_i].Body.substr(0, 30) + '...') : (data[_i].Body)) + '</a></span></li>';

                    if (_i < (data.length - 1))
                        _str += '<li class="rowD"><img src="http://'+LocationStr()+'/Images/line_185.jpg"></li>';
                }
            }
            else {
                _str = '<li>無資料</li>';
            }
            _dataContent.html(_str);
            createMask(_dataContent, 'off');
        },
            error: function() {
                _str = '<li>無資料</li>';
                _dataContent.html(_str);
                createMask(_dataContent, 'off');
            }
        });
    }
    else if (_type == _typeBlogInfo2) {
        $.ajax({ url: _callbackAction, dataType: 'json', data: { type: _type, cnt: 3 },
            beforeSend: function() {
                createMask(_dataContent, 'on');
            },
            success: function(data) {
                var _str = '';
                if (data.length > 0) {
                    for (_i = 0; _i < data.length && _i < 3; _i++) {
                        _str += '<li><h3 class="w12_000" style="padding-left: 27px"><a href="http://' + data[_i].URL + '" title="' + data[_i].Title + '">' + ((data[_i].Title.length > 10) ? (data[_i].Title.substr(0, 10) + '...') : (data[_i].Title)) + '</a></h3>' +
                                            '<p class="w12_8d8a84" style="padding-left:28px;"><a href="http://' + data[_i].URL + '" title="' + data[_i].Title + '">' + ReplaceTag(data[_i].Body).substr(0, 28) + '...</a></p>' +
                                            '</li>';
                    }
                }
                else {
                    _str = '<li><h3 class="w12_000" style="padding-left: 27px">無資料</h3></li>';
                }
                _dataContent.html(_str);
            },
            error: function() {
                _str = '<li><h3 class="w12_000" style="padding-left: 27px">無回應</h3></li>'
                _dataContent.html(_str);
            },
            complete: function() {
                createMask(_dataContent, 'off');
            }
        });
    }
    else if (_type == _typeBlogInfo1) {
        $.ajax({ url: _callbackAction, dataType: 'json', data: { count: 3 },
            beforeSend: function() {
                createMask(_dataContent, 'on');
            },
            success: function(_data) {
                var _str = '';
                var data = _data.Data;
                if (data.length > 0) {
                    for (_i = 0; _i < data.length && _i < 3; _i++) {
                        _str += '<li><h3 class="w12_000" style="padding-left: 27px"><a href="http://' + LocationStr() + '/Portal/ProductInfo/' + data[0].HitdoId + '" title="' + data[_i].Name + '">' + ((data[_i].Name.length > 10) ? (data[_i].Name.substr(0, 10) + '...') : (data[_i].Name)) +
                                            '</a></h3><p class="w12_8d8a84" style="padding-left:28px;"><a href="http://' + LocationStr() + '/Portal/ProductInfo/' + data[_i].HitdoId + '" title="' + data[_i].Name + '">' + (ReplaceTag(data[_i].Description)).substr(0, 25) + '...' +
                                            '</a></p></li>';
                    }
                }
                else {
                    _str = '<li><h3 class="w12_000" style="padding-left: 27px">無資料</h3></li>';
                }
                _dataContent.html(_str);
            },
            error: function() {
                _str = '<li><h3 class="w12_000" style="padding-left: 27px">無回應</h3></li>'
                _dataContent.html(_str);
            },
            complete: function() {
                createMask(_dataContent, 'off');
            }
        });
    }
}

function changeMarqueeTitle(_contentElement, _strs) {
    for (_idx in _strs) {        
        _contentElement.append($("<a/>").attr({ target: "_blank", href: 'http://' + _strs[_idx].Url}).text(_strs[_idx].Content).css('display', 'none'));
    }

    $(_contentElement.children().get(0)).fadeIn("slow");
    //$(_contentElement.children().get(0)).css('display','block');

    self.setInterval('fadeMarquee("' + _contentElement.attr('id') + '",' + _strs.length + ')', 5000);
}

function fadeMarquee(_contentId, _len) {
    var _parent = $("#" + _contentId);
    var _childs = _parent.children();
    for (_i = 0; _i < _len; _i++) {
        if ($(_childs.get(_i)).css('display') != 'none') {
            if (_i == _len - 1) {
                $(_childs.get(_i)).fadeOut("slow", function() { $(_childs.get(0)).fadeIn("slow"); });
                _i = -1;
                break;
            }
            else {
                $(_childs.get(_i)).fadeOut("slow", function() { $(_childs.get(_i + 1)).fadeIn("slow"); });
                break;
            }
        }
    }
}

function PicUrl(_urlstr) {
    if (_urlstr != undefined && _urlstr.length != 0) {
        if (_urlstr.indexOf('http://') > -1)
            return _urlstr;
        else if (_urlstr.indexOf('/') == 0) {
            if (document.domain.indexOf('localhost', 0) >= 0)
                return '..' + _urlstr;
            else
                return _urlstr;
        }
        else if (_urlstr.indexOf('..') == 0) {
            return _urlstr;
        }
        else if (_urlstr.indexOf('/') < _urlstr.indexOf('.')) {
            if (document.domain.indexOf('localhost', 0) >= 0)
                return _urlstr;
            else
                return _urlstr;
        }
        else
            return 'http://' + _urlstr;
    }
    else {
        return '';
    }
}

function LocationStr() {
    if (location.host.indexOf('localhost:', 0) >= 0)
        return location.host;
    else if (location.host.indexOf('localhost', 0) >= 0)
        return location.host + '/' + _portalDomain;
    else if (location.host.indexOf('192.168.168.155', 0) >= 0)
        return location.host + '/' + _portalDomain;
    else
        return _portalDomain;
}

/* For AdsPortal */
function changeAdsPortalShortMsg(_dataContent, _type, _callbackAction) {
    createMask(_dataContent, 'on');
    $.ajax({ url: _callbackAction, dataType: 'json', data: { type: _type, cnt: 2 }, success: function(data) {
        var _str = '<span class="icon_MORE"><a href="#"><img src="<%=Url.Content("~/Images/icon_moreGreen.jpg")%>" width="39" height="10" border="0" /></a></span>';

        for (_idx in data) {
            _str += '<ul class="colLeft"><li class="w10_skyblue">' + data[_idx].PostDate.toString("yyyy/MM/dd") + '</li><li class="w13_000">' + data[_idx].Title + '</li><li class="w12_3a3a3a">' + data[_idx].Body + '</li><li class="w12_orange"><a href="http://' + data[_idx].URL + '">' + data[_idx].Thumb + '→</a></li></ul>';
        }
        _dataContent.html(_str);
        createMask(_dataContent, 'off');
    },
        error: function() {
            var _str = '<span class="icon_MORE"><a href="#"><img src="<%=Url.Content("~/Images/icon_moreGreen.jpg")%>" width="39" height="10" border="0" /></a></span>';
            _dataContent.html(_str);
            createMask(_dataContent, 'off');
        } 
    });
}

function changeAdsPortalBlogContent(_dataContent, _callbackAction, _Controller) {
    createMask(_dataContent, 'on');
    $.ajax({ url: _callbackAction, dataType: 'json', success: function(_data) {
        if (_data.length > 0) {
            var _str = '';
            if (_Controller != undefined)
                _str = '<span id="adsPublish"><a href="http://author.bloggerads.net/01_join.aspx">立即加入</a></span><div class="top"><img src="http://'+LocationStr()+'/Images/blogClassT2.jpg" width="960" height="45" /></div><div id="content">';
            else
                _str = '<span id="adsPublish"><a href="mailto:sales@bloggerads.net?subject=PublishBloggerAds"><img src="http://'+LocationStr()+'/Images/btn_adsPublish.jpg" width="127" height="21" border="0" /></a></span><div class="top"><img src="http://'+LocationStr()+'/Images/blogClassT.jpg" width="960" height="57" /></div><div id="content">';
            for (var _idx in _data) {
                _str += '<ul class="blogBox">';

                if (_data[_idx].IconFlag == '1')
                    _str += '<span class="icon_HOT"><img src="http://'+LocationStr()+'/Images/icon_HOT.png" width="28" height="37" /></span><!--勳章-->';
                else if (_data[_idx].IconFlag == '2')
                    _str += '<span class="icon_ONE"><img src="http://'+LocationStr()+'/Images/icon_ONE.png" width="28" height="37" /></span>';
                else if (_data[_idx].IconFlag == '3')
                    _str += '<span class="icon_TOP"><img src="http://'+LocationStr()+'/Images/icon_TOP.png" width="28" height="37" /></span>';
                if (_Controller != undefined)
                    _str += '<li><a href="http://' + LocationStr() + '/' + _Controller + '/MemberList/' + _data[_idx].ChannelId + '" style="text-decoration:none;"><img src="http://'+LocationStr()+'/Images/blogClass' + ((_data[_idx].ChannelId >= 10) ? _data[_idx].ChannelId.toString() : ('0' + _data[_idx].ChannelId.toString())) + '.jpg" width="60" height="90" class="pic2" /><span class="w13_000">' + _data[_idx].Name + '</span><br /><span class="w12_light_blue">部落格數 :<br />' + _data[_idx].BlogCount + '</span><br /><span class="w12_3a3a3a">每日曝光數 :<br />' + _data[_idx].Impression + '</span></a></li>';
                else
                    _str += '<li><a href="http://' + LocationStr() + '/AdsPortal/MemberList/' + _data[_idx].ChannelId + '" style="text-decoration:none;"><img src="http://'+LocationStr()+'/Images/blogClass' + ((_data[_idx].ChannelId >= 10) ? _data[_idx].ChannelId.toString() : ('0' + _data[_idx].ChannelId.toString())) + '.jpg" width="60" height="90" class="pic2" /><span class="w13_000">' + _data[_idx].Name + '</span><br /><span class="w12_light_blue">部落格數 :<br />' + _data[_idx].BlogCount + '</span><br /><span class="w12_3a3a3a">每日曝光數 :<br />' + _data[_idx].Impression + '</span></a></li>';

                _str += '</ul>';
            }
            _str += '</div><div class="bottom"><img src="http://'+LocationStr()+'/Images/blogClassBT.jpg" width="960" height="27" /></div>'
            _dataContent.html(_str);
        }
        else {
            _str = '無資料';
            _dataContent.html(_str);
        }
    },
        error: function() {
            _str = '無回應';
            _dataContent.html(_str);
        },
        complete: function() {
            createMask(_dataContent, 'off');
        } 
    });
}

function ReplaceTag(str) {
    //var regEx = /<\w+>/ig;
    var regEx = /(\<(\/?[^\>]+)\>)/ig;
    str = str.replace(regEx, '');
    return str;
}

function RemoveHttpProtocol(_url) {
    if (_url.indexOf('http://', 0) >= 0)
        _url = _url.substr(7);
    return _url;
}

function changeBonusContent(_dataContent, _callbackAction) {
    $.ajax({
        url: _callbackAction, dataType: 'json',
        beforeSend: function() {
            createMask(_dataContent, 'on');
        },
        success: function(_data) {
            var _img = $('#bonusPic');
            var _name = $('#bonusName');
            var _summary = $('#bonusSummary');
            if (_data != null) {
                _img.attr('src', _data.Picture);
                _name.html(_data.Name);
                _summary.html(_data.Summary);
                _name.attr('href', 'http://' + _auhtorDomain + '/42_bonus_exchange.aspx?pid=' + _data.Pid);
                _summary.attr('href', 'http://' + _auhtorDomain + '/42_bonus_exchange.aspx?pid=' + _data.Pid);
                $(_img.parent().get(0)).attr('href', 'http://' + _auhtorDomain + '/42_bonus_exchange.aspx?pid=' + _data.Pid);
            }
        },
        complete: function() {
            createMask(_dataContent, 'off');
        }
    });
}

function AddRecommendImpr(Id) {
    $.ajax({
        url: 'http://' + LocationStr() + '/Portal/AddRecommendImpr',
        dataType: 'json',
        data: { Rid: Id }
    });
}

function change_BG1() {
    $('#cell1').removeClass();
    $('#cell2').removeClass();
    $('#cell1').addClass('top01');
    $('#cell2').addClass('top02');
    $('#d1').addClass('contbg');
    $('#d1').show();
    $('#d2').hide();
}
function change_BG2() {
    $('#cell1').removeClass();
    $('#cell2').removeClass();
    $('#cell1').addClass('top02');
    $('#cell2').addClass('top01');
    $('#d2').addClass('contbg');
    $('#d1').hide();
    $('#d2').show();
}
