
(function() {
    oyell_oth_url = false;
    ud = "undefined";
    ef = false;
    var w = window;
    var oyell_random_id = Math.round(Math.random() * 999999999);
    var oyell_iframe_id = 'oyell_iframe_id_' + oyell_random_id;

    function Oyell_CreateUrlObject(url) {
        this.url = url;
    };

    function Oyell_get(murl, name) {
        source = murl;
        var reg = new RegExp("(^|\\?|&)" + name + "=([^&]*)(\\s|&|$)", "i");
        if (reg.test(source)) return RegExp.$2; return "";
    };

    function Oyell_load(a, e, l, ar) {
        var oyell_adShow_url = new Oyell_CreateUrlObject('http://view.oyell.cn/');
        Oyell_append_url('t', Oyell_t(), oyell_adShow_url);
        Oyell_append_url('r', oyell_referer(), oyell_adShow_url);
        Oyell_append_url('loc', oyell_href(), oyell_adShow_url);
        Oyell_append_url('rnd', oyell_random_id, oyell_adShow_url);
        Oyell_append_url('o', Oyell_getOs(), oyell_adShow_url);
        Oyell_append_url('b', Oyell_getBrowser(), oyell_adShow_url);
        Oyell_append_url('h', w.history.length, oyell_adShow_url);
        Oyell_append_url('m', Oyell_GetMimeType(), oyell_adShow_url);
        Oyell_append_url('arid', ar, oyell_adShow_url);
        Oyell_append_url('eid', e, oyell_adShow_url);
        Oyell_append_url('lid', l, oyell_adShow_url);
        Oyell_append_url('aid', a, oyell_adShow_url);
        Oyell_Send(oyell_adShow_url.url, 100);

    };

    function Oyell_v() { return };

    function Oyell_doPause(millisecondi) {
        var exitTime = (new Date()).getTime() + millisecondi;
        while (true) { if ((new Date()).getTime() > exitTime) return } 
    };

    function Oyell_Send(url, d) {
        var clickOyell_image = new Image(1, 1);
        clickOyell_image.src = url;
        clickOyell_image.onload = function() { Oyell_v() };
        if (d) Oyell_doPause(d)
    };

   function Oyell_append_url(param, value, obj) {
        if (obj.url.indexOf('?') != -1) {
            if (!Oyell_isNull(value)) {
                obj.url += '&' + param + '=' + e(value);
            }
            else {
                obj.url += '&' + param + '=no';
            }
        } else {

        obj.url +='?'+ param + '=' + e(value);
        }
    };

    function Oyell_quoted(str) {
        return (str != null) ? '"' + str + '"' : '""';
    };

    function e(str) { return (typeof encodeURIComponent == "function") ? encodeURIComponent(str) : escape(str) };

    function Oyell_isNull(str) {
        if (str == null) return true;
        if (str) return false;
        str += "";
        return str.replace(/^\s+|\s+$/g).length == 0;
    };

    function Oyell_getBrowser() {
        var browser = navigator.userAgent.match(/(Konqueror|Opera|Safar|Firebird|NetCaptor|MSN |Netscape|MSIE|MyIE|OmniWeb|AOL|WebTV|iCab|Maxthon|TencentTraveler|Firefox|GOSURF|America Online Browser|ZoneSurf|Crazy|baidubot|Googlebot|Yahoo|msnbot|Kidzilla|FuckZilla)[\d\/]?\d*\.?\d*\.*\d*[^;\(\)\[]*/gi);
        return browser ? browser.pop() : "other";
    };

    function Oyell_getOs() {
        var os = navigator.userAgent.match(/(Windows|Mac |mac_powerpc|Mac_|Win|PPC|Linux|unix|SunOS|BSD)[^;\(\)\[]{0,20}/gi);
        os = os.toString();
        if (os.search(/Win95/gi) >= 0)
            os = "Windows 95";
        else if (os.search(/Win98/gi) >= 0)
            os = "Windows 98";
        else if (os.search(/Win 9x[\W]*4.90/gi) >= 0)
            os = "Windows Me";
        else if (os.search(/Windows[\W]*(NT)?[\W]*5.0/gi) >= 0)
            os = "Windows 2000";
        else if (os.search(/Windows[\W]*(NT)?[\W]*5.1/gi) >= 0)
            os = "Windows XP";
        else if (os.search(/Windows[\W]*(NT)?[\W]*5.2/gi) >= 0)
            os = "Windows Server 2003";
        else if (os.search(/Windows[\W]*(NT)?[\W]*6.0/gi) >= 0)
            os = "Windows Vista";
        else
            os = "no";
        return os;
    };

    function Oyell_gethost(url) {
        var result = url.match("^[https:\/]*([^\/]*)");
        if (result[1]) {
            var domain = result[1].match("[0-9a-zA-Z]*\.(com\.tw|com\.cn|com\.hk|net\.cn|org\.cn|gov\.cn|ac\.cn|bj\.cn|sh\.cn|tj\.cn|cq\.cn|he\.cn|sx\.cn|nm\.cn|ln\.cn|jl\.cn|hl\.cn|js\.cn|zj\.cn|ah\.cn|fj\.cn|jx\.cn|sd\.cn|ha\.cn|hb\.cn|hn\.cn|gd\.cn|gx\.cn|hi\.cn|sc\.cn|gz\.cn|yn\.cn|xz\.cn|sn\.cn|gs\.cn|qh\.cn|nx\.cn|xj\.cn|tw\.cn|hk\.cn|mo\.cn|com|net|org|biz|info|cn|mobi|name|sh|ac|io|tw|hk|ws|travel|us|tm|cc|tv|ÖÐ¹ú|¹«Ë¾|ÍøÂç)$");
            try { return domain[0] } catch (e) { };
        }
        return false;
    };

    function Oyell_h() {
        try {
           if (self == top) 
                return false;
           else
                return true;
            }
        catch (err) {
        }
        return false;
    };

    function oyell_dc() {
        try {
            var x = top.document.location
            return top.document
        } catch (err) {
            ef = true
        }
        var wd = w
        while (true) {
            var p = wd.parent
            try { var x = p.document.location } catch (err) { return wd.document }
            wd = p

        }
    };

    function Oyell_t() {
        var Oyell_t = "";
        if (Oyell_h()) {
            try {
                Oyell_t = oyell_dc.title;
            } catch (err) {
                Oyell_t = "";
            }
        } else {
            Oyell_t = document.title;
        }
        return Oyell_t;
    };

    function oyell_href() {
        if (!Oyell_h()) return document.location.href;

        if (ef) return oyell_dc.referrer;
        return oyell_dc.location.href; 
    };

    function oyell_referer() 
    {
        var r = "";
        if (Oyell_h()) {
            try {
                r = oyell_dc.referrer;
            } catch (err) {
                r = "";
            }
        } else {
            r = document.referrer;
        }
        if (r == null) r = "";
        return r;
    };

    function Oyell_isCookieEnable() {
        var result = false;
        if (navigator.cookieEnabled)
            return true
        try {
            if (document.cookie.indexOf("oylltestcookie=yes") > -1)
            { document.cookie = "oylltestcookie=" }
            document.cookie = "oyelltestcookie=yes"
            if (document.cookie.indexOf("oylltestcookie=yes") > -1) { result = true }
        } catch (e)
	{ result = false }
        return result
    };

    function Oyell_GetMimeType() {
        if (navigator.mimeTypes) {

            return navigator.mimeTypes.length;

        }
    };

    function init() {
       
        var cookName = "_oyell_51515";
        var ads = [];
       
ads.push('http://js.oyell.cn/action/152/950.htm?arid=51515&aid=152&lid=950&eid=10716&templateurl=2');

ads.push('http://js.oyell.cn/action/152/950.htm?arid=51515&aid=152&lid=950&eid=10716&templateurl=2');

ads.push('http://js.oyell.cn/action/152/950.htm?arid=51515&aid=152&lid=950&eid=10716&templateurl=2');

ads.push('http://js.oyell.cn/action/152/950.htm?arid=51515&aid=152&lid=950&eid=10716&templateurl=2');

ads.push('http://js.oyell.cn/action/152/950.htm?arid=51515&aid=152&lid=950&eid=10716&templateurl=2');

ads.push('http://js.oyell.cn/action/152/950.htm?arid=51515&aid=152&lid=950&eid=10716&templateurl=2');

ads.push('http://js.oyell.cn/action/152/950.htm?arid=51515&aid=152&lid=950&eid=10716&templateurl=2');

ads.push('http://js.oyell.cn/action/152/950.htm?arid=51515&aid=152&lid=950&eid=10716&templateurl=2');

ads.push('http://js.oyell.cn/action/152/950.htm?arid=51515&aid=152&lid=950&eid=10716&templateurl=2');


        var cookItemName = "_loop";
        var cookPlayIndex = readCookie(cookName, cookItemName);

        if (isNaN(parseInt(cookPlayIndex)))
            cookPlayIndex = Math.floor(Math.random() * ads.length)
        cookPlayIndex++;

        if (cookPlayIndex + 1 > ads.length)
            cookPlayIndex = 0;
        writeCookie(cookName, cookItemName, cookPlayIndex);
        var url = ads[cookPlayIndex];
        var ar = Oyell_get(url, "arid");
        var a = Oyell_get(url, "aid");
        var l = Oyell_get(url, "lid");
        var e = Oyell_get(url, "eid");

        Oyell_load(a, e, l, ar); ;
        var oyell_date = new Date();
        var oyell_datestr = oyell_date.getTime();
        url = url + "&t=" + oyell_datestr

        document.write('<ifr' + 'ame' +
                     ' width=' + Oyell_quoted(arw) +
                     ' height=' + Oyell_quoted(arh) +
					 ' id=' + Oyell_quoted(oyell_iframe_id) +
					 ' name=' + Oyell_quoted(oyell_iframe_id) +
					 ' src=' + Oyell_quoted(url) +
                     ' frameborder=0' +
                     ' marginwidth="0"' +
                     ' marginheight="0"' +
                     ' vspace="0"' +
                     ' hspace="0"' +
                     ' style="background-color=transparent"' +
                     ' filter="progid:DXImageTransform.Microsoft.Alpha(style=0,opacity=0)"' +
                     ' allowtransparency="true"' +
                     ' scrolling="no">');
        document.write('</ifr' + 'ame>');

    };
    init();

    function readCookie(name, item) {
        var cook = document.cookie;
        var reg;
        if (item)
            reg = new RegExp("(^|; )" + escape(name) + "=" + "[^; ]*" + escape(item) + "=([^&; ]*)(&|; |$)");
        else
            reg = new RegExp("(^|; )" + escape(name) + "=" + "([^; ]*)" + "([^; ]*)(; |$)");
        var res = cook.match(reg);
        return res ? unescape(res[2]) : null;
    }

    function writeCookie(name, item, value, expires, path, domain, secure) {
        var cook = document.cookie;
        var reg;
        name = escape(name);
        item = escape(item);
        value = escape(value);
        /*today.setTime( today.getTime() );
        if ( expires )
        {
        expires = expires*1000;
        }
        var expires_date = new Date( today.getTime() + (expires) );*/
        var cookExist;
        var cookNew;
        if (!path) path = "/";

        reg = new RegExp("(^|; )" + name + "=([^; ]*)(|; |$)");
        cookExist = cook.match(reg);

        if (cookExist) {
            cookExist = cookExist[2];
            reg = new RegExp("(^|&)" + item + "=([^&]*)(&|$)");
            if (cookExist.search(reg) >= 0) {
                cookNew = cookExist.replace(cookExist.match(reg)[0].replace(/&/g, ""), item + "=" + value);
            }
            else {
                cookNew = cookExist + "&" + item + "=" + value;
            }
        }
        else {
            cookNew = item + "=" + value;
        }
        document.cookie = (name + "=" + cookNew) +
		((expires) ? ";expires=" + expires.toGMTString() : "") + //expires_date.toGMTString()
		((path) ? ";path=" + path : "") +
		((domain) ? ";domain=" + domain : "") +
		((secure) ? ";secure" : "");
    }
})()
