// bibliothèque de javascripts

// fonction pour afficher une page quelconque dans une nouvelle fenêtre
function open_page(page,largeur,hauteur)
{
	imageTop=(screen.height-hauteur)/2;
	imageLeft=(screen.width-largeur)/2;
	page=open(page, 'page','top='+imageTop+',left='+imageLeft+',width='+largeur+',height='+hauteur+',titlebar=no,dependent=yes,alwaysRaised=yes');
}

// fonction pour afficher une page quelconque dans une nouvelle fenêtre avec des dimensions particulières
function open_page2(page,largeur,hauteur)
{
	imageTop=(screen.height-hauteur)/2;
	imageLeft=(screen.width-largeur)/2;
	page2=open(page, 'page2','top='+imageTop+',left='+imageLeft+',width='+largeur+',height='+hauteur+',titlebar=no,dependent=yes,alwaysRaised=yes');
}

// fonction pour afficher une page quelconque dans une nouvelle fenêtre
// deuxième fonction pour permettre une ouverture en cascade dans la fiche détail
function open_page_std(page,largeur,hauteur)
{
	imageTop=(screen.height-hauteur)/2;
	imageLeft=(screen.width-largeur)/2;
	page=open(page, 'page','top='+imageTop+',left='+imageLeft+',width='+largeur+',height='+hauteur+',scrollbars=yes,resizable=yes,toolbar=yes,dependent=yes,alwaysRaised=yes');
}
// fonction pour afficher une page quelconque dans une nouvelle fenêtre
// la fenêtre est entièrement paramétrable scroll, menu, titre, barre d'outils ...
function open_page_param(page,largeur,hauteur,scrollable,resizable,menu,tool){
	if (scrollable===undefined) {
		scrollable='no';
	}
	if (resizable===undefined) {
		resizable='no';
	}
	if (menu===undefined) {
		menu='no';
	}
	if (tool===undefined) {
		tool='no';
	}

	imageTop=(screen.height-hauteur)/2;
	imageLeft=(screen.width-largeur)/2;
	page=open(page, 'page','top='+imageTop+',left='+imageLeft+',width='+largeur+',height='+hauteur+',scrollbars='+scrollable+',resizable='+resizable+',menubar='+menu+',toolbar='+tool+',dependent=yes,alwaysRaised=yes');
}

// fonction pour afficher un formulaire de saisie pour modifier ou ajouter une moto
function open_maj_vente(id,type)
{
	imageLeft=(screen.width-500)/2;
	if (type=='new')
	{
		imageTop=(screen.height-400)/2;
		maj_vente=open('maj_vente.php?id='+id+'&type='+type, 'image','top='+imageTop+',left='+imageLeft+',width=500,height=400,status=no,titlebar=no,dependent=yes,alwaysRaised=yes');	
	}
	else
	{
		imageTop=(screen.height-600)/2;
		maj_vente=open('maj_vente.php?id='+id+'&type='+type, 'image','top='+imageTop+',left='+imageLeft+',width=500,height=600,status=no,titlebar=no,dependent=yes,alwaysRaised=yes');
	}
}

// fonction pour afficher un formulaire de saisie pour modifier ou ajouter une piece
function open_maj_piece(id,type)
{
	imageLeft=(screen.width-500)/2;
	if (type=='new')
	{
		imageTop=(screen.height-400)/2;
		maj_vente=open('maj_piece.php?id='+id+'&type='+type, 'image','top='+imageTop+',left='+imageLeft+',width=500,height=400,status=no,titlebar=no,dependent=yes,alwaysRaised=yes');	
	}
	else
	{
		imageTop=(screen.height-600)/2;
		maj_vente=open('maj_piece.php?id='+id+'&type='+type, 'image','top='+imageTop+',left='+imageLeft+',width=500,height=600,status=no,titlebar=no,dependent=yes,alwaysRaised=yes');
	}
}

// fonction de clignotement
function Clignoter(Objet_nom) {
	var delai=500; // temps d'affichage du texte exprimé en millisecondes (ici 0.5 seconde)
	var ObjTemp=null;
	
	ObjTemp=document.getElementById(Objet_nom);
	ObjTemp.style.color='#FF0000';

	if (ObjTemp.style.visibility=='visible') 
		{
		ObjTemp.style.visibility='hidden';
		}
	else 	{
		ObjTemp.style.visibility='visible';
		}
	setTimeout('Clignoter(\''+Objet_nom+'\')',delai);
}	

function refresh(formulaire) {
    formulaire.submit();
}
function ShowPopup()
{
	var windowFeatures, Win;
	windowFeatures = "width=500, height=600,titlebar=no,toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=no";
	Win=window.open( "aquacvs.php","Toolbar",windowFeatures);
	Win.focus();
}
