﻿//Tan viet
function aboutcase(lang) {
    if (lang=='vi-VN')
        window.open('/vi-VN/1/aboutcase/details.case', '_blank', 'height=500px,width=400px,status=no,toolbar=no,location=no');
    else
        window.open('/en-US/38/aboutcase/details.case', '_blank', 'height=500px,width=400px,status=no,toolbar=no,location=no');
}
function clock(lang) {
    if (lang == 'vi-VN') {
        var dayNames = new Array("Chủ nhật", "Thứ hai", "Thứ ba", "Thứ tư", "Thứ năm", "Thứ sáu", "Thứ bảy");
        var now = new Date();
        var hour = now.getHours();
        var minute = now.getMinutes();
        var second = now.getSeconds();
        //document.write(dayNames[now.getDay()] + " | " + ((now.getDate() < 10) ? "0" : "") + now.getDate() + "/" + ((now.getMonth() + 1 < 10) ? "0" : "") + (now.getMonth() + 1) + "/" + now.getFullYear() + " | " + ((hour < 10) ? "0" : "") + ((hour > 12) ? hour - 12 : hour) + ":" + ((minute < 10) ? "0" : "") + minute + ":" + ((second < 10) ? "0" : "") + second);
        document.getElementById("clock").innerHTML = dayNames[now.getDay()] + " | " + ((now.getDate() < 10) ? "0" : "") + now.getDate() + "/" + ((now.getMonth() + 1 < 10) ? "0" : "") + (now.getMonth() + 1) + "/" + now.getFullYear() + " | " + ((hour < 10) ? "0" : "") + ((hour > 12) ? hour - 12 : hour) + ":" + ((minute < 10) ? "0" : "") + minute + ":" + ((second < 10) ? "0" : "") + second + ((hour < 12) ? " AM" : " PM");
        setTimeout("clock('" + lang + "')", 1000);
    }
    else {
        var dayNames = new Array("Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday");
        var now = new Date();
        var hour = now.getHours();
        var minute = now.getMinutes();
        var second = now.getSeconds();
        //document.write(dayNames[now.getDay()] + " | " + ((now.getDate() < 10) ? "0" : "") + now.getDate() + "/" + ((now.getMonth() + 1 < 10) ? "0" : "") + (now.getMonth() + 1) + "/" + now.getFullYear() + " | " + ((hour < 10) ? "0" : "") + ((hour > 12) ? hour - 12 : hour) + ":" + ((minute < 10) ? "0" : "") + minute + ":" + ((second < 10) ? "0" : "") + second);
        document.getElementById("clock").innerHTML = dayNames[now.getDay()] + " | " + ((now.getMonth() + 1 < 10) ? "0" : "") + (now.getMonth() + 1) + "/" + ((now.getDate() < 10) ? "0" : "") + now.getDate() + "/" + now.getFullYear() + " | " + ((hour < 10) ? "0" : "") + ((hour > 12) ? hour - 12 : hour) + ":" + ((minute < 10) ? "0" : "") + minute + ":" + ((second < 10) ? "0" : "") + second + ((hour < 12) ? " AM" : " PM");
        setTimeout("clock('" + lang + "')", 1000);
        
    }
}

//////////////////////////////////////search Menu
function SearchOnFocus(field) {
    if (field.value == 'Từ khóa tìm kiếm' || field.value=='Key word') { field.value = ''; }
}
function SearchOnBlur(field,lang) {
    if (field.value == '' && lang == 'vi-VN') { field.value = 'Từ khóa tìm kiếm'; }
    else if (field.value == '' && lang == 'en-US') { field.value = 'Key word'; }
}
function Trim(iStr) {
    while (iStr.charCodeAt(0) <= 32) {
        iStr = iStr.substr(1);
    }

    while (iStr.charCodeAt(iStr.length - 1) <= 32) {
        iStr = iStr.substr(0, iStr.length - 1);
    }

    return iStr;
}

function CheckValue(o) {
    if (Trim(o.value) == 'Từ khóa tìm kiếm' || Trim(o.value) == 'Key word' || Trim(o.value) == '') {
        o.value = '';
        o.focus();
        return false;
    }
    else {
        //document.Search.submit();
        return true;
    }
}

