// Javascript functions for closing/updating an active zoom window
// ------------------------------------------------------------------------------------------------------

function closeZoom(doItNow) {

	if (doItNow == 'now') {
		// close it down if it is there
		if (z=window.activeZoom) {
			if (!z.closed) z.close();
		}
	} else {
		setTimeout("closeZoom('now');", 500);
	}
}

function refreshZoom(assetPK, myHref, doItNow) {

	if (doItNow == 'now') {
		// refresh zoom window if it's assetPK matches the one given
		if (z=window.activeZoom) {
			saveDate = new Date;
			saveDate = saveDate.getTime();
			if ( (!z.closed) && ((z.assetPK == assetPK) || (assetPK == 0)) ) z.document.location.href = z.document.location.href+"&tmp="+saveDate;
			if (myHref) document.location.href = myHref;
		}
	} else {
		setTimeout("refreshZoom("+assetPK+",'"+myHref+"', 'now');", 500);
	}
	
	
}


