﻿// JavaScript Document
function fnc_OpenCollection(p_Item,p_Total)
{

		var i;
		var tmp;
		
		if(p_Item<=p_Total && p_Item>=0)
		{
		
				for(i=0;i<=p_Total;i++)
				{
					if(i==p_Item)
						tmp = new Spry.Widget.CollapsiblePanel("CollapsiblePanel"+i, {contentIsOpen:true});
					else
						tmp = new Spry.Widget.CollapsiblePanel("CollapsiblePanel"+i, {contentIsOpen:false});
				}
		}
		else
			{
			for(i=0;i<=p_Total;i++)
			tmp = new Spry.Widget.CollapsiblePanel("CollapsiblePanel"+i, {contentIsOpen:false});
		}
}
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 timer(ngon_ngu)
{
var weekday=new Array(7);
var dayname = new Array("Chủ Nhật", "Thứ Hai", "Thứ Ba", "Thứ Tư", "Thứ Năm", "Thứ Sáu", "Thứ Bảy");
var dayname1 = new Array("Sunday", "Monday", "Thursday", "Wednesday", "Thursday", "Friday", "Saturday");
var monthname = new Array("01", "02", "03", "04", "05", "06", "07", "08", "09", "10", "11", "12");

var now = new Date();
var daynum = now.getDay();
var day = dayname[daynum];
var day1=dayname1[daynum];
if (now.getDate() < 10)
	date = "0" + now.getDate();
else
	date = now.getDate();
monthnum = now.getMonth();
month = monthname[monthnum];

	if(ngon_ngu=="eng") 
	{
		document.write(""+day1+", "+date+"/"+month+"/"+now.getFullYear());	
	}
	else
	{
		document.write(""+day+", Ngày "+date+"/"+month+"/"+now.getFullYear());	
	}
}
function hidediv(pass) 
{ 
    var divs = document.getElementsByTagName('div'); 
    for(i=0;i<divs.length;i++)
    { 
        if(divs[i].id.match(pass))
        {//if they are 'see' divs 
            if (document.getElementById) // DOM3 = IE5, NS6 
            divs[i].style.visibility="hidden";// show/hide 
            else     
            if (document.layers) // Netscape 4 
            document.layers[divs[i]].display = 'hidden'; 
            else // IE 4 
            document.all.hideshow.divs[i].visibility = 'hidden'; 
        } 
    }   
} 

function showdiv(pass) 
{ 
    var divs = document.getElementsByTagName('div'); 
   for(i=0;i<divs.length;i++)
   { 
    if(divs[i].id.match(pass))
    { 
     if (document.getElementById) 
        divs[i].style.visibility="visible"; 
     else 
       if (document.layers) // Netscape 4 
        document.layers[divs[i]].display = 'visible'; 
       else // IE 4 
       document.all.hideshow.divs[i].visibility = 'visible'; 
    } 
   } 
} 
