﻿// 嵌套父页面必须使用此文件。


var sinobull_iframeName="99qh_Quote";					// iframe的ID，改成实际IFRAME的ID。
var sinobull_value="QuoteHeight";						// 根据鑫牛公司提供的变量名称设置。
var sinobull_path="http://service.99qh.com/quote";	// 根据鑫牛公司提供的接口程序路径设置。

var sinobull_iframeFocusTimes=0;
var sinobull_img=document.createElement("img");
sinobull_img.attachEvent("onload",sinobull_AdjustIframe);

// 被嵌套的页每次事件都回发，本页面加载时调用此函数。
function sinobull_LoadIframe(){
	sinobull_GetImage();
}

// 被嵌套的页利用无刷新技术改变页面内容时，本页面调用此函数。
function sinobull_LoadIframeForAjax(){
	document.getElementById(sinobull_iframeName).attachEvent("onfocus",sinobull_FocusIframe);
	sinobull_GetImage();
}

function sinobull_GetImage(){
	var time=new Date();
	var number = Math.random();
	sinobull_img.src=sinobull_path.toLowerCase()+"/GetValue.aspx?Value="+sinobull_value+"&time="+time.toString()+number;
}

function sinobull_AdjustIframe(){
	var l=sinobull_img.width; 
	document.getElementById(sinobull_iframeName).height=l;
}

function sinobull_FocusIframe(){
	// 获得焦点次数
	times=3
	sinobull_iframeFocusTimes++;
	if(sinobull_iframeFocusTimes==1){
		window.setTimeout(sinobull_ClearTimes,10);
	}
	else if(times==sinobull_iframeFocusTimes){
		sinobull_iframeFocusTimes=0;
		sinobull_GetImage();
	}
}

function sinobull_ClearTimes(){
	sinobull_iframeFocusTimes=0;
}

