// local ecobuilding js
//------------------------------------------------------------------------------
//functions to fill a select for a date's choice
//------------------------------------------------------------------------------
function fill_select(data_tab,empty_value,form_name,select_name) {
  var select_index = 0;
  document.forms[form_name].elements[select_name].length=0;
  for(var j=0; j<data_tab.length; j++) {
  	document.forms[form_name].elements[select_name].options[select_index] = new Option(data_tab[j][1],data_tab[j][0]);
    select_index++;
  }
  if(select_index == 0){
  	document.forms[form_name].elements[select_name].options[select_index] = new Option(empty_value,0);
  }
}

//--------------- functions to get the Y-coordinate of an anchor <a> -----------
function getY(MyObject) {
  if (MyObject.offsetParent) 
   return (MyObject.offsetTop + getY(MyObject.offsetParent));// ;
  else 
   return (MyObject.offsetTop);
}
function getYAnchor(ID_Anchor,Name_Anchor) {
  var ie4 = (document.all)? true:false;	  						//IE 4
  var dom = (document.getElementById)? true:false;	  //DOM
  AnchorY = 0;
  if (dom) {
    pos = document.getElementById(ID_Anchor);
    AnchorY = getY(pos);
  }
  else if (ie4) {
    pos = document.all[ID_Anchor];
    AnchorY = getY(pos);
  }
  return AnchorY
}

//xDisplay is defined twice in x_core.js and xDHTML.js !!! i create xDisplay_
function xDisplay_(sId) {
  var ele = xGetElementById(sId);
  if(ele.style) {
		ele.style.display = 'block';
	}
  else if(document.layers) {
		ele.visibility = 'block';
	}
	else {
		alert("ERROR: <element> [" + hide + "] is missing");
	}

}


