/*
 *	MAKE SURE YOUR HTML CODE CALLS THE FUNCTION "htmlAdWH()"	
 *
 *	UPLOAD THIS FILE TO BIGBOWL AND THEN USE THIS LINE OF CODE ON YOUR APP'S
 *	HTML TO INCLUDE THIS JS FUNCTION IN YOUR PAGE AT THE TOP OF THE MODULE:
 *
 *	<script language="javascript" 
 *		src="absolute_path_to_your_dir_izk_flash_adrefresh.js"></script>
 *
 *	call from Flash:
 *		getURL("javascript:IZKadRefresher.refreshAds();");
 */

this.IZKadRefresher = function(theAds, theIframes)
{
	this.ads = theAds;
	(theIframes != null) ? this.iframes = theIframes : this.iframes = [];
}

//	Refreshes the AD frame from Flash to the next magic number in the list:
this.IZKadRefresher.prototype.refreshAds = function()
{
	var adsScr1 = window.adsD.getTime() % 0x3fffffff;
	for(var i = 0; i < this.ads.length; i++)
	{
		parent["adsF" + i].location.href = window.adsHt + "/html/" + this.ads[i][0] + "/" 
				+ adsScr1 + "/" + window.adsExt + "?" + window.adsNMSG + "&width=" 
				+ this.ads[i][1] + "&height=" + this.ads[i][2] + "&target=" + window.adsTar 
				+ window.adsTz + window.adsScS + window.adsSr + window.adsSN 
				+ window.adsWM + window.adsOt + "&CT=I";
	}
	for(var i = 0; i < this.iframes.length; i++)
	{
		window.document.getElementById(this.iframes[i][0]).src = this.iframes[i][1];
	}
}

/*
 *	Creates the IZKadRefresher object:
 *
 *	@params:
 *		1) a square-barcket enclosed, comma-separated list of ads where each ad is enclosed in square brackets and 
 *			includes the quotated magic number, width and height separated by commas
 *			(i.e. [["magic_number_1", width, height], ["magic_number_2", width, height]])
 *
 *		2) an optional second parameter which is a square-bracket enclosed, comma-separated list of hidden iframe ids and 
 *			their urls this is to allow for url-based, hidden, hit counts.
 *			(i.e. [["iframe_id_one", "url1"],["iframe_id_two", "url2"]])
 *
 *		To use, modify the initializer below, deleting all unused entries. Follow the instructions at the top of this document.
 */
this.IZKadRefresher = new IZKadRefresher([["93191315", 728, 90], ["93191316", 160, 600]]);

