function isStockOrMarket(c) {
	var a = {};
	a = external.createObject("Quote");
	var b = a.IsStockOrIndex(c);
	if (b == 1) {
		return 1
	} else {
		return 0
	}
}
function isDevisionOrKline(a) {
	var b = 8192;
	if (a == b) {
		return 1
	} else {
		return 0
	}
}
function isL2OrUnite() {
	var a = {};
	a = external.createObject("Passport");
	if (a.IsLevel2User()) {
		return 1
	} else {
		return 0
	}
}
function sket() {
	var strhtml = new Array();
	strhtml.push('<div class="jbtj">'); 
	strhtml.push('      <table width="524" border="0" cellpadding="1" cellspacing="1">');
	strhtml.push('  <tr  class="t1">');
	strhtml.push('    <td width="65"> \u8d77\u59cb\u65f6\u95f4:</td>');
	strhtml.push('    <td width="107"><input id="begintime" class="time_select2" type="text" style="background-color:#ffffff;width:105px;height:20px;" readonly/></td>');
	strhtml.push('    <td width="65"> \u7ec8\u6b62\u65f6\u95f4:</td>');
	strhtml.push('    <td width="107"><input id="endtime" class="time_select2" type="text" style="background-color:#ffffff;width:105px;height:20px;" readonly/></td>');
	strhtml.push('    <td width="65"> \u5468\u671f\u4e2a\u6570:</td>');
	strhtml.push('    <td width="75" class="td2"><span id="fz\u5468\u671f\u6570" style="_position:relative;_top:-1px"></span>\u4e2a</td>');
	strhtml.push('  </tr>');
	strhtml.push('  <tr>');
	strhtml.push('    <td> \u8d77\u59cb\u4ef7:</td>');
	strhtml.push('    <td class="td2" id="fz\u8d77\u59cb\u4ef7">--</td>');
	strhtml.push('    <td> \u7ec8\u6b62\u4ef7:</td>');
	strhtml.push('    <td class="td2" id="fz\u7ec8\u6b62\u4ef7">--</td>');
	strhtml.push('    <td> \u6700\u9ad8:</td>');
	strhtml.push('     <td class="td2" id="fz\u6700\u9ad8" class="red">--</td>');
	strhtml.push('  </tr>');
	strhtml.push('  <tr>');
	strhtml.push('    <td> \u6700\u4f4e:</td>');
	strhtml.push('    <td class="td2" id="fz\u6700\u4f4e" class="green">--</td>');
	strhtml.push('    <td> \u6da8\u8dcc\u503c:</td>');
	strhtml.push('    <td class="td2" id="fz\u6da8\u8dcc\u503c">--</td>');
	strhtml.push('    <td> \u6da8\u8dcc\u5e45:</td>');
	strhtml.push('    <td class="td2" id="fz\u6da8\u8dcc\u5e45">--</td>');
	strhtml.push('  </tr>');
	strhtml.push('  <tr>');
	strhtml.push('    <td> \u632f\u5e45:</td>');
	strhtml.push('    <td class="td2" id="fz\u632f\u5e45" class="lan">--</td>');
	strhtml.push('<td> \u603b\u624b:</td>');
	strhtml.push('    <td class="td2" id="fz\u603b\u624b" class="lan">--</td>');
	strhtml.push('<td> \u91d1\u989d:</td>');
	strhtml.push('    <td class="td2" id="fz\u91d1\u989d" class="lan">--</td> ');
	strhtml.push('    ');
	strhtml.push('  </tr>');
	strhtml.push('  <tr>');
	strhtml.push('  <td> \u6362\u624b: </td>');
	strhtml.push('    <td class="td2" id="fz\u6362\u624b" class="lan">--</td>');
	strhtml.push('    <td>&nbsp;</td>');
	strhtml.push('    <td>&nbsp;</td> ');
	strhtml.push('    <td>&nbsp;</td>');
	strhtml.push('    <td>&nbsp;</td>');
	strhtml.push('  </tr>');
	strhtml.push('</table>'); 
	strhtml.push('</div>');
	$("#con").html(strhtml.join(""));
	strhtml = [];
	var beginTimeInput = $("#begintime");
	var endTimeInput = $("#endtime");
	var currentPeriod = IntervalStatData.getPeriod();
	selectDate(beginTimeInput, 'begin', currentPeriod);
	selectDate(endTimeInput, 'end', currentPeriod);
	$('#begintime').val(IntervalStatData.getBeginTime());
	$('#endtime').val(IntervalStatData.getEndTime());
	var requestData = function() {
			var dataItems = ['\u8d77\u59cb\u4ef7', '\u7ec8\u6b62\u4ef7', '\u6700\u9ad8', '\u6700\u4f4e', '\u5747\u4ef7', '\u6da8\u8dcc\u503c', '\u6da8\u8dcc\u5e45', '\u632f\u5e45', '\u603b\u624b', '\u91d1\u989d', '\u6362\u624b', '\u7279\u5927\u5355\u4e70\u5165', '\u7279\u5927\u5355\u5356\u51fa', '\u7279\u5927\u5355\u51c0\u91cf', '\u7279\u5927\u5355\u51c0\u989d', '\u5927\u5355\u4e70\u5165', '\u5927\u5355\u5356\u51fa', '\u5927\u5355\u51c0\u91cf', '\u5927\u5355\u51c0\u989d', '\u4e2d\u5355\u4e70\u5165', '\u4e2d\u5355\u5356\u51fa', '\u4e2d\u5355\u51c0\u91cf', '\u4e2d\u5355\u51c0\u989d', 'HUGEBUYMONEY', 'BIGBUYMONEY'];
			return IntervalStatData.getData(dataItems)
		};
	var handleData = function(data) {
			var periodNum = IntervalStatData.getPeriodNum();
			$('#fz\u5468\u671f\u6570').html(periodNum);
			var priseCost, hugeBuyMoney, bigBuyMoney, hugeBuyStocks, bigBuyStocks;
			hugeBuyMoney = parseFloat(data['HUGEBUYMONEY']);
			bigBuyMoney = parseFloat(data['BIGBUYMONEY']);
			hugeBuyStocks = parseFloat(data['\u7279\u5927\u5355\u4e70\u5165']);
			bigBuyStocks = parseFloat(data['\u5927\u5355\u4e70\u5165']);
			if (((hugeBuyStocks + bigBuyStocks) > 0) && ((hugeBuyMoney + bigBuyMoney) > 0)) {
				priseCost = (hugeBuyMoney + bigBuyMoney) / (hugeBuyStocks + bigBuyStocks);
				priseCost = priseCost.toFixed(2)
			}
			var de = ['\u603b\u624b', '\u91d1\u989d', '\u7279\u5927\u5355\u4e70\u5165', '\u7279\u5927\u5355\u5356\u51fa', '\u7279\u5927\u5355\u51c0\u91cf', '\u7279\u5927\u5355\u51c0\u989d', '\u5927\u5355\u4e70\u5165', '\u5927\u5355\u5356\u51fa', '\u5927\u5355\u51c0\u91cf', '\u5927\u5355\u51c0\u989d', '\u4e2d\u5355\u4e70\u5165', '\u4e2d\u5355\u5356\u51fa', '\u4e2d\u5355\u51c0\u91cf', '\u4e2d\u5355\u51c0\u989d'];
			var c100 = ['\u603b\u624b', '\u7279\u5927\u5355\u4e70\u5165', '\u7279\u5927\u5355\u5356\u51fa', '\u7279\u5927\u5355\u51c0\u91cf', '\u5927\u5355\u4e70\u5165', '\u5927\u5355\u5356\u51fa', '\u5927\u5355\u51c0\u91cf', '\u4e2d\u5355\u4e70\u5165', '\u4e2d\u5355\u5356\u51fa', '\u4e2d\u5355\u51c0\u91cf'];
			var priceCode = ['\u8d77\u59cb\u4ef7', '\u7ec8\u6b62\u4ef7', '\u6700\u9ad8', '\u6700\u4f4e', '\u5747\u4ef7', '\u6da8\u8dcc\u503c'];
			var codeDecimal = IntervalStatData.getCodeDecimal();
			for (var key in data) {
				if (isNaN(parseFloat(data[key]))) {
					continue
				}
				if (key != '\u5468\u671f\u6570') {
					data[key] = parseFloat(data[key]).toFixed(2);
					if ($.inArray(key, c100) >= 0) {
						data[key] /= 100
					}
					if ($.inArray(key, de) >= 0) {
						data[key] = judgeNum(data[key], 2)
					}
					if ($.inArray(key, priceCode) >= 0) {
						data[key] = judgeNumNoUnit(data[key], codeDecimal)
					}
					if (key == '\u6da8\u8dcc\u5e45') {
						if (data[key] > 0) {
							$('#fz' + key).addClass('red');
							if (data[key] != '--') {
								data[key] = '+' + data[key] + '%'
							}
						} else {
							$('#fz' + key).addClass('green');
							if (data[key] != '--') {
								data[key] = data[key] + '%'
							}
						}
					} else if (key == '\u6da8\u8dcc\u503c') {
						data[key] = parseFloat(data[key]).toFixed(2);
						if (data[key] > 0) {
							$('#fz' + key).addClass('red');
							data[key] = '+' + data[key]
						} else {
							$('#fz' + key).addClass('green');
							data[key] = data[key]
						}
					} else if (key == '\u632f\u5e45') {
						if (data[key] != '--') {
							data[key] = data[key] + '%'
						}
					} else if (key == '\u6362\u624b') {
						if (data[key] != '--') {
							data[key] = data[key] + '%'
						}
					}
				}
				if ($("#fz" + key).length > 0) $("#fz" + key).html(data[key])
			}
			renderDpHzZdf()
		};
	var data = requestData();
	handleData(data);
	var dataItems = ['\u8d77\u59cb\u4ef7', '\u7ec8\u6b62\u4ef7', '\u6700\u9ad8', '\u6700\u4f4e', '\u5747\u4ef7', '\u6da8\u8dcc\u503c', '\u6da8\u8dcc\u5e45', '\u632f\u5e45', '\u603b\u624b', '\u91d1\u989d', '\u6362\u624b', '\u7279\u5927\u5355\u4e70\u5165', '\u7279\u5927\u5355\u5356\u51fa', '\u7279\u5927\u5355\u51c0\u91cf', '\u7279\u5927\u5355\u51c0\u989d', '\u5927\u5355\u4e70\u5165', '\u5927\u5355\u5356\u51fa', '\u5927\u5355\u51c0\u91cf', '\u5927\u5355\u51c0\u989d', '\u4e2d\u5355\u4e70\u5165', '\u4e2d\u5355\u5356\u51fa', '\u4e2d\u5355\u51c0\u91cf', '\u4e2d\u5355\u51c0\u989d', 'HUGEBUYMONEY', 'BIGBUYMONEY'];
	IntervalStatData.registerPush(dataItems, function(data) {
		handleData(data)
	});
	renderDpHzZdf()
}
function sdfu() {
	var strhtml = new Array();
	strhtml.push('<div class="jbtj">'); 
	strhtml.push('    <table width="524" border="0" cellpadding="1" cellspacing="1">');
	strhtml.push('  <tr class="t1">');
	strhtml.push('    <td width="65"> \u8d77\u59cb\u65f6\u95f4:</td>');
	strhtml.push('    <td width="107"><input id="begintime" type="text" style="width:105px;background-color:#4D0A0A;" readonly/></td>');
	strhtml.push('    <td width="65"> \u7ec8\u6b62\u65f6\u95f4:</td>');
	strhtml.push('    <td width="107"><input id="endtime" type="text" style="width:105px;background-color:#4D0A0A;" readonly/></td>');
	strhtml.push('    <td width="65"> \u5468\u671f\u4e2a\u6570:</td>');
	strhtml.push('    <td width="75" class="td2"><span id="fz\u5468\u671f\u6570" ');
	strhtml.push('style="_position:relative;_top:-1px"></span>\u4e2a</td>');
	strhtml.push('  </tr>');
	strhtml.push('  <tr>');
	strhtml.push('    <td> \u8d77\u59cb\u4ef7:</td>');
	strhtml.push('    <td class="td2" id="fz\u8d77\u59cb\u4ef7">--</td>');
	strhtml.push('    <td> \u7ec8\u6b62\u4ef7:</td>');
	strhtml.push('    <td class="td2" id="fz\u7ec8\u6b62\u4ef7">--</td>');
	strhtml.push('    <td> \u6700\u9ad8:</td>');
	strhtml.push('     <td class="td2" id="fz\u6700\u9ad8" class="red">--</td>');
	strhtml.push('  </tr>');
	strhtml.push('  <tr>');
	strhtml.push('    <td> \u6700\u4f4e:</td>');
	strhtml.push('    <td class="td2" id="fz\u6700\u4f4e" class="green">--</td>');
	strhtml.push('    <td> \u6da8\u8dcc\u503c:</td>');
	strhtml.push('    <td class="td2" id="fz\u6da8\u8dcc\u503c">--</td>');
	strhtml.push('    <td> \u6da8\u8dcc\u5e45:</td>');
	strhtml.push('    <td class="td2" id="fz\u6da8\u8dcc\u5e45">--</td>');
	strhtml.push('  </tr>');
	strhtml.push('  <tr>');
	strhtml.push('    <td> \u632f\u5e45:</td>');
	strhtml.push('    <td class="td2" id="fz\u632f\u5e45" class="lan">--</td>');
	strhtml.push('    <td> \u5927\u76d8\u5bf9\u6bd4:</td>');
	strhtml.push('    <td class="td2" id="fzdpdb" class="lan">--</td>');
	strhtml.push('    <td> \u603b\u624b:</td>');
	strhtml.push('    <td class="td2" id="fz\u603b\u624b" class="lan">--</td>');
	strhtml.push('  </tr>');
	strhtml.push('  <tr>');
	strhtml.push('    <td> \u91d1\u989d:</td>');
	strhtml.push('    <td class="td2" id="fz\u91d1\u989d" class="lan">--</td>');
	strhtml.push('    <td> \u6362\u624b: </td>');
	strhtml.push('    <td class="td2" id="fz\u6362\u624b" class="lan">--</td>');
	strhtml.push('    <td>&nbsp;</td>');
	strhtml.push('    <td>&nbsp;</td>');
	strhtml.push('  </tr>');
	strhtml.push('</table>  '); 
	strhtml.push('</div>');
	$("#con").html(strhtml.join(""));
	strhtml = [];
	var priceCode = ['\u8d77\u59cb\u4ef7', '\u7ec8\u6b62\u4ef7', '\u6700\u9ad8', '\u6700\u4f4e', '\u6da8\u8dcc\u503c'];
	var codeDecimal = IntervalStatData.getCodeDecimal();
	var dataItems = ['\u8d77\u59cb\u4ef7', '\u7ec8\u6b62\u4ef7', '\u6700\u9ad8', '\u6700\u4f4e', '\u6da8\u8dcc\u503c', '\u6da8\u8dcc\u5e45', '\u632f\u5e45', '\u603b\u624b', '\u91d1\u989d', '\u6362\u624b'];
	var periodNum = IntervalStatData.getPeriodNum();
	$('#fz\u5468\u671f\u6570').html(periodNum);
	var data = IntervalStatData.getData(dataItems);
	$('#begintime').val(IntervalStatData.getBeginTime());
	$('#endtime').val(IntervalStatData.getEndTime());
	var data = IntervalStatData.getData(dataItems);
	for (var key in data) {
		var zdz, zdf, zf, zs;
		if ($.inArray(key, priceCode) >= 0) {
			data[key] = judgeNumNoUnit(data[key], codeDecimal)
		}
		if (key == '\u6da8\u8dcc\u503c') {
			if (data[key] > 0) {
				$('#fz' + key).removeClass('green');
				$('#fz' + key).addClass('red');
				zdz = '+' + data[key]
			} else {
				$('#fz' + key).removeClass('red');
				$('#fz' + key).addClass('green');
				zdz = data[key]
			}
			$('#fz' + key).html(zdz)
		} else if (key == '\u6da8\u8dcc\u5e45') {
			data[key] = judgeNum(data[key], 2);
			if (data[key] != '--') {
				if (data[key] > 0) {
					$('#fz' + key).removeClass('green');
					$('#fz' + key).addClass('red');
					data[key] = '+' + data[key] + '%'
				} else {
					$('#fz' + key).removeClass('red');
					$('#fz' + key).addClass('green');
					data[key] = data[key] + '%'
				}
			}
			$('#fz' + key).html(data[key])
		} else if (key == '\u632f\u5e45') {
			data[key] = judgeNum(data[key], 2);
			zf = data[key] + '%';
			$('#fz' + key).html(zf)
		} else if (key == '\u603b\u624b') {
			zs = judgeNum(data[key] / 100, 0);
			$('#fz' + key).html(zs)
		} else if (key == '\u91d1\u989d') {
			data[key] = judgeNum(data[key], 2);
			$('#fz' + key).html(data[key])
		} else if (key == '\u5468\u671f\u6570') {
			$('#fz' + key).html(data[key])
		} else if (key == '\u6362\u624b') {
			data[key] = judgeNum(data[key], 2);
			if (data[key] != '--') {
				data[key] += '%'
			}
			$('#fz' + key).html(data[key])
		} else {
			$('#fz' + key).html(data[key])
		}
	}
	IntervalStatData.getDpHyZdf(function(data) {
		var dp = isNaN(parseFloat(data.dp)) ? '--' : parseFloat(data.dp).toFixed(2) + '%';
		$('#fzdpdb').html(dp)
	})
}
function judgeOpen(h, e) {
	var g, c, f, a, d, b;
	g = isStockOrMarket(h);
	c = isDevisionOrKline(e);
	f = isL2OrUnite();
	b = external.createObject("Quote");
	d = b.getStockCode(h);
	a = b.getStockType(h);
	if (g == 0 && c == 0) {
		sket()
	}
	if (g == 0 && c == 1 && f == 0) {
		sdfu()
	}
	if (g == 1 && c == 1 && f == 0) {
		sdfu()
	}
	if (g == 1 && c == 0 && f == 0) {
		sket()
	}
};