﻿/* 搜索结果页面使用JavaScript */


/* 用ID取得DIV对象 */
function getObject(objectId) {
    if(document.getElementById && document.getElementById(objectId)) {
		// W3C DOM
		return document.getElementById(objectId);
    } else if (document.all && document.all(objectId)) {
		// MSIE 4 DOM
		return document.all(objectId);
    } else if (document.layers && document.layers[objectId]) {
		// NN 4 DOM.. note: this won't find nested layers
		return document.layers[objectId];
    } else {
		return false;
    }
}


/* 搜索框上方搜索类型选择变化函数 */
function tab01() {
  getObject("a1").style.color="#000000";
  getObject("a1").style.fontWeight="bold";
  getObject("a1").style.textDecoration="none";
  getObject("a2").style.color="#0000FF";
  getObject("a2").style.fontWeight="normal";
  getObject("a2").style.textDecoration="underline";
  getObject("a3").style.color="#0000FF";
  getObject("a3").style.fontWeight="normal";
  getObject("a3").style.textDecoration="underline";
  document.queryActionForm.Operate.value = "wordSrch";
}
function tab02() {
  getObject("a1").style.color="#0000FF";
  getObject("a1").style.fontWeight="normal";
  getObject("a1").style.textDecoration="underline";
  getObject("a2").style.color="#000000";
  getObject("a2").style.fontWeight="bold";
  getObject("a2").style.textDecoration="none";
  getObject("a3").style.color="#0000FF";
  getObject("a3").style.fontWeight="normal";
  getObject("a3").style.textDecoration="underline";
  document.queryActionForm.Operate.value = "telSrch";
}
function tab03() {
  getObject("a1").style.color="#0000FF";
  getObject("a1").style.fontWeight="normal";
  getObject("a1").style.textDecoration="underline";
  getObject("a2").style.color="#0000FF";
  getObject("a2").style.fontWeight="normal";
  getObject("a2").style.textDecoration="underline";
  getObject("a3").style.color="#000000";
  getObject("a3").style.fontWeight="bold";
  getObject("a3").style.textDecoration="none";
  document.queryActionForm.Operate.value = "addrSrch";
}


/* index.jsp上查询按钮 */
function check() {
  if ( document.queryActionForm.qryWord.value.length < 1 ) { 
    alert("请输入关键字，并大于1个字！"); 
  }
  else { 
    document.queryActionForm.pageIndex.value = "1";
    document.queryActionForm.submit(); 
  }
}


/* index.jsp上form提交数据验证 */
function CheckDate() {
  if ( document.queryActionForm.qryWord.value.length < 1 ) {
    return false;
  }
  else {
    return true;
  }
}


/* index.jsp上热门关键字点击函数*/
function hot( keyword ) {
  document.queryActionForm.qryWord.value = keyword;
  document.queryActionForm.submit();
}


/* input输入框遇回车就提交函数 */
function keysubmit(e) {
  if (navigator.appName == "Netscape") {
    if (e.which == 13){check();}
  }
  else {
    if (event.keyCode == 13){check();}
  }
}

/* 加入收藏夹函数 */
function JSAddFavorite(title,url)
{
        if ( window.sidebar && "object" == typeof( window.sidebar ) && "function" == typeof( window.sidebar.addPanel ) )
        {
                window.sidebar.addPanel(title, url, "");
        }
        else if ( document.all && "object" == typeof( window.external ) )
        {
                window.external.addFavorite(url,title);
        }
}


/* search.jsp翻页函数 */
function pageturn(pageindex)
{
  document.queryActionForm.pageIndex.value = pageindex;
  document.queryActionForm.submit();
}