var p1;
var p2;

function popupcentree(page,largeur,hauteur,options)
{
	var top=(screen.height-hauteur)/2;
	var left=(screen.width-largeur)/2;
	window.open(page,"","top="+top+",left="+left+",width="+largeur+",height="+hauteur+","+options);
}

function display(param)
{
	i = 1;
	do{
		document.getElementById("s"+i).style.display = "none";
		i++;
	}
	while(document.getElementById("s"+i))
	
	document.getElementById("s"+param).style.display = "inline";
}

function effect(p)
{
	if(p == 2){
		new Effect.BlindDown(document.getElementById(p2));
	}
	else
		if(p == 1)
		{
			new Effect.BlindDown(document.getElementById(p1));
		}
	return;
}

function sleep(millis,p) {
	setTimeout('effect('+p+')', millis)
}

function anim(div1,div2)
{
	p1 = div1;
	p2 = div2;
	
	fl1 = "fl"+div1;
	fl2 = "fl"+div2;
	
	if(document.getElementById(p1).style.display == 'none')
	{
		new Effect.BlindUp(document.getElementById(p2));
		sleep(1000, 1);
	}
	else
	{
		return;
	}
}

function changeImage(myurl,width,height,alt)
{
	ima = new Image();
	ima.src = "images/"+myurl;
	document.getElementById('image').innerHTML = "<img src=images/"+myurl+" width=\""+width+"\" height=\""+height+"\"  alt=\""+alt+"\" border=\"0\"; padding:0px;\"/>";
}


function diaporama()
{
	var array =  new Array("diapo-1.jpg", "diapo-2.jpg", "diapo-3.jpg", "diapo-4.jpg");
	var tmp = arguments[0];

	if(arguments[1])
	{
		for(e=0; e<array.length; e++)
		{
			document.getElementById('preload').innerHTML += "<img src=images/"+array[e]+" width=\"1\" height=\"1\" border=\"0\"; padding:0px;\"/>";
		}
	}


	if(tmp == array.length)
		tmp=0;
	
	changeImage(array[tmp],'122','107','');
	
	tmp = tmp+1;
	
	setTimeout("diaporama("+tmp+")",5000);	
}

function resizePopUp(monImage)
{
 w = window.open('','Chargement','width=10,height=10');
 w.document.write( "<html><head><title>AFM CHIMIE</title>\n" );
 w.document.write( "<script language='JavaScript'>\n");
 w.document.write( "IE5=NN4=NN6=false;\n");
 w.document.write( "if(document.all)IE5=true;\n");
 w.document.write( "else if(document.getElementById)NN6=true;\n");
 w.document.write( "else if(document.layers)NN4=true;\n");
 w.document.write( "function autoSize() {\n");
 w.document.write( "if(IE5) self.resizeTo(document.images[0].width+10,document.images[0].height+49);\n");
 w.document.write( "else if(NN6) self.sizeToContent();\n");
 w.document.write( "else window.resizeTo(document.images[0].width,document.images[0].height+20);\n");
 w.document.write( "self.focus();\n");
 w.document.write( "}\n</scri");
 w.document.write( "pt>\n");
 w.document.write( "</head><body leftmargin=0 topmargin=0 marginwidth=0 marginheight=0 onLoad='javascript:autoSize();'>" );
 w.document.write( "<a href='javascript:window.close();'><img src='"+monImage+"' border=0></a>" );
 w.document.write( "</body></html>" );
 w.document.close();
}
