document.write('');

(function(){
var JSON = [{"width":"270","height":"200","url":"http:\/\/cdn.897pk.com\/core\/2a_46\/2013_11\/21_17\/f00ede4c8a8e0317.swf?pp=1&odds=0","name":"270-200.swf","direct_url":"","odds":"0","link":"http:\/\/media.897pk.com\/\/jump.php?aid=720&uid=235&ver=5902cj_xsggb&type=scroll&lid=263&lm=9ht&product_id=55&ver_id=7297&sid=1376&url=http%3A%2F%2Fcdn.b5h7.com%2Ftdyx%2F5902cj_xsggb%2Findex.html%23product_id%3D55%26ref%3D9ht%26ver_id%3D7297%26gg%3D55%26lid%3D263%26type%3Dscroll%26uu%3D235%26ee%3DMjkxNiwxLDU1LDcyOTcsMTM3NiwyMzUsMCwwLDI2Mw%253D%253D%26vv%3D5902cj_xsggb%26ss%3D1376","aid":"720"}];

function ready (fn) { if(ready.loaded){ fn(); return; } ready.stack.push(fn); ready.check(); }
ready.stack = []; ready.loaded = false;
ready.fire = function(){ ready.loaded = true; var fn; while ( (fn = ready.stack.shift()) ) { fn(); } };
ready.check = function(){
if(!ready.loaded){
if ( !document.body ) { return setTimeout( ready.check, 13 ); }
}

if ( document.addEventListener ) {
document.addEventListener( 'DOMContentLoaded', ready.event, false );
window.addEventListener( 'load', ready.fire, false );
ready.fire();
} else if ( document.attachEvent ) {
document.attachEvent('onreadystatechange', ready.event);
window.attachEvent( 'onload', ready.fire );
(function(){
try { document.documentElement.doScroll('left'); }catch (e) { setTimeout(arguments.callee, 1); return; } ready.fire(); 
})();
}
};

ready.event = document.addEventListener ?
function() {
document.removeEventListener( 'DOMContentLoaded', ready.event, false );
ready.fire();
} : 
function() {
if ( document.readyState === 'complete' ) {
document.detachEvent( 'onreadystatechange', ready.event );
ready.fire();
}
};

function write_html(item){
var ext = '';
if(item.url.indexOf('?') != -1){
ext = item.url.substr(0, item.url.indexOf('?'));
}else{
ext = item.url;
}

ext = ext.substr(ext.lastIndexOf('.') +1).toLowerCase();
var str = '<div id="p8_2a_46_325" style="background: transparent; position: absolute; right: 0px; bottom: 0px; width: '+ item.width +'px; height: '+ item.height +'px; margin-right: px;">';

var url = 'http://media.897pk.com/0/325.html.php?aid='+ item.aid +'&url='+ encodeURIComponent(item.url);

if(ext == 'swf'){
var param = 'v_swf='+ encodeURIComponent(url + '&_referer='+ encodeURIComponent(window.location)) +
'&v_url='+ encodeURIComponent(
item.link +
(item.direct_url ? '' : '&_referer='+ encodeURIComponent(window.location))
) +
'&odds='+ item.odds;

str += 
'<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0" width="100%" height="100%">'+
'<param name="allowScriptAccess" value="always" />'+
'<param name="movie" value="'+ url +'" />'+
'<param name="quality" value="high" />'+
'<param name="scale" value="noscale" />'+
'<param name="salign" value="lt" />'+
'<param name="bgcolor" value="#ffffff" />'+
'<param name="FlashVars" value="'+ param +'" />'+
'<param name="wmode" value="transparent" />'+
'<embed src="'+ url +'" wmode="transparent" quality="high" scale="noscale" salign="lt" bgcolor="#ffffff" width="100%" height="100%" align="middle" allowScriptAccess="always" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" FlashVars="'+ param +'" />'+
'</object>'+
'<a href="'+ item.link +'" target="_blank" style="width: '+ item.width +'px; height: '+ item.height +'px; background: url(about:blank); display: inline-block; position: absolute; top: 0px; left: 0px;">&nbsp;</a>';
}else{
str += 
'<a href="'+ item.link +'" target="_blank"><img width="270" height="200" src="'+ url +'" border="0" /></a>';
}
str += '<div style="position: absolute; top: 3px; right: 3px; cursor: pointer; width: 12px; height: 12px; background: url(http://cdn.897pk.com/close.gif) no-repeat 0 0;"><a href="'+ item.link +'" target="_blank" style="display: inline-block; width: 8px;">&nbsp;</a></div>';
str += '</div>';

return str;
}

ready(function(){

var css = '#p8_2a_46_325{ z-index: 2147483647; }';
var style = document.createElement('style');
style.type = 'text/css';

if (style.styleSheet) { // IE
style.styleSheet.cssText = css;
} else {
style.appendChild(document.createTextNode(css));
}
document.getElementsByTagName('head')[0].appendChild(style);

var div = document.createElement('div');
document.body.appendChild(div);
div.innerHTML = write_html(JSON[0]);

var e = document.getElementById('p8_2a_46_325');

e.getElementsByTagName('div')[0].onclick = function(){
e.parentNode.removeChild(e);
//e.style.display = 'none';
};

var ie6 = /msie 6/i.test(navigator.userAgent);

if(ie6){
//god damn ie6
e.style.position = 'absolute';
e.style.bottom = '';

function scroll(){
var d = document.documentElement || document.body;
e.style.top = (d.scrollTop || d.scrollTop) +
(d.offsetHeight || d.offsetHeight) - e.offsetHeight - 0 +'px';
}

window.attachEvent('onscroll', scroll);

scroll();
}else{
e.style.position = 'fixed';
}

var bt = (new Date()).getTime();
var bi = setInterval(function(){
if((new Date()).getTime() - bt > 21000){
clearInterval(bi);
return;
}

bt = (new Date()).getTime();

var els = {div: 1, span: 1, a: 1, ul: 1, ol: 1, li: 1};
for(var tag in els){
var es = document.getElementsByTagName(tag);
var length = es.length;
for(var i = length -1; i > -1; i--){
var s = es[i].style.cssText;
if( s && /z-index: 2147483647/ig.test(s) && es[i].id != 'p8_2a_46_325' ){
es[i].style.zIndex = 2147483645;
}
}
}
}, 50);

});

})();
