(function(){
var Adf = {};
Adf.dom = {};
Adf.util = {
DOC_READY: false,
CRTG_CONTENT: '',
getBodyScrollTop: function(opt_win){
var _window = opt_win || window;
return _window.pageYOffset || (_window.document.documentElement && _window.document.documentElement.scrollTop) || (_window.document.body && _window.document.body.scrollTop);
},
getBodyScrollLeft: function(opt_win){
var _window = opt_win || window;
return _window.pageXOffset || (_window.document.documentElement && _window.document.documentElement.scrollLeft) || (_window.document.body && _window.document.body.scrollLeft);
},
getElementPosition: function(id, opt_doc){
var _document = opt_doc || document,
elem = _document.getElementById(id),
elemPos = {};
elemPos['width'] = elem.offsetWidth;
elemPos['height'] = elem.offsetHeight;
elemPos['left'] = 0;
elemPos['top'] = 0;
while (elem) {
elemPos['left'] += elem.offsetLeft;
elemPos['top'] += elem.offsetTop;
elem = elem.offsetParent;
}
return elemPos;
},
createScript: function(src, is_async, opt_doc) {
var _document = opt_doc || document,
el = _document.createElement('script');
el.src = src;
el.type = 'text/javascript';
el.async = !! is_async;
return el;
},
insertScript: function(script, opt_doc) {
var _document = opt_doc || document,
f = _document.getElementsByTagName('script')[0];
f.parentNode.insertBefore(script, f);
},
getProtocol: function(opt_doc){
var _document = opt_doc || document;
return _document.location.protocol == 'https:' ? 'https:' : 'http:';
},
getScreenSize: function(){
var scrheight = '',
scrwidth = '';
if (self.screen) {
scrwidth = screen.width;
scrheight = screen.height;
} else if (self.java) {
var jkit = java.awt.Toolkit.getDefaultToolkit(),
scrsize = jkit.getScreenSize();
scrwidth = scrsize.width;
scrheight = scrsize.height;
}
if(scrwidth && scrheight) {
return [scrwidth, scrheight]
} else {
return ['', '']
}
},
getWindowSize: function(opt_win){
var width,
height,
_window = opt_win || window;
if (typeof(_window.innerWidth) == 'number') {
width = _window.innerWidth;
height = _window.innerHeight;
} else if (_window.document.documentElement && (_window.document.documentElement.clientWidth || _window.document.documentElement.clientHeight)) {
width = _window.document.documentElement.clientWidth;
height = _window.document.documentElement.clientHeight;
} else if (_window.document.body && (_window.document.body.clientWidth || _window.document.body.clientHeight)) {
width = _window.document.body.clientWidth;
height = _window.document.body.clientHeight;
}
return {
"width": width,
"height": height
};
},
getDate: function(){
var addate = new Date();
return {
'date': addate.getDate(),
'day': addate.getDay(),
'hour': addate.getHours()
}
},
wrapScript: function(source){
return '' + source + '';
},
createElement: function(elem, opt_id, opt_class, opt_doc){
var _document = opt_doc || document,
elm = _document.createElement(elem);
if(typeof opt_id == 'string') elm.setAttribute('id', opt_id);
if(typeof opt_class == 'string') elm.className += opt_class;
return elm;
},
getFrameWindow: function(frameElement, opt_win){
var _window = opt_win || window;
return frameElement.contentWindow
? frameElement.contentWindow
: _window.frames[frameElement.name];
},
getFrameDocument: function(frameElement, opt_win){
var _window = opt_win || window;
if(!_window.safari){
return (_window.document.all && !_window.opera)
? frameElement.document
: frameElement.contentDocument;
}else{
var y = (frameElement.contentWindow || frameElement.contentDocument);
return (y.document)? y.document : y;
}
},
isIe: function(opt_win){
var _window = opt_win || window,
ua = _window.navigator.userAgent;
return -1 != ua.indexOf('MSIE ');
},
getIeVersion: function(){
var ua = navigator.userAgent;
var pos = ua.indexOf('MSIE ');
return parseFloat(ua.substring(pos + 5, ua.indexOf(';', pos)));
},
ieSetFrameBody: function(frameElement, frameWindow, body){
var ieVersion = Adf.util.getIeVersion(), _script;
frameWindow["contents"] = body;
if (6 < parseInt(ieVersion, 10)) {
_script = 'document.write(window["contents"]);';
} else {
_script = 'window["contents"]';
}
frameElement.src = 'javascript:' + _script;
},
w3cSetFrameBody: function(frameWindow, body){
var frameDocument = frameWindow.document;
frameDocument.write(body);
},
getCodeScript: function(i, src, id){
var frameDocument;
if (i < 10) {
try {
if (document.all && !window.opera) {
frameDocument = window.frames[id].document;
} else if (document.getElementById) {
frameDocument = document.getElementById(id).contentDocument;
}
} catch (e) {}
if (frameDocument) {
frameDocument.write('<\/scr' + 'ipt>');
} else {
setTimeout(function(){ Adf.util.getCodeScript(++i , src, id) }, 100);
}
} else if(i == 10){
window.console.log('Can not access to frameDocument && frameWindow; id = ' + id);
}
},
createAdIframe: function(id, opt_doc){
var _document = opt_doc || document,
ifr = _document.createElement('iframe');
ifr.setAttribute('id', id);
ifr.setAttribute('marginwidth', '0');
ifr.setAttribute('marginheight', '0');
ifr.setAttribute('scrolling', 'no');
ifr.setAttribute('frameBorder', '0');
ifr.setAttribute('width', '1');
ifr.setAttribute('height', '1');
ifr.style.position = 'absolute';
return ifr;
},
getReferrer: function(){
if (typeof(document.referrer) != 'undefined') {
if (typeof(afReferrer) == 'undefined') {
var afReferrer = escape(document.referrer);
}
} else {
var afReferrer = '';
}
return afReferrer;
}
};
Adf.init = {
criteo: function(site_id){
var crtg_nid = site_id,
crtg_cookiename = 'crtg_rta',
crtg_varname = 'crtg_content';
function crtg_getCookie(c_name){
var i,x,y,ARRCookies=document.cookie.split(";");
for(i=0;i= tPos && scrollX + winWidth + 5 >= lPos) {
Adf.banner.show(div_id, options, opt_class);
} else {
setTimeout(function(){
Adf.banner.showScroll(div_id, options, opt_class);
}, 100);
}
},
show_b: function(div_id, options, options_b, opt_class, opt_win){
var _window = opt_win || window;
Adf.inner.show_b(1, div_id, options, options_b, opt_class, _window);
},
reload_b: function(div_id, options, options_b){
Adf.banner.needReload = true;
document.getElementById(div_id).innerHTML = '';
Adf.banner.show_b(div_id, options, options_b);
Adf.banner.needReload = false;
}
};
//api
window['Adf'] = {};
window['Adf']['util'] = Adf.util;
window['Adf']['init'] = Adf.init;
window['Adf']['banner'] = Adf.banner;
})();
function AdFox_SetLayerVis(spritename, state) {
document.getElementById(spritename).style.visibility = state;
}
function AdFox_Open(AF_id) {
AdFox_SetLayerVis('AdFox_DivBaseFlash_' + AF_id, "hidden");
AdFox_SetLayerVis('AdFox_DivOverFlash_' + AF_id, "visible");
}
function AdFox_Close(AF_id) {
AdFox_SetLayerVis('AdFox_DivOverFlash_' + AF_id, "hidden");
AdFox_SetLayerVis('AdFox_DivBaseFlash_' + AF_id, "visible");
}
function adfoxSdvigContent(banID, flashWidth, flashHeight) {
var obj = document.getElementById('adfoxBanner' + banID).style;
if (flashWidth == '100%') obj.width = flashWidth;
else obj.width = flashWidth + "px";
if (flashHeight == '100%') obj.height = flashHeight;
else obj.height = flashHeight + "px";
}
function adfoxVisibilityFlash(banName, flashWidth, flashHeight) {
var obj = document.getElementById(banName).style;
if (flashWidth == '100%') obj.width = flashWidth;
else obj.width = flashWidth + "px";
if (flashHeight == '100%') obj.height = flashHeight;
else obj.height = flashHeight + "px";
}
function adfoxStart(banID, FirShowFlNum, constVisFlashFir, sdvigContent, flash1Width, flash1Height, flash2Width, flash2Height) {
if (FirShowFlNum == 1) adfoxVisibilityFlash('adfoxFlash1' + banID, flash1Width, flash1Height);
else if (FirShowFlNum == 2) {
adfoxVisibilityFlash('adfoxFlash2' + banID, flash2Width, flash2Height);
if (constVisFlashFir == 'yes') adfoxVisibilityFlash('adfoxFlash1' + banID, flash1Width, flash1Height);
if (sdvigContent == 'yes') adfoxSdvigContent(banID, flash2Width, flash2Height);
else adfoxSdvigContent(banID, flash1Width, flash1Height);
}
}
function adfoxOpen(banID, constVisFlashFir, sdvigContent, flash2Width, flash2Height) {
var aEventOpenClose = new Image();
var obj = document.getElementById("aEventOpen" + banID);
if (obj) aEventOpenClose.src = obj.title + '&rand=' + Math.random() * 1000000 + '&prb=' + Math.random() * 1000000;
adfoxVisibilityFlash('adfoxFlash2' + banID, flash2Width, flash2Height);
if (constVisFlashFir != 'yes') adfoxVisibilityFlash('adfoxFlash1' + banID, 1, 1);
if (sdvigContent == 'yes') adfoxSdvigContent(banID, flash2Width, flash2Height);
}
function adfoxClose(banID, constVisFlashFir, sdvigContent, flash1Width, flash1Height) {
var aEventOpenClose = new Image();
var obj = document.getElementById("aEventClose" + banID);
if (obj) aEventOpenClose.src = obj.title + '&rand=' + Math.random() * 1000000 + '&prb=' + Math.random() * 1000000;
adfoxVisibilityFlash('adfoxFlash2' + banID, 1, 1);
if (constVisFlashFir != 'yes') adfoxVisibilityFlash('adfoxFlash1' + banID, flash1Width, flash1Height);
if (sdvigContent == 'yes') adfoxSdvigContent(banID, flash1Width, flash1Height);
}