function gup( name )
{
  name = name.replace(/[\[]/,"\\\[").replace(/[\]]/,"\\\]");
  var regexS = "[\\?&]"+name+"=([^&#]*)";
  var regex = new RegExp( regexS );
  var results = regex.exec( window.location.href );
  if( results == null )
    return "";
  else
    return results[1];
}

function Left(str, n)
{
   if (n <= 0)
         return "";
   else if (n > String(str).length)
         return str;
   else
         return String(str).substring(0,n);
}

function unixtimetodate(unixtimestamp) {
	var theDate = new Date(unixtimestamp * 1000);
	var date = theDate.getDate();
        var day = theDate.getDay();
        var year = theDate.getFullYear();
        var hours = theDate.getHours(); 
        var minutes = theDate.getMinutes();
        var month = theDate.getMonth();
        var seconds = theDate.getSeconds();

        if (day == "1") { day = "Lundi"; }
        if (day == "2") { day = "Mardi"; }
        if (day == "3") { day = "Mercredi"; }
        if (day == "4") { day = "Jeudi"; }
        if (day == "5") { day = "Vendredi"; }
        if (day == "6") { day = "Samedi"; }
        if (day == "0") { day = "Dimanche"; }

        if (month == "0") { month = "Janvier"; }
        if (month == "1") { month = "Fevrier"; }
        if (month == "2") { month = "Mars"; }
        if (month == "3") { month = "Avril"; }
        if (month == "4") { month = "Mai"; }
        if (month == "5") { month = "Juin"; }
        if (month == "6") { month = "Juillet"; }
        if (month == "7") { month = "Aout"; }
        if (month == "8") { month = "Septembre"; }
        if (month == "9") { month = "Octobre"; }
        if (month == "10") { month = "Novembre"; }
        if (month == "11") { month = "D\351cembre"; }

        var output = day + " " + date + " " + month + " " + year + " " + hours + ":" + minutes + ":" + seconds 
	return output;
}

function unixtimetodate2(unixtimestamp) {
	var theDate = new Date(unixtimestamp * 1000);
	var date = theDate.getDate();
        var day = theDate.getDay();
        var year = theDate.getFullYear();
        var hours = theDate.getHours(); 
        var minutes = theDate.getMinutes();
        var month = theDate.getMonth();
        var seconds = theDate.getSeconds();


        if (month == "0") { month = "01"; }
        if (month == "1") { month = "02"; }
        if (month == "2") { month = "03"; }
        if (month == "3") { month = "04"; }
        if (month == "4") { month = "05"; }
        if (month == "5") { month = "06"; }
        if (month == "6") { month = "07"; }
        if (month == "7") { month = "08"; }
        if (month == "8") { month = "09"; }
        if (month == "9") { month = "10"; }
        if (month == "10") { month = "11"; }
        if (month == "11") { month = "12"; }

        var output = date + "/" + month + "/" + year;
	return output;
}

function calcDays(date1 , date2){
  var daysApart = Math.abs(Math.round((date1-date2)/86400000));
  return daysApart;
}

