﻿// JavaScript Document
//Net Concept Code
var isPrint = GetQueryValue(location.search.toLowerCase(),'jsprint');
var globalImgPath = '/file_manager/image/';
if (!isPrint) {
	document.write('<scr'+'ipt language="javascript" type="text/javascript" src="/file_manager/javascript/clock.js"></scr'+'ipt>')
	document.write('<link href="/file_manager/stylesheet/pop_style.css" rel="stylesheet" type="text/css">')
} else {
	document.write('<link href="/file_manager/stylesheet/netconcept_print.css" rel="stylesheet" type="text/css">')
}

function PrepareDisplay(){
	if (!isPrint) {
		MM_preloadImages(globalImgPath+'menu/company_on.jpg',
						 globalImgPath+'menu/products_on.jpg',
						 globalImgPath+'menu/services_on.jpg',
						 globalImgPath+'menu/support_on.jpg',
						 globalImgPath+'menu/netedge_on.jpg',
						 globalImgPath+'menu/reseller_on.jpg',
						 globalImgPath+'menu/search_on.jpg'
						 )
	} else {
		var pageLink = document.getElementsByTagName("a")
		for(var i=0; i<pageLink.length; i++) {
			if (pageLink[i].href.indexOf('javascript:PrinterFriendlyWinClose()') == -1) pageLink[i].href = 'javascript://'
		}
		window.print();
//		window.onblur = PrinterFriendlyWinClose;
	}
}

function LayoutHeader(){
	var htmlStr = '';
	var args = LayoutHeader.arguments
	//logo + slogan
	if (!isPrint) {
		htmlStr += '<table width="100%"  border="0" cellspacing="0" cellpadding="0">';
		htmlStr += '<tr>';
		htmlStr += '<td width="100%" rowspan="2"><a href="/"><img src="'+globalImgPath+'common/logo.jpg" width="155" height="49" border="0"></a></td>';
		htmlStr += '<td rowspan="2" bgcolor="#999999"><img src="'+globalImgPath+'common/shim.gif" width="1" height="10"></td>';
		htmlStr += '<td align="right" valign="bottom"><span id="SiteClock"></span><script type="text/javascript" language="javascript">RefreshDateTimeClock();LoadDateTimeClock();</script></td>';
		htmlStr += '</tr>';
		htmlStr += '<tr>';
		htmlStr += '<td valign="bottom"><img src="'+globalImgPath+'common/message.jpg" width="299" height="25"></td>';
		htmlStr += '</tr>';
		htmlStr += '<tr bgcolor="#999999">';
		htmlStr += '<td colspan="3"><img src="'+globalImgPath+'common/shim.gif" width="10" height="1"></td>';
		htmlStr += '</tr>';
		htmlStr += '</table>';
		if (args[0] != 'nomenu') htmlStr += LayoutMenu();
	} else {
		htmlStr += '<table width="100%" border="0" cellspacing="0" cellpadding="0">';
		htmlStr += '<tr>';
		htmlStr += '<td><img src="'+globalImgPath+'common/logo.jpg" width="155" height="49"></td>';
		htmlStr += '<td align="right" valign="top" width="100%" background="'+globalImgPath+'common/back_to_site.jpg">';
//		htmlStr += '<a href="javascript:history.back(-1);">';
		htmlStr += '<a href="javascript:PrinterFriendlyWinClose();">';
		htmlStr += '<img src="'+globalImgPath+'common/shim.gif" width="120" height="50" border="0">';
		htmlStr += '</a></td>';
		htmlStr += '</tr>';
		htmlStr += '</table>';
		htmlStr += '<hr size="1">'
	}
	return htmlStr;
}

function LayoutMenu(){
	var htmlStr = '';
	//navigation menu
	if (!isPrint) {
		htmlStr += '<table width="100%"  border="0" cellpadding="0" cellspacing="0">';
		htmlStr += '<tr>';
		htmlStr += '<td bgcolor="#FFFFFF"><img src="'+globalImgPath+'common/shim.gif" width="10" height="1"></td>';
		htmlStr += '</tr>';
		htmlStr += '<tr>';
		htmlStr += '<td height="30" background="'+globalImgPath+'menu/menu_background.jpg"><table width="100%" border="0" cellspacing="0" cellpadding="0">';
		htmlStr += '<tr valign="top">';
		htmlStr += '<td width="100%"><img src="'+globalImgPath+'common/shim.gif" name="menu" width="30" height="30" id="menu"></td>';
		htmlStr += '<td><img src="'+globalImgPath+'common/shim.gif" width="10" height="4"><br>';
		htmlStr += '<input name="SearchWord" type="text" class="MenuSearchBox" id="SearchWord" onKeyPress="if (EnterPressed(event)) {SearchSite(); return false}"></td>';
		htmlStr += '<td><img src="'+globalImgPath+'menu/menu_header.jpg" width="10" height="30"><br>';
		htmlStr += '<td><a href="javascript:SearchSite();" onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage(\'search\',\'\',\''+globalImgPath+'menu/search_on.jpg\',1)"><img src="'+globalImgPath+'menu/search.jpg" name="search" width="72" height="30" border="0"></a></td>';
		htmlStr += '</tr>';
		htmlStr += '</table></td>';
		htmlStr += '</tr>';
		htmlStr += '</table>';
	}
	return htmlStr;
}

function LayoutFooter(){
	var htmlStr = '';
	var args = LayoutFooter.arguments
	if (!isPrint) {
		htmlStr += '<img src="'+globalImgPath+'common/shim.gif" width="10" height="20"><br>';
		htmlStr += '<table width="100%" border="0" cellpadding="0" cellspacing="0">';
		htmlStr += '<tr height="24">';
		htmlStr += '<td class="SideIcon"><img src="'+globalImgPath+'icon/arrow_top.jpg" width="9" height="10" align="absmiddle"> <a href="javascript:BackToTop();">Back to Top</a></td>';
		if (args[0]=='frontpage') {
			htmlStr += '<td class="SideIcon" align="right"><img src="'+globalImgPath+'icon/bookmark.jpg" width="15" height="13" align="absmiddle"> <a href="javascript:BookmarkPage();">Bookmark this Page</a><img src="'+globalImgPath+'common/shim.gif" width="20" height="10"><img src="'+globalImgPath+'icon/email.jpg" width="15" height="12" align="absmiddle"> <a href="javascript:SendToFriend();">Send to Friend</a></td>';
		}
		htmlStr += '</tr>';
		htmlStr += '</table>';
		htmlStr += '<img src="'+globalImgPath+'common/shim.gif" width="10" height="5"><br>';
		htmlStr += '<table width="100%" height="30" border="0" cellpadding="0" cellspacing="0" id="Footer">';
		htmlStr += '<tr bgcolor="#DEDEDE">';
		htmlStr += '<td colspan="2"><img src="'+globalImgPath+'common/shim.gif" width="10" height="1"></td>';
		htmlStr += '</tr>';
		htmlStr += '<tr>';
		htmlStr += '<td colspan="2"><img src="'+globalImgPath+'common/shim.gif" width="10" height="5"></td>';
		htmlStr += '</tr>';
		htmlStr += '<tr>';
		htmlStr += '<td class="Footer">Copyright © 2006 Net Concept Limited. All Rights Reserved.</td>';
		htmlStr += '<td rowspan="4" align="right" valign="top"><a href="/products/oneconnect/webconnect/"><img src="'+globalImgPath+'common/powered_by_webconnect.jpg" border="0" alt="Powered by Webconnect"></a></td>';
		htmlStr += '</tr>';
		htmlStr += '<tr>';
		htmlStr += '<td class="Footer"><a href="/site.map.html">Site Map</a> | <a href="/terms.of.use.html">Terms of Use</a> | <a href="/company/contact.us.html">Feedback</a> | <a href="/privacy.policy.html">Privacy Policy</a></td>';
		htmlStr += '</tr>';
		htmlStr += '<tr>';
		htmlStr += '<td class="Footer"></td>';
		htmlStr += '</tr>';
		htmlStr += '<tr>';
		htmlStr += '<td class="Footer">Search powered by <img src="'+globalImgPath+'partner/google_logo.jpg" align="absmiddle" alt="Google" border="0"></td>';
		htmlStr += '</tr>';
		htmlStr += '</table>';
	} else {
		htmlStr += '<img src="'+globalImgPath+'common/shim.gif" width="10" height="40"><br>';
		htmlStr += '<hr size="1">'
		htmlStr += '<table width="100%" height="30"  border="0" cellpadding="0" cellspacing="0" id="Footer">';
		htmlStr += '<tr>';
		htmlStr += '<td class="Footer">Copyright © 2006 Net Concept Limited. All Rights Reserved.</td>';
		htmlStr += '</tr>';
		htmlStr += '<tr>';
		htmlStr += '<td class="Footer">T: 852 2529 0009 | F: 852 2529 2999 | W: http://www.netconcept.com.hk | E: info@netconcept.com.hk</td>';
		htmlStr += '</tr>';
		htmlStr += '<tr>';
		htmlStr += '<td class="Footer"><img src="'+globalImgPath+'common/shim.gif" width="10" height="5"></td>';
		htmlStr += '</tr>';
		htmlStr += '</table>';
	}
	return htmlStr;
}

function LayoutAccessory(){
	var htmlStr = '';
	var args = LayoutAccessory.arguments
	htmlStr += '<table width="92%"  border="0" align="center" cellpadding="0" cellspacing="0">';
	htmlStr += '<tr>';
	htmlStr += '<td bgcolor="#DEDEDE"><img src="'+globalImgPath+'common/shim.gif" width="10" height="1"></td>';
	htmlStr += '</tr>';
	htmlStr += '</table>';
	htmlStr += '<table width="100%"  border="0" cellspacing="0" cellpadding="0">';
	htmlStr += '<tr>';
	htmlStr += '<td height="5"></td>';
	htmlStr += '</tr>';
	if (typeof args[0]=='undefined' || args[0].indexOf('no_bookmark') == -1) {
		htmlStr += '<tr>';
		htmlStr += '<td class="SideIcon"><img src="'+globalImgPath+'icon/bookmark.jpg" alt="Bookmark this Page" width="15" height="13" align="absmiddle" border="0"> <a href="javascript:BookmarkPage();">Bookmark this Page</a></td>';
		htmlStr += '</tr>';
	}
	if (typeof args[0]=='undefined' || args[0].indexOf('no_email') == -1) {
		htmlStr += '<tr>';
		htmlStr += '<td class="SideIcon"><img src="'+globalImgPath+'icon/email.jpg" alt="Send to Friend" width="15" height="12" align="absmiddle" border="0"> <a href="javascript:SendToFriend();">Send to Friend</a> </td>';
		htmlStr += '</tr>';
	}
	if (typeof args[0]=='undefined' || args[0].indexOf('no_print') == -1) {
		htmlStr += '<tr>';
		htmlStr += '<td class="SideIcon"><img src="'+globalImgPath+'icon/print.jpg" width="15" height="13" border="0" align="absmiddle"> <a href="javascript:PrinterFriendly();">Printer Friendly</a></td>';
		htmlStr += '</tr>';
	}
	htmlStr += '<tr>';
	htmlStr += '<td height="14"></td>';
	htmlStr += '</tr>';
	htmlStr += '</table>';
	return htmlStr;
}

function LayoutIcon(){
	var htmlStr = '';
	htmlStr += '<table width="92%"  border="0" align="center" cellpadding="0" cellspacing="0">';
	htmlStr += '<tr>';
	htmlStr += '<td bgcolor="#DEDEDE"><img src="'+globalImgPath+'common/shim.gif" width="10" height="1"></td>';
	htmlStr += '</tr>';
	htmlStr += '</table>';
	htmlStr += '<table width="100%"  border="0" cellspacing="0" cellpadding="0">';
	htmlStr += '<tr>';
	htmlStr += '<td height="5"></td>';
	htmlStr += '</tr>';
	htmlStr += '<tr>';
	htmlStr += '<td class="SideIcon"><a href="http://www.adobe.com/products/acrobat/readstep2.html" target="_blank"><img src="'+globalImgPath+'icon/adobe_reader.jpg" width="88" height="31" border="0"></a></td>';
	htmlStr += '</tr>';
	htmlStr += '</table>';
	return htmlStr;
}

function BuildPagePath(){
	var inStr = BuildPagePath.arguments
	var htmlStr = '';
	for (var x=0;x<inStr.length;x++) {
		var gotURL = false
		if (typeof inStr[x][1] != 'undefined' && inStr[x][1] != '') gotURL = true;
		if (gotURL) htmlStr += '<a href="'+inStr[x][1]+'">'
		htmlStr += inStr[x][0]
		if (gotURL) htmlStr += '</a>'
		if (x!=inStr.length-1) htmlStr += ' / ' //' » '
	}
	return htmlStr;
}

function SearchSite(){
	var frm = window.document.form1;
	searchHeader = 'http://www.google.com/custom?hl=en&cof=S:http://www.netconcept.com.hk;AH:left;LH:49;LW:155;L:http://www.netconcept.com.hk/file_manager/image/common/logo.jpg;AWFID:bd003a399a4a7c88;&domains=www.netconcept.com.hk&sitesearch=www.netconcept.com.hk&q=';
	searchStr = frm.SearchWord.value;
	window.location = searchHeader+searchStr;
}

function BookmarkPage() {
	var markURL = window.location;
	var markTitle = document.getElementsByTagName("title")[0].text;;
	if (navigator.appName != "Netscape"){
		window.external.AddFavorite(markURL, markTitle);
	} else {
		alert('Your browser does not support this function.\nPlease add bookmark using the browser built-in tool bar functions.')
	}
}

function PrinterFriendly(){
	var hash = location.hash
	var url = location.toString();
	url = url.substring(0,url.indexOf(hash))
	if (location.search != '') url = location.search + '&jsprint=1';
	else url = url + '?jsprint=1';
//	location = url;
	window.open(url,'','width=700px,height=500px,menubar=yes,resizable=no,scrollbars=yes,status=no')
}

function PrinterFriendlyWinClose(){
	window.close();
}

function SendToFriend(){
	var pageTitle=document.getElementsByTagName("title")[0].text;
	var pageURL = location.href;
	location = '/send.to.friend.html?title='+escape(pageTitle)+'&url='+escape(pageURL);
}

var position;
function MoveScrollPosition(){
	position = Math.floor(position*0.9);
	if( position > 0.1 ){
		window.scrollTo(0,position)
		setTimeout("BackToTop()",15);
	} else {
		window.scrollTo(0,0)
	}
}

function BackToTop(){
	if(navigator.appName.indexOf("Microsoft Internet Explorer")!=-1){
		position = document.body.scrollTop;
	} else {
		position = window.pageYOffset;
	}
	MoveScrollPosition();
}

function EnterPressed(e) {
	var characterCode;
	if(e && e.which){ //NN4
		e = e
		characterCode = e.which
	} else {
		e = event
		characterCode = e.keyCode
	}
	if (characterCode == 13) return true //press Enter/Return
	else return false
}

function GetQueryValue(queryString,name) {
	var queryItems = queryString.substring(1,location.search.length).split('&');
	var queryValues = new Array();
	for (var i=0; i<queryItems.length; i++){
		queryValues[i] = queryItems[i].substring(queryItems[i].indexOf('=')+1,queryItems[i].length)
		queryItems[i] = queryItems[i].substr(0,queryItems[i].indexOf('='))
	}
	for (var i=0; i<queryItems.length; i++) {
		if (queryItems[i]==name) {
			return queryValues[i];
		}
	}
	return '';
}

function SideTableMenuChange(obj,toggle){
	if (obj.className != 'SideTableMenuSel'){
		if(toggle) {
			obj.className = 'SideTableMenuOn'
		} else {
			obj.className = 'SideTableMenuOff'
		}
	}
}

//form validation
function Valid_String(fldName,fldValue,minLen,maxLen) {
	var errMsg = '';
	if (fldValue.length < minLen) {
		if (minLen==1) {
			errMsg = '"' + fldName + '" cannot be empty.\n';
		} else {
			errMsg = '"' + fldName + '" at least contains '+minLen+' character(s).\n';
		}
	}
	if (fldValue.length > maxLen) {
		errMsg = '"' + fldName + '" maximum contains '+maxLen+' character(s), now exceeding '+ parseInt(fldValue.length - maxLen) +' character(s).\n';
	}
	return errMsg;
}
function Valid_Email(fldName,fldValue) {
	var errMsg = '';
	var emailFilter = /^.+@.+\..{2,3}$/;
	if (!(emailFilter.test(fldValue)) && fldValue.length!=0) { 
		errMsg = '"' + fldName + '" is not a valid email address.\n';
	}
	return errMsg;
}
function Valid_Numeric(fldName,fldValue) {
	var errMsg = '';
	var stripped = fldValue.replace(/[\(\)\.\-\ ]/g, '');
	for (var i=0; i<stripped.length; i++) {
		if (isNaN(parseInt(stripped.substr(i,1)))) {
			errMsg = '"' + fldName + '" only accept numeric input.\n';
			break;
		}
	}
	return errMsg;
}
function Valid_Password(fldName,fldValue) {
	var errMsg = '';
	var illegalChars = /[\W_]/; 
	if (illegalChars.test(fldValue)) {
		errMsg = '"' + fldName + '" only allow letters and numbers.\n';
	} 
	return errMsg;
}
function Valid_IsSame(fldName1,fldValue1,fldName2,fldValue2) {
	var errMsg = '';
	if (fldValue1 != fldValue2) {
		errMsg = '"' + fldName1 + '" is not same as "' + fldName2 + '"\n';
	}
	return errMsg;
}
function Valid_Options(fldName,fldValue,minLen) {
	var errMsg = '';
	var errFlag = 0;
	for (var i=0; i<fldValue.length; i++) {
		if (fldValue[i].checked) {
			errFlag++;
		}
	}
	if (errFlag<minLen) {
		errMsg = '"' + fldName + '" should choose at least '+minLen+' option(s), now only choose '+ errFlag +' option(s).\n';
	}
	return errMsg;
}


//Dreamweaver Code
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];}
}