// JavaScript Document

// Dreamweaver Rollover Functions

function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}

  function openCourse(location){
		var pageName = "";
		var urlString = "";
        var features = '';	
        var isNetscape = (navigator.appName == "Netscape");		
	// check which language page redirect to	
		switch (location){
		  case "hk":
			pageName = "../../course_schedule/hk.html";
			break;
		  case "macau":
			pageName = "../../course_schedule/macau.html";
			break;

		  default: pageName = "../../course_schedule/hk.html";
		}
		
		features = "toolbar = no, resizable = yes, scrollbars = yes,";
        
		if (isNetscape)
                features += ',screenX= 5 screenY= 60';
        else
                features += ',left= 15 top= 60';
		
		features += ",width = 720, height = 560, name = dwin";
		
		dWin = window.open(pageName , "dwin", features);

		dWin.focus();
	}

// _JavaScript Document
//-- Functions for language version switching --//
// -- List of functions (7 in total) --//
// -- 1/ initLangDir(); 
// -- 2/ switchLang_en2tc(); 
// -- 3/ switchLang_en2sc(); 
// -- 4/ switchLang_tc2en(); 
// -- 5/ switchLang_tc2sc(); 
// -- 6/ switchLang_sc2en(); 
// -- 7/ switchLang_sc2tc(); 
//******************** Begin ********************//
//-- intialize the names of the directories of difference language versions --//
function initLangDir(){
  tcDir = "/tc/";
  enDir = "/en/";
  scDir = "/sc/";
}
//-- Switch from English to Traditional Chinese--//
function switchLang_en2tc(){
  initLangDir (); 
// var h = new String(parent.document.location.host);
 var s = new String(parent.document.location);
// window.alert(h);
// window.alert(s);
  s=s.replace(enDir,tcDir);
// window.alert(s);
  self.location.replace(s);
}
//-- Switch from English to Simplified Chinese--//
function switchLang_en2sc(){
 initLangDir (); 
 var s = new String(parent.document.location);
 s=s.replace(enDir,scDir);
 self.location.replace(s);
 
}
//-- Switch from Traditional Chinese to English --//
function switchLang_tc2en(){
 initLangDir (); 
 var s = new String(parent.document.location);
 s=s.replace(tcDir, enDir);
 self.location.replace(s);
}
//-- Switch from Traditional Chinese to Simplified Chinese --//
function switchLang_tc2sc(){
 initLangDir (); 
 var s = new String(parent.document.location);
 s=s.replace(tcDir, scDir);
 self.location.replace(s);
}
//-- Switch from Simplified Chinese to English --//
function switchLang_sc2en(){
 initLangDir (); 
 var s = new String(parent.document.location);
 s=s.replace(scDir, enDir);
 self.location.replace(s);
}
//-- Switch from Simplified Chinese to Traditional Chinese --//
function switchLang_sc2tc(){
 initLangDir (); 
 var s = new String(parent.document.location);
 s=s.replace(scDir, tcDir);
 self.location.replace(s);
}
//******************** End ********************//

	// Set slideShowSpeed (milliseconds)
	var slideShowSpeed = 6000;
	// Duration of crossfade (seconds)
	var crossFadeDuration = 3;
	// Specify the image files
	var Pic = new Array();
	var Link = new Array();
	var Title = new Array();
	var Target = new Array();
	var j = 0;
	var t = 0;
	var p = 2;
	// to add more images, just continue
	// the pattern, adding to the array below

	Pic[0] = '../images/pmsgnetwork_icon.jpg'
	Pic[1] = '../images/itdd_icon.jpg'	

	Link[0] = 'http://www.scollhk.com/pmsgnetwork/'
	Link[1] = 'http://www.scollhk.com/itdd/'	

	Title[0] = 'PM Executive Networking'
	Title[1] = 'IT Digital Divide'	

	Target[1] = '_blank'
	Target[2] = '_blank'

	function runSlideShow() {
		if (document.all) {
			document.images.SlideShowPic.style.filter="blendTrans(duration=crossFadeDuration)";
			document.images.SlideShowPic.filters.blendTrans.Apply();
		}

		document.images.SlideShowPic.src = Pic[j];
		document.images.SlideShowPic.title = Title[j];
		SlideShowLink.target = Target[j];
		SlideShowLink.href = Link[j];	
		if (document.all) {
			document.images.SlideShowPic.filters.blendTrans.Play();
		}
		j = j + 1;
		if (j > (p - 1)) j = 0;
			t = setTimeout('runSlideShow()', slideShowSpeed);
	}