// JavaScript Document
function checkSubStock(obj){
	var stockCode = $(obj).find("input.stockCode").val();
	//if(stockCode.length==6 && stockCode.replace(/\d{6}/ig,"").length==0) { return true; }
	//else { alert("请输入正确的股票代码");return false; }
	var thisShares = _searchShare(stockCode);
	if (thisShares.length>0) {
		var thisShare=thisShares[0];
		var codeNum = thisShare.code;
		$(obj).find("input.stockCode").val(codeNum);
		return true;
	} else { alert("请输入正确的股票代码"); return false;}
}
$(".hasStockCode").submit(function(){return checkSubStock(this);});
$(".stockCode").focus(function(){
	if ($(this).val()=="股票名称/代码/拼音缩写"){
		$(this).val("");
	}
});
$(".stockCode").blur(function(){
	if ($(this).val()==""){
		$(this).val("股票名称/代码/拼音缩写");
	}
});
$(".dzhBtn").click(function(){
	$(this).siblings('#tvFrmType').val('dzh');
	return checkSubStock($(this).parent("form").get());
});
$(".znzBtn").click(function(){
	$(this).siblings('#tvFrmType').val('znz');
	return checkSubStock($(this).parent("form").get());
});
$("form[name='xw']").submit(function(){
	var jgCode = $(this).find("input.jgdm").val();
	if(jgCode.length>2 && jgCode.replace(/[\da-zA-Z]+/ig,"").length==0) { return true; }
	else { alert("请输入正确的席位代码");return false; }
});
$.get("/topview/include/tvDateList.htm",function(data){
		if (data) {
			$("form.hasStockCode").find("select[name='date']").html(data);
		}
	});

//if (!GetCookie("favJS")) {
//	$(window).unload(function(){addfav('中国赢富网：Topview免费查询','http://www.chinaTopview.com');SetCookie("favJS", "1", 90*24*60*60);});
//}