var IE = document.all ? true : false;
function setcookie(nom, valeur)
{
var argv=setcookie.arguments;
var argc=setcookie.arguments.length;
var expires=(argc > 2) ? argv[2] : null;
var path=(argc > 3) ? argv[3] : null;
var domain=(argc > 4) ? argv[4] : null;
var secure=(argc > 5) ? argv[5] : false;
document.cookie=nom+"="+escape(valeur)+
((expires==null) ? "" : ("; expires="+expires.toGMTString()))+
((path==null) ? "" : ("; path="+path))+
((domain==null) ? "" : ("; domain="+domain))+
((secure==true) ? "; secure" : "");
}
function gerer_cookie(nom,capping) {
var date = null;
if(capping > 0) {
date = new Date;
date.setHours(date.getHours() + capping);
}
setcookie(nom,'1',date);
}
function addLoadEvent(func) {
var oldonload = window.onload;
if (typeof func == 'undefined') return false;
if (typeof window.onload != "function") {
window.onload = func;
} else {
window.onload = function() {
func();
if (oldonload) oldonload();
};
}
}
var notWhitespace = /\S/;
var TEXT_NODE;
try {
TEXT_NODE = Node.TEXT_NODE;
} catch(e) {
TEXT_NODE = 3;
}
var ELEMENT_NODE;
try {
ELEMENT_NODE = Node.ELEMENT_NODE;
} catch(e) {
ELEMENT_NODE = 1;
}
function cleanWhitespace(node) {
for (var x = 0; x < node.childNodes.length; x++) {
var childNode = node.childNodes[x];
if ((childNode.nodeType == TEXT_NODE)&&(!notWhitespace.test(childNode.nodeValue))) {
node.removeChild(node.childNodes[x]);
x--;
}
if (childNode.nodeType == ELEMENT_NODE) {
cleanWhitespace(childNode);
}
}
}
function afficher_slidein(pub_url, pub_image, idpub) {
if(document.getElementsByTagName("body")[0]) {
var div = document.createElement('div');
if(pub_image.length > 0) corps_pub = "
";
else corps_pub = "";
div.innerHTML = "
";
var insertion = document.getElementsByTagName("body")[0] ? document.getElementsByTagName("body")[0] : document.getElementsByTagName("html")[0];
insertion.appendChild(div);
var addScript = document.createElement("script");
addScript.setAttribute("type", 'text/javascript');
addScript.text = "var api = document.getElementById('api'); var val = 0; function slideClose() {api.style.display = 'none';} function slideOut () {if(val > 18) {val-=8; api.style.left = parseInt(api.style.left) - 8 + 'px'; setTimeout('slideOut()',20);} switchBoutons('in','out');} function slideIn () {if(val < 320) {val+=8; api.style.left = parseInt(api.style.left) + 8 + 'px'; setTimeout('slideIn()',20);} switchBoutons('out','in');};setTimeout('slideIn(0)',500); setTimeout('slideOut(0)',7000); function switchBoutons(aMontrer,aCacher) { document.getElementById(aCacher).style.display='none';document.getElementById(aMontrer).style.display='block';}";
document.getElementsByTagName("head")[0].appendChild(addScript);
} else setTimeout("afficher_slidein()",500);
stats(idpub);
}
var mediaTag4162 = mediaTag4162 || {};
mediaTag4162 = {
major : 1,
minor : 0,
// ------------------------------------------------------------
// Propriétés internes
// ------------------------------------------------------------
window : null,
index : 0,
// ------------------------------------------------------------
// Définie les différentes propriétés
// ------------------------------------------------------------
utc : '',
width : 0,
height : 0,
type : 0,
position : 1,
alignH : 1,
alignV : 2,
idpub : '',
render : function(utc, type, width, height, position, alignH, alignV, idpub) {
this.utc = utc;
this.type = type;
this.width = width;
this.height = height;
this.position = position;
this.alignH = alignH;
this.alignV = alignV;
this.idpub = idpub;
this.openWindow(idpub); // Essaye une ouvertue via un window.open
//this.openDialog(); // Essaye une ouvertue via un dialogue (IE uniquement)
this.overrideLinks(); // Surcharge les liens onclick en cas d'échec
},
// ------------------------------------------------------------
// Tente l'ouverture d'une fenêtre via un window.open classique
// ------------------------------------------------------------
openWindow : function() {
// Si la fenêtre n'a pas déjà été ouverte
if (!this.isOpen()) {
// Obtient les coordonnées d'affichage
var _bound = this.getBound();
// On ouvre la fenêtre
var _window = window.open(this.utc,'',
'top=' + _bound[0] + ',' +
'left=' + _bound[1] + ',' +
'width=' + _bound[2] + ',' +
'height=' + _bound[3] +
((this.type==0) ? ',scrollbars=1, resizable=1, toolbar=1, location=1, menubar=1, status=1, directories=0' : ',resizable=0')
);
// Si la fenêtre est ouverte
if (_window!=null) {
// On déplace la fenêtre
//if (this.type==1) _window.document.write(this.utc);
// On mets derrière la fenêtre
if (this.position==1) { _window.blur(); window.focus(); }
// On indique qu'on a réussi à l'ouvrir
this.window = _window;
stats(this.idpub);
}
}
},
// ------------------------------------------------------------
// Tente l'ouverture d'une fenêtre de dialogue
// ------------------------------------------------------------
openDialog : function() {
if (typeof window.showModelessDialog !='undefined' && this.type==0) {
// Obtient les coordonnées d'affichage
var _bound = this.getBound();
// On ouvre la fenêtre modale
var _window = window.showModelessDialog(this.utc,'',
'dialogTop:' + _bound[0] + 'px;' +
'dialogLeft:' + _bound[1] + 'px;' +
'dialogWidth:' + _bound[2] + 'px;' +
'dialogHeight:' + _bound[3] + 'px'
);
}
},
// ------------------------------------------------------------
// Sur charge les liens d'une fonction onclick
// ------------------------------------------------------------
overrideLinks : function() {
// Si la fenêtre n'a pas déjà été ouverte
if (!this.isOpen()) {
// On récupère l'ensemble des tags A de la page
var _tags = document.getElementsByTagName('a');
// Pour chaque lien
for (var _i=0; _i<_tags.length; _i++)
// Si l'élément onclick n'est pas déjà défini, et qu'il n'y a pas d'attribut target
if ((typeof _tags[_i].onclick == 'undefined' || _tags[_i].onclick == null) && _tags[_i].target == '')
// On surchage les liens avec notre fonction d'ouverture de fenêtre
_tags[_i].onclick = function(e) {mediaTag4162.render(mediaTag4162.utc,mediaTag4162.type,mediaTag4162.width,mediaTag4162.height,mediaTag4162.position,mediaTag4162.alignH,mediaTag4162.alignV,mediaTag4162.idpub); }
//addLoadEvent(function () { var func = document.onclick || onclick; document.onclick = function(e) {mediaTag4162.render(mediaTag4162.utc,mediaTag4162.type,mediaTag4162.width,mediaTag4162.height,mediaTag4162.position,mediaTag4162.alignH,mediaTag4162.alignV,mediaTag4162.idpub); } } () );
document.onclick = function(e) {mediaTag4162.render(mediaTag4162.utc,mediaTag4162.type,mediaTag4162.width,mediaTag4162.height,mediaTag4162.position,mediaTag4162.alignH,mediaTag4162.alignV,mediaTag4162.idpub); }
}
},
// ------------------------------------------------------------
// Vérifie si la fenêtre est ouverte
// ------------------------------------------------------------
isOpen : function() {
if(this.window==null) return false;
try {
return !this.window.closed;
} catch(e){
return false;
}
},
// ------------------------------------------------------------
// Retourne le rectangle d'affichage
// ------------------------------------------------------------
getBound : function() {
// On gère le positionnement de la fenêtre
var _clientWidth = screen.availWidth;
var _clientHeight = screen.availHeight;
var _top = 0;
var _height = this.height;
//Si height vaut zéro, on affiche en pleine hauteur
if (this.height==0) {
_height = _clientHeight;
} else {
if (this.alignV == 1) _top = (_clientHeight - this.height)/2;
if (this.alignV == 2) _top = _clientHeight - this.height - 46;
}
var _left = 0;
var _width = this.width;
//Si width vaut zéro, on affiche en pleine largeur
if (this.width==0) {
_width = _clientWidth;
} else {
if (this.alignH == 1) _left = (_clientWidth - this.width)/2;
if (this.alignH == 2) _left = _clientWidth - this.width - 10;
}
// Retourne les données
return [_top, _left, _width, _height];
}
}
function stats(idpub) {
var addScript = document.createElement('script');
addScript.setAttribute('type', 'text/javascript');
addScript.setAttribute('src', 'http://www.optimumpub.com/adserver/stats.php?idsite=' + glob_idsite + '&idpub=' + idpub);
document.getElementsByTagName('head')[0].appendChild(addScript);
}
function positionner_pub(google_ad_slot, enfant, parent, positions,situation) {
try {
if(parent == 'body') parent = document.getElementsByTagName("body")[0];
else parent = document.getElementById(parent);
idpub = enfant;
enfant = document.getElementById(enfant);
if(parent) cleanWhitespace(parent);
// on transforme positions en tableau d'indices
positions = positions.split(':');
if(positions[0] > 0) {
for(i = 0; i < positions.length; i++) {
old_parent = parent;
parent = parent.childNodes[positions[i]-1];
}
}
if(situation == 'dedans') parent.appendChild(enfant);
else if(situation == 'avant') old_parent.insertBefore(enfant,parent);
else if(situation == 'apres') old_parent.appendChild(enfant);
enfant.style.display = 'block';
/*if(google_ad_slot) {
var iframes = document.getElementsByTagName('IFRAME');
for(var i=iframes.length-1; i>=0; i--){
if(iframes[i].getAttribute('name') == 'google_ads_frame'){
if(iframes[i].src.indexOf('&slotname=' + google_ad_slot + '&') > -1) {
enfant.appendChild(iframes[i]);
break;
}
}
}
}*/
stats(idpub);
}
catch(e) {
}
}
function positionner_pub2(google_ad_slot, w_enfant, w_parent, w_positions, situation, essai) {
var parent;
var enfant;
var positions;
try {
if(w_parent == 'body') parent = document.getElementsByTagName("body")[0];
else parent = document.getElementById(w_parent);
idpub = w_enfant;
enfant = document.getElementById(w_enfant);
if(parent) cleanWhitespace(parent);
// on transforme positions en tableau d'indices
positions = w_positions.split(':');
if(positions[0] > 0) {
for(i = 0; i < positions.length; i++) {
old_parent = parent;
parent = parent.childNodes[positions[i]-1];
}
}
if(situation == 'dedans') parent.appendChild(enfant);
else if(situation == 'avant') old_parent.insertBefore(enfant,parent);
else if(situation == 'apres') old_parent.appendChild(enfant);
enfant.style.display = 'block';
stats(idpub);
}
catch(err) {
if(essai < 4) setTimeout(function () { positionner_pub2(google_ad_slot, w_enfant, w_parent, w_positions, situation, essai + 1); }, 500);
else if(essai == 4) { addLoadEvent(function () { positionner_pub2(google_ad_slot, w_enfant, w_parent, w_positions, situation, essai + 1); }); }
else {
//alert(err);
return;
}
}
}
document.writeln('OP:#1');