// JavaScript Document
function generate_footerHome() {
	document.writeln('<table width="777" border="0" align="center" cellpadding="0" cellspacing="0">');
  document.writeln('<tr>');
     document.writeln(' <td align="right" class="LightGreyText"> ');
        document.writeln(' Last updated: <MM:BeginLock type="mmdate" format="Sw1" orig="<!-- #BeginDate format:Sw1 -->9 Jan 2008<!-- #EndDate -->">9 Jan 2008<MM:EndLock>');
 document.writeln('&nbsp;&nbsp; </td>');
  document.writeln(' </tr>');
   document.writeln('<tr>');
   document.writeln('<td background="img/main/t_footer.gif" height="20" >');
   document.writeln('<div align="right" ><a href="http://www.ntu.edu.sg/" target="_blank" class="FOOTERLINK" >NTU Home</a> | <a href="http://www.ntu.edu.sg/sci/forms/feedback.htm" target="_blank" class="FOOTERLINK">'); 
   document.writeln('Feedback</a> | <a href="http://www.ntu.edu.sg/sci/about/contactus.html" target="_blank" class="FOOTERLINK"> ');
  document.writeln(' Contact Us</a> | <a href="http://www.ntu.edu.sg/sci/privacy/index.htm" target="_blank" class="FOOTERLINK">Privacy Statement</a> ');
  document.writeln('&nbsp;&nbsp; </div></td>');
  document.writeln('</tr>');
  document.writeln('<tr>');
    document.writeln('<td background="img/main/b_footer.gif" height="30" valign="center">');
	document.writeln('<div align="right" class="WhiteText">Wee Kim Wee School of Communication & Information, 31 Nanyang Link, Singapore 637718 Tel: (65) 6790 4577 Fax: (65) 6791 5214&nbsp;</div></td>');
  document.writeln('</tr>');
  document.writeln('</table>');
}
//
function generate_footerSub() {
	document.writeln('<table width="777" border="0" align="center" cellpadding="0" cellspacing="0">');
  document.writeln('<tr>');
     document.writeln(' <td align="right" class="LightGreyText"> ');
        document.writeln(' Last updated: <MM:BeginLock type="mmdate" format="Sw1" orig="<!-- #BeginDate format:Sw1 -->9 Jan 2008<!-- #EndDate -->">9 Jan 2008<MM:EndLock>');
 document.writeln('&nbsp;&nbsp; </td>');
  document.writeln(' </tr>');
   document.writeln('<tr>');
   document.writeln('<td background="../img/main/t_footer.gif" height="20" > ');
   document.writeln('<div align="right" ><a href="http://www.ntu.edu.sg/" target="_blank" class="FOOTERLINK" >NTU Home</a> | <a href="http://www.ntu.edu.sg/sci/forms/feedback.htm" target="_blank" class="FOOTERLINK">'); 
   document.writeln('Feedback</a> | <a href="http://www.ntu.edu.sg/sci/about/contactus.html" target="_blank" class="FOOTERLINK"> ');
  document.writeln(' Contact Us</a> | <a href="http://www.ntu.edu.sg/sci/privacy/index.htm" target="_blank" class="FOOTERLINK">Privacy Statement</a> ');
  document.writeln('&nbsp;&nbsp; </div></td>');
  document.writeln('</tr>');
  document.writeln('<tr>');
    document.writeln('<td background="../img/main/b_footer.gif" height="30" valign="center">');
	document.writeln('<div align="right" class="WhiteText">Wee Kim Wee School of Communication & Information, 31 Nanyang Link, Singapore 637718 Tel: (65) 6790 4577 Fax: (65) 6791 5214&nbsp;</div></td>');
  document.writeln('</tr>');
  document.writeln('</table>');
}
//
function openext1(externalURL,replacewindow)

	{
	externalURL=escape(externalURL);
	var url = 'http://www.ntu.edu.sg/nr/publicportal/includes/ExternalPage.asp?URL=' + externalURL;
	var replace;

	if (replacewindow=='undefined')
	   replace='win';
	else
	   replace=replacewindow;

	scrWidth = window.screen.availWidth - 50;
	scrHeight = window.screen.availHeight - 100;
	scrLeft = 0;
	scrTop=0;
	var strFeatures = "scrollbars=yes,status=yes,toolbar=yes,menubar=yes,location=no,resizable=yes,left=" + scrLeft + ",top=" + scrTop + ",height=" +  scrHeight + ",width=" + scrWidth
	//url = url.toLowerCase() ;

	window.open(url, replace, strFeatures, 0);
	return;
	}

function selBrowse_onchange()
{
	if(document.frmSearch.selBrowse.options[document.frmSearch.selBrowse.selectedIndex].value==""){

		}
		else if(document.frmSearch.selBrowse.options[document.frmSearch.selBrowse.selectedIndex].value!=""){
			ret=window.open(document.frmSearch.selBrowse.options[document.frmSearch.selBrowse.selectedIndex].value)
			document.frmSearch.selBrowse.selectedIndex=0;
		}

}

function MM_callJS(jsStr) { //v2.0
  Browse_onchange;
}

function fnSubmit(){
	if(bfnValidate()){

		if(document.frmSearch.selSearch.options[document.frmSearch.selSearch.selectedIndex].value=="0"){
			ret=window.open('http://www.google.com/search?q=' +  escape(document.frmSearch.txtKeyword.value) + '&btnG=Google+Search');
		}
		else if(document.frmSearch.selSearch.options[document.frmSearch.selSearch.selectedIndex].value=="1"){
			//ret=openext1('http://gemssharepoint2.ntu.edu.sg/loginbypass.asp?vdomain=student&vusername=cestuwsxqmvj&vpassword=1DzHK31dSct74wL&scope=NTU Websites&keyword=' + escape(document.frmSearch.txtKeyword.value) + '&naddr=/iGems/portal/resources/searchstart.asp')
			//25/8/2004 replace SPS search with Cicada search
			ret=openext1('http://gemssearch.ntu.edu.sg/NTUNative/search.jsp?query=' + escape(document.frmSearch.txtKeyword.value) + '&SearchScope=NTU Websites')
		}
		 else if(document.frmSearch.selSearch.options[document.frmSearch.selSearch.selectedIndex].value=="2"){
			ret=window.open('https://wis.ntu.edu.sg/webexe88/owa/TDR_TELDIR.NAME_SEARCH?STAFF_NAME=' +  escape((document.frmSearch.txtKeyword.value).substr(0,40))  );
		}
	}
}

function bfnValidate(){
	if(trim(document.frmSearch.txtKeyword.value)==""){
		alert("Please enter search keyword");
		return false;
	}
	return true;
}
function trim(str)
{
   return str.replace(/^\s*|\s*$/g,"");
}
//

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];}
}