function refreshComboStyle(myCombo) { 
  if (myCombo.selectedIndex==0) {
    myCombo.style.fontStyle='italic';
	myCombo.style.fontWeight='normal';
  } else {
    myCombo.style.fontStyle='normal';
    myCombo.style.fontWeight='bold';
  }
  for (i=0;i<myCombo.length;i=i+1) {
    if (i==myCombo.selectedIndex) {
	  myCombo.options[i].style.fontWeight='bold';
	} else {
         myCombo.options[i].style.fontWeight='normal';
	}
	if (i==0) { 
	  myCombo.options[i].style.fontStyle='italic';
	} else {
	  myCombo.options[i].style.fontStyle='normal';			
	} 
     }
}

function refreshCombos (offsetYear) {
  myCombo=document.myForm.idDomain;
  myCombo.selectedIndex=0;
  refreshComboStyle(myCombo);
  myCombo=document.myForm.idPedagogy;
  myCombo.selectedIndex=0;
  refreshComboStyle(myCombo);
  myCombo=document.myForm.idTheme;
  myCombo.selectedIndex=0;
  refreshComboStyle(myCombo);
  myCombo=document.myForm.idTarget;
  myCombo.selectedIndex=0;
  refreshComboStyle(myCombo); 
  var now         = new Date();
  var monthnumber = now.getMonth();
  var monthday    = now.getDate();
  var year        = now.getYear();        
  document.myForm.d_SEARCHFROMDATE.selectedIndex=monthday;
  document.myForm.m_SEARCHFROMDATE.selectedIndex=monthnumber+1;
  document.myForm.y_SEARCHFROMDATE.selectedIndex=1+offsetYear;
  onChangeDate('SEARCHFROMDATE');
  return false;
}

function MM_preloadImages() { 
     var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
     var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
     if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}	
function onChangeDate(id){
  var yList=document.getElementById('y_'+id);
  var mList=document.getElementById('m_'+id);
  var dList=document.getElementById('d_'+id);
  if ( (yList.options[yList.selectedIndex].value=='') && (mList.options[mList.selectedIndex].value=='') && (dList.options[dList.selectedIndex].value=='')) {
    document.getElementById(id).value='';
  } else {
    document.getElementById(id).value=document.getElementById('y_'+id).value+'-'+document.getElementById('m_'+id).value+'-'+document.getElementById('d_'+id).value;
  }	
  return true;
}
	
function onSetDate(id){
  var yList=document.getElementById('y_'+id);
  var mList=document.getElementById('m_'+id);
  var dList=document.getElementById('d_'+id);
  myvalue=document.getElementById(id).value;
  if (myvalue!='') {     
    yList.value=myvalue.split('-')[0];
    mList.value=myvalue.split('-')[1];
    day=myvalue.split('-')[2];
    dList.value=day.split(' ')[0];	
  } else {
    yList.selectedIndex=0;
    mList.selectedIndex=0;	
    dList.selectedIndex=0;
  }	 		 
}

function set(id,val){
  if (document.getElementById(id)) document.getElementById(id).value=val;    
}

function disableCK(id){
  document.getElementById(id).checked=false; 
  document.getElementById(id).disabled=true;    
}

function enableCK(id){
  document.getElementById(id).disabled=false;
}
