function link_render_invent ( val, id )
{		
		return '<a href="#">' + val + '</a>';
}
function link_render_autres ( val, id )
{		
		return '<a href="#">' + 'autres' + '</a>';
}

function cell_clicked_callback_invent ( g, cell, x, y, val )
{      
       if(y<3){
         return false;
       }
       if((y==5)||(y==7)){/*désactiver jaugeages et tarages*/
         
         return false;
       }
	var r = g.get_row(x);
       var val1=r[0];
       invent(val1, y-2);
       return true;  
}
function link_render_invano ( val, id )
{		
              if(val!='-'){
        		return '<a href="#">' + val + '</a>';
		}else{
		       return '____';
              }
}
function link_down_adcp ( val, id )
{		
              if(val!=''){
        	//	return '<a href="' + val + '">Download' + '</a>';
			    return '<a href="#">Download' + '</a>';
		}else{
		       return '____';
              }
}
function cell_clicked_callback_adcp ( g, cell, x, y, val )
{
       if((y==6)&&(val!='')) 
         {
	     var r = g.get_row(x);       
 	     download(r[1], val);	
         }
       return true;  
}

function cell_clicked_callback_invano ( g, cell, x, y, val )
{
       if(val!='-') 
         {
            var eclat=val.split('\'');
	     var anod=parseInt(eclat[0], 10);
	     if(y==0){
              var anof=anod+9;
            } else {var anof=anod;}
	     graph(anod, anof);	
         }
       return true;  
}
// This function gets called when the end-user clicks on some date.
function selected(cal, date) {
  cal.sel.value = date; // just update the date in the input field.
  if (cal.dateClicked && (cal.sel.id == "sel1" || cal.sel.id == "sel3"))
    // if we add this call we close the calendar on single-click.
    // just to exemplify both cases, we are using this only for the 1st
    // and the 3rd field, while 2nd and 4th will still require double-click.
    cal.callCloseHandler();
}

// And this gets called when the end-user clicks on the _selected_ date,
// or clicks on the "Close" button.  It just hides the calendar without
// destroying it.
function closeHandler(cal) {
  cal.hide();                        // hide the calendar
//  cal.destroy();
  _dynarch_popupCalendar = null;
}

// This function shows the calendar under the element having the given id.
// It takes care of catching "mousedown" signals on document and hiding the
// calendar if the click was outside.
function showCalendar(id, format, showsTime, showsOtherMonths, idsource) {
  var elcible = document.getElementById(id);
//  write(idsource);
 var el = document.getElementById(idsource);
//  write(el);
  if (_dynarch_popupCalendar != null) {
    // we already have some calendar created
    _dynarch_popupCalendar.hide();                 // so we hide it first.
  } else {
    // first-time call, create the calendar.
    var cal = new Calendar(1, null, selected, closeHandler);
    // uncomment the following line to hide the week numbers
    // cal.weekNumbers = false;
    if (typeof showsTime == "string") {
      cal.showsTime = true;
      cal.time24 = (showsTime == "24");
    }
    if (showsOtherMonths) {
      cal.showsOtherMonths = true;
    }
    _dynarch_popupCalendar = cal;                  // remember it in the global var
    cal.setRange(1900, 2070);        // min/max year allowed.
	cal.weekNumbers = false; // do not display week numbers
    cal.create();
  }
  _dynarch_popupCalendar.setDateFormat(format);    // set the specified date format
  _dynarch_popupCalendar.parseDate(elcible.value);      // try to parse the text in field
  _dynarch_popupCalendar.sel = elcible;                 // inform it what input field we use

  // the reference element that we pass to showAtElement is the button that
  // triggers the calendar.  In this example we align the calendar bottom-right
  // to the button.
  _dynarch_popupCalendar.showAtElement(el, "Br");        // show the calendar

  return false;
}

function clearcoors (form) {
    for (var l=0; l<form.elements.length; l++) {
	if((form.elements[l].name=='p_north')||(form.elements[l].name=='p_south')||
          (form.elements[l].name=='p_west')||(form.elements[l].name=='p_east')){
          form.elements[l].value='';
       } 
    }  

   return false;
}
function addslashes(ch) {
ch = ch.replace(/\\/g,"\\\\");
ch = ch.replace(/\'/g,"\\'");
ch = ch.replace(/\"/g,"\\\"");
return ch
}
