﻿var BOTTOM_AD = true;
function doSelectForm(B){for(var A=0;A<B.elements.length;A++){var C=B.elements[A];if(C.Name!="boxfiles"){C.checked=!C.checked}}}var dURL=window.location.href.toLowerCase();if(dURL.indexOf("bestgo.com")<0&&window.location.href.indexOf("teapub")<0&&window.location.href.indexOf("localhost")<0){var path=document.location.pathname}function drop_mouseover(B){try{window.clearTimeout(timer)}catch(A){}}function drop_mouseout(B){var A=$("#"+B+"Sel").css("display");if(A=="block"){timer=setTimeout("drop_hide('"+B+"')",2000)}}function drop_hide(A){$("#"+A+"Sel").css("display","none")}function addFavorite(B,A){if(document.all){window.external.addFavorite(A,B)}else{if(window.sidebar){window.sidebar.addPanel(B,A,"")}}return false}function seachXview(B){var A=$("#stockcode").val().replace(/sh/gi,"");if(!/[3|6|9|0]\d{5}/gi.test(A)){alert("\u8bf7\u8f93\u5165\u6b63\u786e\u7684\u80a1\u7968\u3001\u677f\u5757\u4ee3\u7801/\u540d\u79f0/\u62fc\u97f3!\u5982(600000\u3001000002\u6216\u8005991001)");return false}else{
	if (searchFH(B,A)) {
		return;
	}
	$.cookie("bestgo_stockcode",A,{path:"/"});(A.substring(0,1)=="9")?window.location.href="/block/dde/"+A+".html":window.location.href="/topview/"+A+".html";return true}}function getCookie(A){var B=$.cookie(A);if(B!=null){return B}}keycode=function(A){return window.event?A.keyCode:A.which};function selPeriod(A){var B=$("#idenddate").attr("value");$("#idbegindate").attr("value",DateAdd("d",A,B));$("#idbegindate1").attr("value",DateAdd("d",A,B))}chkOpen=function(){var F=new Date();var D=new Date(F.format("yyyy/MM/dd")+" 9:29:00");var A=new Date(F.format("yyyy/MM/dd")+" 11:30:00");var C=new Date(F.format("yyyy/MM/dd")+" 13:00:00");var E=new Date(F.format("yyyy/MM/dd")+" 15:01:00");var B=F.getUTCDay();if(B==6||B==0){return false}return((D.dateDiff("n",F)>0&&A.dateDiff("n",F)<=0)||(C.dateDiff("n",F)>=0&&E.dateDiff("n",F)<0))};function chkClose(){var B=new Date();var A=new Date(B.format("yyyy/MM/dd")+" 15:00:00");return(B.dateDiff("n",A)<0)}function DateAdd(interval,number,date){number=parseInt(number);if(typeof(date)=="string"){date=date.split(/\D/);--date[1];eval("var date = new Date("+date.join(",")+")")}if(typeof(date)=="object"){var date=date}switch(interval){case"y":date.setFullYear(date.getFullYear()+number);break;case"m":date.setMonth(date.getMonth()+number);break;case"d":date.setDate(date.getDate()-number);break;case"w":date.setDate(date.getDate()+7*number);break;case"h":date.setHours(date.getHour()+number);break;case"n":date.setMinutes(date.getMinutes()+number);break;case"s":date.setSeconds(date.getSeconds()+number);break;case"l":date.setMilliseconds(date.getMilliseconds()+number);break}return date}Date.prototype.format=function(B){var C={"M+":this.getMonth()+1,"d+":this.getDate(),"h+":this.getHours(),"m+":this.getMinutes(),"s+":this.getSeconds(),"q+":Math.floor((this.getMonth()+3)/3),S:this.getMilliseconds()};if(/(y+)/.test(B)){B=B.replace(RegExp.$1,(this.getFullYear()+"").substr(4-RegExp.$1.length))}for(var A in C){if(new RegExp("("+A+")").test(B)){B=B.replace(RegExp.$1,RegExp.$1.length==1?C[A]:("00"+C[A]).substr((""+C[A]).length))}}return B};Date.prototype.dateDiff=function(A,B){if(arguments.length<2||B.constructor!=Date){return undefined}switch(A){case"s":return parseInt((B-this)/1000);case"n":return parseInt((B-this)/60000);case"h":return parseInt((B-this)/3600000);case"d":return parseInt((B-this)/86400000);case"w":return parseInt((B-this)/(86400000*7));case"m":return(B.getMonth()+1)+((B.getFullYear()-this.getFullYear())*12)-(this.getMonth()+1);case"y":return B.getFullYear()-this.getFullYear();default:return undefined}};function isNumber(B){if(!B){return false}var C=/^\d+(\.\d+)?$/;if(!C.test(B)){return false}try{if(parseFloat(B)!=B){return false}}catch(A){return false}return true}var t=1;function ShowTopDiaLog(A){ShowTopDiaLoged(A,"#topdialog","840","500")}function ShowTopDiaLoged(C,D,A,B){if(t==1){t=0;$(D).dialog({title:C,width:A,height:B})}else{$(D).dialog("open")}$(D).css("display","block")}$(document).ready(function(){$("#stockcode").keydown(function(A){if(keycode(A)==13){seachXview("")}});$("#stockcode").attr("value",getCookie("bestgo_stockcode"));$("#blockS1 ul li span").mousemove(function(){$(this).parents("ul").find("li.hoverA").removeClass().addClass("blockA");$(this).parent("li").removeClass().addClass("hoverA");$(this).parents(".blockA").find(".blockA_con").hide();$("#"+$(this).attr("name")).show()});$("#blockS2 ul li span").mousemove(function(){$(this).parents("ul").find("li.hoverA").removeClass().addClass("blockA");$(this).parent("li").removeClass().addClass("hoverA");$(this).parents(".blockA").find(".blockA_con").hide();$("#"+$(this).attr("name")).show()});$(".topmenu li span").mousemove(function(){$(".submenu").find(".c").hide();$("#"+$(this).attr("name")).show()});$(".topmenu li a").mousemove(function(){$(".submenu").find(".c").hide();$("#subpage1").show()});$(".blocktab span").mousemove(function(){$(this).parents("ul").find("li.hovercap").removeClass().addClass("blockcap");$(this).parent("li").removeClass().addClass("hovercap");$(this).parents("div.blockB").find(".blockcontent").hide();$("#"+$(this).attr("name")).show()});updateddetime(0);setInterval("updateddetime()",30000)});function showddetime(){$("#ddetime").html($("div").data("ddetime"));$("#ddetimes").html($("div").data("ddetime"))}function flashMovie(A){if(navigator.appName.indexOf("Microsoft")>-1){return window[A]}else{return document[A]}}var iframeID=function(B,A){return window.frames[B].document.getElementById(A)};function ajaxQuery(A,E,B,C,D){$.ajax({type:A,async:(D==undefined)?true:D,url:E+"&s="+Math.round(Math.random()*10000),data:B,timeout:20000,error:function(){$("#status").html("\u6570\u636e\u8f7d\u5165\u9519\u8bef!")},success:function(F){C(F)}})}function updateddetime(A){if(A==undefined&&!chkOpen()){return false}ajaxQuery("get",vpath+"ajax?action=s","",function(B){$("div").data("ddetime",B);showddetime()})}function formatNumber(V,S){var Q=V?V.toString().split("."):["0"];var O=S?S.split("."):[""];var T="";var R=Q[0];var N=O[0];var L=R.length-1;var P=false;for(var U=N.length-1;U>=0;U--){switch(N.substr(U,1)){case"#":if(L>=0){T=R.substr(L--,1)+T}break;case"0":if(L>=0){T=R.substr(L--,1)+T}else{T="0"+T}break;case",":P=true;T=","+T;break}}if(L>=0){if(P){var M=R.length;for(;L>=0;L--){T=R.substr(L,1)+T;if(L>0&&((M-L)%3)==0){T=","+T}}}else{T=R.substr(0,L+1)+T}}T=T+".";R=Q.length>1?Q[1]:"";N=O.length>1?O[1]:"";L=0;for(var U=0;U<N.length;U++){switch(N.substr(U,1)){case"#":if(L<R.length){T+=R.substr(L++,1)}break;case"0":if(L<R.length){T+=R.substr(L++,1)}else{T+="0"}break}}return T.replace(/^,+/,"").replace(/\.$/,"")};
function searchFH(B,A) {
	if (A.length < 6)
	{
		alert('请输入正确的股票代码');
		return;
	}
	var a = A.substring(0, 1);
		var type;
		if (a == '6')
		{
			type = 'SH';
		}
		else if (a == '9')
		{
			type = 'B$';
		}
		else {
			type = 'SZ';
		}
		if (B == 'hd')
		{
			window.location.href = '/hd/detail/'+type + A;
			return true;
		}
		else if (B == 'fund')
		{
			window.location.href= '/fund/detail/'+type+A;
			return true;
		}
	return false;
}
function myStockOptional(mode, stockcode, callback)
{
	var show = callback || alert;
	if (stockcode.length<6)
	{
		show('股票代码不正确!');
		return false;
	}
	$.ajax({
		type: "POST",
		url: "/user/bt_mystock_list.asp?action=check",
		timeout: 20000,
		data: "stockcode="+stockcode+"&atype=" + mode,
		success: function(code){
			switch (code)
			{
			case '200':
				show('恭喜您,\['+stockcode+'\]成功加入到自选股中!');
			break;
			case '201':
				show('\['+stockcode+'\]已存在于自选股中!');
			break;
			case '202':
				show('您的自选股数量已达到上限!');
			break;
			case '401':
				show('不存在此股票代码!');
			break;
			case '505':
				show('您需要登录后才能继续操作!');
			break;
			case '500':
				show("数据加载失败，请稍后再试!");
			break;
			case '203':
				show("已成功删除自选股票\["+stockcode+"\]!");
			break;
			default:
				show(code);
			break;
			}
			return false;
		}
	});
	return false;
}
$(function(){
	window.onerror = function() {
		return true;
	}
	if ($("#fstockcode").length > 0)
	{
		window.suggestStock_top = new Suggest("fstockcode", "", ["http://www.bestgo.com/js/lib/astock.js"], ["astock_suggest"], StockSuggestConfiguration, null, [200, 800, 0.95, "solid", "#EEE", "#FFF", 3, 3, 0.2, "#000", "#444", "#e5ebfb", false]);
	}
});
