//AD
var bitAdFrame = {
    $: function (id) { return document.getElementById(id) }
	, tagArr: function (o, name) { return o.getElementsByTagName(name) }
	, nameArr: function (name) { return document.getElementsByName(name) }
	, att: function (o, name, fun) { return document.all ? o.attachEvent(name, fun) : o.addEventListener(name.substr(2), fun, false); }
	, style: function (o) { return o.currentStyle || document.defaultView.getComputedStyle(o, null); }
	, scroll: function (type) { return document.documentElement[type] || document.body[type] }
	, client: function (type) { return document.documentElement[type] || document.body[type] }
	, buildTag: function (id, tagName, arr, object) {
	    var obj = document.createElement(tagName);
	    if (id) { obj.id = id; }
	    if (arr) {
	        for (i = 0; i < arr.length; i++) {
	            obj.style[arr[i][0]] = arr[i][1];
	        }
	    }
	    object.appendChild(obj);
	}
	, buildHtml: function (con, close, clickurl, counturl) {
	    var str = '';
	    var col = close ? ('<div style="font-size:12px;cursor:pointer;" onclick="this.parentNode.style.display=\'none\'">¹Ø±Õ</div>') : '';
	    if (con.type == 'image') {
	        str = '<a href="' + con.link + '" target="_blank"><img src="' + con.url + '" style="border:none; width:' + con.width + 'px;height:' + con.height + 'px"/></a>';
	    } else {
	        str += '<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,19,0" width="' + con.width + '" height="' + con.height + '">';
	        str += '  <param name="movie" value="' + con.url + '" />';
	        str += '  <param name="quality" value="high" />';
	        str += ' <param value="transparent" name="wmode"/>';
	        str += '  <embed src="' + con.url + '" quality="high"  wmode="transparent" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" width="' + con.width + '" height="' + con.height + '"></embed>';
	        str += '</object>';
	    }
	    if (clickurl && clickurl != '') {
	        str += '<div style="margin: -' + con.height + 'px 0px 0px; cursor: pointer; background-image: url(http://gimg.bitauto.com/resourcefiles/bg.gif); position: relative; width: ' + con.width + 'px; height: ' + con.height + 'px; z-index: 10; left: 0px;" onclick="RedirectOnClick(\'' + clickurl + '\',\'' + counturl + '\',true,true);"></div>';
	    }
	    str += col;
	    return str;
	}
	, roll: function (id, top) {
	    var obj = bitAdFrame.$(id);
	    var space = top + bitAdFrame.scroll('scrollTop'), objTop = parseInt(bitAdFrame.style(obj).top), pro = this, a;
	    if (objTop < space) {
	        a = (space - objTop) * 0.01;
	        obj.style.top = objTop + a * 20 + 'px';
	    } else if (objTop > space) {
	        a = (objTop - space) * 0.01;
	        obj.style.top = objTop - a * 20 + 'px';
	    }
	    setTimeout(function () { pro.roll(id, top) }, 10);
	}
};
