
/* requires core.js */

ADCENTRIC.lang.namespace("ADCENTRIC.architectures")

ADCENTRIC.env.architectures = ADCENTRIC.env.architectures || { };
ADCENTRIC.env.architectures['DOM_id_prefix'] = "adcentric";
ADCENTRIC.env.architectures['SWF_LOADER_EXPANDABLE_URL'] = ADCENTRIC.env.creatives[__ADC_ID].placements[__SECTION__].assets["EXPAND_LOADER_SWF"];
ADCENTRIC.env.architectures['FF_MAC_SWF_LOADER_EXPANDABLE_URL'] = ADCENTRIC.env.creatives[__ADC_ID].placements[__SECTION__].assets["FF_MAC_EXPAND_LOADER_SWF"];

/* XXX TO BE DEPRECATED, LEGACY adcClick()/adcAction() global-namespace API: */
function adcClick(crID, _name) { }
function adcAction(crID, _name, _obj) {
	var event_pixel = new Image();
	var rn = Math.random();
	var _obj_to_string = "";

	if(_obj){
		for(var key in _obj){
			_obj_to_string += key + "=" + _obj[key] + '&';
		}
		event_pixel.src = ADCENTRIC.env.creatives[crID].placements[__SECTION__].interactions[_name] + '?' + _obj_to_string + 'num=' +rn;
	}else{
		event_pixel.src = ADCENTRIC.env.creatives[crID].placements[__SECTION__].interactions[_name] + '?num=' + rn;
	}
}

/*
 * AdCentric Banner Architecture for Ripple
 *
 * A TLA is an out of page SWF, with no backup image.  Like any Ripple creative unit,
 * it can have multiple assets (additional files) associated with it, along with AdCentric interaction-tracking URLs and click-tracking
 * redirection URLs.
 *
 * A TLA DIV container is written out when its setup() method is called.  Flash-detection is performed and an interaction 'tla_not_displayed'
 * is triggered should we not detect the presence of the Adobe plugin.  The setup() method also sets up a window.onload event to polite-load the
 * actual SWF TLA object.  Because of this, it's possible to call setup() on a TLA  instance and override width, height, zindex,
 * position, or other attributes prior to window.onload firing (i.e., directly from the tag template).  The simplest TLA
 * tag template will look roughly like this:
 *
 * //...
 * var my_tla = ADCENTRIC.architectures.TLA('__ADC_ID', '__ADC_PLACEMENT_ID');
 * my_tla.setup();
 * //...
 *
 * Note that ADCENTRIC.architectures.TLA is constructed with a (creative_id, placement_id) 2-tuple.  This allows the constructor
 * to extract required configuration structure (prepended automagically by AdCentric when the creative is served) via the
 * ADCENTRIC.env.creatives[].placements[] matrix.
 *
 * Note also that ADCENTRIC.architectures.TLA takes care of setting up the required ExternalInterfaceProxy for the TLA
 * creative as well, so this does not need to be done separately prior to instantiating ADCENTRIC.architectures.TLA
 *
 *
 * Expected ADCENTRIC.env.creatives[creative_id] for TLA architecture, general structure:
 *
 * ADCENTRIC.env.creatives[creative_id].placements[placement_id].interactions[INTERACTION_LABEL]
 * ADCENTRIC.env.creatives[creative_id].placements[placement_id].clicks[CLICK_LABEL]
 * ADCENTRIC.env.creatives[creative_id].placements[placement_id].assets[ASSET_LABEL]
 * ADCENTRIC.env.creatives[creative_id].placements[placement_id].variables[VARIABLE_LABEL]
 *
 * Specific labels required:
 *
 * - Assets: TLA
 * - Clicks: CLICK
 * - Variables: WIDTH, HEIGHT
 *
 *
 * Optional labels:
 *
 * - Variables: ZINDEX (default = '1000000'), POSITION (default = 'absolute'), WMODE (default = 'opaque'),
 *
 */
ADCENTRIC.architectures.Expandable= function(creative_id, placement_id) {
	var cr = ADCENTRIC.env.creatives[creative_id].placements[placement_id];
	var zindex = cr.variables['ZINDEX'] || "1000";
	var position = cr.variables['POSITION'] || "relative";
	var collapsed_width = cr.variables['COLLAPSED_WIDTH'];
	var collapsed_height = cr.variables['COLLAPSED_HEIGHT'];
	var expanded_width = cr.variables['EXPANDED_WIDTH'];
	var expanded_height = cr.variables['EXPANDED_HEIGHT'];
	var msie_wmode = cr.variables['MSIE_WMODE'] || "opaque";
	var ff_wmode  = cr.variables['FF_WMODE'] || "opaque";
	var collapsed_swf_url = cr.assets['COLLAPSED_SWF_FILE'];
	var expanded_swf_url = cr.assets['EXPANDED_SWF_FILE'];
	var backup_img_url = cr.assets['BACKUP_BANNER'];
	var expand_direction = cr.variables['EXPAND_DIRECTION'] || 'B';
	var expand_mode = cr.variables['EXPAND_MODE'] || 'expand_on_rollover';
	var pre_expand_time = cr.variables['PRE_EXPAND_TIME'] || '0';
	var close_on_mouse_out = (cr.variables['CLOSE_ON_MOUSEOUT'] == "true" ? true : false);
	var backup_banner_click = cr.clicks['BACKUP_BANNER_CLICK'];
	var iframe_bust = cr.variables['IFRAME_BUST'] || false;
	var is_dap = cr.variables['IS_DAP'] || false;
	var x_coord;
	var y_coord;
	var swf_id = Math.floor(Math.random() * 1000000);
	
	var origTop = 0;
	var origLeft = 0;
	

	if(iframe_bust == "false"){
		iframe_bust = false;
	}

	if(is_dap == "false"){
		is_dap = false;
	}

	/***************************************************************************************************
	 ** putting an iframe shim below a flash tla, in FF, causes the banner to be unclickable.          **
	 ** The browser seems to not understand what is layered over what, the TLA or the iframe.          **
	 ** To bypass this issue, when using a shim and viewing the TLA in FF, wmode for the embed object  **
	 ** must be equal to "window"                                                                      **
	 ***************************************************************************************************/
	if(cr.variables['USE_SHIM']){
		ff_wmode = "window";
	}

	function setupDIVStyle(){
		thisMovie('adcentric_' + String(creative_id) + "_" + String(placement_id)).style.width = expanded_width+"px";
		thisMovie('adcentric_' + String(creative_id) + "_" + String(placement_id)).style.height = expanded_height+"px";
		thisMovie('adcentric_' + String(creative_id) + "_" + String(placement_id)).style.position = "absolute";
		thisMovie('adcentric_' + String(creative_id) + "_" + String(placement_id)).style.zIndex = 1;
		
		
		if(expand_direction == "L"){
			origTop  = -1*Math.ceil((expanded_height - collapsed_height)/2);
			origLeft = -1*(expanded_width - collapsed_width);
			
		}else if(expand_direction == "R"){
			origTop  = -1*Math.ceil((expanded_height - collapsed_height)/2);
			origLeft = 0;
			
		}else if(expand_direction == "B"){
			origTop  = 0;
			origLeft = -1*Math.ceil((expanded_width - collapsed_width)/2);
			
		}else if(expand_direction == "T"){
			origTop  = -1*(expanded_height - collapsed_height);
			origLeft = -1*Math.ceil((expanded_width - collapsed_width)/2);
			
		}else if(expand_direction == "TL"){
			origTop  = -1*(expanded_height - collapsed_height);
			origLeft = -1*(expanded_width  - collapsed_width);
			
		}else if(expand_direction == "TR"){
			origTop  = -1*(expanded_height - collapsed_height);
			origLeft = 0;
			
		}else if(expand_direction == "BR"){
			origTop  = 0;
			origLeft = 0;
			
		}else if(expand_direction == "BL"){
			origTop  = 0;
			origLeft = -1*(expanded_width - collapsed_width);
			
		}else if(expand_direction == "C"){
			origTop  = -1*Math.ceil((expanded_height - collapsed_height)/2);
			origLeft = -1*Math.ceil((expanded_width  - collapsed_width)/2);
		}
		
		
		thisMovie('adcentric_' + String(creative_id) + "_" + String(placement_id)).style.left = origLeft+"px";
		thisMovie('adcentric_' + String(creative_id) + "_" + String(placement_id)).style.top = origTop+"px";
	}
	
	function thisMovie(movieName) {
		if(is_dap){
			var num_frames = top.document.frames.length; 
			for(i=0;i<num_frames;i++){
				if(eval('top.document.frames[i].' + movieName)){
					return eval('top.document.frames[i].' + movieName);
				}
			}
		}else{
			if (navigator.appName.indexOf("Microsoft") != -1) {
				return top.window[movieName]
			}else {
				return top.document[movieName]
			}
		}
	}

	function get_iframe_obj(){
		var _iframes = top.document.getElementsByTagName('iframe');
		var ifr_obj = _iframes[0];
		for(var i = 0;i<_iframes.length;i++){
			if(_iframes[i].width == collapsed_width){
				ifr_obj = _iframes[i];
			}
		}
		return ifr_obj;
	}

	function get_dap_container(this_obj){
		var dap_container;

		if(typeof(inDapMgrIf) != "undefined"){
			dap_container = construct_dap_container(this_obj);
			return dap_container;
		}else if(typeof(inDapIF) != "undefined"){
			dap_container = construct_dap_container(this_obj);
			return dap_container;
		}else{
			return dap_container = construct_dap_container(this_obj);
		}
	}

	function construct_dap_container(current_obj){
		var _dap_container= top.document.createElement('div');

		_dap_container.id = current_obj.container_id();
		_dap_container.style.zIndex = 100000;
		_dap_container.style.position = 'absolute';
		_dap_container.style.visibility = 'visible';
		_dap_container.style.overflow = 'visible';
		_dap_container.style.display = 'block';
		_dap_container.style.width = current_obj.collapsed_width()  + 'px';
		_dap_container.style.height = current_obj.collapsed_height() + 'px';

		return _dap_container;
	}

	function insert_dap_element(_contain_obj){

		var _dap_publisher_container;

		if(navigator.userAgent.indexOf('Firefox')!=-1){
			_dap_publisher_container = parent.document.getElementById(document.body.id).parentNode;
			_dap_publisher_container.insertBefore(_contain_obj, _dap_publisher_container.firstChild);
		}else{
			_dap_publisher_container = parent.document.getElementById(document.body.id);
			_dap_publisher_container.insertAdjacentElement('beforeBegin', _contain_obj);
		}
	}

	cr.lcPix = ADCENTRIC.util.ExternalInterfaceProxy(creative_id, placement_id, swf_id);

	return {
		adcAction: function(name, obj){
			// do adcAction
		},
		adcClick: function(name, obj){
			// do adcAction
		},
id: function() {
	    return ADCENTRIC.env.architectures['DOM_id_prefix'] + "_" + String(creative_id) + "_" + String(placement_id);
    },
container_id: function() {
		      return ADCENTRIC.env.architectures['DOM_id_prefix'] + "_container_" + String(creative_id) + "_" + String(placement_id);
	      },
shim_id: function() {
		 return ADCENTRIC.env.architectures['DOM_id_prefix'] + "_shim_" + String(creative_id) + "_" + String(placement_id);
	 },

override_left: function(){
		       x_coord = x_coord + cr.variables['OFFSET_LEFT'];
	       },
override_top: function(){
		      y_coord = y_coord + cr.variables['OFFSET_TOP'];
	      },

get_top: function() {
		 return y_coord;
	 },
get_left: function() {
		  return x_coord;
	  },

collapsed_width: function() {
			 return collapsed_width;
		 },
expanded_width: function() {
			return expanded_width;
		},
set_width: function(new_width) {
		   width = new_width;
	   },

collapsed_height: function() {
			  return collapsed_height;
		  },
expanded_height: function() {
			 return expanded_height;
		 },
set_height: function(new_height) {
		    height = new_height;
	    },
	
set_pre_expand_time: function(new_time_secs){
		pre_expand_time = new_time_secs
},	

set_close_on_mouse_out: function(new_val){
		close_on_mouse_out = new_val
},

set_expand_mode: function(new_expand_mode){
		expand_mode = new_expand_mode
},

get_expand_direction: function(){
		return expand_direction
},

set_expand_direction: function(new_direction){
		expand_direction = new_direction
},

zindex: function() {
		return zindex;
	},
set_zindex: function(new_zindex) {
		    zindex = new_zindex;
	    },

position: function() {
		  return position;
	  },
set_position: function(new_position) {
		      position = new_position;
	      },

set_msie_wmode: function(new_msie_wmode) {
			msie_wmode = new_msie_wmode;
		},
msie_wmode: function() {
		    return msie_wmode;
	    },
set_ff_wmode: function(new_ff_wmode) {
		      ff_wmode = new_ff_wmode;
	      },
ff_wmode: function() {
		  return ff_wmode;
	  },

to_string: function() {
		   var swf_loader_url = ""
		   if(navigator.userAgent.indexOf("Firefox") > -1 && navigator.appVersion.indexOf("Mac") > -1){
		   		swf_loader_url = ADCENTRIC.env.architectures['FF_MAC_SWF_LOADER_EXPANDABLE_URL']
		   }else{
		   		swf_loader_url = ADCENTRIC.env.architectures['SWF_LOADER_EXPANDABLE_URL']
		   }
		
		   var expandable_swf = ADCENTRIC.util.FlashTag(swf_loader_url, this.collapsed_width(), this.collapsed_height());
		   var clicks = "";
		   var asset_files = "";

		   for (var key in cr.clicks)
			   clicks += "&adcEvent_" + String(key) + "=__CLICKURL__" + cr.clicks[key];

		   for (var key in cr.assets)
			   asset_files += "&adcEvent_" + String(key) + "=" + cr.assets[key];


		   //MSIE BUG IS HERE, SHOULD CHANGE "_" IN BANNER ID TO "_" 


		   expandable_swf.set_id(this.id());
		   expandable_swf.set_msie_wmode(this.msie_wmode());
		   expandable_swf.set_ff_wmode(this.ff_wmode());
		   expandable_swf.set_flashvars("crID=" + String(creative_id) +
				   "&lcRandID=" + cr.lcPix.lc_id() +	
					"&sectionID=" + String(placement_id) +
					"&ugt=false" +
					"&base_url_click=" +
					"&base_url_assets=" +
				   "&bannerFileName=" + collapsed_swf_url +
				   "&expandFile=" + expanded_swf_url +
				   "&exp_openDirection=" + expand_direction +
				   "&banner_width=" + collapsed_width +
				   "&banner_height=" + collapsed_height +
				   "&exp_width=" + expanded_width +
				   "&exp_height=" + expanded_height +
				   "&expansionMode=" + expand_mode +
				   "&isLive=true" +
				   "&preExpandTimeoutSecs=" + pre_expand_time +
				   clicks + asset_files);

		   return expandable_swf.to_string();
	   },

set_visible: function(){
		     var container = top.document.getElementById(this.container_id());
		     var shim = top.document.getElementById(this.shim_id());

		     if(cr.variables['USE_SHIM']){
			     shim.style.display = 'block';
			     shim.style.visibility = 'visible';
		     }
		     container.style.visibility = "visible";
	     },

destroy: function(){
		 var container = top.document.getElementById(this.container_id());
		 var shim = top.document.getElementById(this.shim_id());

		 if(cr.variables['USE_SHIM']){
			 shim.style.display = 'none';
		 }
		 container.style.display = "none";
	 },

expand: function(){
	
		top.document.getElementById('inner_wrapper' + this.container_id()).style.left = origLeft+"px";
		top.document.getElementById('inner_wrapper' + this.container_id()).style.top = origTop+"px";
		top.document.getElementById('inner_wrapper' + this.container_id()).style.width = expanded_width+"px";
		top.document.getElementById('inner_wrapper' + this.container_id()).style.height = expanded_height+"px";

		thisMovie('adcentric_' + String(creative_id) + "_" + String(placement_id)).style.left = 0+"px";
		thisMovie('adcentric_' + String(creative_id) + "_" + String(placement_id)).style.top = 0+"px";
		
	},

expand_FF_MAC: function(){
	
		if(expand_direction == "L"){
			top.document.getElementById('inner_wrapper' + this.container_id()).style.top =  -((expanded_height - collapsed_height)/2) + 'px';
			top.document.getElementById('inner_wrapper' + this.container_id()).style.left = -( expanded_width - collapsed_width )  + 'px';
		
		}else if(expand_direction == "R"){
			top.document.getElementById('inner_wrapper' + this.container_id()).style.top =  -((expanded_height - collapsed_height)/2)  + 'px';
			top.document.getElementById('inner_wrapper' + this.container_id()).style.left = 0 + 'px';
	
		}else if(expand_direction == "B"){
			top.document.getElementById('inner_wrapper' + this.container_id()).style.top =  0 + 'px';
			top.document.getElementById('inner_wrapper' + this.container_id()).style.left = -((expanded_width - collapsed_width)/2) + 'px';
			
		}else if(expand_direction == "T"){
			top.document.getElementById('inner_wrapper' + this.container_id()).style.top = -(expanded_height - collapsed_height)  + 'px';
			top.document.getElementById('inner_wrapper' + this.container_id()).style.left = -((expanded_width - collapsed_width)/2) + 'px';
			
		}else if(expand_direction == "TL"){
			top.document.getElementById('inner_wrapper' + this.container_id()).style.top = -(expanded_height - collapsed_height)  + 'px';
			top.document.getElementById('inner_wrapper' + this.container_id()).style.left = -( expanded_width - collapsed_width )  + 'px';
			
		}else if(expand_direction == "TR"){
			top.document.getElementById('inner_wrapper' + this.container_id()).style.top = -(expanded_height - collapsed_height)  + 'px';
			top.document.getElementById('inner_wrapper' + this.container_id()).style.left = 0 + 'px';
			
		}else if(expand_direction == "BR"){
			top.document.getElementById('inner_wrapper' + this.container_id()).style.top =  0 + 'px';
			top.document.getElementById('inner_wrapper' + this.container_id()).style.left = 0 + 'px';
			
		}else if(expand_direction == "BL"){
			top.document.getElementById('inner_wrapper' + this.container_id()).style.top =  0 + 'px';
			top.document.getElementById('inner_wrapper' + this.container_id()).style.left = -( expanded_width - collapsed_width )  + 'px';
			
		}else if(expand_direction == "C"){
			top.document.getElementById('inner_wrapper' + this.container_id()).style.top =  -((expanded_height - collapsed_height)/2) + 'px';
			top.document.getElementById('inner_wrapper' + this.container_id()).style.left = -((expanded_width - collapsed_width)/2) + 'px';
		
		}
		
		thisMovie('adcentric_' + String(creative_id) + "_" + String(placement_id)).width = expanded_width;
		thisMovie('adcentric_'+ String(creative_id) + "_" + String(placement_id)).height = expanded_height;
		top.document.getElementById('inner_wrapper' + this.container_id()).style.width = expanded_width;
		top.document.getElementById('inner_wrapper' + this.container_id()).style.height = expanded_height;
	
	},
	
collapse: function(){
		  top.document.getElementById('inner_wrapper' + this.container_id()).style.width = collapsed_width + 'px';
		  top.document.getElementById('inner_wrapper' + this.container_id()).style.height = collapsed_height +'px';
		  top.document.getElementById('inner_wrapper' + this.container_id()).style.left = 0 + 'px';
		  top.document.getElementById('inner_wrapper' + this.container_id()).style.top = 0 + 'px';

		  thisMovie('adcentric_' + String(creative_id) + '_' + String(placement_id)).style.left = origLeft + 'px';
		  thisMovie('adcentric_' + String(creative_id) + '_' + String(placement_id)).style.top = origTop + 'px';
	  },
	
collapse_FF_MAC: function(){
		  top.document.getElementById('inner_wrapper' + this.container_id()).style.width = collapsed_width + 'px';
		  top.document.getElementById('inner_wrapper' + this.container_id()).style.height = collapsed_height +'px';
		  top.document.getElementById('inner_wrapper' + this.container_id()).style.left = 0 + 'px';
		  top.document.getElementById('inner_wrapper' + this.container_id()).style.top = 0 + 'px';

		  thisMovie('adcentric_' + String(creative_id) + '_' + String(placement_id)).width = collapsed_width + 'px';
		  thisMovie('adcentric_' + String(creative_id) + '_' + String(placement_id)).height = collapsed_height + 'px';
	  },
	
local_setup: function(__container){
	
	   if(navigator.userAgent.indexOf("Firefox") > -1 && navigator.appVersion.indexOf("Mac") > -1){
			__container.innerHTML = this.to_string();
		}else{
			__container.style.left = "0px";
			__container.style.top = "0px";
			__container.style.width = this.collapsed_width();
			__container.style.height = this.collapsed_height();
			__container.innerHTML = this.to_string();
			setupDIVStyle();
		}
},
setup: function(){
			var that = this;
			var outter_container;
			var inner_container;

			/*write container div for lcPix swf*/
			cr.lcPix.write_container()


			if(iframe_bust){
				var publisher_iframe = get_iframe_obj();
				var iframe_parent;

				outter_container = top.document.createElement('div');
				outter_container.id = this.container_id();

				outter_container.style.cssText = publisher_iframe.style.cssText;
				outter_container.style.zIndex = this.zindex();
				outter_container.style.visibility = 'hidden';
				outter_container.style.display = 'block';
				outter_container.style.position = 'relative';
				outter_container.style.width = this.collapsed_width() + "px";
				outter_container.style.height= this.collapsed_height() + "px";

				//grab publisher's iframe and minimize it
				if(publisher_iframe.style){
					publisher_iframe.style.width = 1 + "px";
					publisher_iframe.style.height = 1 + "px";
				}else{				
					publisher_iframe.width = 1 + "px";
					publisher_iframe.height = 1 + "px";
				}

				iframe_parent = publisher_iframe.parentNode;

			}else if(is_dap){
				var dap_container = get_dap_container(this);	
			}else{
				/* Setup the creative container and Banner polite-load: */
				outter_container = '<div id="' + this.container_id() + '" ' +
					'style="z-index: ' + this.zindex() + '; ' +
					'position: ' + this.position() + '; ' +
					'visibility: visible; ' +
					'display: block; ' +
					'width: ' + this.collapsed_width() + 'px; ' +
					'height: ' + this.collapsed_height() + 'px;"></div>';

				document.writeln(outter_container);
			}

			//a shim could be prepended to inner_container with display:none by default

			inner_container = '<div id="inner_wrapper' + this.container_id() + '" ' +
				'style="z-index: ' + this.zindex() + ';' +
				'position:absolute;' +
				'top:0px;' +
				'left:0px;' +
				'visibility: visible; ' +
				'overflow: hidden; ' +
				'display: block; ' +
				'width: ' + this.collapsed_width() + 'px; ' +
				'height: ' + this.collapsed_height() + 'px;">';				


				ADCENTRIC.util.Events.add_window_onload(function() {

						/* Setup the ExternalInterfaceProxy (local-connection pixel) for this creative: */
						cr.lcPix.setup();

						var num_forms = 0;
						var num_iframes = 0;
						var flash_id = that.id();

						if(typeof(top.document.forms) != "undefined"){
						num_forms = top.document.forms.length;
						}

						if(typeof(top.document.frames) != "undefined"){
						num_frames = top.document.frames.length;
						}



						if(iframe_bust){
						top.document.body.appendChild(outter_container);

						//put the ADC iframe exactly where the publisher IFRAME is located
						//by inserting it into the publisher iframe's parent
						iframe_parent.insertBefore(outter_container, publisher_iframe);
						outter_container.style.visibility = "visible";
						}else if(is_dap){
							if(dap_container){
								insert_dap_element(dap_container);
							}
						}


						var container = top.document.getElementById(that.container_id());

						if(ADCENTRIC.env.has_flash){                                
							container.innerHTML = inner_container + that.to_string() + '</div>';
							
						   
							if(!(navigator.userAgent.indexOf("Firefox") > -1 && navigator.appVersion.indexOf("Mac") > -1)){
								setupDIVStyle()
							}

							for(var i=0;i < num_forms; i++){
								if(top.document.forms[i][flash_id]){
									window[flash_id] = top.document.forms[i][flash_id];
									top.window[flash_id] = top.document.forms[i][flash_id];
								}
							}

							/*
							   for(var i=0;i < num_forms; i++){
							   if(eval('top.document.forms[' + i + '].' +flash_id)){
							   eval('window.' +flash_id+ ' = top.document.forms[' + i + '].' +flash_id);
							   eval('top.window.' +flash_id+ ' = top.document.forms[' + i + '].' +flash_id);
							   }
							   }
							 */


							for(var i=0;i < num_iframes; i++){
								if(top.document.frames[i][flash_id]){
									window[flash_id] = top.document.frames[i][flash_id];
									top.window[flash_id] = top.document.frames[i][flash_id];
								}
							}


							/*
							   for(var i=0;i < num_iframes; i++){
							   if(eval('top.document.frames[' + i + '].' + flash_id)){
							   eval('window.' +flash_id+ ' = top.document.frames[' + i + '].' +flash_id);
							   eval('top.window.' +flash_id+ ' = top.document.frames[' + i + '].' +flash_id);
							   }
							   }
							 */


							container.onmouseout = function() { 
								if(close_on_mouse_out){
									cr.lcPix.call("closeExpand", "adcCall");
								}
								cr.lcPix.call("rollOutHook"); 
							};
						}else{

							container.innerHTML = '<a target="_blank" href="__ADC_CLICK[BACKUP_GIF_CLICK]?number=' +Math.random()+ '"><img width="__ADC_VARIABLE[COLLAPSED_WIDTH]" height="__ADC_VARIABLE[COLLAPSED_HEIGHT]" border = "0" alt="" src="__ADC_FILE[BACKUP_GIF_FILE]"></a>';

						}

				});
		}

	};
};

/* XXX required bare-minimum: */


/* XXX legacy */
function openLayer__ADC_ID(){
   if(navigator.userAgent.indexOf("Firefox") > -1 && navigator.appVersion.indexOf("Mac") > -1){
		ADCENTRIC.env.creatives[__ADC_ID].placements[__SECTION__].architecture.expand_FF_MAC();
	}else{
		ADCENTRIC.env.creatives[__ADC_ID].placements[__SECTION__].architecture.expand();
	}
}

/* XXX legacy */
function closeLayer__ADC_ID(){
   if(navigator.userAgent.indexOf("Firefox") > -1 && navigator.appVersion.indexOf("Mac") > -1){
    	ADCENTRIC.env.creatives[__ADC_ID].placements[__SECTION__].architecture.collapse_FF_MAC();
	}else{
		ADCENTRIC.env.creatives[__ADC_ID].placements[__SECTION__].architecture.collapse();
	}
}

function out_of_band__ADC_ID(){

	var _msn_tracker__ADC_ID = new Image();
	_msn_tracker__ADC_ID.src = OOBClickTrack;
	return;
}


function flashIsActive__ADC_ID(){
	return;
}




/* finally, actual tag template code: */
ADCENTRIC.env.creatives[__ADC_ID].placements[__SECTION__].architecture = ADCENTRIC.architectures.Expandable(__ADC_ID, __SECTION__);
ADCENTRIC.env.creatives[__ADC_ID].placements[__SECTION__].architecture.setup();



/*

##################################################################################################################
#NOTE: Below are examples of how clicks and events should be added. The labels between the 
#      open brackets ( [ ) and close brackets ( ] ) should reflect the ones the flash banner
#      expects. 
#      
#      Any of the below __ADC_CLICK variables can be erased should they not be needed for the current banner
#      Any of the below __ADC_EVENT variables can be erased should they not be needed for the current banner
#      Any of the below __ADC_FILE variables can be erased should they not be needed for the current banner
#      
#      the __ADC_VARIABLE variables should not be touched, these are defaults and minimum requirements
#      to the banner architecture
#      
#      Do not add any variables concerning back up gif images, clicks, width and height. This is already
#      added in the above code      
###################################################################################################################


//CREATIVE VARIABLES

#####################################
#     DEFAULT VARIABLE LISTING     ##
# 	  DO NOT MODIFY            ##
#####################################

//__ADC_VARIABLE[COLLAPSED_WIDTH];
//__ADC_VARIABLE[COLLAPSED_HEIGHT];
//__ADC_VARIABLE[EXPANDED_WIDTH];
//__ADC_VARIABLE[EXPANDED_HEIGHT];
//__ADC_VARIABLE[EXPAND_DIRECTION];
//__ADC_VARIABLE[EXPAND_MODE];
//__ADC_VARIABLE[IFRAME_BUST];
//__ADC_VARIABLE[IS_DAP];
//__ADC_FILE[COLLAPSED_SWF_FILE];
//__ADC_FILE[EXPANDED_SWF_FILE];
//__ADC_VARIABLE[MSIE_WMODE];
//__ADC_VARIABLE[FF_WMODE];

######################################
#  END OF DEFAULT VARIABLE LISTING  ##
######################################



##################################################
# CREATIVE SPECIFIC VARIABLE LISTING 		##
# PLZ MODIFY ACCORDING TO CREATIVE EXPECTATIONS ##
##################################################

//ASSETS
//__ADC_FILE[LoadSon];
//__ADC_FILE[EXPAND_LOADER_SWF]
//__ADC_FILE[FF_MAC_EXPAND_LOADER_SWF]

//CLICKS
//__ADC_CLICK[learnMore]

//INTERACTIONS
//__ADC_EVENT[TimeSpent]
//__ADC_EVENT[OpenExpanded]
//__ADC_EVENT[PlayingAudio]
//__ADC_EVENT[CloseExpand]

##############################################
# END OF CREATIVE SPECIFIC VARIABLE LISTING ##
##############################################
 */



