
/*************************************
//Fonctions communes Ever-Ezida
*************************************/

/*
* variable globale pour les traductions des jsp dans php
*/
var TERMS=new Hashtable();
TERMS.put("La fiche de cette oeuvre","view artwork notice");
TERMS.put("précédente","previous");
TERMS.put("suivante","next");
TERMS.put("Resultats de votre recherche","search results");
TERMS.put("Votre recherche a fourni","Your search provides");
TERMS.put("résultats","results");
TERMS.put("Sélectionnez toutes ces oeuvres","Select all");
TERMS.put("Information complémentaire","View notice");
TERMS.put("Ajouter cette oeuvre","Add this artwork");
TERMS.put("Oeuvre ajoutée","artwork added");
TERMS.put("Visualiser votre panier","view your basket");
TERMS.put("La fiche de cette oeuvre","artwork notice");
TERMS.put("Supprimer du parcours","remove this notice");
TERMS.put("Retour","Back");
TERMS.put("Voir la fiche de l\'auteur","view author");

/* ************************************
// Edition du panier
************************************ */
function basketEdit(recordId, paramUrl, nomPanier){
	if( document.getElementById("check_"+recordId).checked == true){
		addToBasket(recordId, paramUrl, nomPanier);
	} else {
    	removeFromBasketSearch(recordId, paramUrl, nomPanier);
	}
}
	
/* ************************************
// Ajout d'�l�ment dans le panier
************************************ */
function addToBasket(recordId, paramUrl, nomPanier) {  
	document.getElementById("basketAddFrame").src = paramUrl + "paniers/ajoutPanier.jsp?nomPanier=" + nomPanier + "&numOeuvre=" + recordId;
	document.getElementById("ajout_"+recordId).innerHTML = "Oeuvre ajout&eacute;e";  
   	document.getElementById("check_"+recordId).checked = true;
}	



/* ************************************
// Suppression d'�l�ment du panier a partir des liste r�sultat
************************************ */
function removeFromBasketSearch(recordId, paramUrl, nomPanier) {
  
	document.getElementById("basketAddFrame").src = paramUrl + "paniers/suppPanier.jsp?nomPanier=" + nomPanier + "&numOeuvre=" + recordId;
  
	htm="<a href=javascript:addToBasket('";
	htm+=recordId;
	htm+="') >Ajouter cette oeuvre</a>";
	document.getElementById("ajout_"+recordId).innerHTML = htm;
	document.getElementById("check_"+recordId).checked = false;

}

/* ************************************
// Suppression d'�l�ment dans le panier
************************************ */
function deleteToBasket(recordId, paramUrl, nomPanier) {
	document.getElementById("basketAddFrame").src = paramUrl + "paniers/suppPanier.jsp?nomPanier=" + nomPanier + "&numOeuvre=" + recordId;
	document.getElementById("div_"+recordId).style.display = "none";
}


/* ************************************
// ouverture d'une image en pop-up
************************************ */
function imagezoom(w,h,url) {
   var options = "toolbar=0,scrollbars=0,location=0,statusbar=0,menubar=0,resizable=0";
   var popupWindow = window.open(url, 'Imagezoom', options + ',width=' +w + ',height=' + h);
   var focus = popupWindow.focus();
}



function autoLoad()
{
alert("load");
return true;
}


function submitVisualiseurForm(formName){
	var codeToLoad = "document.FORM_" + formName + ".submit()";
	eval(codeToLoad);
}

function openVisualiseur(formName){
	window.open("/flash/visualiseur.html?formName=" + formName ,"1100" , "770");	
	//getClientWidth()-10
}


function getClientWidth()
{
var width=0;
var widthIE = 14;
var widthNotIE = 12; 
  
      if( typeof( window.innerWidth ) == 'number' )
      {
         //Non-IE
         width = window.innerWidth;
         width = width - widthNotIE;
      } 
      else if(   document.documentElement 
             && ( document.documentElement.clientWidth 
             ||   document.documentElement.clientWidth ) ) 
      {
         //IE 6+ in 'standards compliant mode'
         width = document.documentElement.clientWidth;
         width = width - widthIE;
      }
      else if(    document.body 
              && ( document.body.clientWidth 
              ||   document.body.clientWidth ) ) 
      {
         //IE 4 compatible
         width = document.body.clientWidth;
         width = width - widthIE;
      }
      if (width < 0 )
        width = 20;
             
 return width;     
}


function frmSelect(formName, unused, p0, checkName, element)
{
   var checkAll=true;
   var isChecked=true;
   if(element.id=="checkAll") isChecked=element.checked;
   if(isChecked) checkAll=true;
   else if(isChecked==false) checkAll=false;

   var frm = document.forms[formName];
   if ( ! checkName || (checkName == '' ))
      checkName = "check_";
   if ( frm != null )
   {
      for (var i=0;i<frm.elements.length; i++)
      {
         var elem = frm.elements[i];
         if ( (elem.type=="checkbox"))
         {
            elem.checked = checkAll;
            var fnElem=elem.getAttribute("onChange");
            eval(fnElem);
         }
      }
   }
}

/*
2 variables gloables utilisées :
TERMS : hashtable de traduction défini en haut de ce fichier
LANG : langue utilisé par le système : 1 fr, 2: en
*/
function getTraduction(term)
{

var ret=term;
if(term != null && LANG != null) 
	{
	 if(TERMS.containsKey(term)  && LANG=="2") ret= TERMS.get(term);
	}
document.write(ret);
}



