﻿function getMyDate(language)
{	
	var t = new Date()
	var ampme = 'AM'
	var ampmv = 'Sáng'
	var theHours = t.getHours()
	if (theHours >= 12)
	{	//theHours -= 12
		ampme = 'PM'
		ampmv = 'Chiều'
	} 
	switch(language)
	{			
		case 1: return '&nbsp;&nbsp;' + (getDayName(t.getDay())+' :: '+getMonthName(t.getMonth() + 1)+' '+t.getDate()+' :: '+t.getYear()+' | '+theHours+' : '+t.getMinutes()+' '+ampme)
		case 2: return (t.getDate()+'-'+(t.getMonth() + 1)+'-'+t.getYear()+' '+theHours+':'+t.getMinutes()+' '+ampmv)
		case 3: return (t.getYear()+'&#24180; ' + (t.getMonth() + 1)+'&#26376; ' + getDayNameJapan(t.getDay())+' ' + theHours+' : '+t.getMinutes()+' '+ampme)
		case 5: return '&nbsp;&nbsp;' + (getDayNameFrance(t.getDay())+', le '+t.getDate()+' '+getMonthNameFrance(t.getMonth() + 1)+' '+t.getYear()+' | '+theHours+' : '+t.getMinutes()+' '+ampme)
	}
}

function getCurDate()
{	
	var t = new Date()
	document.write('('+t.getDate()+'-'+(t.getMonth() + 1)+'-'+t.getYear()+')')
}

function getMonthName(whatmonth){
	switch(whatmonth){
		case 1: return 'January'
		case 2: return 'February'
		case 3: return 'March'
		case 4: return 'April'
		case 5: return 'May'
		case 6: return 'June'
		case 7: return 'July'
		case 8: return 'August'
		case 9: return 'September'
		case 10: return 'October'
		case 11: return 'November'
		case 12: return 'December'
	}
}

function getMonthNameFrance(whatmonth){
	switch(whatmonth){
		case 1: return 'Janvier'
		case 2: return 'Février'
		case 3: return 'Mars'
		case 4: return 'Avril'
		case 5: return 'Mai'
		case 6: return 'Juin'
		case 7: return 'Juillet'
		case 8: return 'Août'
		case 9: return 'Septembre'
		case 10: return 'Octobre'
		case 11: return 'Novembre'
		case 12: return 'Décembre'
	}
}

function getDayNameJapan(whatday)
{	switch(whatday)
	{	case 0: return '&#26085;&#26332;&#26085;'
		case 1: return '&#26376;&#26332;&#26085;'
		case 2: return '&#28779;&#26332;&#26085;'
		case 3: return '&#27700;&#26332;&#26085;'
		case 4: return '&#26408;&#26332;&#26085;'
		case 5: return '&#37329;&#26332;&#26085;'
		case 6: return '&#22303;&#26332;&#26085;'
	}	
}

function getDayNameFrance(whatday)
{	switch(whatday)
	{	case 0: return 'Dimanche'
		case 1: return 'Lundi'
		case 2: return 'Mardi'
		case 3: return 'Mercredi'
		case 4: return 'Jeudi'
		case 5: return 'Vendredi'
		case 6: return 'Samedi'
	}	
}

function getDayName(whatday)
{	switch(whatday)
	{	case 0: return 'Sunday'
		case 1: return 'Monday'
		case 2: return 'Tuesday'
		case 3: return 'Wednesday'
		case 4: return 'Thursday'
		case 5: return 'Friday'
		case 6: return 'Saturday'
	}	
}

function getObj(name) 
{   
	if (document.getElementById) { return document.getElementById(name); }
	    else if (document.all)       { return document.all[name]; }
	    else if (document.layers)    { return document.layers[name]; }
}
	
function writedate(language)
{	
	getObj('datetime').innerHTML = getMyDate(language)+"&nbsp; &nbsp;"
}

