function openext1(externalURL,replacewindow)

	{
	externalURL=escape(externalURL);
	var url = 'http://search.ntu.edu.sg/?IW_DATABASE=NTU%20Websites&IW_FIELD_WEB_STYLE=' + 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://search.ntu.edu.sg/?IW_DATABASE=NTU%20Websites&IW_FIELD_WEB_STYLE=' +  escape(document.frmSearch.txtKeyword.value));
		}
		else if(document.frmSearch.selSearch.options[document.frmSearch.selSearch.selectedIndex].value=="1"){
			ret=openext1(escape(document.frmSearch.txtKeyword.value))
		}
		 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,"");
}

document.writeln('<link rel="stylesheet" href="http://www.ntu.edu.sg/banner/banstyle.css" type="text/css"> ');
document.writeln('<center> ');
document.writeln('  <table border="0" cellpadding="0" width="770px" height="120px" id="table1" background="http://www.ntu.edu.sg/nr/publicportal/images/pp_header.jpg"> ');
document.writeln('    <tr> ');
document.writeln('      <td width="125" height="100"> <a href="http://www.ntu.edu.sg"> <img src="http://www.ntu.edu.sg/nr/publicportal/images/spacer.gif" border=0 height=100 width=180> </a> </td> ');
document.writeln('      <td height="100" align="right"> <form id="frmSearch" name="frmSearch" onsubmit="fnSubmit();return false"> ');
document.writeln('          <br> ');
document.writeln('          <table border=0 cellpadding="0"> ');
document.writeln('            <tr> ');
document.writeln('              <td> <table border=0 cellpadding="0"> ');
document.writeln('                  <tr> ');
document.writeln('                    <td> <font face="Arial" color="white" size="2">Search&nbsp;</font> ');
document.writeln('                      <input type="text" class="InputBoxText" id="Text2" name="txtKeyword"> ');
document.writeln('                      <font face="Arial" color="white" size="2">in&nbsp;</font> </td> ');
document.writeln('                    <td> <table> ');
document.writeln('                        <tr> ');
document.writeln('                          <td> <SELECT class="InputBoxText" id="Select1" name="selSearch" style="WIDTH: 150px;height:17px"> ');
document.writeln('                              <OPTION selected style="WIDTH: 150px;height:17px" value="1">NTU Websites</OPTION> ');
document.writeln('                              <OPTION style="WIDTH: 150px;height:17px" value="2">Staff Directory (NTU & NIE)</OPTION> ');
document.writeln('                              <OPTION style="WIDTH: 150px;height:17px" value="0">Internet</OPTION> ');
document.writeln('                            </SELECT> </td> ');
document.writeln('                        </tr> ');
document.writeln('                      </table></td> ');
document.writeln('                    <td align=right> <a href="#"><img border="0" src="http://www.ntu.edu.sg/nr/publicportal/images/pp_btnGo.jpg" align="absmiddle" onclick="return fnSubmit()"></a> </td> ');
document.writeln('                    <td> &nbsp;&nbsp;&nbsp;&nbsp; </td> ');
document.writeln('                  </tr> ');
document.writeln('                </table></td> ');
document.writeln('            </tr> ');
document.writeln('            <tr height="1"> ');
document.writeln('              <td height="1"></td> ');
document.writeln('            </tr> ');
document.writeln('            <tr> ');
document.writeln('              <td> <table border=0 align=right cellpadding="0"> ');
document.writeln('                  <tr> ');
document.writeln('                    <td align=right> <font face="Arial" color="white" size="2">Quick Links&nbsp;</font> </td> ');
document.writeln('                    <td align=right> ');
document.writeln('			<SELECT class="InputBoxText" id="Select2" name="selBrowse" style="WIDTH: 155px;height:17px" LANGUAGE="javascript" onchange="return selBrowse_onchange()"> ');
document.writeln('                        <OPTION value="">Please select</OPTION> ');
document.writeln('                        <OPTION value="https://wis.ntu.edu.sg/webexe88/owa/wdr_search.index_search">A-Z Website Directory</OPTION> ');
document.writeln('                        <OPTION value="http://www.street-directory.com/ntu/">Campus Map</OPTION> ');
document.writeln('                        <OPTION value="http://www.ntu.edu.sg/ohr/Career/Pages/default.aspx">Career Opportunities</OPTION>');
document.writeln('                        <OPTION value="http://www.ntu.edu.sg/chinese/Pages/default.aspx">Chinese Website</OPTION> ');
document.writeln('                        <OPTION value="http://www.ntu.edu.sg/AboutNTU/ntuidentity/guidelines/Pages/default.aspx">Corporate Identity</OPTION> ');
document.writeln('                        <OPTION style="WIDTH: 150px" value="http://www.ntu.edu.sg/AboutNTU/organisation/Pages/Administration.aspx">Department Websites</OPTION> ');
document.writeln('                        <OPTION value="http://research.ntu.edu.sg/researchatntu/Pages/ResearchCentresandInstitutes.aspx">Research Institutes</OPTION> ');
document.writeln('                        <OPTION value="http://research.ntu.edu.sg/researchatntu/Pages/InterdisciplinaryResearchClusters.aspx">Research Centres Under Colleges</OPTION> ');
document.writeln('                        <OPTION style="WIDTH: 150px" value="http://www.ntu.edu.sg/collegesandprogrammes/Pages/colleges.aspx">School Websites</OPTION> ');
document.writeln('                        <OPTION value="">------- Services --------</OPTION> ');
document.writeln('                        <OPTION style="WIDTH: 150px" value="http://www.ntu.edu.sg/opawww/careermall/">CareerMall@NTU</OPTION> ');
document.writeln('                        <OPTION style="WIDTH: 150px" value="http://www.ced.ntu.edu.sg/channelntu/index.htm">ChannelNTU</OPTION> ');
document.writeln('                        <OPTION style="WIDTH: 150px" value="https://pwd.ntu.edu.sg/pwd-ssl.htm">Change Password</OPTION> ');
document.writeln('                        <OPTION style="WIDTH: 150px" value="http://www.ntu.edu.sg/cits/gettinghelp/Pages/default.aspx">Computing</OPTION> ');
document.writeln('                        <OPTION style="WIDTH: 150px" value="http://www.ntu.edu.sg/cce/home/">Continuing Education</OPTION> ');
document.writeln('                        <OPTION style="WIDTH: 150px" value="http://edventure.ntu.edu.sg/">edveNTUre</OPTION> ');
document.writeln('                        <OPTION style="WIDTH: 150px" value="https://webmail.ntu.edu.sg/exchange/">Email</OPTION> ');
document.writeln('                        <OPTION style="WIDTH: 150px" value="http://www2.ntu.edu.sg/calendar/sc.asp">Event Calendar</OPTION> ');
document.writeln('                        <OPTION style="WIDTH: 150px" value="https://sso.wis.ntu.edu.sg/gslink/">GSLink</OPTION> ');
document.writeln('                        <OPTION style="WIDTH: 150px" value="http://www.ntu.edu.sg/library/Pages/default.aspx">Library</OPTION> ');
document.writeln('                        <OPTION style="WIDTH: 150px" value="http://gemsweb.ntu.edu.sg/router1.asp">myNTU Login</OPTION> ');
document.writeln('                        <OPTION value="http://www.ntu.edu.sg/nec">Nanyang Executive Centre</OPTION> ');
document.writeln('                        <OPTION value="http://opac.ntu.edu.sg/">OPAC Search</OPTION> ');
document.writeln('                        <OPTION style="WIDTH: 150px" value="https://sso.wis.ntu.edu.sg/stafflink/">StaffLink</OPTION> ');
document.writeln('                        <OPTION style="WIDTH: 150px" value="https://sso.wis.ntu.edu.sg/studentlink/">StudentLink</OPTION> ');
document.writeln('                        <OPTION value="">--- Student Activities ---</OPTION> ');
document.writeln('                        <OPTION style="WIDTH: 150px" value="http://su.ntu.edu.sg"> NTU Students&acute; Union</OPTION> ');
document.writeln('                        <OPTION style="WIDTH: 150px" value="https://wis.ntu.edu.sg/pls/webexe88/wdr_search.index_search?P_category=CLU&P_index=A">Clubs/Societies</OPTION> ');
document.writeln('                        <OPTION style="WIDTH: 150px" value="https://wis.ntu.edu.sg/pls/webexe88/wdr_search.index_search?P_category=JCR&P_index=A">JCRCs/Hall of Residence</OPTION> ');
document.writeln('                      </SELECT> </td> ');
document.writeln('                    <td> &nbsp;&nbsp;&nbsp;&nbsp; </td> ');
document.writeln('                  </tr> ');
document.writeln('                </table></td> ');
document.writeln('            </tr> ');
document.writeln('          </table> ');
document.writeln('        </form></td> ');
document.writeln('    </tr> ');
document.writeln('  </table>'); 
document.writeln('</center> ');
