/* */
/* Used to avoid the message on the browser top with IE (block information about the user connected to Communicator, ...  */
/* */
function ProcessImn() {
}

function ProcessImnMarkers() {
}

/******* eServices JS***********/
/* */
/* Used to see flv media type */
/* */
function redirectToExternal(url,murl) 
{
  openWindowWithPost(url,'',"mURL",murl);
}

function openWindowWithPost(url,name,keys,values)
{
  var newWindow = window.open('', name, "menubar=no, status=no, scrollbars=no, menubar=no, width=420, height=340"); 
  if (!newWindow)
    return false;
    
  var html = "";
  html += "<html><head></head><body><form id='formid' method='post' action='" + url + "'>";
  if (keys && values)
  {
    html += "<input type='hidden' name='" + keys + "' value='" + values + "'/>";
  }
  html += "</form><scr"+"ipt type=text/javascript>document.getElementById(\"formid\").submit()</scr"+"ipt></body></html>";
  newWindow.document.write(html);
  return newWindow;
}

//function used in the header of the webcontrols
//in order to hide and display it
//also changes the collapse/expand picture
function webcontrolHeaderCollapse(imgid, elementid, minusImgUrl, plusImgUrl)
{
	var element = document.getElementById(elementid);
	var img = document.getElementById(imgid);
	if (element.style.display == 'none')
	{
		img.src = minusImgUrl;
		element.style.display = '';
	}
	else
	{
		element.style.display = 'none';
		img.src = plusImgUrl;
	}
}

/*
Functionnality to change the font size of the current page.
Used by the Tools WebControl
*/
//****** Begin Change Font Size functionnality ******
/*
 * Utility function for changeFontSize()
 *
 */

function getElementsByClassName(nomClasse, element) {
  var resultat = new Array();
  if(nomClasse!="" || typeof element == 'object'){
    var children = element.getElementsByTagName('*');
    var exp_reg = new RegExp("(^|\\s)" + nomClasse + "(\\s|$)");
    for (var i = 0; i < children.length; i++) {
      var laClasse = (children[i].className)? children[i].className : "";
      if(laClasse != "" && (laClasse == nomClasse || laClasse.match(exp_reg))){
        resultat.push(children[i])
      }
    }
  }
  return resultat;
}
/*
 * Change these values to adapt font size amplitude
 *
 */
var min=8;
var max=36;
function increaseFontSize(modif) {
   var p = getElementsByClassName("MainColumn", document)[0].getElementsByTagName('*');
   for(i=0;i<p.length;i++) {
	if (p[i].style.fontSize && p[i].style.fontSize.indexOf("px")>=0) {
          var s = parseInt(p[i].style.fontSize.replace("px",""));
	}
	else {
	  s = 12;
	}
        if(s+modif<max && s+modif>min) {
          s += modif;
        }
        p[i].style.fontSize = s+"px";
   }
}

/*
 * Legacy Call
 *
 */
function changeFontSize(modif)
{
	/*
	t = t + modif;
	
	if(t>1.30) {t=1.30};

	if(t<0.75) {t=0.75};

	if(0.75<=t && t<=1.25)
	{
		document.getElementsByTagName('body')[0].style.fontSize = t + 'em';
	}
	*/
	if (modif > 0){
	  increaseFontSize(2);
	}
	else {
	  increaseFontSize(-2);
	}
}
//****** End Change Font Size functionnality ******


/*
Used to correct the sharepoint image publishing field
*/
function fixRichImageField()
{
	var allElements=document.getElementsByName("_fixRichImageField");
	
	for (var curElement = 0; curElement < allElements.length; curElement++)
	{
		try
		{
			if(allElements[curElement].innerHTML.toLowerCase().indexOf("</span>&nbsp;") != -1)
			{
				var content = allElements[curElement];
				content.firstChild.removeChild(content.firstChild.childNodes[1]);
			}
		}
		catch (e)
		{
		}
	}
}

