//
// openPopUps v1.01 Copyright (c) 2006 openWebWare.com
// This copyright notice MUST stay intact for use.
//
// The perfect pop up window replacement for your advertisements and web 
// applications. Pop up blockers will fail to prevent an openPopUp window 
// from opening. 
//
// This library is free software; you can redistribute it and/or modify 
// it under the terms of the GNU Lesser General Public License as published 
// by the Free Software Foundation; either version 2.1 of the License, or 
// (at your option) any later version.
//
// This library is distributed in the hope that it will be useful, but 
// WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY 
// or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public 
// License for more details.
//
// You should have received a copy of the GNU Lesser General Public License along 
// with this library; if not, write to the Free Software Foundation, Inc., 59 
// Temple Place, Suite 330, Boston, MA 02111-1307 USA 

// CSS Diretory
//cssDir = "styles/";

// Images Directory
imageDir = "images/";

// Include Style Sheet
//document.write('<link rel="stylesheet" type="text/css" href="' +cssDir+ 'styles.css">\n');

/* ---------------------------------------------------------------------- *\
  Function    : JSWindow()
  Description : creates a new window
  Usage       : JSWindow("title", oContent, [x], [y], [id], [width])
  Arguments   : title    - The title of the window as displayed in the titlebar
	              oContent - The content of the Div called using getElementbyID
								x        - The number of pixels from the left the window appears when first open
								y        - The number of pixels from the top the window appears when first open
	              id       - The <div> this window will use for its content
                width    - The default width of the window                
\* ---------------------------------------------------------------------- */

function JSWindow(title, oContent, x, y, id, width, popupColor, minimizeIcon)
{
	
	// define variables
	this.title = title;
	this.oContent = oContent;
	this.oContent = "ARFEO";
    this.width = width;
	this.x = x;
	this.y = y;
    this.id = id;
	this.bgcolor = popupColor;
	
	
	// create the table window and define CSS properties
	this.oTable = document.createElement("table");
  	this.oTable.id = "Window " + this.id;
	this.oTable.style.width = this.width + "px";
	this.oTable.style.border = "1px solid #000000";
  	this.oTable.cellSpacing = 0;
	this.oTable.cellPadding = 0;
	this.oTable.border = 0;
	this.oTable.style.backgroundColor = "";

	// determine the windows position when first open
	this.oTable.style.position = "absolute";
	this.oTable.style.zIndex = 101;
	this.oTable.style.left = this.x + "px";
	this.oTable.style.top = this.y + "px";

	// link from the table to the JSWindow object
	this.oTable.jsWindow = this;

	// if the table is clicked anywhere, show the table in front of other open windows
	this.oTable.onmousedown = JSWindow.prototype.onBringToFront;

	// append to document body
	document.body.appendChild(this.oTable);

	// add a row for the titlebar
	var oTR = this.oTable.insertRow(0);
	oTR.className = "JSWindowTitleStyle";
	
	
	// Title: add the title to the titlebar	
	oTD = oTR.insertCell(0);
	oTD.innerHTML = "&nbsp;";
	oTD.jsWindow = this;
	oTD.onmousedown = JSWindow.prototype.tdOnMouseDown;
	oTD.style.borderBottom = "1px solid #6f605b";
	oTD.style.color= "#ffffff";
	oTD.style.backgroundColor= "#6f605b";
	oTD.style.backgroundImage = "url(_img/space.gif)";
	oTD.height = "20";
	oTD.width = "460";
	
	// Minimize: add the minimize button to the titlebar

	oTD = oTR.insertCell(1);
	oTD.innerHTML = "<a href=''><img src='" + imageDir + "bg_close.jpg' border='0'></a>";
	oTD.onmousedown = JSWindow.prototype.onClose;
	oTD.jsWindow = this;
	oTD.style.borderBottom = "1px solid #6f605b";
	oTD.style.backgroundColor= "#6f605b";
	oTD.style.backgroundImage = "url(_img/space.gif)";
	oTD.width = "5%";
	oTD.style.paddingRight= "20px";
	
	// add a row for the window's content
	oTR = this.oTable.insertRow(1);
	
	this.oContentTD = oTR.insertCell(0);
	this.oContentTD.colSpan = 2;
	this.oContentTD.style.backgroundColor = this.bgcolor;
	this.oContentTD.className = "JSWindowContentStyle";
 
 
	// use the content from the referenced div as the content for the window
	
	if(id==1){
		this.oContentTD.innerHTML = "<img src='images/v2/visuel_decouvrez_new_gamme.jpg' height='166' width='283' border='0' alt=''>";
	}
	if(id=='div3'){
	
		var strAnnonces ;
		strAnnonces = "<div id='DivParle'><div id='innerParle'> <div style='overflow:auto;height:430px' >";
		
		var puce = "<img src='images/bg_puce.jpg' />  ";
		
		strAnnonces += puce + "<a href='_pdf/ARFEO_LesEchos_02-06-2010.pdf' target='_blank'><strong>Les Echos :</strong> Comment les bureaux de Poste s'affranchissent du mod&egrave;le unique (02/06/2010)</a> ";
		strAnnonces += "<br /><br />";
		
		strAnnonces += puce + "<a href='_pdf/ARFEO_InfoBuroMag_05-2010.pdf' target='_blank'><strong>Info Buro Mag : </strong>Un espace d&eacute;tente en pleine mutation (mai/juin 2010)</a> ";
		strAnnonces += "<br /><br />";
		strAnnonces += puce + "<a href='_pdf/ARFEO_InfoBuroMag_05-2010_2.pdf' target='_blank'><strong>Info Buro Mag : </strong>Le bien-&ecirc;tre dans l'entreprise passe par une dimension socio-environnementale (mai/juin 2010)</a> ";
		strAnnonces += "<br /><br />";
		strAnnonces += puce + "<a href='_pdf/CP_Arfeo_ accord_egalite_prof_femmes_hommes_04052010.pdf' target='_blank'><b>Communiqu&eacute; de presse :</b> Accord sur l'&eacute;galit&eacute; professionnelle entre les femmes et les hommes (mai 2010)</a> ";
		strAnnonces += "<br /><br />";
		strAnnonces += puce + "<a href='_pdf/ARFEO_Entreprendre_avril2010.pdf' target='_blank'><b>Entreprendre :</b> Arf&eacute;o : nouveaux rois du mobilier de bureau (avril 2010)</a> ";
		strAnnonces += "<br /><br />";
		strAnnonces += puce + "<a href='_pdf/ARFEO_UNIFA_DecisionAchats_02042010.pdf' target='_blank'><b>D&eacute;cision Achat :</b> Jacques Albert, nouveau pr&eacute;sident du groupement des industriels de mobilier de bureau de l'Unifa (02/04/10)</a> ";
		strAnnonces += "<br /><br />";
		strAnnonces += puce + "<a href='_pdf/ARFEO_RenoueAvecLaCroissance_LA_TRIBUNE_02042010.pdf' target='_blank'><b>La Tribune :</b> Arf&eacute;o renoue avec la croissance apr&egrave;s une cure de jouvence (02/04/10)</a> ";
		strAnnonces += "<br /><br />";
		strAnnonces += puce + "<a href='_pdf/ARFEO_UNIFA_INFOBUROMAG_02042010.pdf' target='_blank'><b>Info Buro Mag :</b> Le Pr&eacute;sident d'Arf&eacute;o &agrave; la t&ecirc;te du Groupement des industriels de mobilier (02/04/10)</a> ";
		strAnnonces += "<br /><br />";
		strAnnonces += puce + "<a href='_pdf/CP_Arfeo_ UNIFA_31mars2010DEF.pdf' target='_blank'><b>Communiqu&eacute; de presse :</b> Election de Jacques Albert &agrave; la Pr&eacute;sidence du Groupement des industriels de mobilier de bureau (30/03/10)</a> ";
		strAnnonces += "<br /><br />";
		strAnnonces += puce + "<a href='_pdf/ARFEO_ConfirmeSonBonResultat_INFOBUROMAG_29032010.pdf' target='_blank'><b>Info Buro Mag :</b> Arf&eacute;o confirme son bon r&eacute;sultat 2009 (29/03/10)</a> ";
		strAnnonces += "<br /><br />";
		strAnnonces += puce + "<a href='_pdf/ARFEO_LES ECHOS_16032010.pdf' target='_blank'><b>Les Echos : </b>Arf&eacute;o revient en force sur le march&eacute; du mobilier de bureau (16/03/10)</a> ";
		strAnnonces += "<br /><br />";
		strAnnonces += puce + "<a href='_pdf/ARFEO_TravaillezCommeVousVivez_INFOBUROMAG_mars_avril10.pdf' target='_blank'><b>Info Buro Mag :</b> Arf&eacute;o, travaillez comme vous vivez&nbsp;! (Mars/Avril 2010)</a> ";
		strAnnonces += "<br /><br />";
		strAnnonces += puce + "<a href='_pdf/ARFEO_le_retour_Office_et_Culture_n15_fevrier2010.pdf' target='_blank'>ARFEO le retour <b>Office et Culture</b> (01/02/10)</a> ";
		strAnnonces += "<br /><br />";
		strAnnonces += puce + "<a href='_pdf/DP_ARFEO_Fevrier_2010.pdf' target='_blank'>Dessine moi un bureau :  Nouveau <b>dossier<br/> de presse</b> Arf&eacute;o (18/02/10)</a> ";
		strAnnonces += "<br /><br />";
		strAnnonces += puce + "<a href='_pdf/CP_Arfeo_ Resultat 2009 -16fev2010V3.pdf' target='_blank'>R&eacute;sultats 2009 : <b>Forte hausse</b> pour le concepteur et fabricant de mobilier de bureau Arf&eacute;o (16/02/10)</a> ";
		strAnnonces += "<br /><br />";
		strAnnonces += puce + "<a href='_pdf/CP_Arfeo_ retour_a_la_croissance_8fev2010DEF.pdf' target='_blank'>Retour &agrave; la <b>croissance</b> pour Arf&eacute;o (8/02/10)</a> ";
		strAnnonces += "<br /><br />";
		strAnnonces += puce + "<a href='_pdf/Il_y_a_une_dimmension_sociale_et_humanitaire_derriere_le_developpement_durable.pdf' target='_blank'><b>Capvert-info.com</b> : Interview de Jacques Albert, PDG d'Arf&eacute;o (01/01/10)</a> ";  
		strAnnonces += "<br /><br />";
		strAnnonces += puce + "<a href='_pdf/Au_salon_SIMI_ARFEO_presente_@tribu_la_solution_innovante_du_poste de travail en espace collaboratif.pdf' target='_blank'>Pr&eacute;sentation au <b>SIMI</b> de <b>Tribu</b>, la solution innovante du poste de travail collaboratif (01/12/09)</a> ";
		strAnnonces += "<br /><br />";
		strAnnonces += puce + "<a href='_pdf/ARFEO_l_entreprise_decembre2009.pdf' target='_blank'><b>L'Entreprise</b> : Arf&eacute;o, une assise locale et &eacute;thique (01/12/09)</a> ";  
		strAnnonces += "<br /><br />";
		strAnnonces += puce + "<a href='_pdf/ARFEO_present_au_salon_entreprise_durable_octobre2009.pdf' target='_blank'>Arf&eacute;o &eacute;tait pr&eacute;sent au <b>Salon Entreprise Durable</b> les 20 et 21 octobre 2009 (29/10/09)</a> ";
		strAnnonces += "<br /><br />";
		strAnnonces += puce + "<a href='_pdf/Profession_Nouveau_Papetier_1.07.2009.pdf' target='_blank'>Le <b>renouveau</b> d'Arf&eacute;o (01/07/09)</a> ";  
		strAnnonces += "<br /><br />";
		strAnnonces += puce + "<a href='_pdf/ARFEO_inaugure_sa_chaine_de_peinture_et_son_showroom.pdf' target='_blank'>Arf&eacute;o inaugure sa <b>cha&icirc;ne de peinture</b> et son showroom (01/02/09)</a> ";   
		strAnnonces += "<br /><br />";
		strAnnonces += puce + "<a href='_pdf/ARFEO_se_met_au_vert.pdf' target='_blank'><b>Ouest France</b> : Arf&eacute;o se met au vert (02/01/09)</a> ";
		strAnnonces += "<br /><br />";
		strAnnonces += puce + "<a href='_pdf/ARFEO_obtient_la_certification_ISO_14001.pdf' target='_blank'>Arf&eacute;o obtient la certification <b>ISO 14001</b> (01/01/09)</a> ";
		strAnnonces += "<br /><br />";
		strAnnonces += puce + "<a href='_pdf/Info_Buro_Mag_jan_fev09.pdf' target='_blank'><b>Buro Mag</b> (01/01/09)</a> ";    
		strAnnonces += "<br /><br />";
		strAnnonces += puce + "<a href='_pdf/Info_Buro_Mag-nov-dec-2008.pdf' target='_blank'><b>Buro Mag</b> (01/11/08)</a> ";
		strAnnonces += "<br /><br />";
		strAnnonces += puce + "<a href='presse/communiques/Communique_Arfeo_de_ Haut-Anjou_14_03_08.pdf' target='_blank'><strong>Haut-Anjou</strong> (14-03-2008)</a> ";
		strAnnonces += "<br /><br />";
		strAnnonces += puce + "<a href='presse/revue/08-01-01_buro mag.pdf' target='_blank'><strong>Buro Mag </strong> (03-01-2008)</a> ";
		
		strAnnonces += "<br /><br /></div></div></div>";
		
		this.oContentTD.innerHTML = strAnnonces ;
	}
	if(id=='div2'){
		strAnnonces = "<div id='DivPresse'><div id='innerPresse1' align='left'><div style='overflow:auto;height:430px;' >";
		strAnnonces +="<br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br />";
			
			strAnnonces +="<br /><br />";
		strAnnonces +="&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;";
		strAnnonces +="<a href='_pdf/responsable_ordonnancement_approvisionnement.pdf' target='_blank'>Responsable ordonnancement approvisionnement</a> ";
		
			strAnnonces +="<br /><br />";
		strAnnonces +="&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;";
		strAnnonces +="<a href='_pdf/technicien_methodes_de_production.pdf' target='_blank'>Technicien methodes de production</a> ";

			strAnnonces +="<br /><br />";
		strAnnonces +="&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;";
		strAnnonces +="<a href='_pdf/Chef_de_projet _etudes_industrielles_BE.pdf' target='_blank'>Chef de projet &eacute;tudes industrielles BE</a> ";

		strAnnonces +="</div></div></div>";
		
		this.oContentTD.innerHTML = strAnnonces ;
	}
	
}

JSWindow.prototype.onBringToFront = function()
{
	this.jsWindow.bringToFront();
}

JSWindow.prototype.bringToFront = function()
{
	// if not already the last child of the document.body, make it so
	if ( document.body.childNodes[document.body.childNodes.length-1] !== this.oTable )
	{
		// move to bottom of document
		document.body.appendChild(this.oTable);
	}
}

JSWindow.prototype.tdOnMouseDown = function()
{
	this.jsWindow.onMouseDown();
}

JSWindow.prototype.onMouseDown = function()
{
	// record that an onmousedown has just occurred
	this.bDown = true;
	
	// link from body to this JSWindow object
	document.body.jsWindow = this;

	// save body mouse handlers
	this.saveMouseMove = document.body.onmousemove;
	this.saveMouseUp = document.body.onmouseup;

	// set new handlers.
	document.body.onmousemove = JSWindow.prototype.bodyOnMouseMove;
	document.body.onmouseup = JSWindow.prototype.bodyOnMouseUp;
}

JSWindow.prototype.bodyOnMouseMove = function(evt)
{
	var e = window.event ? window.event : evt;
	this.jsWindow.onMouseMove(e);
}

JSWindow.prototype.onMouseMove = function(evt)
{
	// if mouse not down, stop the move (for IE only)
	if ( (document.all) && !(evt.button & 1) )
	{
		this.onMouseUp();
		return;
	}
	if ( this.bDown )
	{
		this.dx = parseInt(this.oTable.style.left, 10) - evt.clientX;
		this.dy = parseInt(this.oTable.style.top, 10) - evt.clientY;
		this.bDown = false;
	}
	else
	{
		this.oTable.style.left = Math.max((this.dx + evt.clientX),0) + "px";
		this.oTable.style.top = Math.max((this.dy + evt.clientY),0) + "px";
	}
}

JSWindow.prototype.bodyOnMouseUp = function()
{
	this.jsWindow.onMouseUp();
}

JSWindow.prototype.onMouseUp = function()
{
	document.body.onmouseup = this.saveMouseUp;
	document.body.onmousemove = this.saveMouseMove;
	document.body.jsWindow = null;
}


JSWindow.prototype.onMinimize = function()
{
  this.jsWindow.minimize();
}



JSWindow.prototype.minimize = function()
{
	// hide the content
	this.oContent.style.visibility = "hidden";
	this.oContent.style.position = "absolute";
	document.body.appendChild(this.oContent);
	
	this.oTable.deleteRow(1);
	
	// save current position
	this.saveX = this.oTable.style.left;
	this.saveY = this.oTable.style.top;
	
  // get the "window bar"
	if ( !window.jsWindowBar )
	{
		window.jsWindowBar = document.createElement("span");
	  document.body.appendChild(window.jsWindowBar);
	}
	
	window.jsWindowBar.appendChild(this.oTable);
	this.oTable.style.position = "static";
	this.oTable.style.left = "0px";
	this.oTable.style.top = "0px";
	
	this.oMinTD.innerHTML = "<img src='" + imageDir + "maximize.jpg'>";
	this.oMinTD.onmousedown = JSWindow.prototype.onMaximize;
	this.oTable.style.width = "220px";
    this.oTable.style.borderBottom = "0px";
	
}


JSWindow.prototype.onMaximize = function()
{
	this.jsWindow.maximize();
}

JSWindow.prototype.maximize = function()
{
	document.body.appendChild(this.oTable);
	this.oTable.style.position = "absolute";
	
	this.oTable.style.left = this.saveX;
	this.oTable.style.top = this.saveY;
	this.oTable.style.width = this.width + "px"
	this.oTable.style.borderBottom = "1px solid #000000";
	
	// add the content again.
	oTR = this.oTable.insertRow(1);
	
    this.oContentTD = oTR.insertCell(0);
	this.oContentTD.colSpan = 3;
	this.oContentTD.innerHTML = document.all["Div" + this.id].innerHTML;
	
	//oTD.appendChild(this.oContent);
	this.oContent.style.position = "static";
	this.oContent.style.visibility = "visible";
	this.oContentTD.style.backgroundColor = "";//this.bgcolor;
	this.oContentTD.className = "JSWindowContentStyle";
	
    this.oMinTD.style.paddingRight = "1px";	
	this.oMinTD.innerHTML = "<img src='" + imageDir + "minimize.jpg'>";
	this.oMinTD.onmousedown = JSWindow.prototype.onMinimize;

}

JSWindow.prototype.onMaximize = function()
{
	this.jsWindow.maximize();
}

JSWindow.prototype.close = function()
{	
	// remove from browser document
	this.oTable.parentNode.removeChild(this.oTable);
}

JSWindow.prototype.onClose = function()
{
	this.jsWindow.close();
}

/* ---------------------------------------------------------------------- *\
  Function    : hideDiv()
  Description : Hides all Divs on the page.
  Usage       : hideDiv([divNumber])
  Arguments   : divNumber - The number of Divs in the page that must be hidden
\* ---------------------------------------------------------------------- */

function hideDiv(divNumber) {
	for (var count = 1; count <= divNumber;) {
    document.getElementById('Div' + count).style.display = 'none';
		count++;
	}
}

function del(windowID) {
	if (document.getElementById('Window ' + windowID)) {
  document.getElementById('Window ' + windowID).style.display = 'none';
  }
    
}




/* ---------------------------------------------------------------------- *\
  Function    : createWindows()
  Description : determines if Window already exists, else calls JSWindow
  Usage       : createWindows([windowID], [width], "title")
  Arguments   : windowID - The <div> this window will use for its content
                width    - The default width of the window
                title    - The title of the window as displayed in the titlebar
\* ---------------------------------------------------------------------- */

function createWindow(title, width, popupColor, windowID, minimizeIcon, x, y)
{
if (document.getElementById('Window ' + windowID)) {
  }
else {
  new JSWindow("&nbsp;" + title, document.getElementById("Div" + windowID), x, y, windowID, width, popupColor, minimizeIcon); 
  }
}

function createPresse()
{
if (document.getElementById('Window div2')) {
  }
else {
  new JSWindow("&nbsp; ARFEO recrute", '', 20, 100, 'div2', 499, '#5a4e48', 0); 
  }
}

function createParle()
{
if (document.getElementById('Window div3')) {
  }
else {
  new JSWindow("&nbsp; ARFEO on en parle", '', 20, 100, 'div3', 499, '#5a4e48', 0); 
  }

}


