/*
	Epipub V0.42 
		by 3on
*/
var o = new Object();
o.EpiPubs = new Array();
o.l = 0;
o.osefl = 0;
//setTimeout('iframesCheck();',900);

function epipub(kind,size,id){
var width,height,type;
switch(size)
{
	case 'large':{this.width='468';this.height='60';type='1';break;};
	case 'haute':{this.width='120';this.height='300';type='2';break;};
	case 'carrée':{this.width='180';this.height='150';type='3';break;};
	default:{this.width='468';this.height='60';type='1'};
}
switch(kind)
{
	case 'valid_osef':{epiOsef(this.width,this.height,id,type);break;};
	case 'ie_unfriendly':{epiCare(this.width,this.height,id,type);break;};
	default:epiOsef(this.width,this.height,id,type);
}
}
function epiOsef(width,height,id,type){	
	var iO = o.osefl;
	o.osefl++;
	var src = "http://epipub.info/valid_osef.php?g="+id+"&f="+type;
	document.write(unescape('%3Ciframe id="iEpiPub'+iO+'"" name="iEpiPub'+iO+'"" width="'+width+'" height="'+height+'" scrolling="no" frameborder="0" src="'+src+'" %3Eepipub%3C/iframe%3E'));
}
function epiCare(width,height,id,type){
   var format = type;
   var iC = o.l;
    o.l = o.l + 1;
    document.write('<div id="EpiPub'+iC+'" style="display:inline"></div>');
    var url = "http://epipub.info/valid_care.php?g="+id+"&f="+format+"&i="+iC;
    var script = document.createElement('script');
    script.src = url;
    //alert(url) OK ca marche
    script.type = "text/javascript";
    document.getElementById('EpiPub'+iC).appendChild(script);
    //setTimeout("if(!o.EpiPubs["+i+"]){alert('No JS retrived')}",1000);
}
function reFresh(id)
{
    var e = document.getElementById('EpiPub'+id);
    e.innerHTML = o.EpiPubs[id];
}
function iframesCheck(){
    for(var i = 0;i < o.osefl;i++)
    {
       	var e = document.getElementById('iEpiPub'+i); // javascript:alert(document.getElementById('EpiPub1').document.fileSize)
       	//alert(e.document.bgColor)
       	if( e && e.tagName == 'IFRAME' &&  
       		( /* tt sauf ie */ !e.hasOwnProperty('document') || 
      		/* ie */   e.document.bgColor == '#ffffff' )) 
       		/*
       			typeof(eval(e.document))== 'undefined', frames['EpiPub'+i].document.links.length == '0' // safari + ff 

       			!e.document || !eval(e.document) || typeof(e.document.title) == 'undefined' ||
       			e.document.bgColor != '#000000' // ie 
       		*/
       	{
	    e.src=" ";	
       	}
       	else
       	{
	    //alert('euh: '+e.document.valueOf());
       	}
     }
}