﻿window['undefined'] = window['undefined'];
String.prototype.getQuery = function(key){
    var reg = new RegExp('(^|&)' + key + '=([^&]*)(&|$)');
    var rs = this.substr(this.indexOf('\?') + 1).match(reg);
    if (rs != null) {
        return unescape(rs[2]);
    } else {
        return null;
    }
};
var getSelf = function(){
    var script = document.getElementsByTagName('script');
    var length = script.length;
    do {
        if (script[length - 1].src != '') {
            return script[length - 1].src;
        }
    }while (length--);
};
var src = getSelf();
var ruri = src;
try {
    ruri = top.document.referrer;
} catch (e) {
    if (parent) {
        if (parent._getReferrer) {
            try {ruri = parent._getReferrer;}catch(e3){}
        } else {
            try {ruri = parent.document.referrer;} catch (e1) {try {ruri = document.referrer;} catch (e2) {}}
        }
        parent._getReferrer = document.location.href;
    } else {
        try {ruri = document.referrer;} catch (e0) {}
    }
}
var _plugInMZ = function(mz){
    if (piTmp.indexOf(mz) != -1 && (navigator.mimeTypes[mz].enabledPlugin != null)) {
        return true;
    }else {
        return false;
    }
}
var _plugInIE = function(ie){
    isFind = false;
    document.write('<scr' + 'ipt language="vbscript">\n on error resume next \n isFind = IsObject(CreateObject("' + ie + '"))</scr' + 'ipt>\n');
    if (isFind) {
        return true;
    }else {
        return false;
    }
}
var ua = navigator.userAgent.toLowerCase(),
	isIE = (ua.indexOf('msie') != -1),
	isFF = (ua.indexOf('firefox') != -1),
	isNS = (ua.indexOf('netscape') != -1),
	isOR = (ua.indexOf('opera') != -1);
var os = navigator.platform.toLowerCase(),
	isWin = (os.indexOf('win') != -1),
	isUix = (os.indexOf('x11') != -1),
	isMac = (os.indexOf('mac') != -1);
var isCK = (navigator.cookieEnabled) ? true : false;
if ((typeof(navigator.cookieEnabled) == 'undefined') && isCK == false) {
    document.cookie = 'mmosite_testCookie';
    isCK = (document.cookie.indexOf('mmosite_testCookie') != -1);
}
var isJava = (navigator.javaEnabled());
if (!isWin || !isIE) {
    var piTmp = '';
    for (var i = 0; i < navigator.mimeTypes.length; i++) {
        piTmp += navigator.mimeTypes[i].type.toLowerCase();
    }
    var isMF = _plugInMZ('application/x-shockwave-flash');
    var isQT = _plugInMZ('video/quicktime');
    var isRO = _plugInMZ('audio/x-pn-realaudio-plugin');
    var isMP = _plugInMZ('application/x-mplayer2');
    var isPDF = _plugInMZ('application/pdf');
} else {
    var isMF = _plugInIE('ShockwaveFlash.ShockwaveFlash.1');
    var isQT = _plugInIE('Quicktime.Quicktime');
    if (!isQT) {
        var isQT = _plugInIE('QuickTimeCheckObject.QuickTimeCheck.1');
    }
    var isRO = _plugInIE('rmocx.RealPlayer G2 Control.1');
    var isMP = _plugInIE('wmplayer.ocx');
    if (!isMP) {
        isMP = _plugInIE('MediaPlayer.MediaPlayer.1');
    }
    var isPDF = false;
    if (_plugInIE('PDF.PdfCtrl.1') == '1' || _plugInIE('PDF.PdfCtrl.5') == '1' || _plugInIE('PDF.PdfCtrl.6') == '1') {
        isPDF = true;
    }
}
var $$ = function(o){
    return document.getElementById(o);
}
var $$import = function(scriptUrl){
    document.writeln("<script type='text/javascript' src='" + scriptUrl + "' charset='utf-8'></scr" + "ipt>");
};
var $$XHR = function(url, callback, data){
    url += url.indexOf('?') >= 0 ? '&' : '?';
    url += 'mmo_random=' + Math.random();
    if (typeof(data) == 'undefined') {
        data = null;
    }
    method = data ? 'POST' : 'GET';
    if (window.XMLHttpRequest) {
        var XHR = new XMLHttpRequest();
    }
    else {
        var MSXML = ['MSXML2.XMLHTTP.6.0', 'MSXML2.XMLHTTP.3.0', 'MSXML2.XMLHTTP.5.0', 'MSXML2.XMLHTTP.4.0', 'MSXML2.XMLHTTP', 'Microsoft.XMLHTTP'];
        for (var i = 0; i < MSXML.length; i++) {
            try {
                var XHR = new ActiveXObject(MSXML[i]);
                break;
            } 
            catch (e) {
            }
        }
    }
    if (XHR) {
        try {
            XHR.open(method, url, true);
            if (method == 'POST') {
                setRequestHeader('Content-Type', 'application/x-www-form-urlencoded; charset=UTF-8');
            }
            XHR.send(data);
        } 
        catch (E) {
        }
        XHR.onreadystatechange = function(){
            if (XHR.readyState == 4) {
                callback(XHR.responseText, XHR.status);
                delete (XHR);
            }
        }
    }
}
var $$getCookie = function(name){
    var cs = document.cookie.indexOf(name);
    var ce = document.cookie.indexOf(';', cs);
    return cs == -1 ? '' : unescape(document.cookie.substring(cs + name.length + 1, (ce > cs ? ce : document.cookie.length)));
}
var $$rand = function(number){
    var today = new Date();
    var seed = today.getTime();
    seed = ((seed * 9301 + 49297) % 233280) / (233280.0);
    return Math.ceil(seed * number);
};
var $$image = function(){
    document.imgArray = new Array();
    var args = $$image.arguments;
    for (var i = 0; i < args.length; i++) {
        var imgIndex = document.imgArray.length;
        document.imgArray[imgIndex] = new Image;
        document.imgArray[imgIndex].src = args[i];
    };
    };
var $$escape = function(url){
    return escape(url);
};
var $$getX = function(){
    if (window.getSelection) {
        return document.body.scrollLeft;
    }
    var s = 0;
    if (document.documentElement && document.documentElement.scrollLeft) {
        s = document.documentElement.scrollLeft;
    }
    else {
        if (document.body && document.body.scrollLeft) {
            s = document.body.scrollLeft;
        }
    }
    return s;
};
var $$getY = function(){
    var s = 0;
    if (window.getSelection) {
        return document.body.scrollTop;
    }
    if (document.documentElement && document.documentElement.scrollTop) {
        s = document.documentElement.scrollTop;
    }
    else 
        if (document.body && document.body.scrollTop) {
            s = document.body.scrollTop;
        }
    return s;
};
var $$__c__ = function(awID, keyword, title, text, picture, links, url, awType, htmlContent, isExtend, isHelp, isSearch){
    this.awID = awID;
    this.awType = awType;
    this.keyword = keyword;
    this.title = title;
    this.text = text;
    var tmp = '';
    if (picture.indexOf('http://') == 0) {
        tmp = picture;
    }
    else 
        if (picture != '') {
            tmp = adwordImg + picture;
        }
        else {
            tmp = '';
        }
    this.picture = tmp;
    this.links = ((links == '') ? '&nbsp;' : links);
    this.url = url;
    this.htmlContent = htmlContent;
    this.isExtend = isExtend;
    this.isHelp = isHelp;
    this.isSearch = isSearch;
};
var site_id = src.getQuery('site_id') ? src.getQuery('site_id') : 0;
var max_keywords = src.getQuery('max_keywords') ? src.getQuery('max_keywords') : 10;
var _is_vote = src.getQuery('vote') ? src.getQuery('vote') : 0;
var _frame = 5;
var _is_ready = false;
var _is_helper = false;
var _is_extend = false;
var hideTO;
var mcLinks = Array();
var mcKeywords = Array();
var mcMatches = Array();
var mcMatcheskeywords = Array();
var _server = 'http://analytics.mmosite.com/mmokeywords/';
var statisticURL = 'http://analytics.mmosite.com/mmokeywords/statistic.php?';
var voteURL = 'http://analytics.mmosite.com/mmokeywords/vote.php?';
var vouchURL = 'http://analytics.mmosite.com/mmokeywords/vouch.php?';
var publicImg = 'http://images.mmosite.com/analytics/mmokeywords/publics/';
var adwordImg = 'http://images.mmosite.com/analytics/mmokeywords/attached/';
var frameImg = 'http://images.mmosite.com/analytics/mmokeywords/publics/frame/';
var _is_area = $$('mmosite_keywords_area') ? true : false;
var aw_list = Array('keywords_area');
var aw_area = $$('mmosite_keywords_area') ? $$('mmosite_keywords_area') : document.body;
var good = publicImg + 'good.gif';
var bad = publicImg + 'bad.gif';
var mail = publicImg + 'mail.gif';
var ihelper = publicImg + 'google.gif';
var search = publicImg + 'search.gif';
var loading = publicImg + 'loading.gif';
var CURRENT_AW_COUNT = 0;
var CURRENT_AW_STYLE = 0;
var TITLE_TEXT_COLOR = '#FF6600';
var KEYWORD_TEXT_COLOR = '#333333';
var LINK_TEXT_COLOR = '#0088FF';
var ADWORD_TEXT_COLOR = '#3366FF';
var LAYER_BACKGROUND_COLOR = '#F7F7F7';
var LAYER_HOVER_COLOR = '#FFFEEF';
function _i_s_(isWrite){
    var BB = '1', TD = 'underline', BBS = 'dotted', HBBS = 'solid', HBB = '2';
    switch (CURRENT_AW_STYLE) {
        case 1:
            BBS = 'solid';
            break;
        case 2:
            TD = 'none';
            HBB = '1';
            HBBS = 'dotted';
            break;
        case 3:
            BBS = 'solid';
            TD = 'none';
            HBB = '1';
            break;
        case 4:
            BB = '0';
            TD = 'none';
            HBB = '0';
            break;
        case 5:
            BB = '0';
            TD = 'none';
            HBB = '1';
            break;
        default:
            break;
    };
    var style = [['A.mcLink:link', 'font:tahoma,Arial,Helvetica,sans-serif;color:' + ADWORD_TEXT_COLOR + '!important;' + 'border-bottom: ' + BB + 'px ' + ADWORD_TEXT_COLOR + ' ' + BBS + ';' + 'text-decoration: ' + TD + ';'], ['A.mcLink:visited', 'color:' + ADWORD_TEXT_COLOR + '!important;' + 'border-bottom: ' + BB + 'px ' + ADWORD_TEXT_COLOR + ' ' + BBS + ';' + 'text-decoration:' + TD + ';'], ['A.mcLink:hover', 'color:' + ADWORD_TEXT_COLOR + '!important;' + 'border-bottom: ' + HBB + 'px ' + ADWORD_TEXT_COLOR + ' ' + HBBS + ';' + 'text-decoration:' + TD + ';'], ['A.mcLink:active', 'color:' + ADWORD_TEXT_COLOR + '!important;' + 'border-bottom: ' + BB + 'px ' + ADWORD_TEXT_COLOR + ' ' + BBS + ';' + 'text-decoration: ' + TD + ';'], ['div.linkTitle', 'position: absolute;' + 'font-size: 9pt;' + 'padding: 0px;' + (isIE) ? 'filter:revealTrans(duration=0.3,transition=4)' : ''], ['A.mcTLink:link', 'color:' + TITLE_TEXT_COLOR + '!important;' + 'text-decoration:none;'], ['A.mcTLink:visited', 'color:' + TITLE_TEXT_COLOR + '!important;'], ['A.mcTLink:hover', 'color:' + TITLE_TEXT_COLOR + '!important;' + 'text-decoration:' + TD + '!important;'], ['A.mcTLink:active', 'color:' + TITLE_TEXT_COLOR + '!important;' + 'text-decoration:none;']];
    if (isWrite) {
    }else {
        if (!document.styleSheets.length) {
            document.createStyleSheet();
        }
        var sheet = document.styleSheets[0];
        if (isIE) {
            for (var i = 0; i < style.length; i++) {
                sheet.addRule(style[i][0], style[i][1]);
            }
        }else {
            for (var i = 0; i < style.length; i++) {
                sheet.insertRule(style[i][0] + ' { ' + style[i][1] + ' } ', 0);
            }
        }
	}
};
function _i_k_(aw, n){
    var _flag = false;
    for (var l = 0; l < mcKeywords[n].length; l++) {
        var _kw_ = mcKeywords[n][l];
        var _cr_ = aw.title + ' @ MMOSite.com';
        var show_url = statisticURL + 'site_id=' + site_id + '&ads_id=' + aw.awID + '&url=' + $$escape(aw.url) + '&keys=' + $$escape(mcKeywords[n]) + '&page=' + $$escape(location.href) + '&ruri=' + $$escape(ruri) + '&vote=' + _is_vote + '&show=1';
        var click_url = statisticURL + 'site_id=' + site_id + '&ads_id=' + aw.awID + '&url=' + $$escape(aw.url) + '&keys=' + $$escape(mcKeywords[n]) + '&page=' + $$escape(location.href) + '&ruri=' + $$escape(ruri) + '&vote=' + _is_vote + '&click=1';
        _adw_ = "<A id=\"mc_keywords_" + n + "\" title=\"" + _cr_ + "\" class=\"mcLink\" style=\"font-size:1em;\" href=\"" + click_url + "\" target=\"_blank\" onmouseover=\"if(typeof(_i_p_)!='undefined'){this.title='';window.clearTimeout(hideTO);_i_p_(event, this, " + n + ",'mc_keywords_" + n + "');$$XHR('" + show_url + "',function(data,responseCode){return;});}\" onmouseout=\"if(typeof(_i_p_)!='undefined'){mouseIsOverLayer = false; mouseOverWhileLoad = false; hideTO = window.setTimeout('checkIfMouseOverLayer()',500);}\" onClick=\"\">" + _kw_ + "</A>";
        if (isIE) {
            var _tr_ = document.body.createTextRange();
            while (_tr_.findText(_kw_)) {
                var _trp_ = _tr_.parentElement();
                if (!_noer_(_trp_) && _yeser_(_trp_)) {
                    _tr_.pasteHTML(_adw_);
                    CURRENT_AW_COUNT++;
                    _flag = true;
                    break;
                }
                _tr_.collapse(false);
            }
            if (_flag) {
                break;
            }
        }else {
            var $$_Node = function(node){
                if (node.tagName == "IMG" || node.tagName == "A" || node.tagName == "INPUT" || node.tagName == "SELECT" || node.tagName == "SCRIPT") {
                    return NodeFilter.FILTER_REJECT;
                }
                else {
                    return NodeFilter.FILTER_ACCEPT;
                }
            };
            var tw = document.createTreeWalker(aw_area, NodeFilter.SHOW_ELEMENT | NodeFilter.SHOW_TEXT, $$_Node, false);
            var vNodes = new Array();
            var range = document.createRange();
            while (cNode = tw.nextNode()) {
                if (cNode.nodeValue != null) {
                    vNodes[vNodes.length] = cNode;
                }
            }
            for (var i = 0; i < vNodes.length; i++) {
                var key = vNodes[i].nodeValue;
                var pos = key.indexOf(_kw_);
                if (pos != -1) {
                    range.selectNode(vNodes[i]);
                    range.setStart(vNodes[i], pos);
                    range.setEnd(vNodes[i], range.startOffset + _kw_.length);
                    range.deleteContents();
                    var nNode = document.createElement('span');
                    nNode.innerHTML = _adw_;
                    range.insertNode(nNode);
                    CURRENT_AW_COUNT++;
                    _flag = true;
                    break;
                }
			}
            if (_flag) {
                break;
            }
        }
	}
};
function _i_p_(evt, obj, adLinkId, divId){
    var _X_ = 0, _Y_ = 0, _PX_ = 0, _PY_ = 0;
    var status = 1;
    var isNetease = true;
    var title = mcLinks[adLinkId].title;
    var text = mcLinks[adLinkId].text;
    var picture = mcLinks[adLinkId].picture;
    var url = mcLinks[adLinkId].url;
    var divHeight = 200;
    if (mcLinks[adLinkId].awType == '4' || mcLinks[adLinkId].awType == '5' || mcLinks[adLinkId].awType == '6' || mcLinks[adLinkId].awType == '7' || mcLinks[adLinkId].awType == '8' || mcLinks[adLinkId].awType == '9') {
        divHeight = 155;
    }else if (mcLinks[adLinkId].awType == '1' || mcLinks[adLinkId].awType == '21') {
		divHeight = 150;
	}else if (mcLinks[adLinkId].awType == '3') {
		divHeight = 160;
	}
    mouseOverWhileLoad = false;
    currentAdLinkIndexToShow = adLinkId;
    mouseIsOverLayer = true;
    var divElement = null;
    if (isIE) {
        _Y_ = window.event.y;
        _X_ = window.event.x;
        winW = document.body.clientWidth;
        winH = document.body.clientHeight;
        curX = event.clientX;
        curY = event.clientY;
    } else {
        _Y_ = evt.pageY - $$getY();
        _X_ = evt.pageX - $$getX();
        winW = window.innerWidth;
        winH = window.innerHeight;
        curX = evt.pageX - window.pageXOffset;
        curY = evt.pageY - window.pageYOffset;
    }
    var tel = $$('mc_keywords_' + adLinkId);
    var textH = tel.offsetHeight;
    var textW = tel.offsetWidth;
    var textY = tel.offsetTop;
    var textX = tel.offsetLeft;
    while (tel = tel.offsetParent) {
        textY += tel.offsetTop;
        textX += tel.offsetLeft;
    }
    _PY_ = (textY - divHeight - 38);
    if (divHeight > 150) {
        _PY_ = (textY - divHeight - 72);
    }
    _PX_ = textX + 12;
    if (divHeight > 150) {
        _TY_ = divHeight + 32;
    } else {
        _TY_ = divHeight;
    }
    if (curY < _TY_ + 20) {
        if (curY < winH - curY) {
            status = 3;
            _PY_ = textY + textH;
        }
	}
    var _TX_ = 310;
    if (mcLinks[adLinkId].awType == "6" || mcLinks[adLinkId].awType == "8") {
        _TX_ = 200;
    }
    if ((winW - textX - textW - 12) < _TX_) {
        _PX_ = textX - _TX_ - textW + 72;
        if (status == 1) {
            status = 2;
        } else {
            status = 4;
        }
    }
    _i_f_(adLinkId, _PY_, _PX_, status);
};
function _i_i_(){
    if (!_is_ready) {
        setTimeout('_i_i_();', 250);
        return;
    }
    _i_s_(false);
    $$image(frameImg + 'top.png', frameImg + 'topright.png', frameImg + 'bottom.png', frameImg + 'bottomright.png', frameImg + 'right.png', frameImg + 'left.png', frameImg + 'topleft.png', frameImg + 'bottomleft.png', frameImg + 'bottomrightsmall.png', frameImg + 'toprightsmall.png', frameImg + 'bottomdrag.png', frameImg + 'topdrag.png');
    $$image(good, bad, mail, ihelper, search, loading);
    var awLength = mcLinks.length;
    while (CURRENT_AW_COUNT < max_keywords && mcMatches.length < awLength) {
        var i = $$rand(awLength) - 1;
        while (_exister_(i) && i >= 0 && i <= 9) {
            i = $$rand(awLength) - 1;
        }
        mcMatches[mcMatches.length] = i;
        mcMatcheskeywords[mcMatcheskeywords.length] = mcLinks[i].awID;
        var _pp = mcLinks[i].picture;
        switch (parseInt(mcLinks[i].awType)) {
            case 2:
            case 3:
                $$image(_pp);
                _i_k_(mcLinks[i], i);
                break;
            case 8:
            case 9:
                var sp = _pp.split(',');
                var ps = '';
                if (sp.length > 2) {
                    for (j = 1; j < sp.length; j++) {
                        ps += ("\"" + sp[0] + "/" + sp[j] + "\",");
                    }
                    ps = ps.substr(0, ps.length - 1);
                    $$image(ps);
                    _i_k_(mcLinks[i], i);
                }
                break;
            default:
                _i_k_(mcLinks[i], i);
                break;
        }
	}
    _init_drag();
};
function _i_f_(adLinkId, _ADY_, _ADX_, status){
    var draged = false;
    var isNetease = true;
    var ads_id = mcLinks[adLinkId].awID;
    var keyword = mcLinks[adLinkId].keyword;
    if (mcLinks[adLinkId].isSearch) {
        if (isIE) {
            keyword = $$('mc_keywords_' + adLinkId).innerText;
        }else {
            keyword = $$('mc_keywords_' + adLinkId).textContent;
        }
    }
    var title = mcLinks[adLinkId].title;
    var text = mcLinks[adLinkId].text;
    var picture = mcLinks[adLinkId].picture;
    var links = mcLinks[adLinkId].links;
    var url = statisticURL + 'ads_id=' + ads_id + '&site_id=' + site_id + '&url=' + $$escape(mcLinks[adLinkId].url) + '&vote=' + _is_vote + '&keyword=' + $$escape(keyword) + '&site=' + $$escape(ruri) + '&click=1&rn=' + $$rand(999999);
    var ads_type = mcLinks[adLinkId].awType;
    if (mcLinks[adLinkId].isExtend) {
        var _is_extender = mcLinks[adLinkId].isExtend;
    }
    if (mcLinks[adLinkId].isHelp) {
        var _is_helper = mcLinks[adLinkId].isHelp;
    }
    var _fv_ = 4;
    var headH = isNetease ? 28 : 14;
    var footH = 42;
    var headImg = frameImg + 'top.png';
    var footImg = frameImg + 'bottomright.png';
    if (ads_type == '6' || ads_type == '8') {
        headImg = frameImg + 'topsmall.png';
        footImg = frameImg + 'bottomsmallright.png';
    }
    if (status == 2) {
        footImg = frameImg + 'bottomleft.png';
        if (ads_type == '6' || ads_type == '8') {
            footImg = frameImg + 'bottomsmallleft.png';
        }
	}else if (status == 3) {
        _fv_ = 5;
        headH = 42;
        footH = isNetease ? 28 : 14;
        headImg = frameImg + 'topright.png';
        footImg = frameImg + 'bottom.png';
        if (ads_type == '6' || ads_type == '8') {
            headImg = frameImg + 'topsmallright.png';
            footImg = frameImg + 'bottomsmall.png';
        }
	}else if (status == 4) {
		_fv_ = 5;
		headH = 42;
		footH = isNetease ? 28 : 14;
		headImg = frameImg + 'topleft.png';
		footImg = frameImg + 'bottom.png';
		if (ads_type == '6' || ads_type == '8') {
			headImg = frameImg + 'topsmallleft.png';
			footImg = frameImg + 'bottomsmall.png';
		}
	}
    var pI = '';
    if (picture != '') {
        if (ads_type == '5' || ads_type == '7' || ads_type == '9') {
            pI = '<div id="flashcontent" style="float:left; margin-right:2px; margin-left:2px; width:180px; height:150px;"></div>';
        }else if (ads_type == '6' || ads_type == '8') {
			pI = '<div id="flashcontent" style="width:180px; height:150px;"></div>';
		}else if (ads_type == '4') {
			pI = '<div id="flashcontent" style="width:300px; height:150px;"></div>';
		}else if (ads_type == '10') {
			pI = '<div id="flashcontent" style="width:396px; height:396px;"></div>';
		}else if (ads_type == '2') {
			pI = '<img src="' + picture + '" style="width:240px;height:200px;" onclick="window.open(\'' + url + '\')">';
		}else {
			pI = '<img src="' + picture + '" style="float:left; margin-right:6px; margin-left:4px;" onclick="window.open(\'' + url + '\')">';
		}
    }
    if (ads_type == '99') {
        links = '';
        url = '';
        pI = mcLinks[adLinkId].htmlContent;
    }
    if (ads_type == '21') {
        pI = '<div id="text_links" style="width:260px;height:128px;font-size:12px;margin-left:6px; line-height:18px;">';
        var tmp = mcLinks[adLinkId].url;
        sp = tmp.split(';');
        for (i = 0; i < sp.length; i++) {
            var tmp1 = sp[i].split('|');
            var _href_ = tmp1[0];
            var _txt_ = tmp1[1];
            var reg = new RegExp(keyword, 'g');
            _txt_ = _txt_.replace(reg, '<b>' + keyword + '</b>');
            var _url_ = statisticURL + 'ads_id=' + ads_id + '&site_id=' + site_id + '&url=' + $$escape(_href_) + '&vote=' + _is_vote + '&keyword=' + $$escape(keyword) + '&site=' + $$escape(ruri) + '&click=1';
            pI += '<a class="mcTLink" href="' + _url_ + '" target="_blank">' + _txt_ + '</a><br>';
        }
        pI += '</div>';
    }
    var voteY = voteURL + 'vote=1&ads_id=' + ads_id;
    var voteN = voteURL + 'vote=0&ads_id=' + ads_id;
    var vouch = vouchURL + 'ads_id=' + ads_id;
    var newListing = '';
    if (document.all) {
        document.all.linkTitleText.innerHTML = '';
    }else {
        $$('linkTitleText').innerHTML = '';
    }
    var cursor = 'pointer';
    var _styleH = '';
    var _styleW = '';
    var cursorType = 'move';
    var _onClickH = 'onClick="javascript:return false;"';
    var _onClickF = 'onClick="javascript:return false;"';
    var _server_ = 'http://www.mmosite.com/';
    if (headH == 14 || headH == 28) {
        _styleH = 'cursor:' + cursorType + ';';
        _onClickH = 'onClick="javascript:window.open(\'' + _server_ + '\');" onmouseover="_ind_=true;" onmouseout="_ind_=false;draging=false"';
    }
    if (footH == 14 || footH == 28) {
        _styleW = 'cursor:' + cursorType + ';';
        _onClickF = 'onClick="javascript:window.open(\'' + _server_ + '\');" onmouseover="_ind_=true;" onmouseout="_ind_=false;draging=false"';
    };
    var __nl__ = '<table id="_main_" style="';
    if (isIE) {
        __nl__ += 'filter:alpha(opacity=95);';
    }
    __nl__ += 'width:';
    if (ads_type == '6' || ads_type == '8') {
        __nl__ += '194';
    }else if (ads_type == '2') {
		__nl__ += '146';
	}else {
		__nl__ += '310';
	}
    __nl__ += 'px;table-layout:auto;border:0px;" cellspacing="0" cellpadding="0"><tr id="_mcHeader_"><td id="_header_" style="' + _styleH + 'position:relative" colspan="3" height="' + headH + '" ' + _onClickH + '></td></tr><tr id="_mcBodyer_"><td width="7" background="' + frameImg + 'right.png"></td><td id="_rightBG" width="';
    if (ads_type == '6' || ads_type == '8') {
        __nl__ += '180';
    }else {
        __nl__ += '296';
    }
    if (ads_type == '2') {
        __nl__ += '" align="center" style="cursor:' + cursor + ';margin:0px;padding:';
    }else {
        __nl__ += '" align="left" style="cursor:' + cursor + ';margin:0px;padding:';
    }
    if (ads_type == '2' || ads_type == '4' || ads_type == '6' || ads_type == '8' || ads_type == '99' || ads_type == '21') {
        __nl__ += '0';
    }else {
        __nl__ += '3';
    }
    __nl__ += 'px; background-color:' + LAYER_BACKGROUND_COLOR + '" onmouseover="this.style.backgroundColor=\'' + LAYER_HOVER_COLOR + '\'; ';
    if (isIE) {
        __nl__ += 'document.all._main_.filters.alpha.opacity=100;';
    }else {
        __nl__ += '$$(\'_main_\').style.opacity=\'1.0\';';
    }
    __nl__ += '" onmouseout="this.style.backgroundColor=\'' + LAYER_BACKGROUND_COLOR + '\';';
    if (isIE) {
        __nl__ += 'document.all._main_.filters.alpha.opacity=90;"';
    }else {
        __nl__ += '$$(\'_main_\').style.opacity=\'0.95\';"';
    }
    __nl__ += '>';
    if (_is_extender) {
        if (ads_type != '6' && ads_type != '8') {
            __nl__ += '<div style="height:12px; width:100%; border-bottom:1px dashed #555;padding:0px;margin:0px;font-size:8px;"><table width="97%" height="10" border="0" cellpadding="0" cellspacing="0"><tr align="right"><td width="16">&nbsp;</td><td valign="top"><a href="' + voteY + '" target="_black"><img src="' + good + '" alt="Good" border="0"/></a>&nbsp;&nbsp;<a href="' + voteN + '" target="_black"><img src="' + bad + '" alt="Bad" border="0"/></a>&nbsp;&nbsp;<a href="' + vouch + '" target="_black"><img src="' + mail + '" alt="Vouch" border="0"/></a></td><td width="16">&nbsp;</td></tr></table></div>';
        }
	}
    if (ads_type == '1' || ads_type == '3') {
        __nl__ += '<table style="width:100%;table-layout:auto;" border="0"><tr><td>' + pI + '</td><td>';
    }else {
        __nl__ += pI;
    }
    if (ads_type == '1' || ads_type == '3' || ads_type == '5' || ads_type == '7' || ads_type == '9') {
        __nl__ += '<div onclick="window.open(\'' + url + '\')"><span id="_title_" style="font-family:tahoma,Arial;color:' + TITLE_TEXT_COLOR + ';font-size:12px; line-height:12px;text-align:left"><strong>' + title + '</strong></span><div id="_content_" style="margin-top:5px;font-size:12px;line-height:12px;text-align:left;font-family:tahoma,Arial;color:' + KEYWORD_TEXT_COLOR + ';">' + text + '</div>';
        if (ads_type == '5' || ads_type == '7' || ads_type == '9') {
            __nl__ += '<div style="margin-top: 5px;"><table style="width:30%;table-layout:auto;" border="0" cellspacing="0" cellpadding="0"><tr><td style="font-size:10px;font-family:tahoma,Arial;color:' + LINK_TEXT_COLOR + ';" align="left" onmouseover="this.style.textDecoration=\'underline\'" onmouseout="this.style.textDecoration=\'none\'">' + links + '</span></td></tr><tr><td width="100">';
        }else if (ads_type == '1' || ads_type == '3') {
			__nl__ += '</div></td></tr></table><div style="margin-top: 5px;"><table style="width:100%;table-layout:auto;" border="0" cellspacing="0" cellpadding="0"><tr><td style="font-size:10px;font-family:tahoma,Arial;color:' + LINK_TEXT_COLOR + ';" onmouseover="this.style.textDecoration=\'underline\'" onmouseout="this.style.textDecoration=\'none\'">' + links + '</span></td><td width="105" align="right" valign="middle">';
		}
        if (ads_type == '5' || ads_type == '7' || ads_type == '9') {
            __nl__ += '</td></tr></table></div></div>';
        }else if (ads_type == '1' || ads_type == '3') {
			__nl__ += '</td></tr></table></div>';
		}
    }
    if (_is_helper) {
        if (ads_type != '6' && ads_type != '8') {
            __nl__ += '<div style="height:32px; width:100%; border-top:1px dashed #555;padding:0px;margin:0px;"><table width="97%" height="32" border="0" cellpadding="0" cellspacing="0"><form method="get" action="" name="mc_helper_form" onkeydown="if(event.keyCode==13){return false;}" onSubmit="return false;"><tr align="center"><td width="16">&nbsp;</td><td><input type="hidden" name="ie" value="utf-8"><input type="hidden" name="oe" value="utf-8"><input type="hidden" name="hl" value="zh-CN"><img src="' + ihelper + '" onClick="_helper_()" alt="Google Search Engine" align="absmiddle">&nbsp;<input type="text" name="q" style="border:1px solid #003C74;height:16px;width:75px;font-size:13px;background-color:#F7F7F7;padding:2px 1px 1px 2px;" maxlength="255"  value="' + keyword + '" onkeydown="if(event.keyCode==13){_helper_();}">&nbsp;<input type="image" src="' + search + '" name="btnG" align="absmiddle" onClick="_helper_()"/></td><td width="16">&nbsp;</td></tr></form></table></div>';
        }
	}
    __nl__ += '</td><td width="7" background="' + frameImg + 'left.png"></td></tr><tr id="_mcFooter_"><td id="_footer_" style="' + _styleW + 'position:relative" colspan="3" height="' + footH + '" ' + _onClickF + '></td></tr></table>';
    if (ads_type == '10') {
        newListing = pI;
    }else {
        newListing = __nl__;
    }
    if (isIE) {
        if (document.all.linkTitle.filters != 'undefined' && ads_type != '10') {
            document.all.linkTitle.filters[0].Transition = _fv_;
            document.all.linkTitle.filters[0].apply();
        };
        document.all.linkTitle.all.linkTitleText.innerHTML += newListing;
        document.all.linkTitle.style.left = _ADX_;
        document.all.linkTitle.style.top = _ADY_;
        document.all.linkTitle.style.display = '';
        document.all.linkTitle.style.zIndex = 99999;
        document.all.linkTitle.style.visibility = 'visible';
        if (ads_type != '10') {
            var headLayer = $$('_header_');
            headLayer.style.filter = "progid:DXImageTransform.Microsoft.AlphaImageLoader(enabled=true, sizingMethod=scale, src='" + headImg + "');";
            var footLayer = $$('_footer_');
            footLayer.style.filter = "progid:DXImageTransform.Microsoft.AlphaImageLoader(enabled=true, sizingMethod=scale, src='" + footImg + "');";
        }
        if (document.all.linkTitle.filters != "undefined" && ads_type != "10") {
            document.all.linkTitle.filters[0].play();
        }
	}else {
        var oLayer = $$('linkTitle');
        var oLayerTxt = $$('linkTitleText');
        var wW = window.innerWidth;
        var wH = window.innerHight;
        oLayer.style.top = _ADY_ + 'px';
        oLayer.style.left = _ADX_ + 'px';
        oLayerTxt.innerHTML += newListing;
        oLayer.style.display = '';
        oLayer.style.zIndex = 99999;
        if (!isOR) {
            oLayer.style.opacity = 0.95;
        }
        oLayer.style.visibility = 'visible';
        if (ads_type != '10') {
            var headLayer = $$('_header_');
            headLayer.innerHTML = '<img src="' + headImg + '">';
            var footLayer = $$('_footer_');
            footLayer.innerHTML = '<img src="' + footImg + '">';
        }
	}
    if (ads_type == '4' || ads_type == '5' || ads_type == '6' || ads_type == '7' || ads_type == '8' || ads_type == '9' || ads_type == '10') {
        var _fid_ = 'mc_swf', _src_ = picture, _vars_ = '', __w__ = 180, __h__ = 150, _trans_ = false, _bgc_ = '#FFFFFF';
        if (ads_type == '8' || ads_type == '9') {
            _fid_ = 'mc_swf_img';
            var text_height = 0;
            var swf_height = __h__ + text_height;
            var _pics = '';
            var _links = '';
            var _texts = '';
            var sp = picture.split(',');
            if (sp.length > 2) {
                for (j = 1; j < sp.length; j++) {
                    imgUrl = sp[0] + '/' + sp[j];
                    _pics += imgUrl + '|';
                    _links += escape(url) + '|';
                    _texts += '|';
                }
			}
            _pics = _pics.substr(0, _pics.length - 1);
            _links = _links.substr(0, _links.length - 1);
            _texts = _texts.substr(0, _texts.length - 1);
            _vars_ = 'pics=' + _pics + '&links=' + _links + '&texts=' + _texts + '&borderwidth=' + __w__ + '&borderheight=' + __h__ + '&textheight=' + text_height;
            _src_ = publicImg + 'focus.swf';
            _bgc_ = '#F0F0F0';
        }else if (ads_type == '10') {
			_trans_ = true;
			var _w_h_ = mcLinks[adLinkId].htmlContent;
			if (_w_h_ != '') {
				var sp = _w_h_.split('x');
				if (!isNaN(sp[0]) && !isNaN(sp[1])) {
					__w__ = sp[0];
					__h__ = sp[1];
				}
			}
		}else {
			_bgc_ = '#000';
		}
		var so = '<a href="' + url + '"><div>';
		if (isIE) {
			so += '<object id="'+_fid_+'" height="' + __h__ + '" width="' + __w__+ '" classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"><param name="movie" value="' + _src_ + '"><param name="src" value="' + _src_ + '"><param name="autoplay" value="true"><param name="menu" value="false"><param name="quality" value="high">';
        }else {
            so += '<object id="' + _fid_ + '" data="' + _src_ + '" type="application/x-shockwave-flash" height="' + __h__ + '" width="' + __w__ + '" class="mozilla"><param name="autoplay" value="true"><param name="menu" value="false"><param name="quality" value="high">';
        }
		if (_vars_ != '') {
            so += '<param name="FlashVars" value="' + _vars_ + '">';
        }
		if (_trans_) {
			so += '<param name="wmode" value="transparent">';
		}
		so += '</object></div></a>';
		$$('flashcontent').innerHTML = so;
	}
    _viewer_(site_id, ads_id, $$escape(keyword));
}
function _hide_show(){
    if (!mouseIsOverLayer) {
        $$('linkTitle').style.display = 'none';
        _displayer_('sotester');
    }
}
function _hide_title(evt, el){
    if (draged) {
        return;
    }
    if (document.all) {
        if (!(linkTitle.contains(window.event.toElement))) {
            mouseIsOverLayer = false;
            if (!mouseOverWhileLoad) {
                hideTO = window.setTimeout('_hide_show()', 500);
            }
		}
	}else {
        if (checkMouseLeave(el, evt)) {
            mouseIsOverLayer = false;
            if (!mouseOverWhileLoad) {
                hideTO = window.setTimeout('_hide_show()', 500);
            }
		}
	}
};
function checkMouseLeave(el, evt){
    if (el.contains && evt.toElement) {
        return !el.contains(evt.toElement);
    }else if (evt.relatedTarget) {
		return !checkIfIsParent(el, evt.relatedTarget);
	}
};
function checkIfMouseOverLayer(){
    if (draged) {
        return;
    }
    if (!mouseIsOverLayer && !mouseOverWhileLoad) {
        if (document.all) {
            document.all.linkTitle.style.display = 'none';
        }else {
            $$('linkTitle').style.visibility = 'hidden';
            $$('linkTitle').style.display = 'none';
        }
        _displayer_('sotester');
    }
};
function checkIfIsParent(container, containee){
    var isParent = false;
    do {
        if ((isParent = (container == containee))) {
            break;
        }
        containee = containee.parentNode;
    }
    while (containee != null)
		return isParent;
};
if (!$$('linkTitle')) {
    if (isIE) {
        var _m_b_ = document.getElementsByTagName('BODY')[0];
        var _n_n_ = document.createElement('div');
        _n_n_.id = 'mmo_keywords_id';
        _n_n_.innerHTML = '<div onmouseover="mouseIsOverLayer = true;" onmouseout=" mouseOverWhileLoad=false; _hide_title(event, this);" class="linkTitle" id="linkTitle" style=" position: absolute; visibility: hidden; z-index:9999; display: none;"><div id="linkTitleText"></div></div>';
        _m_b_.children(0).insertAdjacentElement('BeforeBegin', _n_n_);
    }else {
        document.writeln('<div onmouseover="mouseIsOverLayer = true;" onmouseout=" mouseOverWhileLoad=false; _hide_title(event, this);" class="linkTitle" id="linkTitle" style=" position: absolute; visibility: hidden; z-index:9999; display: none;">');
        document.writeln('<div id="linkTitleText"></div>');
        document.writeln('</div>');
    }
}
var draging = false;
var draged = false;
var offsetX = 0;
var offsetY = 0;
var _ind_ = false;
function BeforeDrag(evt){
    var evt = evt || window.event;
    if (evt.button != 1) {
        return;
    }
    var obj = $$('linkTitle');
    offsetX = document.body.scrollLeft + (evt.clientX || evt.pageX) - obj.style.pixelLeft;
    offsetY = document.body.scrollTop + (evt.clientY || evt.pageY) - obj.style.pixelTop;
    draging = true;
};
function OnDrag(evt){
    var evt = evt || window.event;
    if (!draging) {
        return;
    }
    if (!_ind_) {
        return;
    }
    $$('_header_').onclick = '';
    $$('_footer_').onclick = '';
    var obj = $$('linkTitle');
    event.returnValue = false;
    obj.style.pixelLeft = document.body.scrollLeft + (evt.clientX || evt.pageX) - offsetX;
    obj.style.pixelTop = document.body.scrollTop + (evt.clientY || evt.pageY) - offsetY;
    if (draged) 
        return;
    var footLayer = $$('_footer_');
    var headLayer = $$('_header_');
    if (isIE) {
        _x = footLayer.style.filter;
        _y = headLayer.style.filter;
    }
    else {
        _x = footLayer.innerHTML;
        _y = headLayer.innerHTML;
    };
    if (_x.indexOf("bottomleft") > -1) {
        if (isIE) {
            footLayer.style.filter = _x.replace("bottomleft", "bottomdrag");
        }
        else {
            footLayer.innerHTML = _x.replace("bottomleft", "bottomdrag");
        }
        footLayer.style.height = "14px";
    }
    else 
        if (_x.indexOf("bottomright") > -1) {
            if (isIE) {
                footLayer.style.filter = _x.replace("bottomright", "bottomdrag");
            }
            else {
                footLayer.innerHTML = _x.replace("bottomright", "bottomdrag");
            }
            footLayer.style.height = "14px";
        }
        else 
            if (_y.indexOf("topright") > -1) {
                if (isIE) {
                    headLayer.style.filter = _y.replace("topright", "topdrag");
                }
                else {
                    headLayer.innerHTML = _y.replace("topright", "topdrag");
                }
                headLayer.style.height = "14px";
            }
            else 
                if (_y.indexOf("topleft") > -1) {
                    if (isIE) {
                        headLayer.style.filter = _y.replace("topleft", "topdrag");
                    }
                    else {
                        headLayer.innerHTML = _y.replace("topleft", "topdrag");
                    }
                    headLayer.style.height = "14px";
                };
    draged = true;
};
function EndDrag(evt){
    var evt = evt || window.event;
    if (evt.button != 1) {
        return;
    };
    draging = false;
};
function _init_drag(){
    var obj = $$('linkTitle');
    obj.onmousedown = BeforeDrag;
    document.onmousemove = OnDrag;
    obj.onmouseup = EndDrag;
};
var _helper_ = function(){
    var _adw_elperURL = "http://www.google.com/search?complete=1&hl=en&newwindow=1&q=";
    window.open(_adw_elperURL + (document.mc_helper_form.q.value));
};
var _viewer_ = function(site_id, ads_id, keyword){
    var _viewAds = new Image;
    _viewAds.src = _server + "view.php?site_id=" + site_id + "&ads_id=" + ads_id + "&k=" + keyword + "&s=" + $$escape(ruri) + "&rn=" + $$rand(999999);
};
var _exister_ = function(i){
    for (j = 0; j < mcMatches.length; j++) {
        if (mcMatches[j] == i) {
            return true;
        }
    }
    return false;
};
var _checker_ = function(_t){
    for (var i = 0; i < aw_list.length; i++) {
        if (aw_list[i] == _t) {
            return true;
        }
        return false;
    }
};
var _displayer_ = function(ID){
    if (!isIE) {
        return;
    }
    if (ID == "mc_swf_img") {
        return;
    }
    var loc = eval("window.document." + ID);
    if (loc != undefined) {
        loc.StopPlay();
    }
};
var _yeser_ = function(_t){
    if (!_is_area && aw_list.length == 0) {
        return true;
    }
    if (_t === 'undefined') {
        return false;
    }
    if ((_t.id).indexOf("mmosite_keywords_area") == 0 || _checker_(_t.id)) {
        return true;
    }
    var _y = _t.parentElement;
    if (_y === 'undefined') {
        return false;
    }
    while ((_y.id).indexOf("mmosite_keywords_area") != 0 && !_checker_(_y.id)) {
        _y = _y.parentElement;
        if (_y === 'undefined') {
            return false;
        }
        if (_y.tagName == "BODY" || _y.tagName == "TBODY" || _y.tagName == "HTML" || _y.tagName == "HEAD") {
            return false;
        }
    }
    return true;
};
var _noer_ = function(_t){
    if (_t === 'undefined') {
        return false;
    }
    if (_t.tagName == "A") {
        return true;
    }
    var _y = _t.parentElement;
    if (_y === 'undefined') {
        return false;
    }
    while (_y.tagName != "A") {
        _y = _y.parentElement;
        if (_y === 'undefined') {
            return false;
        }
        if (_y.tagName == "BODY" || _y.tagName == "TBODY" || _y.tagName == "HTML" || _y.tagName == "HEAD") {
            return false;
        }
    }
    return true;
};
$$import(_server + 'webdata/keywords/mmo_keywords_' + site_id + '.js');
window.onload = function(){
    _is_ready = true;
    _i_i_();
    if (unescape($$getCookie('mmo_keywords_cookie')) != location.href) {
        $$XHR(statisticURL + 'site_id=' + site_id + '&kids=' + $$escape(mcMatcheskeywords.toString()) + '&isWin=' + isWin + '&isUix=' + isUix + '&isMac=' + isMac + '&x=' + screen.height + '&y=' + screen.width + '&c=' + screen.colorDepth + '&isIE=' + isIE + '&isFF=' + isFF + '&isNS=' + isNS + '&isOR=' + isOR + '&isCK=' + isCK + '&isMF=' + isMF + '&isMP=' + isMP + '&isRO=' + isRO + '&isQT=' + isQT + '&isPDF=' + isPDF + '&isJava=' + isJava + '&page=' + $$escape(location.href) + '&ruri=' + $$escape(ruri) + '&match=1', function(data, responseCode){
            return;
        });
    }
}