var PopupFromFlash = function(){
	var popups = new Array();	// keep track of all the windows this object has popped up
	this.getWindows = function(){return popups;}	// 'getter' fucntion to access the window array
		// this is a super simple msie detector... you could substitute your own if you need a more specific one.
	var isIE = (navigator.appName.indexOf("Microsoft") != -1) ? true : false;
		// this is where all the magic happens - this function is called from flash, and is passed the target url, the window title, window parameters, and the option to use a random seed in the window title
	this.openWindow = function(swfID, url, title, useRandomSeed, params){
		var pageName;	// this will eventually be passed into the window.open function
		if(isIE){pageName='_blank';}else{	// IE doesn't like custom window titles, so we'll default to '_blank' if that's the case
			switch(useRandomSeed){
				case false:	// if you've chosen not to use a random seed, this'll just default to the title you passed in
					pageName = title;
				break;
				case 'append':	// this appends a random seed to the end of your title
					pageName = title + generateRandomSeed();
				break;
				case true:	// and this will completely ignore whatever title you've specified, and use the seed instead.
					pageName = generateRandomSeed();
				break;
				default:	// by default, no random seed, just the title you passed in
					pageName = title;
				break;
			}
		}	// window.open returns a reference to the popup, which we're going to store in newPage
		var newPage = window.open(url,pageName,params);
		if(newPage){	// and if that popup worked, newPage will reflect that success
				// if you need a reference back to that window, you can look in the popups array, so we'll add our recently popped up window to that array
			popups.push({title:title,window:newPage,generatedTitle:pageName});
				// and focus on it, to make sure it doesn't just disapear behind the other windows.
			newPage.focus();
		}else{	// otherwise, the popup failed - which means we call the function specified by the actionscript PopupFromFlash class, which essentially defaults to opening a new window in the normal manner
			if(!document.getElementById(swfID)){	// if we can't get this element, then either getElementById isn't supported, or the id is incorrect
				alert('Error: PopupFromFlash could not find a flash element with the id "' + swfID + '" while attempting to pop up "' + url + '".');
			}
			document.getElementById(swfID).openWindowFromSwf(url);	// occasionally generates an error/warning, but doesn't prevent it from executing.
		}
	}
	var generateRandomSeed = function(){	// random number to 4 places, plus datestamp... plenty unique enough for our purposes.
		return Math.round(9999*Math.random()) + new Date().getTime();
	}
}
this.popupFromFlash = new PopupFromFlash();	// this ensures that there is an instance of the PopupFromFlash object available in the DOM for the .swf to access