<!--

// =====================================
// Copyright GreenFacts Organization 
// =====================================
// Kindly contact GreenFacts Organization (info@greenfacts.org) for more information regarding permission to use these javascript functions.

// ADJUSTABLE PARAMETERS
// =====================
var deltaWidth = 12;
var deltaHeightTools = 51;
var deltaHeightFull = 144;
var bottomBorder = 28;
var overlap = 6;
var toolsIntWidth = 326;

// MAIN WINDOW
//============
var toolsExtWidth = toolsIntWidth + deltaWidth;
var mainExtWidth = screen.width - toolsExtWidth + overlap;
var mainExtHeight = screen.height - bottomBorder;

// TOOLS POPUP
//============
var toolsExtHeight = 290;
var toolsX = screen.width - toolsExtWidth;
var toolsY = 0;

if(screen.width < 1000) 
   var toolsX = toolsX - deltaWidth - 4, toolsIntHeight = toolsExtHeight - deltaHeightTools, toolsY = screen.height - toolsExtHeight - bottomBorder;
   else var toolsIntHeight = mainExtHeight - deltaHeightTools;       

if (document.all);                               //Explorer
    else var mainExtHeight = mainExtHeight - 7; //Netscape
 
var toolsframe = "toolbar=no,location=no,status=yes,menubar=no,scrollbars=yes,resizable=yes,";
var toolspos = "left="+toolsX+",top="+toolsY+",screenX="+toolsX+",screenY="+toolsY+",width="+toolsIntWidth+",height="+toolsIntHeight;
var toolsdef = toolsframe+toolspos;

function ltf(filename){// Load file in Tools window (= gft) and Focus it
if(screen.width > 999)
window.moveTo(0,0), window.resizeTo(mainExtWidth,mainExtHeight);
    else;
ttt = window.open(filename,"gft",toolsdef);
ttt.focus();
}



// EXWEB POPUP
//============
var exwebX = 0;
var exwebY = 110;
var gfigY = 50; 
 
var exwebIntWidth = mainExtWidth - deltaWidth;
var exwebIntHeight = mainExtHeight - exwebY - deltaHeightFull - 35;
var gfigHeight = mainExtHeight - gfigY - gfigY;

if (document.all);                                //Explorer
   else var exwebIntHeight = exwebIntHeight + 48; //Netscape

if(screen.width < 1000)
  var exwebpos = "";
    else
  var exwebpos = "left="+exwebX+",top="+exwebY+",width="+exwebIntWidth+",height="+exwebIntHeight;

if(screen.width < 1000)
  var gfigpos = "";
    else
  var gfigpos = "left="+exwebX+",top="+gfigY+",width=700,height="+gfigHeight;
//  var gfigpos = "left="+exwebX+",top="+gfigY+",width="+exwebIntWidth+",height="+gfigHeight;

var exwebframe = "toolbar=yes,location=yes,status=yes,menubar=yes,scrollbars=yes,resizable=yes,";
var exwebdef = exwebframe+exwebpos;
var gfignobar = "toolbar=no,location=no,status=no,menubar=no,scrollbars=yes,resizable=yes,";
var gfigdef = gfignobar+gfigpos;

function fe(){// Focus ExWeb window (= gfe)
eee = window.open("","gfe",exwebdef);
eee.focus();
}

function fi(){// Focus IntWeb window (= gfi)
iii = window.open("","gfi",exwebdef);
iii.focus();
}

function fig(){// Focus figure window (= gfig)
iii = window.open("","gfig",gfigdef);
iii.focus();
//ttt = window.open("","gft",toolsdef);
//ttt.focus();

}

function ft(){// Focus Tools window (= gft)
if(screen.width > 999)
    window.moveTo(0,0), window.resizeTo(mainExtWidth,mainExtHeight);
    else	;
ttt = window.open("","gft",toolsdef);
ttt.focus();
}

function fg(){// Focus GreenFacts.org window (= gf)
iii = window.open("","gf",exwebdef);
iii.focus();
}


// New Window System Added by Daniel 13/02/2006
/* http://forum.alsacreations.com/topic-5-3916-1-quotAmliorationquot-du-script-alsa-quotouverture-liens-externes.html */
 function open_ext_link()
{
	var liens = document.getElementsByTagName('a');
	// On rcupre tous les liens (<a>) du document dans une variable (un array), ici liens.
	// Une boucle qui parcourt le tableau (array) liens du dbut  la fin.
	for (var i = 0 ; i < liens.length ; ++i)  {
		// Si les liens ont un nom de class gal  lien_ext, alors on agit.
		if (liens[i].className == 'link-external')  {
			liens[i].title = 'Opens in a new window';
			// Au clique de la souris.
                        liens[i].target ="gfe";
			liens[i].onclick = function()  {fe();};
		}

		if (liens[i].className == 'link-internal' || liens[i].className == 'link-pdf' || liens[i].className == 'link-word' || liens[i].className == 'printer')  {
			liens[i].title = 'Opens in a new window';
			// Au clique de la souris.
                        liens[i].target ="gfi";
			liens[i].onclick = function()  {fi();};
		}
		if (liens[i].className == 'link-figure')  {
			liens[i].title = 'Opens in a new window';
			// Au clique de la souris.
                        liens[i].target ="gfig";
                                    if (!(liens[i].onclick))
			liens[i].onclick = function()  {fig();};
		}

		if (liens[i].className == 'link-glossary' || liens[i].className == 'link-toolbox' || liens[i].className == 'ssMenuGlossary')  {
			liens[i].title = 'Opens in a new window';
			// Au clique de la souris.
			liens[i].target ="gft";
			if (!(liens[i].onclick))
			liens[i].onclick = function()  {ft();};
			
			
		}

	}
}
window.onload = open_ext_link;
// Au chargement de la page, on appelle la fonction.



