﻿
  //var adflashbig = 'http://img.ifeng.com/tres/recommend/pacx/110307-pacx-258x215.swf';
var adflashbig = '/pagead/tcsx/1.swf';
var adflashsmall = '/pagead/tcsx/yb.gif';
var adclickurl = 'http://www.xiaozhangchina.com/subscribe/';

    var flat_stream_t_showtimer = '0';
    var float_stream_t_small_bottom = '10';

    var float_stream_width = 561;
    var float_stream_height = 315;
    var float_stream_top = 151;
    var float_stream_left = 0;
    var ifcl_stylebigBg = 1;
    var closetimer = 20;
    var maxopentime = 2;
    var showtimer = 0;
    var float_stream_small_bottom = 10;
    var float_stream_small_right = 0;

    if (flat_stream_t_showtimer === '') {
    } else {
        showtimer = flat_stream_t_showtimer;
    }

    if (float_stream_t_small_bottom === '') {
    } else {
        float_stream_small_bottom = float_stream_t_small_bottom;
    }

    if (typeof (window.Ifeng_Sc_float_Sleep) == "undefined" || window.Ifeng_Sc_float_Sleep == "" || window.Ifeng_Sc_float_Sleep == 'undefined') {
    } else {
        showtimer = window.Ifeng_Sc_float_Sleep;
    }

    if (typeof (window.Ifeng_Sc_float_Height) == "undefined" || window.Ifeng_Sc_float_Height == "" || window.Ifeng_Sc_float_Height == 'undefined') {
    } else {
        float_stream_small_bottom = window.Ifeng_Sc_float_Height;
    }

    var ifengFlash = function(V, x, X, Z, v, z, i, c, I, l, o) {
        var floatObj = this; if (!document.createElement || !document.getElementById) { return }
        floatObj.id = x ? x : '';
        var O = function(I, i) {
            for (var l = 0; l < I.length; l++) { if (I[l] == i) { return l } }
            return -1
        },
	C = '8.0.42.0';
        /*if(O(['news.ifeng.com.cn','ent.ifeng.com.cn'],document.domain)>-1)
        {
        floatObj.ver=C;
        }
        else
        {
        floatObj.ver=v?v:C;
        }*/
        floatObj.ver = v ? v : C;

        floatObj.ver = floatObj.ver.replace(/\./g, ',');
        floatObj.__classid = "clsid:D27CDB6E-AE6D-11cf-96B8-444553540000";
        floatObj.__codebase = "http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=" + floatObj.ver;
        floatObj.width = X;
        floatObj.height = Z;
        floatObj.movie = V;
        floatObj.src = floatObj.movie;
        floatObj.bgcolor = z ? z : '';
        floatObj.quality = c ? c : "high";
        floatObj.__pluginspage = "http://wwfloatObj.macromedia.com/go/getflashplayer";
        floatObj.__type = "application/x-shockwave-flash";
        floatObj.useExpressInstall = (typeof (i) == "boolean") ? i : false;
        floatObj.xir = I ? I : window.location;
        floatObj.redirectUrl = l ? l : window.location;
        floatObj.detectKey = (typeof (o) == "boolean") ? o : true;
        floatObj.escapeIs = false;
        floatObj.__objAttrs = {};
        floatObj.__params = {};
        floatObj.__embedAttrs = {};
        floatObj.__flashVars = [];
        floatObj.__flashVarsStr = "";
        floatObj.__forSetAttribute("id", floatObj.id);
        floatObj.__objAttrs["classid"] = floatObj.__classid;
        floatObj.__forSetAttribute("codebase", floatObj.__codebase);
        floatObj.__forSetAttribute("width", floatObj.width);
        floatObj.__forSetAttribute("height", floatObj.height);
        floatObj.__forSetAttribute("movie", floatObj.movie);
        floatObj.__forSetAttribute("quality", floatObj.quality);
        floatObj.__forSetAttribute("pluginspage", floatObj.__pluginspage);
        floatObj.__forSetAttribute("type", floatObj.__type);
        floatObj.__forSetAttribute("bgcolor", floatObj.bgcolor)
    };
    ifengFlash.prototype = {
        getFlashHtml: function() {
            var I = this, i = '<object ';
            for (var l in I.__objAttrs) {
                i += l + '="' + I.__objAttrs[l] + '"' + ' '
            }
            i += '>\n';
            for (var l in I.__params) {
                i += '	<param name="' + l + '" value="' + I.__params[l] + '" \/>\n'
            }
            if (I.__flashVarsStr != "") {
                i += '	<param name="flashvars" value="' + I.__flashVarsStr + '" \/>\n'
            }
            i += '	<embed ';
            for (var l in I.__embedAttrs) {
                i += l + '="' + I.__embedAttrs[l] + '"' + ' '
            }
            i += '><\/embed>\n<\/object>';
            return i;
        },
        __forSetAttribute: function(I, i) {
            var l = this;
            if (typeof (I) == "undefined" || I == '' || typeof (i) == "undefined" || i == '')
            { return }
            I = I.toLowerCase();
            switch (I) {
                case "classid":
                    break;
                case "pluginspage":
                    l.__embedAttrs[I] = i;
                    break;
                case "onafterupdate": case "onbeforeupdate": case "onblur": case "oncellchange": case "onclick": case "ondblClick": case "ondrag": case "ondragend": case "ondragenter": case "ondragleave": case "ondragover": case "ondrop": case "onfinish": case "onfocus": case "onhelp": case "onmousedown": case "onmouseup": case "onmouseover": case "onmousemove": case "onmouseout": case "onkeypress": case "onkeydown": case "onkeyup": case "onload": case "onlosecapture": case "onpropertychange": case "onreadystatechange": case "onrowsdelete": case "onrowenter": case "onrowexit": case "onrowsinserted": case "onstart": case "onscroll": case "onbeforeeditfocus": case "onactivate": case "onbeforedeactivate": case "ondeactivate": case "codebase":
                    l.__objAttrs[I] = i;
                    break;
                case "src": case "movie":
                    l.__embedAttrs["src"] = i;
                    l.__params["movie"] = i;
                    break;
                case "width": case "height": case "align": case "vspace": case "hspace": case "title": case "class": case "name": case "id": case "accesskey": case "tabindex": case "type":
                    l.__objAttrs[I] = l.__embedAttrs[I] = i;
                    break;
                default:
                    l.__params[I] = l.__embedAttrs[I] = i
            }
        },
        __forGetAttribute: function(i) {
            var I = this;
            i = i.toLowerCase();
            if (typeof I.__objAttrs[i] != "undefined") {
                return I.__objAttrs[i]
            }
            else if (typeof I.__params[i] != "undefined") {
                return I.__params[i]
            }
            else if (typeof I.__embedAttrs[i] != "undefined") {
                return I.__embedAttrs[i]
            }
            else
            { return null }
        },
        setAttribute: function(I, i) {
            this.__forSetAttribute(I, i)
        },
        getAttribute: function(i) {
            return this.__forGetAttribute(i)
        },
        addVariable: function(I, i) {
            var l = this;
            if (l.escapeIs) {
                I = escape(I);
                i = escape(i)
            }
            if (l.__flashVarsStr == "") {
                l.__flashVarsStr = I + "=" + i
            }
            else {
                l.__flashVarsStr += "&" + I + "=" + i
            }
            l.__embedAttrs["FlashVars"] = l.__flashVarsStr
        },
        getVariable: function(I) {
            var o = this, i = o.__flashVarsStr; if (o.escapeIs) { I = escape(I) }
            var l = new RegExp(I + "=([^\\&]*)(\\&?)", "i").exec(i);
            if (o.escapeIs) { return unescape(RegExp.$1) }
            return RegExp.$1
        },
        addParam: function(I, i) {
            this.__forSetAttribute(I, i)
        },
        getParam: function(i) {
            return this.__forGetAttribute(i)
        },
        write: function(i) {
            var I = this;
            if (typeof i == "string") {
                document.getElementById(i).innerHTML = I.getFlashHtml()
            }
            else if (typeof i == "object") {
                i.innerHTML = I.getFlashHtml()
            }
        }
    };

    (function(sm_Flashbig_url, sm_Flashsmall_url, sm_ClickUrl, sm_width, sm_height, sm_top, sm_left, sm_bigBg, sm_CloseTimer, sm_MaxOpenTime, sm_small_bottom, sm_small_right, sm_ShowTimer) {
        window.ifshowbig = false;
        var smCloseTimer = sm_CloseTimer * 1000;
        var smShowTimer = sm_ShowTimer * 1000;
        var smMaxOpenTime = sm_MaxOpenTime;
        if (!sm_small_bottom) sm_small_bottom = 15;
        if (!sm_small_right) sm_small_right = 0;
        var smCloseSt;
        var smGetPosSt;
        var ifshowbig = false;
        var closeall = false;
        var version = navigator.appVersion.split(";");
        var trim_Version = version[1].replace(/[ ]/g, "");
        var isIE6 = (navigator.appName == "Microsoft Internet Explorer" && trim_Version == "MSIE6.0") ? true : false;
        var isXHTML = document.compatMode == "CSS1Compat" ? true : false;
        var pthis = this;
        var bdy = (document.documentElement && document.documentElement.clientWidth) ? document.documentElement : document.body;
        var $ = function(id) { if (document.getElementById) { return eval('document.getElementById("' + id + '")') } else { return eval("document.all." + id) } };
        this.ifengDotInitWrap = function(aType, aId, id, aE, aW, aH, aM, aP, aBg, aPo, aT, aR, aB, aL, aDisp, azI) {
            var lstStr = "";
            if (aType == 1) {
                lstStr += "var " + aId + ' = document.createElement("' + aE + '");'
            }
            else {
                if (aType == 2) { lstStr += "var " + aId + ' = document.getElementById("' + aE + '");' } else { return }
            }
            if (id != "") { lstStr += aId + '.id = "' + id + '";' }
            if (aW != "") { lstStr += aId + ".style.width = " + aW + ' + "px";' }
            if (aH != "") { lstStr += aId + ".style.height = " + aH + ' + "px";' }
            if (aBg != "") { lstStr += aId + '.style.background = "' + aBg + '";' }
            if (aM != "") { lstStr += aId + '.style.margin = "' + aM + '";' }
            if (aP != "") { lstStr += aId + '.style.padding = "' + aP + '";' }
            if (aPo != "") { lstStr += aId + '.style.position = "' + aPo + '";' }
            if (aT != "") { lstStr += aId + '.style.top = "' + aT + '";' }
            if (aR != "") { lstStr += aId + '.style.right = "' + aR + '";' }
            if (aB != "") { lstStr += aId + '.style.bottom = "' + aB + '";' }
            if (aL != "") { lstStr += aId + '.style.left = "' + aL + '";' }
            if (aDisp != "") { lstStr += aId + '.style.display = "' + aDisp + '";' }
            if (azI != "") { lstStr += aId + '.style.zIndex = "' + azI + '";' }
            return lstStr
        };
        this.ifengDotInitObj = function(theAdId, theAdSrc, theAdUrl, theAdWidth, theAdHeight) {
            var theAdType = theAdSrc.substring(theAdSrc.length - 3).toLowerCase();
            var tmpAdObj = document.createElement("span");
            tmpAdObj.style.textAlign = "left";
            switch (theAdType) {
                case "tml": case "htm":
                    var tmpAdContent = document.createElement("iframe");
                    tmpAdContent.id = theAdId;
                    tmpAdContent.style.width = theAdWidth + "px";
                    tmpAdContent.style.height = theAdHeight + "px";
                    tmpAdContent.src = theAdSrc;
                    tmpAdContent.frameBorder = 0;
                    tmpAdContent.scrolling = "no";
                    tmpAdContent.marginheight = 0;
                    tmpAdContent.marginwidth = 0;
                    break;
                case "swf":
                    var tmpAdContent = document.createElement("div");
                    tmpAdContent.id = theAdId;
                    tmpAdContent.style.width = theAdWidth + "px";
                    tmpAdContent.style.height = theAdHeight + "px";
                    tmpAdContent.style.margin = "0 auto";
                    tmpAdContent.style.cursor = "pointer";

                    theAdSrc += "?clickTag=" + escape(theAdUrl);

                    var flashObj = new ifengFlash(theAdSrc, theAdId + "_swf", theAdWidth, theAdHeight, "7", "", false, "High");
                    if (sm_bigBg == 1)
                        flashObj.addParam("wmode", "opaque");
                    else
                        flashObj.addParam("wmode", "transparent");
                    flashObj.addParam("allowScriptAccess", "always");
                    flashObj.addParam("menu", "false");
                    flashObj.write(tmpAdContent);
                    break;
                case "jpg": case "gif":
                    var tmpAdContent = document.createElement("a");
                    tmpAdContent.id = theAdId;
                    tmpAdContent.style.padding = "0px";
                    tmpAdContent.href = theAdUrl;
                    tmpAdContent.target = "_blank";
                    tmpAdContent.style.width = theAdWidth + "px";
                    tmpAdContent.style.height = theAdHeight + "px";
                    tmpAdContent.style.margin = "0 auto";
                    tmpAdContent.style.display = "block";
                    var ImageObj = new Image();
                    ImageObj.id = theAdId + "_img";
                    ImageObj.style.width = theAdWidth + "px"; ImageObj.style.height = theAdHeight + "px";
                    ImageObj.style.border = "none"; ImageObj.src = theAdSrc;
                    tmpAdContent.appendChild(ImageObj);
                    break;
                default:
                    var tmpAdContent = document.createElement("a");
                    tmpAdContent.id = theAdId;
                    tmpAdContent.style.padding = "0px";
                    tmpAdContent.href = theAdUrl;
                    tmpAdContent.target = "_blank";
                    tmpAdContent.innerText = theAdSrc;
                    break
            }
            tmpAdObj.appendChild(tmpAdContent);
            return tmpAdObj
        };

        this.initSM = function() {
            var apthis = this;
            sm_ClickUrl = (sm_ClickUrl == "") ? location.href : sm_ClickUrl;
            document.write('<span id="StreamMediaWrap"></span>');
            var pNode = $("StreamMediaWrap");
            pNode.style.textAlign = "left";
            eval(pthis.ifengDotInitWrap(1, "smExtObj", "smExtObj", "div", sm_width, eval(sm_width > 375 ? sm_height + 31 : sm_height + 31), "0", "0", "", "fixed", "0", "", "", "0", "none", "9999"));
            if (isIE6 || !isXHTML) {
                smExtObj.style.position = "absolute"
            }
            eval(pthis.ifengDotInitWrap(1, "smExtObjFlash", "smExtObjFlash", "div", sm_width, sm_height, "0", "0", "", "absolute", "0", "", "", "0", "", "100"));
            if (float_stream_width > 375) {
                eval(pthis.ifengDotInitWrap(1, "smExtObjCls", "smExtObjCls", "div", "77", "31", "0", "0", "url(/pagead/tcsx/test-guanbid.gif) no-repeat", "absolute", "", "0", "0", "", "", "300"));
            }
            else {
                eval(pthis.ifengDotInitWrap(1, "smExtObjCls", "smExtObjCls", "div", "77", "31", "0", "0", "url(/pagead/tcsx/floatadclose-z.gif) no-repeat", "absolute", "", "0", "0", "", "", "300"));
                //smCloseTimer=5000;
            }
            smExtObjCls.style.cursor = "pointer";
            smExtObjCls.overflow = "hidden";
            smExtObjCls.title = "关 闭";
            if (sm_bigBg == 1) {
                eval(pthis.ifengDotInitWrap(1, "smExtObjBg", "smExtObjBg", "div", sm_width, sm_height, "0", "0", "#fff", "absolute", "0", "", "", "0", "", "1"));
                eval(pthis.ifengDotInitWrap(1, "smExtObjBgIfm", "smExtObjBgIfm", "iframe", sm_width, sm_height, "", "", "", "", "", "", "", "", "", ""));
                smExtObjBgIfm.frameBorder = 0;
                smExtObjBgIfm.scrolling = "no";
                smExtObjBg.appendChild(smExtObjBgIfm); smExtObj.appendChild(smExtObjBg);
            }
            smExtObj.appendChild(smExtObjCls);
            smExtObj.appendChild(smExtObjFlash);
            pNode.appendChild(smExtObj);
            eval(pthis.ifengDotInitWrap(1, "smTagObj", "smTagObj", "div", 90, 161, "0", "0", "", "fixed", "", "0", "0", "", "none", "9999"));
            if (isIE6 || !isXHTML) { smTagObj.style.position = "absolute" }
            eval(pthis.ifengDotInitWrap(1, "smTagObjFlash", "smTagObjFlash", "div", 90, 150, "0", "0", "", "", "", "", "", "", "", ""));
            smTagObjFlash.style.float = "left"; smTagObjFlash.style.overflow = "hidden";
            eval(pthis.ifengDotInitWrap(1, "smTagObjPlay", "smTagObjPlay", "div", 25, 19, "0", "0", "url(/pagead/tcsx/bf.gif) no-repeat center", "", "", "", "", "", "", ""));
            smTagObjPlay.style.cursor = "pointer"; smTagObjPlay.overflow = "hidden"; smTagObjPlay.style.float = "left"; smTagObjPlay.title = "重 播";
            eval(pthis.ifengDotInitWrap(1, "smTagObjCls", "smTagObjCls", "div", 65, 19, "0", "0", "url(/pagead/tcsx/gb.gif) no-repeat center top", "", "", "0", "0", "", "", ""));

            smTagObjCls.style.float = "left";
            smTagObjCls.style.margin = "-19 0 0 25";
            smTagObjCls.style.cursor = "pointer";
            smTagObjCls.overflow = "hidden";
            smTagObjCls.title = "关 闭";
            smTagObj.appendChild(smTagObjFlash);
            smTagObj.appendChild(smTagObjPlay);
            smTagObj.appendChild(smTagObjCls);
            pNode.appendChild(smTagObj);

            this.getPos = function() {
                if (isIE6 || !isXHTML) { smTagObj.style.top = bdy.scrollTop + bdy.offsetHeight - 206 - sm_small_bottom + "px" }
                else { smTagObj.style.bottom = sm_small_bottom + "px" }

                smTagObj.style.right = sm_small_right + "px";

                if (isIE6 || !isXHTML) { smExtObj.style.top = bdy.scrollTop + sm_top + "px" }
                else { smExtObj.style.top = sm_top + "px" }
                //smExtObj.style.left=sm_left>=0?sm_left:(bdy.offsetWidth-sm_width)/2+"px";
                smExtObj.style.left = ((bdy.offsetWidth - sm_width) / 2 + sm_left) + "px"; //cds add
                if (isIE6 || !isXHTML) { smGetPosSt = setTimeout("getPos()", 10) }
            };

            this.playSM = function() {
                window.ifshowbig = true;
                clearTimeout(smCloseSt);
                apthis.getPos();
                smExtObj.style.display = "block";
                smTagObj.style.display = "none";
                smExtObjFlash.appendChild(pthis.ifengDotInitObj("smExtObjSwf", sm_Flashbig_url, sm_ClickUrl, sm_width, sm_height));
                smTagObjFlash.innerHTML = "";
                smCloseSt = setTimeout(function() { apthis.closeSM() }, smCloseTimer)
            };

            this.closeSM = function() {
                window.ifshowbig = false;
                clearTimeout(smCloseSt);
                apthis.getPos();
                smExtObj.style.display = "none";
                smTagObj.style.display = "block";
                smTagObjFlash.appendChild(pthis.ifengDotInitObj("smTagObjSwf", sm_Flashsmall_url, sm_ClickUrl, 90, 151));
                smExtObjFlash.innerHTML = ""
            };

            this.closeAllSM = function() {
                window.ifshowbig = false;
                clearTimeout(smCloseSt);
                clearTimeout(smGetPosSt);
                smExtObj.style.display = "none";
                smTagObj.style.display = "none";
                smExtObjFlash.innerHTML = ""
            };

            this.getAdCookie = function(N) {
                var c = document.cookie.split("; ");
                for (var i = 0; i < c.length; i++) {
                    var d = c[i].split("=");
                    if (d[0] == N) { return unescape(d[1]) }
                }
                return "";
            };

            this.setAdCookie = function(N, V, Q) {
                var L = new Date();
                var z = new Date(L.getTime() + Q * 60000);
                document.cookie = N + "=" + escape(V) + ";path=/;expires=" + z.toGMTString() + ";"
            };
            smExtObjCls.onclick = function() {
                apthis.closeSM()
            };
            smTagObjPlay.onclick = function() {
                apthis.playSM()
            };
            smTagObjCls.onclick = function() {
                apthis.closeAllSM()
            };
            this.openWin = function() {
                var cookie_time = new Date();
                var flag_cookie = "StreamMediaCookie" + adflashbig.substr(adflashbig.lastIndexOf('/') + 1) + cookie_time.getFullYear().toString() + (cookie_time.getMonth() + 1).toString() + cookie_time.getDate().toString() + document.URL;
                var smCookie = pthis.getAdCookie(flag_cookie);
                smCookie = smCookie == "" ? 1 : ++smCookie;
                if (smCookie < smMaxOpenTime + 1) {
                    setTimeout(function() { apthis.playSM() }, smShowTimer);
                    pthis.setAdCookie(flag_cookie, smCookie, 1440)
                }
                else {
                    apthis.closeSM()
                }
            };
            var ifengDotSmStforFS;
            this.ckeOpenWin = function() {
                if (typeof (fullScreenForLmt) != "undefined") {
                    if (fullScreenForLmt == false) {
                        clearTimeout(ifengDotSmStforFS);
                        apthis.openWin()
                    }
                    else {
                        if (fullScreenForLmt == true) {
                            ifengDotSmStforFS = setTimeout(function() { apthis.ckeOpenWin() }, 1000)
                        }
                    }
                }
                else {
                    apthis.openWin()
                }
            };
            apthis.ckeOpenWin()
        };

        pthis.initSM()
    }
)(adflashbig, adflashsmall, adclickurl, float_stream_width, float_stream_height, float_stream_top, float_stream_left, ifcl_stylebigBg, closetimer, maxopentime, float_stream_small_bottom, float_stream_small_right, showtimer);


