// JavaScript Document

function GetParam(name) {
  var start=location.search.indexOf("?"+name+"=");
  if (start<0) start=location.search.indexOf("&"+name+"=");
  if (start<0) return '';
  start += name.length+2;
  var end=location.search.indexOf("&",start)-1;
  if (end<0) end=location.search.length;
  var result=location.search.substring(start,end);
  var result='';
  for(var i=start;i<=end;i++) {
    var c=location.search.charAt(i);
    result=result+(c=='+'?' ':c);
  }
  return unescape(result);
}

function printTab() {

urlArray = new Array(8);
imageArray=new Array();

for (i=0; i < 8; i++) {
	urlArray[i] = "?page=" + (i + 1);
	//alert("URL " + i + " is " + urlArray[i]); 
}


imageArray = ["about_og.jpg", "events_og.jpg", "network_og.jpg", "social_og.jpg", "personal_og.jpg", "research_og.jpg", "fromHKU_og.jpg", "forum_og.jpg"];
//alert("image 0 = " + imageArray[0]);
//alert("image 1 = " + imageArray[1]);

/*
var pageNo = GetParam("page");
alert("Page No = " + pageNo);
if (pageNo != "") {

} else {
	alert("No Input!");
}
*/

switch (GetParam("page")) {
   case "1" :
	  //alert("case 1");      
      imageArray[0] = "about_rd.jpg";
      break;
   case "2" :
      imageArray[1] = "events_rd.jpg";
      break;
   case "3" :
      imageArray[2] = "network_rd.jpg";
      break;
   case "4" :
      imageArray[3] = "social_rd.jpg";
      break;
   case "5" :
      imageArray[4] = "personal_rd.jpg";
      break;
   case "6" :
      imageArray[5] = "research_rd.jpg";
      break;
   case "7" :
      imageArray[6] = "fromHKU_rd.jpg";
      break;
   case "8" :
      imageArray[7] = "forum_rd.jpg";
      break;
   default :
      //alert("No Input!");
   	  break;
} 



//about us
document.write("<td width=70 height=16 valign=bottom><a href=");
document.write(urlArray[0]);
document.write("><img src=../user/images/");
document.write(imageArray[0]);
document.write(" width=63 height=16 border=0></a></td>");

//others
var TDwidth, imageWidth;
var n = 1;
while( n < 8 ) {
    if (n == 4) { TDwidth = 111; imageWidth = 106;}
	else if (n == 7) { TDwidth = 72; imageWidth = 63;}
	else { TDwidth = 70; imageWidth = 63;}
	
	document.write("<td width=");
	document.write(TDwidth);
	document.write(" valign=bottom><a href=");
	document.write(urlArray[n]);
	document.write("><img src=../user/images/");
	document.write(imageArray[n]);
	document.write(" width=");
	document.write(imageWidth);
	document.write(" height=16 border=0></a></td>");
   n ++;
} 
}