//获得当天日期
function GetDate()
{
var date=new Date();
var ss = date.getMonth()+1;
var aa = ss;
if(ss < 10 ) aa = "0" + ss; 
var se = date.getDate();
var sae = se;
if(se < 10 ) sae = "0" + se;
var tradedate=date.getFullYear()+ "-"  + aa + "-" + sae;
//alert(tradedate);
//document.getElementById("tradedate").value=tradedate;
document.getElementById("data").value=tradedate;
}
//交易提示
function tradeinfo(dated){
	var dates = dated.replace(/-/g,"");
url="http://forex.money.hexun.com/calendar/default.aspx?newsday=";
window.open(url+dates);
}

function tradeinfo2(date){
    url="http://www.fxbjxh.com/html/cjrl.html?date=";
    window.open(url+date);
}

//国内期市品种合约
function homesearch(date){
url="/search1.aspx?date=";
window.open(url+date);
}
//国际期市品种合约
function intersearch(date){
url="/search2.aspx?date=";
window.open(url+date);
}
//标签切换
function ExchangeSwitch(obj1,obj2,arg){
ExchangeCss(obj2,arg);
ExchangeContent(document.getElementById(obj1),arg);
}
function ExchangeCss(obj,arg){
for(i=1;i<=5;i++){
	if(i==1){
		if(i==arg){
			document.getElementById(obj+i).className="buss_a1";
		}else{
			document.getElementById(obj+i).className="buss_a2";
		}
	}
	if(i==2 || i==3 || i==4){
		if(i==arg){
			document.getElementById(obj+i).className="buss_b1";
		}else{
			document.getElementById(obj+i).className="buss_b2";
		}
	}
	if(i==5){
		if(i==arg){
			document.getElementById(obj+i).className="buss_c1";
		}else{
			document.getElementById(obj+i).className="buss_c2";
		}
	}
}
}
function ExchangeContent(obj,arg){
var j=1;
for(i=0;i<obj.childNodes.length;i++){
	if(obj.childNodes[i].nodeType==1){
		if(arg==j){
		obj.childNodes[i].style.display="";
		}else{
		obj.childNodes[i].style.display="none";
		}
		j=j+1;
	}
}
}
//多空
function duokong(obj){
var url="/iframe/duokong.aspx?id=";
url=url+obj.options[obj.selectedIndex].value;
document.getElementById("duokong").src=url;
}
//标签切换
function SwitchLabel(obj1,obj2,obj,arg){
	SwitchStyle(document.getElementById(obj),arg)
	SwitchContent(document.getElementById(obj1),arg);
	SwitchContent(document.getElementById(obj2),arg);
}
function SwitchLabelHot(obj1,obj2,arg){
	SwitchStyle(document.getElementById(obj2),arg)
	SwitchContent(document.getElementById(obj1),arg);
}
function SwitchContent(obj,arg){
var j=1;
for(i=0;i<obj.childNodes.length;i++){
	if(obj.childNodes[i].nodeType==1){
		if(arg==j){
		obj.childNodes[i].style.display="";
		}else{
		obj.childNodes[i].style.display="none";
		}
		j=j+1;
	}
}
}
function SwitchStyle(obj,arg){
	var j=1;
	for(i=0;i<obj.childNodes.length;i++){
		if(obj.childNodes[i].nodeType==1){
			if(j==1){
				if(arg==j){
				obj.childNodes[i].className="tag_a1";
				}else{
				obj.childNodes[i].className="tag_a2";
				}
			}
			if(j==2){
				if(arg==j){
				obj.childNodes[i].className="tag_b1";
				}else{
				obj.childNodes[i].className="tag_b2";
				}
			}
			if(j==3){
				if(arg==j){
				obj.childNodes[i].className="tag_c1";
				}else{
				obj.childNodes[i].className="tag_c2";
				}
			}
			j=j+1;
		}
	}
}
//财经日历
function YYYYMMDDstart(form,year,month,day)
{
　　MonHead = [31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31];
　　				
　　				//先给年下拉框赋内容
　　var y = new Date().getFullYear();
　　for (var i = (y-5); i < (y+1); i++) //以今年为准，前30年，后30年
　　year.options.add(new Option(i,i));
　　				
　　				//赋月份的下拉框
　　for (var i = 1; i < 13; i++)
　　month.options.add(new Option(i,i));
　　year.value = y;
　　month.value = new Date().getMonth() + 1;
　　var n = MonHead[new Date().getMonth()];
　　				
　　if (new Date().getMonth() ==1 && IsPinYear(year.options[year.selectedIndex].value)) n++;
　　writeDay(n,day); //赋日期下拉框Author:meizz
　　day.value = new Date().getDate();
　　
}
　　				
function YYYYDD(str,month,day) //年发生变化时日期发生变化(主要是判断闰平年)
{
　　var MMvalue = month.options[month.selectedIndex].value;
　　if (MMvalue == "" ){ var e = day; optionsClear(e); return;}
　　var n = MonHead[MMvalue - 1];
　　if (MMvalue ==2 && IsPinYear(str)) n++;
　　writeDay(n,day)
}
　　				
function MMDD(str,year,day) //月发生变化时日期联动
{
　　var YYYYvalue = year.options[year.selectedIndex].value;
　　if (YYYYvalue == "" ){ var e = day; optionsClear(e); return;}
　　var n = MonHead[str - 1];
　　if (str ==2 && IsPinYear(YYYYvalue)) n++;
　　writeDay(n,day)
}
　　				
function writeDay(n,day) //据条件写日期的下拉框
{
　　var e = day; optionsClear(e);
　　for (var i=1; i<(n+1); i++)
　　e.options.add(new Option(i,i));
}
　　				
function IsPinYear(year)//判断是否闰平年
{
	return(0 == year%4 && (year%100 !=0 || year%400 == 0));
}
　　				
function optionsClear(e)
{
　　for (var i=e.options.length; i>0; i--)
　　e.remove(i);
}

function writeDay(n,day) //据条件写日期的下拉框
{
　　var e = day; optionsClear(e);
　　for (var i=1; i<(n+1); i++)
　　e.options.add(new Option(i,i));
}
function QueryData()
{
　　var year=document.getElementById("calYear").value;
　　		
　　var month=document.getElementById("calMonth").value;
　　			
　　if(month < 10)
　　	month = "0" + month;
　　			
　　var day = document.getElementById("calDay").value;
　　			
　　if(day < 10)
　　	day = "0" + day;
　　
　　var now=year + month + day;
　　//year=2007&month=05&day=24&newsday=20070524
　　window.open("http://forex.money.hexun.com/calendar/default.aspx?year="+year+"&month="+month+"&day="+day+"&newsday=" + now);　　
}
//
function openfuture(str,file)
{
	window.open("/column/"+file+"?sl="+str);
}
//百科
function GetValue(e)
{
	if(e.value == "输入搜索关键词")
	{
		e.value = '';
	}
}

function AllSelect(e)
{
	e.focus();
	e.select();
}


function ShowFutures(obj)
{
	var id = obj.options[obj.selectedIndex].value;
	if(id == "1")
	{
		document.getElementById('guonei').className='hexunInitShow';
		document.getElementById('guoji').className='hexunInitHide';
	}
	else
	{
		document.getElementById('guonei').className='hexunInitHide';
		document.getElementById('guoji').className='hexunInitShow';
	}
}
