﻿
function hotarticles(id,img,t,num){
	document.getElementById(id).style.backgroundImage="url(http://img.hexun.com/money/"+img+")";
	hideall(t,3);
	document.getElementById(t+num).style.display="";
}
function interestrate(id1,id2,num){
	defaultcss(id1,3,"hx_label8");
	hideall(id2,3);
	document.getElementById(id1+num).className="hx_label7";
	document.getElementById(id2+num).style.display="";
}
function moneyproduct(id1,id2,num){
	defaultcss(id1,2,"hx_label8");
	hideall(id2,2);
	document.getElementById(id1+num).className="hx_label7";
	document.getElementById(id2+num).style.display="";
}
function hideall(id,count){
	for(i=1;i<=count;i++){
		document.getElementById(id+i).style.display="none";
	}
}
function kuaidi(id1,id2,num){
	defaultcss(id1,5,"hx_label1b");
	hideall(id2,5);
	document.getElementById(id1+num).className="hx_label1a";
	document.getElementById(id2+num).style.display="";
}
function defaultcss(obj,count,css){
	for(i=1;i<=count;i++){
		document.getElementById(obj+i).className=css;
	}
}
function moneysearch_click(arg){

	loopmenu(7);
		
	if(arg==1){
	document.getElementById("ms_menu_"+arg).className="hx_label3";
	}else{

	document.getElementById("ms_menu_"+arg).className="hx_label3a";
	}
	document.getElementById("ms_box_"+arg).style.display="";
}
function loopmenu(arg){
	for(i=1;i<=arg;i++){
		if(i==1){
		document.getElementById("ms_menu_"+i).className="hx_label2a";
		}else{
		if(i==3)continue ;
		document.getElementById("ms_menu_"+i).className="hx_label2";
		}
		document.getElementById("ms_box_"+i).style.display="none";
	}
}
/*------------------------------------------------------------*/
function stock_submit(){				
	if(document.sb_form.msn_stockid.value.length==0 || document.sb_form.msn_stockid.value=="输入股票代码")
	{
		alert("请输入查询条件");
		return false;
	}							
}
function SwitchFundsSearch(obj){
	if(obj.fund_code.value.length==0 || obj.fund_code.value=="输入基金代码")
	{
		 alert("请输入查询条件");
		 return false;
	}
}
function isDate(str)
{
	var r = str.match(/^(\d{1,4})(-|\/)(\d{1,2})\2(\d{1,2})$/); 
	if(r==null)return false; var d = new Date(r[1], r[3]-1, r[4]); 
	return (d.getFullYear()==r[1]&&(d.getMonth()+1)==r[3]&&d.getDate()==r[4]);
}
function SwitchFuturesSearch()
{
	var mydate=document.getElementById("data").value;
	
	if(!isDate(mydate))
	{
		alert("交易日期不符合格式规范或无效的日期!");
		return false;
	}
	
	var type=document.getElementById("futures_search").value;
	var myurl;
	if(type=="1")
	{
		myurl="http://futures.money.hexun.com/search1.aspx?date="+mydate;
	}
	if(type=="2")
	{
		myurl="http://futures.money.hexun.com/search2.aspx?date="+mydate;
	}
	window.open(myurl);
}
function SwitchForexSearch(){
	var geturl=document.getElementById("forex_search").value;
	window.open(geturl);
}
function SwitchBankSearch()
{
	var geturl=document.getElementById("bank_search").value;
	window.open(geturl);
}
function SwitchBankSearch1()
{
	var geturl=document.getElementById("bank_search1").value;
	window.open(geturl);
}
function SwitchInsuranceSearch(){
	window.open("http://insurance.money.hexun.com/market/query.aspx?company="+company_name.value+"&type="+type.value);
}
function SwitchInsuranceSearch1(){
	var company_name1 = document.getElementById("company_name1") ;
	var type1 =  document.getElementById("type1") ;
	window.open("http://insurance.money.hexun.com/market/query.aspx?company="+company_name1.value+"&type="+type1.value);
}
function SwitchBondSearch(){
	if(window.ActiveXObject){
		document.charset='GB2312';
	}
	var type=document.getElementById("bond_search").value;
	//var code=document.getElementById("bondcode").value;
	//if(code==null||code==""){
		//alert("请输入查询条件");
	//}else{
		switch(type)
		{
			case "1":
			{
				window.open("http://bond.money.hexun.com/quote/");
				break;
			}
			case "2":
			{
				window.open("http://bond.money.hexun.com/data/search.aspx");
				break;
			}
			case "3":
				window.open("http://bond.money.hexun.com/data/new_income.aspx");
				break;
			case "4":
				window.open("http://bond.money.hexun.com/data/bank.htm");
				break;
			case "5":
				window.open("http://bond.money.hexun.com/data/transform.htm");
				break;
			case "6":
				window.open("http://bond.money.hexun.com/counter/");
				break;	
		}
	//}
}
function inputclick(obj,arg){
	if(obj.value==arg){
		obj.value="";
	}
}
function GetValue(e)
{
	if(e.value == "输入搜索关键词")
	{
		e.value = '';
	}
}
function AllSelect(e)
{
	e.focus();
	e.select();
}


// 银行理财产品查询
function BankQuery()
{
	var bankName = document.getElementById("bankname").value;
	
	var highYield = document.getElementById("highyield").options.value;

	var url = "http://bank.money.hexun.com/bankquery/list.aspx?";
	
	if(bankName != -1)
	  url += "&bankname=" + bankName;
	  
	 if(highYield != -1)
	  url += "&highyield= " + highYield;
	
	window.open(url);
}
function OMOver(OMO){OMO.style.backgroundColor='#FFFBF2';OMO.cells[0].style.color='#927500';}
function OMOut(OMO){OMO.style.backgroundColor='';OMO.cells[0].style.color='';}
function OMOver2(OMO){OMO.style.backgroundColor='#FFFBF2';OMO.cells[1].style.color='#927500';OMO.cells[0].style.backgroundColor='transparent';}
function OMOut2(OMO){OMO.style.backgroundColor='';OMO.cells[1].style.color='';OMO.cells[0].style.backgroundColor='';}
