﻿function AboutVega()
{
	alert("mailto:" + "Info-vn" + "@" + "vegasoft.ws");
}

function cutStrExper( head, length )
{
   	var strLen = head.length;
	if (strLen > length)
	{
		head = head.substr(0, length) ;
        document.write(head + " ...");
		return;
	}
	else
	{
		document.write(head);		
	}
}

function updateClock() {
    var currentTime = new Date();

    var currentHours = currentTime.getHours();
    var currentMinutes = currentTime.getMinutes();
    var currentSeconds = currentTime.getSeconds();

    // Pad the minutes and seconds with leading zeros, if required
    currentMinutes = (currentMinutes < 10 ? "0" : "") + currentMinutes;
    currentSeconds = (currentSeconds < 10 ? "0" : "") + currentSeconds;

    // Choose either "AM" or "PM" as appropriate
    var timeOfDay = (currentHours < 12) ? "AM" : "PM";

    // Convert the hours component to 12-hour format if needed
    currentHours = (currentHours > 12) ? currentHours - 12 : currentHours;

    // Convert an hours component of "0" to "12"
    currentHours = (currentHours == 0) ? 12 : currentHours;

    // Compose the string for display
    var currentTimeString = currentHours + ":" + currentMinutes + ":" + currentSeconds + " " + timeOfDay;

    // Update the time display
    document.getElementById("clock").firstChild.nodeValue = currentTimeString;
}


function WriteCurrentDate() {
    d = new Array("Chủ Nhật", "Thứ Hai", "Thứ Ba", "Thứ Tư", "Thứ Năm", "Thứ Sáu", "Thứ Bảy");
    m = new Array(" 01", " 02", " 03", " 04", " 05", " 06", " 07", " 08", " 09", " 10", " 11", " 12");

    today = new Date();
    day = today.getDate();
    year = today.getYear();

    if (year < 2000)    // Y2K Fix, Isaac Powell
        year = year + 1900; // http://onyx.idbsu.edu/~ipowell

    end = " ";
    if (day == 1 || day == 21 || day == 31) end = " ";
    if (day == 2 || day == 22) end = " ";
    if (day == 3 || day == 23) end = " ";
    day += end;

    document.write(" ");
    document.write(d[today.getDay()]);
    document.write(', ');
    document.write(day + "/ " + m[today.getMonth()] + " ");
    document.write("/ " + year);
    document.write("");
}