// JavaScript Document

/*var starttime = new Date().getTime();
window.onload=function() {
 var loading_time = new Date().getTime()-starttime;
 var loader = document.getElementById('loader');
 loader.style.visibility = 'visible';
 if(loading_time){
 	loader.style.visibility = 'hidden';
 }
 //alert('Webpage loading time in ' + loading_time + 'ms - milisecond');
}
*/

 

function ShowPicture(id,Source) {
	if (Source=="1"){
	if (document.layers) document.layers[''+id+''].visibility = "show"
	else if (document.all) document.all[''+id+''].style.visibility = 			"visible"
	else if (document.getElementById) document.getElementById(''+id+''	).style.visibility = "visible"
	}
	else
	if (Source=="0"){
	if (document.layers) document.layers[''+id+''].visibility = "hide"
	else if (document.all) document.all[''+id+''].style.visibility = "hidden"
	else if (document.getElementById) document.getElementById(''+id+''	).style.visibility = "hidden"
	}
	}

function MM_reloadPage(init) {  //reloads the window if Nav4 resized
  if (init==true) with (navigator) {if ((appName=="Netscape")&&(parseInt(appVersion)==4)) {
    document.MM_pgW=innerWidth; document.MM_pgH=innerHeight; onresize=MM_reloadPage; }}
  else if (innerWidth!=document.MM_pgW || innerHeight!=document.MM_pgH) location.reload();
}
MM_reloadPage(true);

function MM_openBrWindow(theURL,winName,features) { //v2.0
  window.open(theURL,winName,features);
}
//SHOW UNDERCONSTRUCTION NOTICE
function ShowNotice(id,Source) {
	if (Source=="1"){
	if (document.layers) document.layers[''+id+''].visibility = "show"
	else if (document.all) document.all[''+id+''].style.visibility = 			"visible"
	else if (document.getElementById) document.getElementById(''+id+''	).style.visibility = "visible"
	}
	else
	if (Source=="0"){
	if (document.layers) document.layers[''+id+''].visibility = "hide"
	else if (document.all) document.all[''+id+''].style.visibility = "hidden"
	else if (document.getElementById) document.getElementById(''+id+''	).style.visibility = "hidden"
	}
	}


function ShowNoticeS(){
	var undercons = document.getElementById('undercons');
	aseanaavp.style.left = 100 + "px";
    aseanaavp.style.top  = 800 + "px";
	undercons.style.display = 'block';
	
}

function closeNoticeS(){
	var undercons = document.getElementById('undercons');
	undercons.style.display = 'none';
}

function ViewAVP(){
	DarkenPage();
	ShowAvp();
}

function ShowAvp(){
	var aseanaavp = document.getElementById('aseanaavp');
	// w is a width of the news panel
    w = 800;
    // h is a height of the news panel
    //h = 750;

    // get the x and y coordinates to center the news panel
    xc = Math.round((document.body.clientWidth/2)-(w/2))
    //yc = Math.round((document.body.clientHeight/2)-(h/2))

    // show the newsletter panel
    aseanaavp.style.left = xc + "px";
    aseanaavp.style.top  = 10 + "px";
    aseanaavp.style.display = 'block';
}


function ViewNews(n)
{
    DarkenPage();
    ShowNews(n);
}

function ShowNews(n)
{
	
    var newsletter_panel = document.getElementById('newsletter_panel' + n);
	
    // w is a width of the news panel
    w = 600;
    // h is a height of the news panel
    //h = 750;

    // get the x and y coordinates to center the news panel
    xc = Math.round((document.body.clientWidth/2)-(w/2))
    //yc = Math.round((document.body.clientHeight/2)-(h/2))

    // show the newsletter panel
    newsletter_panel.style.left = xc + "px";
    newsletter_panel.style.top  = 10 + "px";
    newsletter_panel.style.display = 'block';
}

function CloseNews(n)
{
    var newsletter_panel = document.getElementById('newsletter_panel' + n);

    
    newsletter_panel.style.display = 'none';
	LightenPage();
}

function CloseNews1()
{
    var newsletter_panel = document.getElementById('newsletter_panel' + n);

    
    newsletter_panel.style.display = 'none';
	LightenPage();
}

// this function puts the dark screen over the entire page
function DarkenPage()
{
    var page_screen = document.getElementById('page_screen');
    page_screen.style.height = document.body.parentNode.scrollHeight + 'px';
    page_screen.style.display = 'block';
}

// this function removes the dark screen and the page is light again
function LightenPage()
{
    var page_screen = document.getElementById('page_screen');
    page_screen.style.display = 'none';
}



function news_navi(xtrans,curr)
{
	newsArray = new Array("1","2","3");
	numNews = 3;
	currNews = curr;
	var x;
	CloseNews(currNews);
	currNews = currNews + xtrans;
	if (currNews > numNews)
	{ currNews = 1; }
	if (currNews == 0)
	{ currNews = numNews; }
	x = newsArray[currNews-1];
	
	ViewNews(x);
	x=0;
}

function ViewAVP(){
	DarkenPage();
	ShowAVP();
}

function ShowAVP(){
	var aseanaavp = document.getElementById('aseanaavp');
	// w is a width of the news panel
    w = 800;
    // h is a height of the news panel
    //h = 750;

    // get the x and y coordinates to center the news panel
    xc = Math.round((document.body.clientWidth/2)-(w/2))
    //yc = Math.round((document.body.clientHeight/2)-(h/2))

    // show the newsletter panel
    aseanaavp.style.left = xc + "px";
    aseanaavp.style.top  = 10 + "px";
    aseanaavp.style.display = 'block';
}





//=======================
//
// BANNER SLIDESHOW


var slideshowMergeAnimate = new Array();
var slideshowMergeTimer   = new Array();
var slideshowMergeCount   = new Array();
var slideshowMergeImages  = new Array();

//======================

function slideshowMerge(id,cl,imageArray,fadeInterval,holdTime)
{

  for(i=0;i<imageArray.length;i++)
  {
    var imgLoad = new Image();
    imgLoad.src = imageArray[i];
  }

  if(cl)
    cl = ' class="'+cl+'"';

  document.write('<div id="'+id+'"'+cl+' style="position:relative">');
  document.write('<img id="'+id+'img1" onload="slideshowMergeRun(\''+id+'\')"/>');
  document.write('<img id="'+id+'img2" style="position:absolute; top:0px; left:0px;display:none;"/></div>');
  
  slideshowMergeCount[id]   = 0;
  slideshowMergeImages[id]  = imageArray;
  slideshowMergeAnimate[id] = 'run';
  slideshowMergeTimer[id]   = setInterval('slideshowMergeAnimation(\''+id+'\',\''+holdTime+'\');',fadeInterval);

}

//======================

function slideshowMergeAnimation(id,holdTime)
{
  if(slideshowMergeAnimate[id]=='run')
  {
    var obj1 = document.getElementById(id+'img1');
    var obj2 = document.getElementById(id+'img2');

    var opa  = slideshowMergeCount[id]%100;

    if(opa==0)
    {  
      if(obj1.src)
      {
        slideshowMergeAnimate[id] = 'hold';
        setTimeout('slideshowMergeRun(\''+id+'\')',holdTime);
        obj2.src = obj1.src;
        obj2.style.display = 'block';
      }
    }
    else if(opa==1)
    {
      slideshowMergeAnimate[id] = 'load';
      obj1.src = slideshowMergeImages[id][Math.floor(slideshowMergeCount[id]/100)%slideshowMergeImages[id].length];
    }
      
    obj1.style.opacity = (opa/100).toString();
    obj1.style.filter  = "alpha(opacity="+opa.toString()+")";
    obj2.style.opacity = ((100-opa)/100).toString();
    obj2.style.filter  = "alpha(opacity="+(100-opa).toString()+")";
     
    slideshowMergeCount[id]++;
    
    if(slideshowMergeCount[id]==(slideshowMergeImages[id].length*100))
      slideshowMergeCount[id]=0;
  }
}

//======================

function slideshowMergeRun(id)
{
  slideshowMergeAnimate[id] = 'run';
}

//======================
 
 function ViewFeat(){
	DarkenPage();
	ShowFeat();
}

function ShowFeat(){
	
	var featproj = document.getElementById('featproj');
	
	
	// w is a width of the news panel
    w = 600;
    // h is a height of the news panel
    //h = 750;

    // get the x and y coordinates to center the news panel
    xc = Math.round((document.body.clientWidth/2)-(w/2));
    //yc = Math.round((document.body.clientHeight/2)-(h/2))

    // show the newsletter panel
	featproj.style.backgroundColor= "#ffffff";
	
    featproj.style.left = xc + "px";
    featproj.style.top  = 10 + "px";
    featproj.style.display = 'block';
}

//====================================

//=====================================

function ViewEvents(n){
	DarkenPage();
	ShowEvents(n);
}

function ShowEvents(n){
	
	var aseanaevents = document.getElementById('aseanaevents' + n);
	
	
	// w is a width of the news panel
    w = 600;
    // h is a height of the news panel
    //h = 750;

    // get the x and y coordinates to center the news panel
    xc = Math.round((document.body.clientWidth/2)-(w/2));
    //yc = Math.round((document.body.clientHeight/2)-(h/2))

    // show the newsletter panel
	aseanaevents.style.backgroundColor= "#ffffff";
	
    aseanaevents.style.left = xc + "px";
    aseanaevents.style.top  = 10 + "px";
    aseanaevents.style.display = 'block';
}

function events_navi(xtrans,curr)
{
	eventsArray = new Array("1","2","3");
	numEvents = 3;
	currEvents = curr;
	var x;
	CloseEvents(currEvents);
	currEvents = currEvents + xtrans;
	if (currEvents > numEvents)
	{ currEvents = 1; }
	if (currEvents == 0)
	{ currEvents = numEvents; }
	x = eventsArray[currEvents-1];
	
	ViewEvents(x);
	x=0;
}

function CloseEvents(n)
{
    var aseanaevents = document.getElementById('aseanaevents' + n);

    
   aseanaevents.style.display = 'none';
	LightenPage();
}

function CloseEvents1()
{
    var aseanaevents = document.getElementById('aseanaevents' + n);

    
    aseanaevents.style.display = 'none';
	LightenPage();
}
