var Apcnews={};

Apcnews.getXmlHttp = function(){
    var xmlHttp = null;
    try{
        xmlHttp = new XMLHttpRequest();
    }catch (e){
        var progIds = ['MSXML2.XMLHTTP', 'Microsoft.XMLHTTP', 'MSXML2.XMLHTTP.5.0', 'MSXML2.XMLHTTP.4.0', 'MSXML2.XMLHTTP.3.0'];
        var success = false;
        for (var iterator = 0; (iterator < progIds.length) && ( ! success); iterator ++){
            try{
                xmlHttp = new ActiveXObject(progIds[iterator]);
                success = true;
            }catch (e) {}
        }
        if ( ! success ) {
            return null;
        }
    }
    return xmlHttp;
}

Apcnews.sendRequest = function(method,url,callBack){   
    var xmlHttp = Apcnews.getXmlHttp();
    xmlHttp.open(method,url,true);   
    xmlHttp.onreadystatechange = function(){
        if (xmlHttp.readyState == 4){
            if (xmlHttp.status == 200){
                callBack(xmlHttp.responseText);
            }
        }
    }

    xmlHttp.send(null);
}

Apcnews.listMenu=function(data){
   document.getElementById("listMenu").innerHTML="hello";
   document.getElementById("listMenu").style.display="block";	
}

Apcnews.getCompanyNames=function(id){
}

Apcnews.get_enter=function(){
        if(event.keyCode==13)
        {
                Apcnews.search();  
                return false;                               
        }
}

Apcnews.search = function () {
    if (document.getElementById('keyword').value == "请输入证券代码、简称、首字母搜索证券资讯") {
        return false;
    }
    window.open('http://search.p5w.net/newsIndexSearch.action?keyword=' + encodeURI(document.getElementById('keyword').value.substring(0, 80).replace(/[#$%'^&*()]/g, '').replace(/\r\n/ig, '')));
}

Apcnews.searchIndex=function(){
   window.open('http://search.p5w.net/newsIndexSearch.action?keyword='+encodeURI(document.getElementById('keyword1').value.substring(0,80).replace(/[#$%'^&*()]/g,'').replace(/\r\n/ig,'')));
}



			    function checksearch(o)
				{
					var leirong;
					leirong=o.value;
					if (leirong=="请输入证券代码、简称、首字母搜索证券资讯"){	o.value="";}
				}
				function zccsh(o)
				{
					var leirong;
					leirong=o.value;
					if (leirong==""){	
						o.value="请输入证券代码、简称、首字母搜索证券资讯";
					}
				}

Apcnews.showSearch=function(){
document.writeln("			   <div class='search_left'>");
document.writeln("			     <label>");
document.writeln("			     <input name='textfield3' type='text' class='search' onkeydown='Apcnews.get_enter();' id='keyword' value='请输入证券代码、简称、首字母搜索证券资讯' onfocus='checksearch(this);' onblur='zccsh(this);'>");
document.writeln("			     <input name='Submit2' type='button' class='submit2' value='全景财经搜索' onclick='Apcnews.search();'>");
document.writeln("			     </label>");
document.writeln("			   </div>");
}

Apcnews.showSearchFile=function(){
document.writeln("<table align='left' style='margin-left:10px' cellpadding='0' cellspacing='0'>");
document.writeln("<tr>");
document.writeln("<td>");
document.writeln("<input type='text' onkeyup='Apcnews.getCompanyNames(this.value);' style='line-height:18px;height:18px;width:160px;border:1px solid #c7c6c4' id='keyword' />");
document.writeln("<div style='position:relative;'><div id='listMenu' style='left:20px;top:54px;'></div></div>");
document.writeln("</td>");
document.writeln("</tr>");
document.writeln("<tr>");
document.writeln("<td align='right'>");
document.writeln("&nbsp;&nbsp;<input type='button' style='margin-top:10px;font-size:14px;height:24px;' onclick='Apcnews.search();' value='搜&nbsp;索' />");
document.writeln("</td>");
document.writeln("</tr>");
document.writeln("</table>");
}

Apcnews.showIndexSearch=function(){
document.writeln("<table cellpadding='0' cellspacing='0'>");
document.writeln("<tr>");
document.writeln("<td style='font-weight:bold;font-size:14px;'>");
//document.writeln("<img src='http://www.p5w.net/images2006/top_01.jpg' />");
document.writeln("<a href='http://search.p5w.net/' target='_blank'><img src='http://www.p5w.net/pfgg/main/apc_search.gif' border='0'/></a>");
document.writeln("</td>");
document.writeln("<td valign='top' style='padding-top:15px;'>");
document.writeln("<input type='text' onkeyup='Apcnews.getCompanyNames(this.value);' style='line-height:18px;height:18px;width:400px;border:1px solid #c7c6c4' id='keyword1' />");
document.writeln("<div style='position:relative;'><div id='listMenu' style='left:20px;top:54px;'></div></div>");
document.writeln("<p style='font-size:14px;margin-top:15px;margin-left:40px;'>");
document.writeln("<a href='http://search.p5w.net/breakingnews.jsp' target='_blank' >滚动资讯</a>");
document.writeln("<a href='http://search.p5w.net/newsMain.action?cateId=002' target='_blank' >证券报纸</a>");
document.writeln("<a href='http://search.p5w.net/newsMain.action?cateId=003' target='_blank' >24小时热点</a>"); 　
document.writeln("<a href='http://search.p5w.net/newsMain.action?cateId=009' target='_blank' >个股信息</a>");
document.writeln("<a href='http://search.p5w.net/anounceSearch.jsp' target='_blank' >公告搜索</a>");
document.writeln("</p>");
document.writeln("</td>");
document.writeln("<td valign='top' style='padding-top:15px;'>");
document.writeln("&nbsp;&nbsp;<input type='button' style='font-size:14px;height:24px;' onclick='Apcnews.searchIndex();' value='搜&nbsp;索' />");
document.writeln("</td>");
document.writeln("</tr>");
document.writeln("</table>");
}
