
//GENERATION TIME VARIABLE
/* Generated: 03/16/2007  01:55 PM EST */

//COMMON VARIABLES
// From include/commonjsvars
var cp14522 = 'http://cdn.eyewonder.com/100125/adWdrDemos/501211/14522/';
		// From include/commonjsvars
	
var ew14522_bannerWidth = 728;
var ew14522_bannerHeight = 90;
var ew14522_fullWidth = 728;
var ew14522_fullHeight = 270;

var ew_cacheBuster = new Date().getTime();
var ew_cacheBusterReplaceArray = new Array("\\[timestamp\\]", "\\[cachebuster\\]", "\\[random\\]"); 	
	
	

//RESEARCH TAGS


//TRACKING VARIABLES
// From include/tracking	
	

var ew14522_startTime = ew_getTime14522();



var ew14522_imgArray = new Array();
var ew14522_imgArrayCounter = 0;
function ew_addImage14522(img)
{
	ew14522_imgArray[ew14522_imgArrayCounter] = new Image();
	ew14522_imgArray[ew14522_imgArrayCounter].src = img;
	ew14522_imgArrayCounter++;
}

function ew14522_otrk(img, extra)
{
	ew_addImage14522(cp14522+img+'?ewbust='+new Date().getTime()+extra);
	return '';
}

function ew14522_otrk_nobust(img, extra)
{
	ew_addImage14522(cp14522+img+'?ewbust=0'+extra);
	return '';
}

function ew14522_ctrk(type, info)
{ 
/* TEMPORARILY DISABLING CENTRAL TRACKING


    var img = 'http://cdn.eyewonder.com/100125/trk1.gif?sys=cdn'
		+ '&id=14522&type='+type
		+ '&info='+info+'&ewbust='+new Date().getTime();
	ew_addImage14522(img);
	*/
}

function ew14522_ctrk_nobust(type, info)
{ 
/* TEMPORARILY DISABLING CENTRAL TRACKING


    var img = 'http://cdn.eyewonder.com/100125/trk1.gif?sys=cdn'
		+ '&id=14522&type='+type
		+ '&info='+info+'&ewbust=0';
	ew_addImage14522(img);
	*/
}

function ew_thirdpartytrackingcachebust14522(trkURL)
{
	
	for(var i = 0; i < ew_cacheBusterReplaceArray.length; i++)
	{
		trkURL = trkURL.replace(new RegExp(ew_cacheBusterReplaceArray[i],"gi"), ew_cacheBuster); 
	}
	
	return trkURL;
}


function ew_getTime14522() { var ew_t = new Date(); return ew_t.getTime();}



function onLoadTracker14522() { var ew_t = ew_getTime14522()-ew14522_startTime; ew14522_ctrk('onload',ew_t); return ew14522_otrk('ewtrack_onload.gif','&info='+ew_t); }
function flashTracker14522() { ew14522_ctrk('creative',''); return ew14522_otrk('ewtrack_v.gif',''); }
	
function impressionTracker14522() { ew14522_ctrk('impression',''); return ew14522_otrk('ewtrack.gif',''); }
function impressionTurnOffExecutionTracker14522() {  ew14522_ctrk('failover_turnoffexecution',''); return ew14522_otrk('ewtrack_ito.gif',''); }
function flashfailoverTracker14522() { ew14522_ctrk('failover_flash',''); return ew14522_otrk('ewtrack_ff.gif',''); }
function failoverTracker14522() {  ew14522_ctrk('failover_img',''); return ew14522_otrk('ewtrack_f.gif',''); }
function failoverTurnOffExecutionTracker14522() {  ew14522_ctrk('failover_turnoffexecution',''); return ew14522_otrk('ewtrack_fto.gif',''); }
function failoverReasonBrowserTracker14522() {  ew14522_ctrk('fail_reason_browser',''); return ew14522_otrk('ewtrack_rb.gif',''); }
function failoverReasonFlashTracker14522() { ew14522_ctrk('fail_reason_flash',''); return ew14522_otrk('ewtrack_rf.gif',''); }
function flashSupportTracker14522(verStr) { ew14522_ctrk('flash_support_'+verStr,''); return ew14522_otrk('ewtrack_'+verStr+'.gif',''); }
function weSupportTracker14522() { var ew_t = ew_getTime14522()-ew14522_startTime; ew14522_ctrk('wesupport',ew_t); return ew14522_otrk('ewtrack_wesupport.gif','&info='+ew_t); } 


// Expiration count versions of the _f, _ff, and _v trackers for AIM and ICQ cookie versions
function flashTrackerCache14522(expCount) { ew14522_ctrk('creative_aim_exposure',expCount); return ew14522_otrk('ewtrack_v'+expCount+'.gif',''); }
function flashfailoverTrackerCache14522(expCount) { ew14522_ctrk('failover_flash_aim_exposure',expCount); return ew14522_otrk('ewtrack_ff'+expCount+'.gif',''); }
function failoverTrackerCache14522(expCount) {  ew14522_ctrk('failover_img_aim_exposure',expCount); return ew14522_otrk('ewtrack_f'+expCount+'.gif',''); }


// Send out the current location
function ew_urlTracker()
{
/* TEMPORARILY DISABLE URL TRACKER


	var currentURL;
	if (typeof(ew_isIFrame) != "undefined" && ew_isIFrame==true)
		currentURL = escape(document.referrer);
	else
		currentURL = escape(window.location.toString());
	ew14522_ctrk_nobust('url',currentURL);
	return ew14522_otrk_nobust('ewtrack_url.gif','&id=14522&url='+currentURL);
*/
	return '';
}


document.writeln(impressionTracker14522());	


// Log the URL for troubleshooting purposes
document.writeln(ew_urlTracker());



//DESIGN VARIABLES
var ew_adFile_Proxy = cp14522+"exp_interimDetect.html";


if (typeof(clickTagFramePrepend) == "undefined")
	var clickTagFramePrepend = "[ewclickthru]";
clickTagFramePrepend = clickTagFramePrepend.replace("[%ewclickthru%]", "[ewclickthru]");	// Legacy conversion for tags prior to 7/24/2006

var ew_mpUsedClickthruMagic = false;


if (ew_mpUsedClickthruMagic == false)
{
var failclickTag = clickTagFramePrepend.replace("[ewclickthru]","http://www.nationalgeographic.com/channel/galapagos");
var	clickTag1 = clickTagFramePrepend.replace("[ewclickthru]","http://www.nationalgeographic.com/channel/galapagos");
var	clickTag2 = clickTagFramePrepend.replace("[ewclickthru]","http://galapagos.kp9.net/");
var	clickTag3 = clickTagFramePrepend.replace("[ewclickthru]","http://www.nationalgeographic.com/community/privacy.html");
}





function ew_clickTagCacheBust(_ct)
{
	
	for(var i = 0; i < ew_cacheBusterReplaceArray.length; i++)
		_ct = _ct.replace(new RegExp(ew_cacheBusterReplaceArray[i],"gi"), ew_cacheBuster); 
	if (_ct.indexOf("ord=") >= 0)
		_ct = _ct.split("ord=")[0] + "ord=" + ew_cacheBuster;
	return _ct;
}

clickTag1 = ew_clickTagCacheBust(clickTag1);
clickTag2 = ew_clickTagCacheBust(clickTag2);
clickTag3 = ew_clickTagCacheBust(clickTag3);
failclickTag = ew_clickTagCacheBust(failclickTag);



if (typeof(failclickTag) == "undefined")
	var failclickTag = "http://www.nationalgeographic.com/channel/galapagos";	//define it anyway because it is referenced (even if not really used)
	
var ew_isIFrame = false;	// iframe detection turned off for this site
var ew_interimFile = "";
	



if(typeof(inDapIF) == "undefined") // Added to not throw undefined errors if it's not defined.
    var inDapIF = false;  
if(inDapIF)
    ew_isIFrame = false;
		    
var ew14522_DynIF;
var ew14522_DynIFOrigParent;
var ew14522_DynIFOrigNextChild;
var ew14522_DynIFrameContentWindow;

if (ew_isIFrame)
{

	var ew14522_iFrameQueryStringExtra = "";
}

if (ew_isIFrame)
{
	var ew_containsHTTP = (( ew_interimFile.indexOf("http://") > -1 ) || 
				( ew_interimFile.indexOf("https://") > -1 ));
	if (!ew_containsHTTP)
	{	
		var ref = document.referrer;
		var host='';
		if(ref == '') {
			host = 'http://'+document.domain; 
		}
		else {
			var pos1 = ref.indexOf("://");
			if (pos1 != -1) {
				pos2 = ref.indexOf("/", pos1+3);
				host = ref.substring(0, pos2);
			}
		}
	
		if(ew_interimFile.indexOf('/')==0) {
			ew_interimFile = host+ew_interimFile; 
		}
		else {
			ew_interimFile = host+'/'+ew_interimFile;
		}

	}
}

//AUTHENTICATION

	
/*** Begin include/authentication:AUTHENTICATION_SHORT ***/

var ua = ' ' + navigator.userAgent.toLowerCase();
var isIe = (ua.indexOf('msie') >= 0);
var isNav4 = ((ua.indexOf('mozilla') >= 0) && (ua.indexOf('compatible') == -1) && (parseInt(navigator.appVersion) < 5));
var isWin = (ua.indexOf('win') >= 0);
var isWinVista = false;
var isMac = (ua.indexOf('mac') >= 0);
//Opera
var isOpera = (ua.indexOf('opera') > 0);
if (isOpera)	// Opera's string is almost identical to IE's
	isIe = false;
//KHTML browsers
var isSafari = (ua.indexOf('applewebkit') > 0);
var isKonqueror = (ua.indexOf('konqueror')>0);
// GECKO(Mozilla) browsers
// isGecko will also include Netscape 6+, Epiphany, Galeon, Camino, K-Meleon, etc
// safari says (like gecko) in it's UA string, but safari uses KHTML engine
var isGecko = (ua.indexOf('gecko/') > 0);
var isCamino = (ua.indexOf('camino/') > 0);

// Check for Vista
if(isWin)
{
	isWinVista = (ua.indexOf('windows nt 6.0') >= 0);
}

/*** End include/authentication:AUTHENTICATION_SHORT ***/

	

/*** Begin include/authentication:AUTHENTICATION ***/

// Check how old the gecko version is for the part following "gecko/" in the UA string
var geckoDate;
var geckoRevisionString;
var geckoRevision;
var geckoRevisionMajor;
var geckoRevisionMinor;

var webkitVersion;
if (isGecko)
{
	function ew_getGeckoRevisionString(ua)	// Keep temp variables from being placed into window object
	{
		var tempStr = ua.split("rv:");
		return tempStr[1].split(")")[0];
	}

	geckoRevisionString = ew_getGeckoRevisionString(ua);
	geckoRevision = parseFloat(geckoRevisionString);
	geckoRevisionMajor=parseFloat(geckoRevisionString.split(".")[0] )
	geckoRevisionMinor=parseFloat(geckoRevisionString.split(".")[1]+ "." + geckoRevisionString.split(".")[2])
	geckoDate = parseInt(ua.substr(ua.indexOf('gecko/')+6,8));
}
var ieVersion;
if (isIe)
{
	ieVersion = ua.substr(ua.indexOf('msie')+5,4);
	if (ieVersion.indexOf(';') > 0)
		ieVersion = ieVersion.substr(0,3);
}
var operaVersion
if (isOpera)
{
	operaVersion = ua.substr(ua.indexOf('opera')+6,4);
}
if (isSafari)
{
    webkitVersion = parseInt(ua.substr(ua.indexOf('applewebkit')+12,4));

}
var ew14522_weSupport = false;
var failReason = "browser";	// Reason we failed over
 
	
/*** Begin include/authentication:AUTHENTICATION_FLASH ***/

var isFlash7up = false;	// Flash 7 or up
var isFlash8up = false;
var isFlash9up = false;
var isFlashFailover = false;	// Flash 6

// Check Flash info

if (navigator.mimeTypes && navigator.mimeTypes["application/x-shockwave-flash"])
	var navPlugin = (navigator.mimeTypes["application/x-shockwave-flash"].enabledPlugin);

if (navPlugin)
{
	navPlugin = navigator.plugins["Shockwave Flash"];
	var ver = parseInt(navPlugin.description.substring(navPlugin.description.indexOf(".")-1));
	isFlash9up = (ver>=9);
	isFlash8up = (ver>=8);
	isFlash7up = (ver>=7);
	isFlashFailover = (ver>=6);
}
else if(isIe && isWin)
{
	document.writeln('<SCR'+'IPT LANGUAGE="VBScript"\>'); // Hide this from IE4.5 Mac by splitting the tag
	document.writeln('On Error Resume Next');
	document.writeln('isFlash9up=IsObject(CreateObject("ShockwaveFlash.ShockwaveFlash.9"))');
	if(!isWinVista)
	{
		document.writeln('isFlash8up=IsObject(CreateObject("ShockwaveFlash.ShockwaveFlash.8"))');
		document.writeln('isFlash7up=IsObject(CreateObject("ShockwaveFlash.ShockwaveFlash.7"))');
		document.writeln('isFlashFailover=IsObject(CreateObject("ShockwaveFlash.ShockwaveFlash.6"))');
	}

	
	document.writeln('</SCR'+'IPT\>');
	
	if (!isWinVista && isFlash8up){
		var swf = new ActiveXObject("ShockwaveFlash.ShockwaveFlash.8").GetVariable("$version");
		var ver = parseInt(swf.substring(swf.indexOf(",")-1));
		isFlash8up = (ver>=8);
	}
	
	if( isWinVista && isFlash9up)
	{ 
	
			isFlash8up = isFlash7up = true;
			
			var swf = new ActiveXObject("ShockwaveFlash.ShockwaveFlash.9").GetVariable("$version");
			var ver = swf.substring(swf.indexOf(" "));
			ver = ver.split(",");			
			if( (ver[0] < 9) || (ver[0] == 9 && ver[1] == 0 && ver[2] < 28))
			{ // Vista requires 9,0,28,0 and up for proper behavior
				ew14522_weSupport = false;
				failReason = "vistaflash";
			}
			
	}

}
else
	isFlash7up = false;
	
/*** End include/authentication:AUTHENTICATION_FLASH ***/

	
	
// Do a an exclusive check for support to protect page contents for rare and untested browsers
if(isGecko || isSafari || (isIe && isWin && ieVersion >= 6) || (isOpera && operaVersion >= 8)) 
{
	// Support Mozilla-based browsers (i.e. Firefox), Safari Mac, 
	// and IE browsers (IE 6/Win and AOL Explorer), and Opera >= 8
	failReason = "none";
	ew14522_weSupport = true;

	// Do we support Flash 7?
	if (!isFlash7up)
	{
		ew14522_weSupport = false;
		failReason = "flash";
	}
}
else
{
	// Still attempt a flash failover if browser isn't supported
	failReason = "browser"
	ew14522_weSupport = false;
}



	

var ew14522_turnOffExecution = false;



if (!ew14522_turnOffExecution && isFlash8up)
	document.writeln(flashSupportTracker14522("8"));

if (!ew14522_turnOffExecution && isFlash9up)
	document.writeln(flashSupportTracker14522("9"));

/*** End include/authentication:AUTHENTICATION ***/

	
// We support expandables in Opera 8+ for JS ads & Opera 9+ for Iframe Ads
if (isOpera)
{
	failReason = "browser";
	ew14522_weSupport = false;
	if ((operaVersion >= 8 && !ew_isIFrame) || (operaVersion >= 9))
	{
		ew14522_weSupport = true;
		failReason = "none";
	}
}
// Flash doesn't currently honor clipping on *nix browsers (Q1 2006)
if (!isWin && !isMac)
{
    failReason = "flash";
    ew14522_weSupport = false;
}

//DISNEY SITE SPECIFIC


//CUSTOM FUNCTIONS


	
weSupport = ew14522_weSupport; 
ew14522_turnOffExecutionBackup = ew14522_turnOffExecution; 
	
/* Begin custom functions */

/* Begin ad-specific custom functions */

/* End ad-specific custom functions */

/* Begin execution-specific custom functions */

/* End execution-specific custom functions */

/* End custom functions */
	
ew14522_weSupport = weSupport; 
ew14522_turnOffExecution = ew14522_turnOffExecutionBackup;
	
	

	var ew14522_context = window;

	function ew_delegate14522(delegateUrl)
	{
		if (delegateUrl.indexOf('javascript:') > -1)	/* block standard URL calls, since clickthrus require ew_clickthru */
		{
			var jsLine = delegateUrl.replace("javascript:","");
			eval("ew14522_context." + jsLine);
		}

	}	
	
	

// FLASH

/*** Begin include/flash:FLASH8 ***/




var ew14522_flvNames = "NG Galapagos 728x90 RB text 30fps v1,Galapagos Promo 300x200";
var ew14522_creativeName = "ngc_728x90_rb_MAIN_FL7.swf";
var ew14522_swfVersion = 7;


/*** Begin include/flash:FLASH8COMMON ***/

function ew_getfNames(flvvideos,flashBool)
{
	for(var i = 0; i < flashBool.length; i++)
	{
		if(flashBool[i] == "true")
			flvvideos[i] = "fl8_" + flvvideos[i];
	}
	
	return flvvideos.join(",");
}

function ew_setupCreative(flash7Creative, flash8Creative, flash9Creative)
{
	if (isFlash9up && flash9Creative != "")
	{
		ew14522_swfVersion = 9;
		return flash9Creative;
	}
	else if (isFlash8up && flash8Creative != "")
	{
		ew14522_swfVersion = 8;
		return flash8Creative;
	}
	else if (isFlash7up && flash7Creative != "")
	{
		ew14522_swfVersion = 7;
		return flash7Creative;
	}
	else /* no creative. failover */
	{
		ew14522_weSupport=false;
		failReason = "nocreative";
		return flash7Creative;	// return anyway, even if not used
	}
}
/*** End include/flash:FLASH8COMMON ***/



function ew_setupFlash8Videos()
{
	var flvvideos = new String("NG Galapagos 728x90 RB text 30fps v1,Galapagos Promo 300x200").split(',');
	var flashBool = new String("true,true").split(',');
	ew14522_flvNames = ew_getfNames(flvvideos,flashBool);
}

ew14522_creativeName = ew_setupCreative("ngc_728x90_rb_MAIN_FL7.swf","ngc_728x90_rb_MAIN_FL8.swf","");

if (isFlash8up && (ew14522_swfVersion >= 8))
	ew_setupFlash8Videos();

/*** End include/flash:FLASH8 ***/

/*** Begin include/flash:FLASHVARS ***/


var ew14522_adMode = "prog";
var ew14522_videoPath = "http://cdn.eyewonder.com/100125/video/";




var ew14522_videoID = '5231,5169';



if (typeof(isIFrameContent) != "undefined" && isIFrameContent)
	ew_qaReportUUID = topWin.ew_qaReportUUID;
	
if (typeof(ew_qaReportUUID)=="undefined")
	ew_qaReportUUID = "common";
	



	
var ewclicktags14522 = ''
	+ '&clickTag1='+escape(clickTag1)
	+ '&clickTag2='+escape(clickTag2)
	+ '&clickTag3='+escape(clickTag3);

if( typeof( ew14522_flashvarsExtra ) == "undefined" )
	var ew14522_flashvarsExtra = "";


var ewflashvars14522 = 'ewbase='+cp14522
	+ '&bwfile=bwtest.swf'
	+ '&creative=' + ew14522_creativeName
	+ '&vLength=7.9,30'
	+ '&bw=56,90,135,300,450,600'
	+ '&buf=5,4,3,2,2,2'
	+ '&flv=' + ew14522_flvNames
	+ '&flvId=0'
	+ '&formatId='+26
	+ '&aInit='+'user'
	+ '&vInit=host'
	+ '&videoID='+ew14522_videoID
	+ '&videoPath='+ew14522_videoPath
	+ '&adId=14522'
	+ '&adMode=' + ew14522_adMode
	+ '&trkUrl=http://cdn.eyewonder.com/100125/'
	+ '&swfVersion=' + ew14522_swfVersion
	+ '&qaReportUUID=' + ew_qaReportUUID
	+ ew14522_flashvarsExtra
	+ ewclicktags14522;


/*** End include/flash:FLASHVARS ***/	


//EXPAND FUNCTIONS
var ew14522_isOverflowHidden = false;

var ew_maxZIndex = 2147483647;	



        var ew14522_minZIndex = 10002;
    


var ew14522_saveZIndex;

function ew_checkOverflowHidden14522() 
{
 		
 	var tempNode = document.getElementById("ew_BannerDiv14522").parentNode;
	
	while (tempNode!=null && (tempNode.tagName != "BODY"))
	{
		var computedOverflow;
		if (isIe)
			computedOverflow = tempNode.currentStyle.overflow;
		else
			computedOverflow = document.defaultView.getComputedStyle(tempNode,"").getPropertyValue("overflow");
		if (computedOverflow == "hidden")
			return true;
		 tempNode = tempNode.parentNode;
	}
	
	return false;
}



function ew_modifyOverflow14522()
{
	   
	var tempNode = document.getElementById("ew_BannerDiv14522").parentNode;
	   
	if (isGecko)	// This workaround doesn't work yet in IE 5.5 and Safari 1.3
	{
		while (tempNode!=null && (tempNode.tagName != "BODY"))
		{
			var computedDisplay;
			if (isIe)
				computedDisplay = tempNode.currentStyle.display;
			else
				computedDisplay = document.defaultView.getComputedStyle(tempNode,"").getPropertyValue("display");
			if ((computedDisplay == "block") || (computedDisplay == "table-cell"))
			{
				var computedOverflow;
				if (isIe)
					computedOverflow = tempNode.currentStyle.overflow;
				else
					computedOverflow = document.defaultView.getComputedStyle(tempNode,"").getPropertyValue("overflow");
				if (computedOverflow == "hidden")
				{
					// Change overflow
					tempNode.style.overflow="visible";
				}
			}
			tempNode=tempNode.parentNode;
   		}
	}
}


function ew_modifyZIndex14522()
{
	
    if (isIe)
    {
		var count = 0;
		var tempElement = document.getElementById("ew_BannerDiv14522").parentElement; 
		// Safari also handles parentElement DOM object, unfortunately
		if (tempElement!=null) 
		{
		      // ew14522_saveZIndex is used to save the z-indexes before they are changed
			ew14522_saveZIndex = new Array();
			while (tempElement!=null && tempElement.tagName != "BODY")
			{
				computedDisplay = tempElement.currentStyle.display;
				if ((computedDisplay == "block") || (computedDisplay == "table-cell"))
				{
					if (tempElement.currentStyle.zIndex==0)
					{
						// Save the z-index here
						var tempPair=new Array(2);
						tempPair[0] = tempElement;
						tempPair[1] = tempElement.currentStyle.zIndex;
						ew14522_saveZIndex[count] = tempPair;
						count++;
						// Now change it
						tempElement.style.zIndex=1;
					}
				}
				tempElement=tempElement.parentElement;
			}
		}

	}
}

function ew_restoreZIndex14522()
{

	// IE6/5.5 restore the values saved in ew_expand
	if (ew14522_saveZIndex != null)
	{
		// restore the backed up zIndex values
		for (i = 0; i < ew14522_saveZIndex.length; i++)
		{
			var tempPair = ew14522_saveZIndex[i];
			var tempElement = tempPair[0];
			var tempZIndex = tempPair[1];
			//alert("resetting z-index to " + tempZIndex);
			if (tempElement != null)	// Is the element still on the page?
			{
				tempElement.style.zIndex = tempZIndex;
			}
		}

		ew14522_saveZIndex = null;	// delete the array
	}
}

function ew_contract14522()
{
	ew_reset14522();
		
	if (isIe)
		ew_restoreZIndex14522();
				
	if(isIe)
		document.getElementById('ew_shim14522').style.clip = "rect(0px 728px 90px 0px)";
	document.getElementById('ew_FlashDiv14522').style.clip = "rect(0px 728px 90px 0px)";
    
}

function ew_expand14522()
{
	ew_reset14522();
	
	if (isIe)
		ew_modifyZIndex14522();

	if(isIe)
		document.getElementById('ew_shim14522').style.clip = "rect(0px 728px 270px 0px)";	
	document.getElementById('ew_FlashDiv14522').style.clip = "rect(0px 728px 270px 0px)";
	document.getElementById('trackingImage14522').src = cp14522+'ewtrack_m.gif?ewbust='+new Date().getTime();
    
}





function ew_reset14522()
{
	ew_changeHeight14522(270);
}

function ew_onmouseout14522()
{
	ew_changeHeight14522(271);
}

var ew14522_embed;
var ew14522_ewad;

function ew_changeHeight14522(newHeight)
{
	// Define variables only once to speed up execution
	if (typeof(ew14522_ewad) == "undefined")
	{
		ew14522_ewad = document.getElementById("ewad14522");
		if (isGecko || isOpera)
		{
			ew14522_embed = ew14522_ewad.firstChild;
			while (ew14522_embed.nodeName != "EMBED")
				ew14522_embed = ew14522_embed.nextSibling;
		}
	}


	if (isIe || isSafari)
	{
		ew14522_ewad.style.height=newHeight + "px";
	}

	if (isGecko || isOpera)
	{
		var ew14522_embed = ew14522_ewad.firstChild;
		while (ew14522_embed.nodeName != "EMBED")
			ew14522_embed = ew14522_embed.nextSibling;
		ew14522_embed.height = newHeight;
		ew14522_embed.style.height = newHeight + "px";
	}
}




var flashHTML14522='<div id="ew_BannerDiv14522" style="visibility: visible; position: relative; width:728px; height:90px; z-index: ' + ew14522_minZIndex + '">'

	+'</div>';

//EYEWONDER FLASH OBJECT
var flashHTMLonLoad14522='<div id="ew_FlashDiv14522" onmouseout="ew_onmouseout14522()" style="visibility: visible; position: absolute; top: -0px; left: -0px; width:728px; height:270px; clip: rect(0px 728px 90px 0px); z-index: ' + (ew14522_minZIndex+2) + '">'
	+'<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,0,0" width="728" height="270" id="ewad14522" align="middle">'
	+'<param name="allowScriptAccess" value="always">'
	+'<param name="movie" value="'+cp14522+ew14522_creativeName+'">'
	+'<param name="quality" value="high">'
	+'<param name="bgcolor" value="#FFFFFF">'
	+'<param name="base" value="'+cp14522+'">'
	+'<param name="wmode" value="transparent">'
	+'<param name="FlashVars" value="'+ewflashvars14522+'" >'
	+'<embed src="'+cp14522+ew14522_creativeName+'" base="'+cp14522+'" wmode="transparent" quality="high" bgcolor="#FFFFFF" width="728" height="270" name="ewad14522" FlashVars="'+ewflashvars14522+'" align="middle" allowScriptAccess="always" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer">'
	+'</object>'
	+'</div>'
	+'<div style="position:absolute;top:0px;left:0px;z-index:0"><img src="'+cp14522+'dot.gif" id="trackingImage14522" width="1" height="1" border="0"></div>';

if(isIe)
	flashHTMLonLoad14522 +='<iframe id="ew_shim14522" src="about:blank" noresize="true" scrolling="no" display="none" frameborder=0 marginheight=0 marginwidth=0 style="filter:progid:DXImageTransform.Microsoft.Alpha(style=0,opacity=0);visibility: visible;position:absolute;top: -0px; left: -0px; width:728px; height:270px;clip: rect(0px 728px 90px 0px);z-index: ' + ew14522_minZIndex + '"></iframe>';


//EYEWONDER FLASH FAILOVER OBJECT
var flashfailoverHTML14522 ='<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=4,0,0,0" width="728" height="90" id="ewfailad14522" align="middle">'
	+'<param name="allowScriptAccess" value="always">'
	+'<param name="movie" value="'+cp14522+'">'
	+'<param name="quality" value="high">'
	+'<param name="bgcolor" value="#FFFFFF">'
	+'<param name="wmode" value="opaque">'
	+'<param name="FlashVars" value="clickTag='+escape(failclickTag)+'" >'
	+'<embed src="'+cp14522+'" flashvars="clickTag='+escape(failclickTag)+'" quality="high" bgcolor="#FFFFFF" width="728" height="90" name="ewfaildesign" align="middle" allowScriptAccess="always" wmode="opaque"  type="application/x-shockwave-flash" base="'+cp14522+'" pluginspage="http://www.macromedia.com/go/getflashplayer">'
	+'</object>';

//EYEWONDER FAILOVER
var failoverHTML14522 = '<a href="http://www.eyewonderlabs.com/ct.cfm?ewbust=0&file=http://cdn.eyewonder.com/100125/adWdrDemos/501211/14522/failover.jpg&eid=14522&name=Clickthru-failover&num=1&time=0&diff=0&click='+escape(failclickTag)+'" target="_blank"><img src="'+cp14522+'failover.jpg" border="0"></a>';

//IFRAME HTML (if ad served in IFrame)
if(ew_isIFrame) { 
	var mpTrkStr = "";
	
	
	var ew14522_interimWidth = 1;
	var ew14522_interimHeight = 1;
	
	var attributesExtra = "";
	var styleExtra = "";

	if (isIe)
		attributesExtra = 'allowtransparency="true"';
	var iframeHTML14522 = '<iframe id="ew_expAd" border="0"  width="'+ew14522_interimWidth+'" height="'+ew14522_interimHeight+'" noresize'
	+ ' style="position: absolute; top: 0px; left: 0px; ' + styleExtra + '" ' + attributesExtra
	+ ' scrolling="No" frameborder="0" marginheight="0" marginwidth="0" src="'
	+ ew_interimFile+'?url='+cp14522+'exp_Inc.js'
	+ '?interim='+escape(ew_interimFile)
		+ '&clickTagFramePrepend='+escape(clickTagFramePrepend)
	+ '&iframeURL='+escape(document.URL)
	+ '&cp='+escape(cp14522)
	+ '&extra='+escape(ew14522_iFrameQueryStringExtra)
	+ '&stime='+escape(ew14522_startTime)
	+ '&cb='+escape(ew_cacheBuster)
	+ mpTrkStr
	+ '"></iframe>';
}

// MSN DYNAMIC IFRAME SUPPORT

function ew14522_GetDynIframe()
{
	var iframes = parent.document.getElementsByTagName("iframe");

    var iframe;
        
    for(var i = 0; i < iframes.length; i++)
    {
      if(!isSafari && window == iframes[i].contentWindow)
         iframe = iframes[i];
      else if(iframes[i].contentDocument == window.document)
          iframe = iframes[i];
    }
    
	var parentnode = iframe.parentNode;
	var nextchild = iframe.nextChild;
	
	// Store these values for later
	ew14522_DynIF = iframe;
	ew14522_DynIFOrigParent = parentnode;
	ew14522_DynIFOrigNextChild = nextchild;
	
	parent.ew14522_DynIFrameContentWindow = window; // For easy access to variables    
    
    var posX = -0;
	 var posY = -0;
    
    posX += parseInt(findPosX(iframe), 10);
    posY += parseInt(findPosY(iframe), 10);
	
	parent.document.body.appendChild( iframe );
    
    var filler = parent.document.createElement("DIV");
    filler.style.width = 728 + "px";
    filler.style.height = 90 + "px";
	filler.id = "ew_fillerDiv14522";
    
    document.body.style.backgroundColor = "transparent";
    
    parentnode.appendChild( filler );
    
    if (nextchild == null)
        parentnode.appendChild(filler);
    else
        parentnode.insertBefore(nextchild, filler);
    
    iframe.setAttribute("allowTransparency", "true");
    iframe.setAttribute("background-color", "transparent");
    
    
    iframe.style.position = "absolute";
    iframe.style.left = posX + "px";
    iframe.style.top = posY + "px";
    iframe.style.width = 728 + "px";
    iframe.style.height = 270 + "px";
	iframe.style.zIndex = ew14522_minZIndex;	// We need a zIndex because we're placing it on the body.
	
	document.getElementById('ew_BannerDiv14522').style.position = "relative";
	document.getElementById('ew_BannerDiv14522').style.left = 0 + "px";
	document.getElementById('ew_BannerDiv14522').style.top = 0 + "px";
	
}

//POSITION CHECK FUNCTIONS
var ew14522_origPos_x = 0;
var ew14522_origPos_y = 0;
var ew14522_positionCheckTimer;

function ew_positionCheck14522()
{
    if(!inDapIF)
	    return;
		
    var filler = parent.document.getElementById("ew_fillerDiv14522");
    if (!filler)
        return;
     
	var posX = -0;
	var posY = -0;
	posX += parseInt(findPosX(filler), 10);
	posY += parseInt(findPosY(filler), 10);
 
    if (posX != ew14522_origPos_x || posY != ew14522_origPos_y && ew14522_DynIF)
    {
        ew14522_DynIF.style.visibility = "hidden";    // Prevents errors

        ew14522_origPos_x = posX;
        ew14522_origPos_y = posY; 
 

        ew14522_DynIF.style.left = posX + "px";
        ew14522_DynIF.style.top = posY + "px"; 

        ew14522_DynIF.style.visibility = "visible";
 
    }
 
}

var ew14522_positionCheckTimer;


function findPosX(obj) {
	var curleft = obj.offsetLeft;
	if (obj.offsetParent) {
		while (obj.offsetParent) {
			obj = obj.offsetParent;
			curleft += obj.offsetLeft;			
		}
	}
	else if (obj.x)
		curleft += obj.x;
	return curleft;
}

function findPosY(obj) {
	var curtop = obj.offsetTop;
	if (obj.offsetParent) {
		while (obj.offsetParent) {
			obj = obj.offsetParent;
			curtop += obj.offsetTop;			
		}
	}
	else if (obj.y)
		curtop += obj.y;
	return curtop;
}


var ew14522_onLoadWasCalled = false; //Protects against multiple of the same execution being loaded in the same page

//appends flash ad div to the banner div (called on page load)
function ew_onLoad14522() {

	flashHTMLonLoad14522 += onLoadTracker14522();
	
	if (ew14522_onLoadWasCalled == true)
		return;
	
	ew14522_onLoadWasCalled = true;

	if(inDapIF && ew14522_weSupport)
	{
        ew14522_GetDynIframe();
		ew14522_positionCheckTimer = window.setInterval("ew_positionCheck14522()",250);
	}

	if (isGecko && geckoRevisionMajor < 1)	// ew_CheckOverflowHidden doesn't work in Mozilla < 1.0
	{
		failReason = "browser"
		ew14522_weSupport = false;
	}
	/* document.write is asynchronous, so the div has to be written before we can do
		document.getElementById in ew_checkOverflowHidden#### */
	if (ew14522_weSupport)
		ew14522_isOverflowHidden = ew_checkOverflowHidden14522();
	// We don't support expandables when overflow:hidden is set on anything but Gecko
	// browsers (Mozilla >= 1.0 and Firefox, etc) and IE >= 6.0
	if (ew14522_isOverflowHidden && !(isGecko  || (isIe && (ieVersion >= 6.0)) || (isOpera && (operaVersion >= 8))))
	{
		failReason = "browser"
		ew14522_weSupport = false;
	}
	if (ew14522_weSupport)	// Do we still support the expandable?
	{
		if (ew14522_isOverflowHidden == true)	
			ew_modifyOverflow14522();
		// Note: Don't do two innerHTML statements or IE will give an error when hovering
		document.getElementById('ew_BannerDiv14522').innerHTML+=flashHTMLonLoad14522;
        
        
        if (isCamino)
            document.getElementById('ew_BannerDiv14522').addEventListener("mouseout",ew_onmouseout14522,true);
	}
	else
	{
		var failReasonTracker = "";
		// Reason for failover
		if (failReason == "browser")
			failReasonTracker = failoverReasonBrowserTracker14522();
		else if (failReason == "flash")
			failReasonTracker = failoverReasonFlashTracker14522();
		// Replace, don't append innerHTML (innerHTML= not innerHTML+=) to write out failovers because they are inline content
		if(!ew14522_turnOffExecution&&isFlashFailover&&false) 
		{
			document.getElementById('ew_BannerDiv14522').innerHTML=flashfailoverHTML14522+flashfailoverTracker14522()+failReasonTracker;
		}
		else 
		{
			document.getElementById('ew_BannerDiv14522').innerHTML=failoverHTML14522+failoverTracker14522()+failReasonTracker;
		}
	}
	
	
}
	
//SERVE THE APPROPRIATE FILE
if (ew14522_weSupport) {
	document.writeln(weSupportTracker14522());
	if(ew_isIFrame) { 
		//serve the IFrame ad
		document.writeln(flashHTML14522);
		document.writeln(iframeHTML14522);
	}
	else 
	{
		document.writeln(flashHTML14522);
		document.writeln(flashTracker14522());
		if(inDapIF)
		{
			if(isIe && parent.document.readyState == 'complete') // page is already finished loading?
				ew_onLoad14522();
			else
			{
				if (window.addEventListener) parent.addEventListener("load",ew_onLoad14522,false);
				else if (window.attachEvent) parent.attachEvent("onload",ew_onLoad14522);
			}
		}
		else
		{
			if(isIe && document.readyState == 'complete') // page is already finished loading?
				ew_onLoad14522();
			else
			{
				if (window.addEventListener) window.addEventListener("load",ew_onLoad14522,false);
					else if (window.attachEvent) window.attachEvent("onload",ew_onLoad14522);
			}
		}
	}
}
else { //serve failover
	
	if(!ew14522_turnOffExecution&&isFlashFailover&&false) {
		document.writeln(flashfailoverHTML14522);
		document.writeln(flashfailoverTracker14522());
	}
	else {
		document.writeln(failoverHTML14522);
		if(!ew14522_turnOffExecution)
			document.writeln(failoverTracker14522());
		else
			document.writeln(failoverTurnOffExecutionTracker14522());
	}
	// Reason for failover
	if (failReason == "browser")
		document.writeln(failoverReasonBrowserTracker14522());
	else if (failReason == "flash")
		document.writeln(failoverReasonFlashTracker14522());
}



