var largeur  = new Array ;
var hauteur = new Array ;

largeur[1] = 120 ;
largeur[2] = 468 ;
largeur[3] = 750 ;

hauteur[1] = 170 ;
hauteur[2] = 60 ;
hauteur[3] =  40 ;

ndd 		= "cqui-cquoi.com" ;
ndd_texte_lien	= "annuaire" ;

page_vue 	= "n" ;		//*** o si le visiteur a déjà vu la page dans le délai


try { if (couleur_fond == "") { throw "Err_couleur_fond" 	; } }
catch(err) { if (err.message.lastIndexOf("couleur_fond") > -1) { couleur_fond 	= "C0FFFF" ; } }

try { if (couleur_liens == "") { throw "Err_couleur_liens" 	; } }
catch(err) { if (err.message.lastIndexOf("couleur_liens") > -1) { couleur_liens = "0000FF" ; } }

try {if (taille == "") { throw "Err_taille" ; } }
catch(err) { if (err.message.lastIndexOf("taille") > -1) { taille = 1 ; } }

if ( (taille < 1) || (taille > 3) ) { taille = 2 ; }



nb_minutes = 60 ;
seconde_par_minutes = 60 ;
duree = seconde_par_minutes * nb_minutes ;	// en secondes
nb_ms = (1000 * duree) ;    			// en ms

var aujourdhui = new Date() ;

var expiration_j_ms = aujourdhui.getTime() + nb_ms ;
expiration_j = new Date(expiration_j_ms) ;

expiration_j = expiration_j.toGMTString(); 
aCookie = document.cookie.split("; ") ;

URL = document.URLUnencoded ;

URL_host 	= window.location.host ;		//*** NDD
URL_hostname 	= window.location.hostname ;	//*** NDD + N° de port
URL_href 		= window.location.href ;		//*** URL complète
URL_protocol	= window.location.protocol ;		//*** http: ou file:


for (i=0; i<aCookie.length; i++)
{
	aCrumb = aCookie[i].split("=") ;
	if ("affichage_local" == aCrumb[0])
		affichage_local = unescape(aCrumb[1]) ;
}

for (i=0; i<aCookie.length; i++)
{
	aCrumb = aCookie[i].split("=") ;
	if ("page_vue" == aCrumb[0])
		page_vue = unescape(aCrumb[1]) ;
}

document.cookie = "host_distant=" + URL_host + ";  expires=" + expiration_j + ";path=/"   ;
document.cookie = "page_vue=o;  expires=" + expiration_j + ";path=/"   ;

if (URL.substr(0, 4) != "http")
{
	document.write('<a href="http://www.' + ndd + '/" target="_blank">' + ndd_texte_lien + '</A>') ;
	document.write("<BR><FONT FACE=arial>L'échange de bannières ne fonctionne pas en local</FONT>") ;
}
else
{
	URL_envoi = 'http://links.' + ndd + '/bin/exchg.php?ID=' + ID + '&couleur_fond=' + couleur_fond + '&couleur_liens=' + couleur_liens + '&taille=' + taille + '&page_vue=' + page_vue ;
	Frame_decoration = ' FRAMEBORDER="no" HEIGHT=' + hauteur[taille] + ' WIDTH=' + largeur[taille] + ' SCROLLING="no" MARGINHEIGHT=2' ;

//	document.write(URL_envoi + "<BR>") ;
//	document.write(Frame_decoration) ;

	document.write('<CENTER><BR> ') ;
	document.write('<IFRAME SRC=' + URL_envoi + Frame_decoration + '></IFRAME>') ; 
//	document.write('<BR><A  STYLE=\"text-decoration:underline;\" HREF="http://www.' + ndd + '">' + ndd_texte_lien + '</A> ') ;
	document.write('</CENTER><BR> ') ;
	
}


