﻿
function AdjustColumnsHeight()
{
    // get a reference to the three DIVS that make up the columns
    var centerCol = window.document.getElementById('centercol');
    var leftCol = window.document.getElementById('leftcol');
    var rightCol = window.document.getElementById('rightcol');
    // calculate the max height
    var hCenterCol = centerCol.offsetHeight;
    var hLeftCol = leftCol.offsetHeight;
    var hRightCol = rightCol.offsetHeight;
    var maxHeight = Math.max(hCenterCol, Math.max(hLeftCol, hRightCol));
    // set the height of all 3 DIVS to the max height
    centerCol.style.height = maxHeight + 'px';
    leftCol.style.height = maxHeight + 'px';
    rightCol.style.height = maxHeight + 'px';            
    // Show the footer
    window.document.getElementById('footer').style.visibility = 'inherit';
}
//window.onload = function() { AdjustColumnsHeight(); }    

function showDisclaimer()
{
    alert("The appearance of hyperlinks does not constitute endorsement by the U. S. Forces Korea, or the Department of Defense, of the external Web site, or the information, products or services contained therein. \nFor other than authorized activities such as military exchanges and Morale, Welfare and Recreation (MWR) sites, the U. S. Forces Korea does not exercise any editorial control over the information you may find at these locations. \nSuch links are provided consistent with the stated purpose of the Web site.  ");
}

function showDisclaimerURL(url)
{
    showDisclaimer();
    window.location = url;
}

function goToNews(imageIndex){
    slider1 = $find("behaviorID");
    slider1._currentIndex = imageIndex;
    slider1.setCurrentImage();
    setSlideIndexIcon(imageIndex);
}

function pageLoad(){  
    var slider1;   
    slider1 = $find("behaviorID");  
    slider1.add_slideChanging(onSlideChanging);   
}
 
function onSlideChanging(sender, args){  
    currentSlideIndex = args.get_slideIndex();   
    //Do what you want using this index
    setSlideIndexIcon(currentSlideIndex);
 } 
 
function setSlideIndexIcon(index)
{
    //reset
    document.btnNews1.src = 'Images/icon_usfktoday_index.gif';
    document.btnNews2.src = 'Images/icon_usfktoday_index.gif';
    document.btnNews3.src = 'Images/icon_usfktoday_index.gif';
    document.btnNews4.src = 'Images/icon_usfktoday_index.gif';
    document.btnNews5.src = 'Images/icon_usfktoday_index.gif';
    document.btnNews6.src = 'Images/icon_usfktoday_index.gif';
            
    switch (index){
        case 0: 
            document.btnNews1.src = 'Images/icon_usfktoday_indexb.gif';
            break;
        case 1: 
            document.btnNews2.src = 'Images/icon_usfktoday_indexb.gif';
            break;
        case 2: 
            document.btnNews3.src = 'Images/icon_usfktoday_indexb.gif';
            break;
        case 3: 
            document.btnNews4.src = 'Images/icon_usfktoday_indexb.gif';
            break;
        case 4: 
            document.btnNews5.src = 'Images/icon_usfktoday_indexb.gif';
            break;
        case 5: 
            document.btnNews6.src = 'Images/icon_usfktoday_indexb.gif';
            break;
    }
}


function toggle_div(id) {
   var e = document.getElementById(id);
   if(e.style.display == 'block')
      e.style.display = 'none';
   else
      e.style.display = 'block';
}

//World Clock Code //
var mn = ["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"]
function d2(vlu) {
	return ((vlu > 9)? vlu: "0"+vlu)
}
function run_clock() {
	var dst = 2 //daynight savings... either 1 (fall) or 2 (spring) needs to be updated twice a year.
	var ct = new Date()
	var gmt = new Date()
	var kst = new Date()
	var hi = new Date()
	var dc = new Date()
	var offst = ct.getTimezoneOffset()
	var tms = gmt.getTime() + (offst * 60000)
	gmt.setTime(tms)
	kst.setTime(tms + (9 * 3600 * 1000))
	dc.setTime(tms - ((6-dst) * 3600 * 1000))
	hi.setTime(tms - (10 * 3600 * 1000))
	tgmt.innerHTML = gmt.getDate()+" "+mn[gmt.getMonth()]+":"+d2(gmt.getHours())+d2(gmt.getMinutes())+"Z"
	tkst.innerHTML = kst.getDate()+" "+mn[kst.getMonth()]+":"+d2(kst.getHours())+d2(kst.getMinutes())+"I"
	thi.innerHTML = hi.getDate()+" "+mn[hi.getMonth()]+":"+d2(hi.getHours())+d2(hi.getMinutes())+"W"
	tdc.innerHTML = dc.getDate()+" "+mn[dc.getMonth()]+":"+d2(dc.getHours())+d2(dc.getMinutes())+"R"

	eMin = setTimeout("run_clock()", 60000)
}
//EF World Clock Code //
