/*
date:		2008-05
author:		guohao
*/
D = new Date();
var	nowTime = new String(D.getTime());
window.onload=function init()
{
	var url = ''+location.href;
	if( s = url.lastIndexOf('error='))
	{
		times = url.substr(s).replace("error=",'').substr(0,8);
		//alert(nowTime.substr(0,8)+'_'+times)
		if( nowTime.substr(0,8)==times ) alert('登录名或密码不正确!');
	}
}
function o(o){return document.getElementById(o)}
function sear()
{
	var code = o('code').value;
	if(!code)	{	alert('请输入股票代码!');return false;	}
	var p =/^[0-9]+$/
	if(code =='请输入股票代码')	{	alert('请输入有效的股票代码!');return false;	}
	o('fcode').action='http://stock.1.com/'+o('type').value+'.php';
	return true;
}
var searType=1;
//股票&基金
function sear2()
{
	var code = o('code').value;
	if(!code || code=='代码或名称')	{	alert('请输入代码或名称!');return false;	}
	if(searType==1)
		o('fcode').action='http://stock.1.com/'+o('type1').value+'.php';
	else
		o('fcode').action='http://fund.1.com/search_index.php';
	return true;
}

function click1(id)
{
	o('sear1').style.display='none';
	o('sear2').style.display='none';
	o('sear'+id).style.display='block';
	searType=id;
}
function input(t)
{
	var str = '输入股票代码或名称';
	if( t=='click')	if(o('code').value==str) o('code').value='';
	if( t== 'out' )	if(!o('code').value) o('code').value=str;
}
function input1(t)
{
	var str = '输入基金代码或名称';
	if( t=='click')	if(o('txt').value==str) o('txt').value='';
	if( t== 'out' )	if(!o('txt').value) o('txt').value=str;
}
function over(id)
{
	for(i=1;i<5;i++){o('gb'+i).className='';	o('table'+i).style.display='none';}
	o('gb'+id).className='active';
	o('table'+id).style.display='block';
}
function jjImg(id)
{
	d = new Date();
	str = new String(d.getMinutes());
	rand = d.getHours()+str.substring(0,1);
	for(i=1;i<3;i++)o('jj'+i).className='noselectd';
	var url ='http://baidu.hexun.com/stock/images/';
	if(id==1)	o('jjImg').src=url+'index_1B0008.png?'+rand;	else	o('jjImg').src=url+'index_399305.png?'+rand;
	o('jj'+id).className='selectd';
}
//基金
function show(name,id)
{
	calss = "box_mr";
	for(i=1;i<4;i++){	o(name+'c'+i).className=calss;o(name+i).style.display='none';	}
	o(name+'c'+id).className="box_mr active";o(name+id).style.display='block';
}
function shows(name,id,num)
{
	calss = "box_mr";
	for(i=1;i<=num;i++){	o(name+'c'+i).className=calss;o(name+i).style.display='none';	}
	o(name+'c4').className='';
	if(id=='4'){
		o(name+'c'+id).className="active";
	}else{
		o(name+'c'+id).className="box_mr active";
	}
	o(name+id).style.display='block';
}
function show1(name,id)
{
	calss = "box_mr";
	for(i=1;i<3;i++){	o(name+'c'+i).className=calss;o(name+i).style.display='none';	}
	o(name+'c'+id).className="box_mr active";o(name+id).style.display='block';
}
function show11(name,id)
{
	for(i=1;i<3;i++){o(name+i).style.display='none';	}
	if(id=='1'){
		o(name+'c1').className="box_mr active";
		o(name+'c2').className="";
	}else{
		o(name+'c1').className="box_mr";
		o(name+'c2').className="active";
	}
	o(name+id).style.display='block';
}
function show2(id)
{
	calss = "noselectd1";
	for(i=1;i<3;i++){	o('nc'+i).className=calss;o('n'+i).style.display='none';	}
	o('nc'+id).className="selectd1";o('n'+id).style.display='block';
}
function show3(name,id)
{
	calss = "";
	for(i=1;i<5;i++){	o(name+'c'+i).className=calss;o(name+i).style.display='none';	}
	o(name+'c'+id).className="active";o(name+id).style.display='block';
}
function show4(name,id,num)
{
	calss = "";
	for(i=1;i<=num;i++){	o(name+'c'+i).className=calss;o(name+i).style.display='none';	}
	o(name+'c'+id).className="active";o(name+id).style.display='block';
}
 function copyToClipBoard(){
    var clipBoardContent="";
      clipBoardContent+=this.location.href;
    window.clipboardData.setData("Text",clipBoardContent);
}
function checkTel1()
{
	if(!o('gp').value && !o('tel').value)
	{
		alert('请填写股票代码或手机号码或固话!');return false;
	}
}
function search()
{
	var key = o('keyword').value;
	if( !key || key=='请输入关键字')
	{
		alert('请输入搜索关键字!');o('keyword').focus();return false;
	}
}
function getCookie(sName)
{
	var aCookie = document.cookie.split("; ");
	for (var i=0; i < aCookie.length; i++)
	{
	var aCrumb = aCookie[i].split("=");
	if (sName == aCrumb[0])	return unescape(aCrumb[1]);
	}
	return "";
}
function login()
{
	var url = ''+location.href;
	if( (end = url.indexOf("error=")) != -1 ) url = url.substr(0,end);
	
	var name = getCookie('75n_zcname');
	var v = name.split('%'); 
	if(v.length>1)
	{
		name ='';
		for(i=0;i<v.length;i++)
		{
			if(v[i]>0)  name +=String.fromCharCode(v[i]);
		}
	}
	if( getCookie('75n_auth') && name )
	{	
		document.write('<table width="100%" border="0" cellspacing="0" cellpadding="0"><tr><td　nowrap="nowrap">&nbsp;欢迎登录至诚理财网，'+name+' 　<a href="http://bbs.1.com">进入论坛</a> | <a href="http://myfund.1.com">我的基金</a>　　<a href="http://www.1.com/loggin.php?ac=exit" target=_self>退出</a></td></tr></table>');
	}
	else
	{
		document.write('<table width="99%" border="0" align="right" cellpadding="0" cellspacing="0"><form name="form1" target="_self" method="post" onSubmit="return checkForm();" action="http://bbs.1.com/logging.php?action=login&loginsubmit=true"><tr><td width="50">用户名:</td><td width="130"><input name="username" type="text" id="username" size="15" onmouseover="this.select()" /></td><td width="40">密码:</td><td width="120"><input name="password" type="password" id="password" size="15" /><input type="hidden" name="cookietime" value="2592000" /><input type="hidden" name="loginfield" value="username" /><input name="url" type="hidden" id="url" value="'+url+'" /><input name="times" type="hidden" id="times" value="'+nowTime+'" /></td><td width="60"><input type="image" src="/0311/login_h.gif" /></td><td><a href="http://bbs.1.com/member.php?action=lostpasswd" target="_blank" class="black">找回密码</a> | <a href="http://bbs.1.com/register.php" class="black" target="_blank">注册</a> | <a href="http://bbs.1.com"><font color="#cc0000">进入论坛</font></a></td></tr></form></table>');
	}
}
function checkForm()
{
	var	user = document.getElementById('username');
	var	pass = document.getElementById('password');
	if( !user.value || !pass.value )
	{
		alert('请填写用户名和密码!');user.focus();return false;
	}
	return true;
}

function showFlash(src,w,h,value)
{
	document.write('<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,0,0" width="'+w+'" height="'+h+'">');
	document.write('<param name="allowScriptAccess" value="sameDomain"><param name="movie" value="'+src+'"><param name="quality" value="high"><param name="bgcolor" value="#F0F0F0">');
	document.write('<param name="FlashVars" value="'+value+'">');
	document.write('<param name="menu" value="false"><param name=wmode value="opaque">');
	document.write('<embed src="'+src+'" wmode="opaque" FlashVars="'+value+'" menu="false" bgcolor="#ffffff" quality="high" width="'+w+'" height="'+h+'" allowScriptAccess="sameDomain" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" />');
	document.write('</object>');
}

function gz(i)
{
	window.open('http://fund.1.com/fund_data/fund_jjssgz.php?id='+i,'','resizable=yes,width=600,height=400');
}

function changegz(value)
{
	document.getElementById('gzt').src="http://fund.1.com/fund_data/fund_jjssgz.php?id="+value;
}

function gourl(url){
	document.location=url;
}
