﻿var show = false;
if(/MSIE (\d+\.\d+);/.test(navigator.userAgent)) show = (new Number(RegExp.$1) >= 7); //test for MSIE x.x;
if(/Firefox[\/\s](\d+\.\d+)/.test(navigator.userAgent)) show = (new Number(RegExp.$1) >= 3); //test for Firefox/x.x or Firefox x.x
show = false;
document.write('<link rel="search" type="application/opensearchdescription+xml" href="http://yp.com.hk/ypsearch/ypsearch.xml" title="yp search" />' + 
'<table border="0" cellspacing="0" cellpadding="0"><form id="form1" name="form1" action="http://yp.com.hk/ypsearch/ypsearch.asp" target="_blank"><tr>' + 
//'	<td><font style = "font:11px Arial; color: #1e508a; font-weight: bold;">網頁搜尋:</font></td>' + 
//'	<td width="4"></td>' + 
//'	<td><img src="http://yp.com.hk/ypsearch/yp_pccw.jpg" height="20" width="20" /></td>' + 
'	<td style="border:solid 1px #ccc; border-right:0px"><img src="/portal/icon/image/yp_pccw.jpg" height="20" width="22" alt="黃頁網頁搜尋功能" title="黃頁網頁搜尋功能"/></td>' + 
//'	<td width="4"></td>' + 
//'	<td><input id="keyword" name="keyword" type="text" style="width: 60px; color:#CCCCCC;" value="yp 搜尋    " onfocus="onf(this);" onblur="onb(this);" onload="onb(this);" /><input id="language" name="language" type="hidden" value="zh" /><input id="source" name="source" type="hidden" value="ypsb_ch" /></td>' + 
'	<td style="border:solid 1px #ccc; border-left:0px"><input id="keyword" name="keyword" type="text" style="border:0px; width: 110px; color:#CCCCCC;" value="yp 網頁搜尋    " onfocus="onf(this);" onblur="onb(this);" onload="onb(this);" /><input id="language" name="language" type="hidden" value="zh" /><input id="source" name="source" type="hidden" value="ypsb_mobile_ch" /></td>' + 
'	<td width="4"></td>' + 
//'	<td><input id="btn_find" name="btn_find" type="image" src="http://yp.com.hk/ypsearch/find_pccw.jpg" height="22" width="22" border="0" alt="搜尋"></td>' + 
'	<td><input id="btn_find" name="btn_find" type="image" src="/portal/icon/image/find_pccw.jpg" height="22" width="24" border="0" alt="搜尋"></td>' + 
'</tr></form></table>' + 
(show?'<div><a href="#" id="addypsearch" style = "font:12px Arial" onclick="window.external.AddSearchProvider(\'http://yp.com.hk/ypsearch/ypsearch.xml\')">install yp search</a></div>':''));
delete show;
//function onf(obj){ if(obj.value=='yp 搜尋    '){ obj.style.color = '#000000'; obj.value = '';}}
function onf(obj){ if(obj.value=='yp 網頁搜尋    '){ obj.style.color = '#000000'; obj.value = '';}}
//function onb(obj){ MM_findObj('btn_find').disabled = (obj.value==''); if(obj.value==''){ obj.style.color = '#CCCCCC'; obj.value = 'yp 搜尋    ';}}
function onb(obj){ MM_findObj('btn_find').disabled = (obj.value==''); if(obj.value==''){ obj.style.color = '#CCCCCC'; obj.value = 'yp 網頁搜尋    ';}}
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;
}
