/* set variable */
var ct;     // clear time
var hf = 0; // hide flag
var flag = 0;

/* preload flag images */
function preloadFlagImages() {
	var flagImgDir = '/asv/images/load/';
	if (document.icon.complete && document.flag.complete) {
		preImg = new Array();
		imgList = new Array('load','load2','loading','complete','spacer');
		for (i = 0; i < imgList.length; i++) {
			preImg[i] = new Image();
			preImg[i].src = flagImgDir + imgList[i] + '.gif';
		}
	}
	flag = 1;
}

/* loading */
function loading(i,j) {
	document.icon.src = preImg[i].src;
	document.flag.src = preImg[j].src;
}

/* hide flag images */
function hideFlags() {
	if (flag) {
		if (hf && (document.icon && document.flag)) {
			document.icon.src = preImg[4].src;
			document.flag.src = preImg[4].src;
		}
		clearTimeout(ct);
		hf = 0;
	}
}

/* document complete */
function complete() {
	if ((parent.header.loaded) && (parent.body.loaded) && (parent.footer.loaded)) {
		document.icon.src = icon[1].src;
		document.flag.src = flag[3].src;
	}
	hf = 1;
	ct = setTimeout('hideFlags()',2000);
}
