/*
dhtml.js : routines javascript diverses

franck ruzzin - Juin 2005. fruzzin@voila.fr
*/


/* change la classe d'un objet */
function changeclass(objet, myClass) { 
	/*if (nav.ie) return;*/
	objet.className = myClass;
}

/* lancer la recherche sur le formulaire de recherche */
function chercher() {
	document.searchForm.submit();
}


/* empile des fonctions à lancer lors de l'évènement onload */
function addLoadEvent(func) {
	var oldonload = window.onload;
	if (typeof window.onload != 'function') {
		window.onload = func;
	} else {
		window.onload = function() {
			oldonload();
			func();
		}
	}
}


/* Affichage d'une image dans une nouvelle fenetre, maximisÃ©e */
//
// image : String = chemin de l'image
// titre : String = titre de l'image (optionnel)
// largeur : Number = largeur de l'image
// hauteur : Number = hauteur de l'image
// couleur : Number ou String = couleur du fond de la page numÃ©rique ou hexa (si non dÃ©fini, blanc)
function photoPleinEcran(image, titre, largeur, hauteur, couleur) {
    if (typeof couleur == 'undefined') {
       couleur=16777216;
    }
    couleur=couleur+''; //cast to String

    var mywin=window.open("","","menubar=yes,resizable=yes,scrollbars=no","false");
    var lscreen=screen.availWidth;
    var hscreen=screen.availHeight;
    mywin.moveTo(0,0);	
    mywin.resizeTo(lscreen,hscreen);
    var largNav=lscreen-30;
    var hautNav=hscreen-100;
    var l=largeur,h=hauteur;
    ratio=l/largNav;
    if (ratio>1) {
	l=l/ratio;
	h=h/ratio;
    }
    ratio=h/hautNav;
    if (ratio>1) {
	l=l/ratio;
	h=h/ratio;
    }

    var contenu="<html><head><title>FIAN France - "+titre+" ("+largeur+"x"+hauteur+")</title>";  
    mywin.document.write(contenu);
    var contenu="<style type=\"text/css\">body {background-color: "+ couleur+ ";}</style>";
    mywin.document.write(contenu);
    contenu="</head><body>"
    mywin.document.write(contenu);
    contenu='<table width="100%" height="100%" border="0" cellpadding="0" cellspacing="0">';
    mywin.document.write(contenu);
    contenu='<tr>';
    mywin.document.write(contenu);
    contenu='<td><div align="center"><img style="height:'+h+'px;width:'+l+'px" src="'+image+'"></div></td>';
    mywin.document.write(contenu);
    contenu='</tr>';
    mywin.document.write(contenu);
    contenu='</table>';
    mywin.document.write(contenu);  
    contenu="</body></html>";
    mywin.document.write(contenu);
    mywin.document.close();  //fermer le flux	  
    mywin.document.title="FIAN France - "+titre+" ("+largeur+"x"+hauteur+")";
}




