function fund_search()
{
document.writeln("<table width=\"980\" height=\"34\" border=\"0\" align=\"center\" cellpadding=\"0\" cellspacing=\"0\">");
document.writeln("  <tr> ");
document.writeln("    <td><table width=\"980\" border=\"0\" align=\"center\" cellpadding=\"1\" cellspacing=\"0\" bgcolor=\"#92C3F2\">");
document.writeln("        <tr> ");
document.writeln("          <td><TABLE width=\"100%\" border=0 align=\"center\" cellpadding=\"0\" cellspacing=\"0\">");
document.writeln("              <TBODY>");
document.writeln("                <TR>");
document.writeln("                  <TD height=28 align=\"center\" bgcolor=\"#D3E8FD\"><span class=\"14hei\"><img src=\"http://www.p5w.net/fund/jingzhi/search/images/1.gif\" width=\"110\" height=\"26\" align=\"absmiddle\" ignoreapd=1></span> ");
document.writeln("                    <select style=\"width:180px\" id=\"select1\" onchange=\"ld()\">");
document.writeln("                      <option selected value=\"0\">---请选择基金公司---</option>");
document.writeln("			            <script>");
document.writeln("			            for (var i = 0; i < fundc.length; i++)");
document.writeln("            			{");
document.writeln("			              document.writeln(\"<option value='\"+fundc[i].code+\"'>\"+fundc[i].name+\"</option>\");");
document.writeln("            			}");
document.writeln("            			</script>");
document.writeln("                    </select> ");
document.writeln("					<select style=\"width:100px\" id=\"select2\">");
document.writeln("                      <option selected value=\"0\">选择类别</option>");
document.writeln("					  <option value=\"1\">基金公司专区</option>");
document.writeln("					  <option value=\"2\">基金公司论坛</option>");
document.writeln("					  <option value=\"3\">基金公司新闻</option>");
document.writeln("					  <option value=\"4\">基金公司公告</option>");
document.writeln("					  <option value=\"5\">基金公司评论</option>");
document.writeln("                    </select>");
document.writeln("                    <input type=\"submit\" name=\"Submit2\" value=\"查公司\" onClick=\"jump_1();\">");
document.writeln("                    <select style=\"width:100px\" id=\"select3\" onchange=\"ld()\">");
document.writeln("                      <option selected value=\"0\">所有基金类型</option>");
document.writeln("                      <option value=\"1\">--股票型基金</option>");
document.writeln("                      <option value=\"2\">--混合型基金</option>");
document.writeln("                      <option value=\"3\">--债券型基金</option>");
document.writeln("                      <option value=\"4\">--货币型基金</option>");
document.writeln("                      <option value=\"5\">--封闭式基金</option>");			  
document.writeln("                    </select>");
document.writeln("					<select style=\"width:180px\" id=\"select4\">");
document.writeln("                      <option selected value=\"0\">---请选择基金---</option>");
document.writeln("			            <script>");
document.writeln("										//初始默认选择全部基金");
document.writeln("				            for (var i = 0; i < funds.length; i++)");
document.writeln("    	        			{");
document.writeln("				              document.writeln(\"<option value='\"+funds[i].code+\"'>\"+funds[i].name+\"</option>\");");
document.writeln("            				}");
document.writeln("			            </script>");
document.writeln("                    </select> ");
document.writeln("					<select style=\"width:100px\" id=\"select5\">");
document.writeln("                      <option selected value=\"0\">选择类别</option>");
document.writeln("                      <option value=\"1\">基金详细资料</option>");
document.writeln("                      <option value=\"2\">基金历史净值</option>");
document.writeln("                      <option value=\"3\">基金网友评论</option>");
document.writeln("                    </select>");
document.writeln("                    <input type=\"submit\" name=\"Submit22\" value=\"查基金\" onClick=\"jump_2();\">");
document.writeln("					</TD>");
document.writeln("                </TR>");
document.writeln("              </TBODY>");
document.writeln("            </TABLE></td>");
document.writeln("        </tr>");
document.writeln("      </table></td>");
document.writeln("  </tr>");
document.writeln("  <tr> ");
document.writeln("    <td><img name=\"\" src=\"\" width=\"1\" height=\"3\" alt=\"\"></td>");
document.writeln("  </tr>");
document.writeln("</table>");
}

function jump(code,cs){
	switch(code){
		case 1:
			window.open("http://company.p5w.net/fund/jjgs.asp?gsdm="+cs);
			break;
		case 2:
			cs=zh(cs,1);
			window.open("http://bbs.p5w.net/searchzqdm.php?fid=5&zqdm="+cs);
			break;
		case 3:
			cs=zh(cs,2);
			window.open("http://comment.p5w.net/comment/comment?newsid="+cs);
			break;
		case 4://基金净值
			window.open("http://company.p5w.net/fund/fund.asp?jjdm="+cs);
			break;
		case 5://基金资料
			window.open("http://www.p5w.net/fund/jingzhi/index.htm?daima="+cs);			
			break;
		case 6://基金评论
			cs=zh_2(cs,2);		
			window.open("http://comment.p5w.net/comment/comment?newsid="+cs);
			break;
		case 7://基金公司新闻
			window.open("http://www.p5w.net/fund/jjzq/zixun/"+cs+"/index.htm");			
			break;
		case 8://基金公司公告
			window.open("http://www.p5w.net/fund/jjzq/gonggao/"+cs+"/index.htm");
			break;			
		}
	}
function ld(){
		 for (m=select4.options.length-1;m>0;m--)
		 	select4.options[m]=null;
	 	select4.options[0]=new Option("无符合条件的基金","0");
		 n=0;
		 n1=select1.value;//基金公司
		 n2=select3.value;//基金类型
		 s=0;
		 if (n1=="0" & n2=="0")
		     s=1;//条件均未选中
		 else if(n1!="0" & n2!="0")
		 	 s=4;//条件均选中了
		 else if(n1=="0" & n2!="0")
		     s=2;//仅选中了基金类型
		 else
		     s=3;//仅选中了基金公司
			switch(s){
				case 1:
					for (i = 0; i < funds.length; i++)
    	        	{
					 	select4.options[i]=new Option(funds[i].name,funds[i].code);//名称,value
            		}
					break;
				case 2:
					for (i = 0; i < funds.length; i++)
    	        	{
					 	if(funds[i].lx==n2){
							select4.options[n]=new Option(funds[i].name,funds[i].code);//名称,value
							n++;
						}
            		}
					break;
				case 3:
					for (i = 0; i < funds.length; i++)
    	        	{
					 	if(funds[i].company==n1){
							select4.options[n]=new Option(funds[i].name,funds[i].code);//名称,value
							n++;
						}
            		}				
					break;
				case 4:	
					for (i = 0; i < funds.length; i++)
    	        	{
					 	if(funds[i].company==n1 & funds[i].lx==n2){
							select4.options[n]=new Option(funds[i].name,funds[i].code);//名称,value
							n++;
						}
            		}				
					break;	
			}
}

function jump_1()
{
    i=Number(document.getElementById('select2').value);
	if (document.getElementById('select1').value=="0")
	  alert("请选择一家基金公司");
	else{
	switch(i){
		case 0:
		case 1:
		  jump(1,document.getElementById('select1').value);
		  break;
		case 2:
		  jump(2,document.getElementById('select1').value);
		  break;
		case 3:
		  jump(7,document.getElementById('select1').value);
		  break;
		case 4:
		  jump(8,document.getElementById('select1').value);
		  break;
		case 5:
		  jump(3,document.getElementById('select1').value);
		  break;		  		  
		}
	}
}
function jump_2()
{
    i=Number(document.getElementById('select5').value);
	if (document.getElementById('select4').value=="0")
	  alert("请选择一只基金");
	else{
		switch(i){
			case 0:
			case 1:
			  jump(4,document.getElementById('select4').value);
 			  break;
			case 2:
			  jump(5,document.getElementById('select4').value);
			  break;
			case 3:
			  jump(6,document.getElementById('select4').value);
			  break;						
			}
		}
}

function jump_3()
{
  if (document.getElementById('select4').value=="0")
	  alert("请选择一只基金");
	else{
		jump(4,document.getElementById('select4').value);	
		}
}

function fund(name,lt,code,pl)
{
  this.name = name;
  this.lt = lt;//论坛
  this.code = code;
  this.pl = pl;//评论
}
function zh(code,n)
{
	for (var i = 0; i < fundc.length; i++)
	{
		if (code == fundc[i].code){
			switch(n){
				case 1:
				  return fundc[i].lt;
				  break;
				case 2:
				  return fundc[i].pl;
				  break;
				}
		}
	}
}
var fundc = new Array(58);
fundc[0] =new fund("宝盈基金管理有限公司","fund012","jjjl0000044","1240872");             
fundc[1] =new fund("博时基金管理有限公司","fund005","jjjl0000035","1240881");             
fundc[2] =new fund("长城基金管理有限公司","fund015","jjjl0000045","1240871");             
fundc[3] =new fund("长盛基金管理有限公司","fund008","jjjl0000038","1240878");             
fundc[4] =new fund("长信基金管理有限公司","fund026","jjjl0000069","1240858");             
fundc[5] =new fund("大成基金管理有限公司","fund009","jjjl0000039","1240877");             
fundc[6] =new fund("东方基金管理公司","fund039","jjjl0000079","1240850");                 
fundc[7] =new fund("东吴基金管理有限公司","fund041","jjjl0000087","1240842");             
fundc[8] =new fund("富国基金管理有限公司","fund010","jjjl0000040","1240876");             
fundc[9] =new fund("工银瑞信基金管理有限公司","fund047","jjjl0000090","1240839");         
fundc[10]=new fund("光大保德信基金管理有限公司","fund036","jjjl0000081","1240848");       
fundc[11]=new fund("广发基金管理有限公司","fund030","jjjl0000065","1240860");             
fundc[12]=new fund("国海富兰克林基金管理有限公司","fund042","jjjl0000084","1240845");     
fundc[13]=new fund("国联安基金管理有限公司","fund024","jjjl0000051","1240866");           
fundc[14]=new fund("国泰基金管理有限公司","fund001","jjjl0000034","1240882");             
fundc[15]=new fund("国投瑞银基金管理有限公司","fund017","jjjl0000046","1240870");         
fundc[16]=new fund("海富通基金管理有限公司","fund025","jjjl0000047","1240869");           
fundc[17]=new fund("华安基金管理有限公司","fund004","jjjl0000032","1240884");             
fundc[18]=new fund("华宝兴业基金管理有限公司","fund022","jjjl0000062","1240862");         
fundc[19]=new fund("华富基金管理有限公司","fund037","jjjl0000088","1240841");             
fundc[20]=new fund("华商基金管理有限公司","fund051","jjjl0000091","1240838");             
fundc[21]=new fund("华泰柏瑞基金管理有限公司","fund044","jjjl0000082","1240847");
fundc[22]=new fund("华夏基金管理有限公司","fund003","jjjl0000031","1240885");             
fundc[23]=new fund("汇丰晋信基金管理有限公司","fund052","jjjl0000098","1240831");         
fundc[24]=new fund("汇添富基金管理有限公司","fund046","jjjl0000089","1240840");           
fundc[25]=new fund("嘉实基金管理有限公司","fund007","jjjl0000037","1240879");             
fundc[26]=new fund("建信基金管理有限公司","fund050","jjjl0000097","1240832");             
fundc[27]=new fund("交银施罗德基金管理公司","fund048","jjjl0000096","1240833");           
fundc[28]=new fund("金鹰基金管理有限公司","fund020","jjjl0000061","1240863");             
fundc[29]=new fund("金元比联基金管理有限公司","fund058","9900003461","1240886");          
fundc[30]=new fund("景顺长城基金管理有限公司","fund029","jjjl0000063","1240861");         
fundc[31]=new fund("民生加银基金管理有限公司","fund061","9900005499","");
fundc[32]=new fund("摩根士丹利华鑫基金管理有限公司","fund023","jjjl0000067","1240859");
fundc[33]=new fund("南方基金管理有限公司","fund002","jjjl0000033","1240883");             
fundc[34]=new fund("农银汇理基金管理有限公司","fund060","9900004441","");             
fundc[35]=new fund("诺安基金管理有限公司","fund033","jjjl0000078","1240851");             
fundc[36]=new fund("诺德基金管理有限公司","fund056","9900003002","1240887");              
fundc[37]=new fund("鹏华基金管理有限公司","fund006","jjjl0000036","1240880");             
fundc[38]=new fund("浦银安盛基金管理有限公司","fund059","9900004383","");             
fundc[39]=new fund("融通基金管理有限公司","fund013","jjjl0000043","1240873");             
fundc[40]=new fund("上投摩根基金管理公司","fund038","jjjl0000080","1240849");             
fundc[41]=new fund("申万巴黎基金管理公司","fund034","jjjl0000074","1240854");             
fundc[42]=new fund("泰达宏利基金管理有限公司","fund018","jjjl0000059","1240865");         
fundc[43]=new fund("泰信基金管理有限公司","fund027","jjjl0000071","1240857");             
fundc[44]=new fund("天弘基金管理有限公司","fund043","jjjl0000085","1240844");             
fundc[45]=new fund("天治基金管理有限公司","fund028","jjjl0000073","1240855");             
fundc[46]=new fund("万家基金管理有限公司","fund019","jjjl0000050","1240867");             
fundc[47]=new fund("新世纪基金管理有限公司","fund045","jjjl0000086","1240843");           
fundc[48]=new fund("信诚基金管理有限公司","fund049","jjjl0000099","1240830");             
fundc[49]=new fund("信达澳银基金管理有限公司","fund055","9900000041","1240888");          
fundc[50]=new fund("兴业全球基金管理有限公司","fund031","jjjl0000077","1240852");             
fundc[51]=new fund("易方达基金管理有限公司","fund011","jjjl0000041","1240875");           
fundc[52]=new fund("益民基金管理有限公司","fund053","jjjl0000092","1240837");             
fundc[53]=new fund("银河基金管理公司","fund016","jjjl0000049","1240868");                 
fundc[54]=new fund("银华基金管理有限公司","fund014","jjjl0000042","1240874");             
fundc[55]=new fund("招商基金管理有限公司","fund021","jjjl0000060","1240864");             
fundc[56]=new fund("中海基金管理有限公司","fund035","jjjl0000083","1240846");             
fundc[57]=new fund("中欧基金管理有限公司","fund057","jjjl0000101","1240825");             
fundc[58]=new fund("中信基金管理有限公司","fund032","jjjl0000075","1240853");             
fundc[59]=new fund("中银基金管理有限公司","fund040","jjjl0000072","1240856");         
fundc[60]=new fund("中邮创业基金管理有限公司","fund054","jjjl0000100","1240829");         

function fs(lx,name,company,code,pl)
{
  this.lx = lx;	//基金类型
  this.name = name;//基金名称
  this.company = company;//公司编码
  this.code = code;//基金代码
  this.pl = pl;//评论
}

function zh_2(code,n)
{
	for (var i = 0; i < funds.length; i++)
	{
		if (code == funds[i].code){
			switch(n){
				case 1://未用到
				  return funds[i].company;
				  break;
				case 2:
				  return funds[i].pl;
				  break;
				}
		}
	}
}

var funds = new Array(400);
