﻿
var ACTUAL_FONT_SIZE = "";

function loupe(size_text)
{
  if (document.getElementsByTagName) 
  {
     var tag,i,j;
   
    tags = new Array ("div","td","span");
    
    for (t in tags) 
    {      
         tag = document.getElementsByTagName(tags[t]);
         
         for(i in tag)
          {
              if(tag[i].className != "")
               {
                   //if (css_array.inArray(tag[i].className + ACTUAL_FONT_SIZE))
                   //{
                        //alert(tag[i].className);

                        for(j in css_array)
                        {                     
                            //alert(css_array[i]);
                            //alert(tag[i].className);

                            if (tag[i].className == css_array[j] + ACTUAL_FONT_SIZE)
                            {
                                //alert(tag[i].className.search(/contenu_titre_noir/));
                                tag[i].className = css_array[j] + size_text;
                                //alert(tag[i].className);
                                //alert(tag[i].style.fontSize);
                             }
                        }
                   // }
               }
          }
      }
   }

    ACTUAL_FONT_SIZE = size_text;  
}

Array.prototype.inArray = function (value)
// Returns true if the passed value is found in the
// array.  Returns false if it is not.
{
    var i;
    for (i=0; i < this.length; i++) {
        // Matches identical (===), not just similar (==).
        if (this[i] === value) {
            return true;
        }
    }
    return false;
};

// READ FILE ==========================================================================================================
/*
objXml = new ActiveXObject("Microsoft.XMLHTTP");

// objXml = new ActiveXObject("Msxml2.XMLHTTP"); older version
var datafile = "/css/apchq.css";

objXml.open("GET", datafile, true);
objXml.onreadystatechange=function() {
   if (objXml.readyState==4) {
       display(objXml.responseText);
  }
 }

objXml.send(null);

function display(msg) {
  alert(msg);
}


    //alert("tri");
    //alert(window.document.forms[0].name);
    //alert(window.document.body.getElementsByTagName);
    
    //document.body.style.fontSize = '120%';
    //document.body.className.fontSize;
	//e = window.document.forms[0].elements;
	
	//alert(e.length);
	//for (i=0; i < e.length ; i++) 
	//{
	    //alert(e[i].type);
    //}
    
    //var css_array = new Array("titre_marron","en_tete","contenu_titre_noir","contenu_titre_bleu","texte_marron","contenu_commentaire","contenu_texte","contenu_texte_bleu");
      
*/


// AIDANT.CA ==========================================================================================================
var firstCall = true;
var TTITREONCE = 0, STYLEPRODONCE = 0;

function changeFontsize(fSize, increment) 
{
  if (firstCall) 
  {
    firstCall = false;
    if (increment != "")
      changeFontsize('15', '');
  }
  
  if (document.getElementsByTagName) 
  {
    tags = new Array ("div","td","span");
    for (j=0; j<tags.length; j++) 
    {
      var getElement = document.getElementById('contenuReSizable').getElementsByTagName(tags[j]);
      var eachElement, currentFontSize, fontIncrease, newFontSize;

      if (document.getElementById('contenuReSizable').getElementsByTagName(tags[j]).name != 'noResize'){
	      for (i=0; i<getElement.length; i++) {
	        eachElement = getElement[i];
	
	        if (increment != "") {
	          currentFontSize = parseInt(eachElement.style.fontSize);
	          fontIncrease = parseInt(increment);
	          newFontSize = currentFontSize + fontIncrease;
	        }
	        else if (fSize != "")
	          newFontSize = parseInt(fSize);
	
	
	        if (eachElement.className == "ttitre"){
	        	if (TTITREONCE == 0){
	        		TTITREONCE = 1;
	        		newFontSize = newFontSize + 9;
	        	}
	        }
	        if (eachElement.className == "styleprod"){
	        	if (STYLEPRODONCE == 0){
	        		STYLEPRODONCE = 1;
	        		newFontSize = newFontSize - 2;
	        	}
	        }

	       	eachElement.style.fontSize = newFontSize + "px";
	      }
	  }
    }
  }
}
