/*---------------------------------------------------------*/
function setDayForm()
{
/* after http://www.digital-web.com/articles/javascript_date_object_with_user_methods/
   Lawrence O'Sullivan 
 */
language = findLanguage();

if ( language.split("-")[0] == 'nl' ){
   Date.prototype.DAYN   = ["zo", "ma", "di", "wo", "do","vr","za"];
   Date.prototype.MONTHN = ["jan", "feb", "mrt", "apr", "mei","jun","jul","aug","sep","okt","nov","dec"];

   Date.prototype.toLdate = function( doyear ){
    	wday = this.DAYN[ this.getDay() ];
      d    = this.getDate();
      mnam = this.MONTHN [ this.getMonth()];
	y    = this.getFullYear();

	if ( doyear == -1 ) y = '';
	d = "0" + d; d = d.slice(-2);

	return( wday + ' ' + d + ' ' + mnam + ' ' + y );
   };	

   Date.prototype.toLtime =  function(){
	m = this.getMinutes();
	h = this.getHours();

	m = "0" + m; h = "0" + h;
	return( h.slice(-2) + ":" + m.slice(-2) );
   };	

}
else if ( language.split("-")[0] == 'de' ){
   Date.prototype.DAYN   = ["Son", "Mon", "Die", "Mit", "Ton","Fre","Sam"];
   Date.prototype.MONTHN = ["Jan", "Feb", "Mae", "Apr", "Mai","Jun","Jul","Aug","Sep","Okt","Nov","Dec"];

   Date.prototype.toLdate = function( doyear ){
    	wday = this.DAYN[ this.getDay() ];
      d    = this.getDate();
      mnam = this.MONTHN [ this.getMonth()];
	y    = this.getFullYear();
	if ( doyear == -1 ) y = '';
	
	d = "0" + d; d = d.slice(-2);
	return( wday + ' ' + d + '. ' + mnam + ' ' + y );
   };	

   Date.prototype.toLtime = function(){
	m = this.getMinutes();
	h = this.getHours();

	m = "0" + m; h = "0" + h;
	return( h.slice(-2) + ":" + m.slice(-2) );
   };	

}
else if ( language.split("-")[0] == 'fr' ){

   Date.prototype.DAYN   = ["Dim", "Lun", "Mar", "Mer", "Jeu","Ven","Sam"];
   Date.prototype.MONTHN = ["Jan", "Fev", "Mar", "Avr", "Mai","Jun","Jul","Aou","Sep","Oct","Nov","Dec"];

   Date.prototype.toLdate = function( doyear ){
    	wday = this.DAYN[ this.getDay() ];
      d    = this.getDate();
      mnam = this.MONTHN [ this.getMonth()];
	y    = this.getFullYear();

	if ( doyear == -1 ) y = '';
	
	d = "0" + d; d = d.slice(-2);
	return( wday + ' ' + d + ' ' + mnam + ' ' + y );
   };	

   Date.prototype.toLtime = function(){
	m = this.getMinutes();
	h = this.getHours();

	m = "0" + m; h = "0" + h;
	return( h.slice(-2) + ":" + m.slice(-2) );
   };	




}else{
   Date.prototype.DAYN   = ["Sun", "Mon", "Tue", "Wed", "Thu","Fri","Sat"];
   Date.prototype.MONTHN = ["Jan", "Feb", "Mar", "Apr", "May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];

   Date.prototype.toLdate = function( doyear ){
    	wday = this.DAYN[ this.getDay() ];
      d    = this.getDate();
      mnam = this.MONTHN [ this.getMonth()];
	y    = this.getFullYear();
	
	if ( doyear == -1 ) y = '';
	d = "0" + d; d = d.slice(-2);

	return( wday + ', ' + mnam + ' ' + d + ', ' + y );
   };	

   Date.prototype.toLtime = function(){
	m = this.getMinutes();
	h = this.getHours();
	
	m = "0" + m; h = "0" + h;
	return( h.slice(-2) + ":" + m.slice(-2) );
   };	
}

/* For google event feed, no timezoneinfo, 
   2005-08-09T10:57:00(left out : -08:00). 
*/

Date.prototype.toStartMin = function(){
        /* Current date minus 60 days */
	this.setDate( this.getDate() - 60 );

        d    = this.getDate();
	  d    = "0" + d; d = d.slice(-2);

        mm   = this.getMonth();
        mm   = "0" + mm; mm  = mm.slice(-2);

	  y    = this.getFullYear();
	
	  m    = this.getMinutes();
        m    = "0" + m; m    = m.slice(-2);

	  h    = this.getHours();
        h    = "0" + h; h    = h.slice(-2);

	return( y + '-' + mm + '-' + d + 'T' + h + ':' + m + ':00' );
};

Date.prototype.toICSUTC = function(){
        /* Current date minus 60 days */

        d    = this.getUTCDate();
	  d    = "0" + d; d = d.slice(-2);

        mm   = this.getUTCMonth() + 1;
        mm   = "0" + mm; mm  = mm.slice(-2);

	  y    = this.getUTCFullYear();
	
	  m    = this.getUTCMinutes();
        m    = "0" + m; m    = m.slice(-2);

	  h    = this.getUTCHours();
        h    = "0" + h; h    = h.slice(-2);

	return( y + mm + d + 'T' + h + m + '00' );
};

Date.prototype.tofullday = function(){
        /* Current date minus 60 days */

        d    = this.getDate();
	  d    = "0" + d; d = d.slice(-2);

        mm   = this.getMonth() + 1;
        mm   = "0" + mm; mm  = mm.slice(-2);

	  y    = this.getFullYear();
	

	return( y + mm + d  );
};




}

/*---------------------------------------------------------*/
function findLanguage()
{
var language;

if ( navigator.userLanguage )return( navigator.userLanguage );
if ( navigator.systemLanguage )return( navigator.systemLanguage );
if ( navigator.language )return( navigator.language );
return( null );
}

