// Nicolas - 2003-05-05 11:47:34 - V1.0.1
// Reno - 2003-03-13 09:28:19 - V1.0.0
//*******************************************************************************
//-------------------------------------------------------------------------------
// UTILS.JS
//-------------------------------------------------------------------------------
//*******************************************************************************
// ********************************** PRINT +
// The code by Captain <cerebrum@iname.com>
// Mead & Company, http://www.meadroid.com/wpm/
// fake print() for IE4.x
function printFrame(frame, onfinish) {
  if ( !frame ) frame = window;
//  if ( frame.document.readyState != "complete" &&
//       !confirm("Le document a imprimer n'est pas encore completement telecharge! Continuer l'impression?") )
//  {
//    if ( onfinish ) onfinish();
//    return;
//  }
  isMinIE4 = (document.all) ? 1 : 0;
  if (!isMinIE4) {
    frame.print();
    return;
  }
  if (printIsNativeSupport() ) {
    /* focus handling for this scope is IE5Beta workaround,
       should be gone with IE5 RTM.
    */
    var focused = document.activeElement; 
    frame.focus();
    frame.self.print();
    if ( onfinish ) onfinish();
    if ( focused && !focused.disabled ) focused.focus();
    return;
  }
  var eventScope = printGetEventScope(frame);
  var focused = document.activeElement;
  window.printHelper = function() {
    execScript("on error resume next: printWB.ExecWB 6, 1", "VBScript");
    printFireEvent(frame, eventScope, "onafterprint");
    printWB.outerHTML = "";
    if ( onfinish ) onfinish();
    if ( focused && !focused.disabled ) focused.focus();
    window.printHelper = null;
  }
  document.body.insertAdjacentHTML("beforeEnd",
    "<object id=\"printWB\" width=0 height=0 \
    classid=\"clsid:8856F961-340A-11D0-A96B-00C04FD705A2\"></object>");
  printFireEvent(frame, eventScope, "onbeforeprint");
  frame.focus();
  window.printHelper = printHelper;
  setTimeout("window.printHelper()", 0);
}
// helpers
function printIsNativeSupport() {
  var agent = window.navigator.userAgent;
  var i = agent.indexOf("MSIE ")+5;
  return parseInt(agent.substr(i)) >= 5 && agent.indexOf("5.0b1") < 0;
}
function printFireEvent(frame, obj, name) {
  var handler = obj[name];
  switch ( typeof(handler) ) {
    case "string": frame.execScript(handler); break;
    case "function": handler();
  }
}
function printGetEventScope(frame) {
  var frameset = frame.document.all.tags("FRAMESET");
  if ( frameset.length ) return frameset[0];
  return frame.document.body;
}
// ********************************** PRINT -

function MM_openBrWindow(theURL,winName,features) { //v2.0
  window.open(theURL,winName,features);
}

function MM_jumpMenu(targ,selObj,restore){ //v3.0
  eval(targ+".location='"+selObj.options[selObj.selectedIndex].value+"'");
  if (restore) selObj.selectedIndex=0;
}

function animages(iCollection,iFreq) {
	var i = 0;
	var max = iCollection.length-1;
	for (i = 0 ; i < max ; i++) {
		if (i == iTemoin) {
			obj = iCollection[i];
			obj.src = "images/" + iCollection[i+1]+".gif";
			i = i + 2;
			if (i < max) continue;
		}
		if (i != iTemoin) {
			obj = iCollection[i];
			obj.src = "images/" + iCollection[i+2]+".gif";
			i = i + 2;
			if (i < max) continue;
		}
	}
	iTemoin = iTemoin + 3;
	if ( iTemoin> (max - 1) ) iTemoin = 0;
	strTimer=iCollection;
	timer=window.setTimeout("animages(strTimer,iFreq)",iFreq);
}

// Get var of an object 
function getProperties(obj) 
{   
  var result = "";
  for (var i in obj)      
    result += i + ": " + obj[i] + "\n";
  return result;
}
