var NS4 = (document.layers) ; // Detect Netscape
var IE4 = (document.all) ;    // Detect Explorer
var W3C = (typeof document.getElementById != "undefined") ;
var OUT = (!NS4 && !IE4 && !W3C) ;
var MAC = (navigator.userAgent.indexOf("Mac")>= 0); // Detect Macintosh
var counter = -1 ;// variable used in the data files
var changeSelects = false ;


// ===============================================================================
// CONSTRUCTOR :
// -------------------------------------------------------------------------------

function oArray(){
// Dynamic table constructor
   return this;
}
// -------------------------------------------------------------------------------
function oOption(txt,val){

  this.txt = txt ;
  this.val = val ;
}
// -------------------------------------------------------------------------------
function clearOptions(oSelect){
// Clear the drop-down list specified in parameter
   var longueur = oSelect.length ;
   for (var i = 0; i < longueur ; i++){
      oSelect.options[0] = null;
   }
}
// -------------------------------------------------------------------------------
function addOption(oSelect, txt, val) {
// Add an element to the drop-down list specified in parameter
   oOption   = new Option();
   oOption.text  = txt ;
   oOption.value = val ;
   oSelect.options[oSelect.options.length] = oOption;
}
// -------------------------------------------------------------------------------
function writeOptions(oSelectSource,oSelectTarget){
/*
**	This function will change dynamically the contents of the target drop-down list 
**	to add Options which are based on the object "oOption" found in the <data>.js file
*/
   if(OUT) return ; // Leave if version is less then V.3

   // Clear the targeted drop-down list
   clearOptions(oSelectTarget) ;

   // The target list is filled with data from the elements that have been defined 
   // in the <data>.js files included in the HTML file
   
   var j = 0 ;
   var test = true ;
   while(test != false){
	oElement = eval(oSelectSource.options[oSelectSource.selectedIndex < 0 ? 0 : oSelectSource.selectedIndex].value + "[" + j + "]") ;
	addOption(oSelectTarget, oElement.txt, oElement.val) ;
	j++ ;
	oElement = eval(oSelectSource.options[oSelectSource.selectedIndex < 0 ? 0 : oSelectSource.selectedIndex].value + "[" + j + "]") ;
	if(typeof oElement == "undefined") test = false ;
   }

	// Note: "VALUE" of the select option having called the function must be spelled 
	// exactly the same way as the name of the objects array created by the 
	// <data>.js file
	
   oSelectTarget.options[0].selected = true ;

}

// -------------------------------------------------------------------------------
function writeCountry(quellecountry, quelSelect){
//	This function carries out the selection of the drop-down list 

   var i = 0 ;
   var j = quelSelect.options.length;
   for(i = 0; i < j ; i++ ) {
   	if(quelSelect.options[i].text == quellecountry){
   		quelSelect.options[i].selected = true ;
   	}
   }
}


function writeProvince(quelleprovince, quelSelect){
//	This function carries out the selection of the drop-down list 

   var i = 0 ;
   var j = quelSelect.options.length;
   for(i = 0; i < j ; i++ ) {
   	if(quelSelect.options[i].value == quelleprovince){
   		quelSelect.options[i].selected = true ;
   	}
   }
}

// -------------------------------------------------------------------------------
function writeMethod(quellemethod, quelSelect){
//	This function carries out the selection of the drop-down list 

   var i = 0 ;
   var j = quelSelect.options.length;
   for(i = 0; i < j ; i++ ) {
   	if(quelSelect.options[i].value == quellemethod){
   		quelSelect.options[i].selected = true ;
   	}
   }
}

// -------------------------------------------------------------------------------
function spotLang(lang,oSelect){
   var i = 0 ;
   for(i = 0; i < oSelect.options.length ; i++ ) {
	if(oSelect.options[i].value == lang) oSelect.options[i].selected = true ;
   }
}
// -------------------------------------------------------------------------------
function setDDList(fromValue,toValue,oSelect_From,oSelect_To){

   var i = 0 ;
   for(i = 0; i < oSelect_From.options.length ; i++ ) {
	if(oSelect_From.options[i].text == fromValue) oSelect_From.options[i].selected = true ;
   }
   writeOptions(oSelect_From,oSelect_To);
   for(i = 0; i < oSelect_To.options.length ; i++ ) {
	if(oSelect_To.options[i].value == toValue) oSelect_To.options[i].selected = true ;
   }

}