// UTILITY TO RETURN EXPAND OBJECT
function adsExpand_getObj(objKey){
	for (adsExpand_tempX = 0; adsExpand_tempX < ads_expObjArray.length; adsExpand_tempX++){
		if(ads_expObjArray[adsExpand_tempX].objKey == objKey)
			return ads_expObjArray[adsExpand_tempX];
	}
}
// UTILITY TO RETURN EXPAND ARRAY POSITION
function adsExpand_getObjNode(objKey){
	for (adsExpand_tempX = 0; adsExpand_tempX < ads_expObjArray.length; adsExpand_tempX++){
		if(ads_expObjArray[adsExpand_tempX].objKey == objKey)
			return adsExpand_tempX;
	}
}
// UTILITY TO RETURN FLASH OBJECT REFERENCE BASED ON BROWSER TYPE //
function getMovieName(movieName) {
	if (navigator.appName.indexOf("Microsoft") != -1) {
		return window[movieName]
	} else {
		return document[movieName]
	}
}
// X,Y LOCATION DETECTION UTILITIES
function ads_getY(element){
	var y = 0;
	for (var e = element; e; e = e.offsetParent) // Iterate the offsetParents
		y += e.offsetTop;

	for (var e = element.parentNode; e && e !=document.body; e = e.parentNode) // Iterate the parent Nodes
		if (e.scrollTop) y -= e.scrollTop; 	// subtract scrollbar values

	//This is the Y coordinate with the doucment-internal scrolling accounted for.
	return y;
}
function ads_getX(element){
	var x = 0;
	for (var e = element; e; e = e.offsetParent) // Iterate the offsetParents
		x += e.offsetLeft;

	for (var e = element.parentNode; e && e !=document.body; e = e.parentNode) // Iterate the parent Nodes
		if (e.scrollLeft) x -= e.scrollLeft; 	// subtract scrollbar values

	//This is the Y coordinate with the doucment-internal scrolling accounted for.
	return x;
}
// CHECK MOUSE (make sure the user hasn't left the hotspot while interacting with a rollover expand)
function ads_checkMouse(){
	Handler.add(window.document.body,"mousemove", ads_getCoords);
}

// CHECK DELAY (make sure the user hasn't left the hotspot within 1 second)
function ads_checkDelay(){
	Handler.remove(window.document.body, "mousemove", ads_getDelayCoords);
	Handler.add(window.document.body,"mousemove", ads_getDelayCoords);
}

// MOUSE DETECTION FUNCTIONS //
// GET COORDINATES FOR ROLLOVER AUTO-COLLAPSE
function ads_getCoords(e){
	// Remove any old handlers before adding new one
	Handler.remove(window.document.body, "mousemove", ads_getCoords);	
	// The event object holds the mouse position in window coordinates
	// Convert these to document coordinates using the Geometry module
	var x = e.clientX + Geometry.getHorizontalScroll();
	var y = e.clientY + Geometry.getVerticalScroll();
	ads_checkCoords(x,y);
}
// GET COORDINATES FOR ROLLOVER 1 SEC DELAY
function ads_getDelayCoords(e){
	// Remove any old handlers before adding new one
	Handler.remove(window.document.body, "mousemove", ads_getDelayCoords);
	// The event object holds the mouse position in window coordinates
	// Convert these to document coordinates using the Geometry module
	var x = e.clientX + Geometry.getHorizontalScroll();
	var y = e.clientY + Geometry.getVerticalScroll();
	// Set the Coords of current mouse position
	ads_globalDelayRecentX = x;
	ads_globalDelayRecentY = y;
}

// MOUSE X,Y COORDS CHECK FUNCTIONS
// CHECK COORDINATES FOR ROLLOVER AUTO-COLLAPSE
function ads_checkCoords(x,y){

	var collapseBase = false;
	var collapseExpand = false;

	// get expandObj to read its hotspot coordinates
	var expandObj = adsExpand_getObj(ads_globalCurrentKey);

	if(!((x >= expandObj.ads_baseXleft) && (x <= expandObj.ads_baseXright)) || !((y >= expandObj.ads_baseYtop) && (y <= expandObj.ads_baseYbottom)))
		collapseBase = true;
		
	if(!((x >= expandObj.ads_expandXleft) && (x <= expandObj.ads_expandXright)) || !((y >= expandObj.ads_expandYtop) && (y <= expandObj.ads_expandYbottom)))
		collapseExpand = true;	
				
	if(collapseBase && collapseExpand)	
		cnetCollapse(ads_globalRolloffKey);

}
// CHECK COORDINATES FOR ROLLOVER 1 SEC DELAY
function ads_checkDelayCoords(){
	// remove the timer checking mouse position
	window.clearInterval(ads_globalTimerInterval);
	
	// Rollover has finished after the 1 second delay
	ads_globalRolloverActive = false;
	
	// Global Var to put expand actions on hold till this expand has finished
	ads_globalOnHold = false;
		
	// get Base panel as an object to determine its position on the page	
	var expandObj = adsExpand_getObj(ads_globalCurrentKey);
	if(((ads_globalDelayRecentX >= expandObj.ads_baseXleft) && (ads_globalDelayRecentX <= expandObj.ads_baseXright)) && ((ads_globalDelayRecentY >= expandObj.ads_baseYtop) && (ads_globalDelayRecentY <= expandObj.ads_baseYbottom)))
		expandObj.runOnLoad(cnetExpandDelay);
}
// END AUTO-COLLAPSE AND MOUSE DETECTION SCRIPT //

// GLOBAL VARS

// Object to hold the expand content
var ads_expandSlide;
// Boolean for all occurances of Expand. False is closed, True is open.
var ads_globalExpandState = false;
// Global Var to put all expand actions on hold until the current Expand Animation is done animating
var ads_globalOnHold = false;
// Boolean to put expand actions on hold while one expand is still active
var ads_globalRolloverActive = false;
// Remember the Node position of most recent expand
var ads_globalExpandObjNode;
// Remember the Node position for collapse
var ads_globalCollapseObjNode;
// Global for Delay Mouse Cursor - Most Recent Position
var ads_globalDelayRecentX;
var ads_globalDelayRecentY;
// Remember the key of most recent expand
var ads_globalCurrentKey;
// Remember the Rolloff key of most recent rollover expand
var ads_globalRolloffKey;
// Check to see if Expand Movie is available yet
var ads_globalExpandChecker = false;
var ads_globalExpandCheckerCount = 0;
// Global Timer Vars
var ads_globalTimerTimeout;
var ads_globalTimerInterval;
var ads_globalTimerReset;
var ads_globalCheckTimerInterval;
var ads_globalDelayTimerInterval;

// EXPAND FUNCTIONS

// EXPAND - REQUIRES EXPAND AS STRING AND KEY AS NUMBER
function cnetExpand(a, b) {

// New Component Tracking Class passes 1 variable - key
if(arguments.length==1){
	var key = a;
	var expand = null;
// Old Tracking Class passes expand and key
} else {
	var expand = a;
	var key = b;		
}

// Retrieve expand Obj to access all data
var expandObj = adsExpand_getObj(key);

if ( typeof(expandObj.adsExpand_expandType) == "undefined" ) {
	if(expand==null){
		expandObj.adsExpand_expandType = "click";
	} else {
		expandObj.adsExpand_expandType = expand;	
	}
}

if ( typeof(expandObj.adsExpand_collapseType) == "undefined" ) {
	if(expand==null){
		expandObj.adsExpand_collapseType = "click";
	} else if(expand=="rollover") {
		expandObj.adsExpand_collapseType = "rolloff";
	} else {
		expandObj.adsExpand_collapseType = "rolloff";
	}
}

// Do not initiate one expand until another has finished
// if (another expand ad is not animating its expand action) AND ((the expand type is rollover AND another expand is not open currently) OR (expand type is click))
if(!ads_globalOnHold && ((expandObj.adsExpand_expandType=="rollover" && (!ads_globalRolloverActive) || expandObj.adsExpand_expandType=="click"))){

	// if the expand ad is expanded do not expand
	if(!expandObj.expandState){
		
		// Global Var to put expand actions on hold till this expand has finished
		ads_globalOnHold = true;

		// Global Var to set most recent Expand
		ads_globalCurrentKey = key;

		// Retrieve Base Panel DIV Element to control it
		var baseDiv = document.getElementById(expandObj.adsExpand_parDiv);
		// Retrieve Expand Panel DIV Element to control it
		var expandDiv = document.getElementById(expandObj.adsExpand_childDiv);

		// find X position of base object
		expandObj.ads_hotspotXleft = ads_getX(baseDiv);
		// find y position of base object
		expandObj.ads_hotspotYtop = ads_getY(baseDiv);
		
		// DETERMINE BASE HOTSPOT COORDINATES
		// find left mouse position
			expandObj.ads_baseXleft = ads_getX(baseDiv);
		// find right mouse position by adding the base width to the left position 
			expandObj.ads_baseXright = expandObj.ads_baseXleft + expandObj.adsExpand_width;
		// find top mouse position by adding the top offset to the Base panel y position
			expandObj.ads_baseYtop = ads_getY(baseDiv);
		// find bottom mouse position by adding the expand height to the top position 
			expandObj.ads_baseYbottom = expandObj.ads_baseYtop + expandObj.adsExpand_height;	

		// DETERMINE EXPAND HOTSPOT COORDINATES
		// find left mouse position by adding the left offset to the Base panel x position
			expandObj.ads_expandXleft = expandObj.ads_baseXleft + expandObj.adsExpand_leftOffset;
		// find right mouse position by adding the Expand width to the left position 
			expandObj.ads_expandXright = expandObj.ads_expandXleft + expandObj.adsExpand_widthEx;			
		// find top mouse position by adding the top offset to the Base panel y position
			expandObj.ads_expandYtop = expandObj.ads_baseYtop + expandObj.adsExpand_topOffset;
		// find bottom mouse position by adding the expand height to the top position 
			expandObj.ads_expandYbottom = expandObj.ads_expandYtop + expandObj.adsExpand_heightEx;	

		// if the expand action is a mouse rollover, add 1 second delay
		if(expandObj.adsExpand_expandType=="rollover"){
			
			// Begin Auto-Detection for Delay
			ads_globalDelayRecentX = expandObj.ads_baseXleft;
			ads_globalDelayRecentY = expandObj.ads_baseYtop;
			ads_globalDelayTimerInterval=window.setInterval(ads_checkDelay, 100);

			ads_globalTimerTimeout=setTimeout(ads_checkDelayCoords, 1000);

		} else {
			expandObj.runOnReady(cnetExpandDelay);
		}
	}
}
}

// EXPAND DELAY (the expand actions triggered after the initial delay)
function cnetExpandDelay(){
	// Detect Version of IE
	version = parseFloat(navigator.appVersion.split("MSIE")[1]);

	// Retrieve expand Obj to access all data
	var expandObj = adsExpand_getObj(ads_globalCurrentKey);

	// clear the one second delay routine if expand is a rollover
	if(expandObj.adsExpand_expandType=="rollover")
		window.clearInterval(ads_globalTimerInterval);

	// set global Expand state to open
	expandObj.expandState=true;	

	// Remove On Hold from global Var
	ads_globalOnHold = false;

	// IFrame Shim
	//if ((version >= 5.5) && (version < 7) && (document.body.filters) && document.getElementsByTagName("select")) {	
	//	var shimName = expandObj.adsExpand_childDiv + "Shim";
	//	document.getElementById(shimName).style.display="block";
	//}
	
	// IE requires special formatting for the clip property
	if(isIE && isWin && !isOpera){	
		// Unclip the Expand object so users can see and interact with it
		document.getElementById(expandObj.adsExpand_childDiv).style.clip="rect(0px "+expandObj.adsExpand_widthEx+"px "+expandObj.adsExpand_heightEx+"px 0px)";
	} else {
		// Unclip the Expand object so users can see and interact with it
		document.getElementById(expandObj.adsExpand_childDiv).style.clip="rect(0px,"+expandObj.adsExpand_widthEx+"px,"+expandObj.adsExpand_heightEx+"px,0px)";
	}	

	// Retrieve Base DIV to get its coordinates
	var baseDiv = document.getElementById(expandObj.adsExpand_parDiv);
	
	// find left mouse position
	var ads_baseXleft = ads_getX(baseDiv);	
	
	// find top mouse position by adding the top offset to the Base panel y position
	var ads_baseYtop = ads_getY(baseDiv);
	
	// Position Expand Panel
	var expand_x = ads_baseXleft + expandObj.adsExpand_leftOffset;
	var expand_y = ads_baseYtop + expandObj.adsExpand_topOffset;
		
	var adSlide = document.getElementById(expandObj.adsExpand_childDiv);
	
	adSlide.style.top = expand_y + "px";
	adSlide.style.left = expand_x + "px";
	
	// Set Expand DIV z-index to 4999 for proper layering
	document.getElementById(expandObj.adsExpand_childDiv).style.zIndex=99999;

	// get Base panel as an object and as a node position to determine its position on the page	
	var expandObj = adsExpand_getObj(ads_globalCurrentKey);
	
	ads_globalExpandObjNode = adsExpand_getObjNode(ads_globalCurrentKey);

	// SEND COMMAND TO EXPAND MOVIE
	// Create a fast Interval to look for the Expand Movie, if movie is found the expand command will be sent
	// DO NOT SEND IF DISABLED BY VAR
	if(!expandObj.jsFLashDisable)
		ads_globalCheckTimerInterval=window.setInterval(ads_checkExpand, 50);

	// reload tracking gif to track the expand action
	document.getElementById(expandObj.impTrack_name).src=expandObj.expandImpTrack;

	// If 3rd Party Expand Trackign supported
	if(expandObj.expandImpTrack3P){
		// reload tracking gif to track the expand action
		document.getElementById(expandObj.impTrack_name3P).src=expandObj.expandImpTrack3P;
	} 	
	
	// Initiate default mouse detection routine during expand
	if(expandObj.adsExpand_collapseType=="rolloff"){

		// Set a Rolloff Key for Auto-Collapse function
		ads_globalRolloffKey = ads_globalCurrentKey;

		// Set the Boolean to mark that Auto-Collapse is active
		ads_globalRolloverActive = true;

		// Begin Auto-Collapse
		ads_globalTimerInterval=window.setInterval(ads_checkMouse, 10);
	}
}

// COLLAPSE
function cnetCollapse(key) {

	// Detect Version of IE
	version = parseFloat(navigator.appVersion.split("MSIE")[1]);

	// get Base panel as an object and as a node position to determine its position on the page	
	var expandObj = adsExpand_getObj(key);
	var expandObjNode = adsExpand_getObjNode(key);
	
	// Set Global Vars for Timeout scope
	ads_globalCollapseObjNode = expandObjNode;
	
	if(expandObj.expandState){	
		// Stop the mouse detection routine
		if(expandObj.adsExpand_collapseType=="rolloff"){
			// Set the Boolean to mark that Auto-Collapse is not active
			ads_globalRolloverActive = false;
			// Clear Auto-Collapse function
			window.clearInterval(ads_globalTimerInterval);		
		}
	
   		// Send Expand Panel command to collapse
		// DO NOT SEND IF DISABLED BY VAR
		if(!expandObj.jsFLashDisable)
			getMovieName(ads_expObjArray[ads_globalCollapseObjNode].adsExpand_expandName).callCnetCollapse();
 		
		//if ((version >= 5.5) && (version < 7) && (document.body.filters) && document.getElementsByTagName("select")) {
		//	var shimName = expandObj.adsExpand_childDiv + "Shim";
		//	document.getElementById(shimName).style.display="none";
		//}
		
		// IE needs special formatting for the clip property
		if(isIE && isWin && !isOpera){
			// Clip Expand DIV to hide it on screen		
			document.getElementById(expandObj.adsExpand_childDiv).style.clip="rect(0px 0px 0px 0px)";
		} else {
			// Clip Expand DIV to hide it on screen		
			document.getElementById(expandObj.adsExpand_childDiv).style.clip="rect(0px,0px,0px,0px)";
		}		
		
		// Set Expand DIV z-index back to 0 for proper layering		
		document.getElementById(expandObj.adsExpand_childDiv).style.zIndex=0;

		// Set Global Expand state to "closed"
   		expandObj.expandState=false;

 		// Record Collapse impression
 		document.getElementById(expandObj.impTrack_name).src=expandObj.collapseImpTrack;

		// If 3rd Party Expand Trackign supported
		if(expandObj.collapseImpTrack3P){
			// reload tracking gif to track the expand action
			document.getElementById(expandObj.impTrack_name3P).src=expandObj.collapseImpTrack3P;
		} 				

	}
}

//CHECK FOR EXPAND
function ads_checkExpand(){

	// Get the current expand object
	ads_globalExpandObjNode = adsExpand_getObjNode(ads_globalCurrentKey);
	
	// Put the expand action call in an error catching loops to avoid potential errors
	try{
		// send the Expand Panel Flash Object the command to Expand
	    getMovieName(ads_expObjArray[ads_globalExpandObjNode].adsExpand_expandName).callCnetExpand();
		ads_globalExpandChecker=true;	
	}
	catch(e){
		// If expand action call fails then set the checker to false and try again
		ads_globalExpandChecker=false;
	}
	finally{
		// increase count to restrict number of loops the interval will make
		ads_globalExpandCheckerCount++;	
	}

	//If expand action call was successful or the Interval has looped too many times kill the Interval loop
	if(ads_globalExpandCheckerCount>10 || ads_globalExpandChecker==true){
		window.clearInterval(ads_globalCheckTimerInterval);
		ads_globalExpandCheckerCount=0;
	}
}

function cbsiRunAd(){

	// tempObj is a placeholder for inserting the expand layer
	var tempObj;
	// find either the first available DIV object or the first node
	for(var x=0; x<document.body.childNodes.length; x++){	
		if((document.body.childNodes[x].nodeName)=='DIV'){
			tempObj=document.body.childNodes[x];
			break;
		} else {
			tempObj=document.body.firstChild;
		}
		
	}
	var key = ads_globalCurExpandArray.shift();

	// Retrieve expand Obj to access all data
	var expandObj = adsExpand_getObj(key);// Retrieve Base Panel DIV Element to control it

	// Retrieve Base DIV to get its coordinates
	var baseDiv = document.getElementById(expandObj.adsExpand_parDiv);
	
	// find left mouse position
	var ads_baseXleft = ads_getX(baseDiv);	
	
	// find top mouse position by adding the top offset to the Base panel y position
	var ads_baseYtop = ads_getY(baseDiv);
	
	// Position Expand Panel
	var expand_x = ads_baseXleft + expandObj.adsExpand_leftOffset;
	var expand_y = ads_baseYtop + expandObj.adsExpand_topOffset;
	var adSlide=document.createElement('div');
	adSlide.id = expandObj.adsExpand_childDiv;
	// Insert AdSlide expand panel before the first DIV or child node found
	document.body.insertBefore(adSlide,tempObj);	
	adSlide.style.position = "absolute";	
	adSlide.style.top = expand_y + "px";
	adSlide.style.left = expand_x + "px";
	adSlide.style.width = expandObj.adsExpand_widthEx;
	adSlide.style.height = expandObj.adsExpand_heightEx;
	adSlide.style.zIndex = 99999;
	if(isIE && isWin && !isOpera)
		adSlide.style.clip = "rect(0px 1px 1px 0px)";
	else
		adSlide.style.clip = "rect(0px,1px,1px,0px)";
	adSlide.innerHTML = '<div>'+expandObj.ads_expandHTML+'</div>';
	expandObj.onReadyRun();
}

function ads_createExpand(o) {

	// Detect Version of IE
	version = parseFloat(navigator.appVersion.split("MSIE")[1]);	
	
	if(o.adsExpand_srcBase.indexOf(".swf") == -1){
		o.adsExpand_srcBase = o.adsExpand_srcBase+".swf";
	}
	if(o.adsExpand_srcExpand.indexOf(".swf") == -1){
		o.adsExpand_srcExpand = o.adsExpand_srcExpand+".swf";
	}
	// List Defaults for 3rd Party tracking GIFs for backwards compatability
	if ( typeof(o.impTrack_name3P) == "undefined" ) {
		o.expandImpTrack3P=""; 
		o.collapseImpTrack3P=""; 
		o.flashImpTrack3P=""; 
		o.impTrack_name3P = "ads_impTrack3P7777";
	}
	
	// jsFLashDisable
	// Var used to disable JS to Flash expand/collapse initiation.  Should be set only for cross talk creatives.
	if(o.jsFLashDisable==undefined)
		o.jsFLashDisable = false;
	
	if(isIE && isWin && !isOpera){
		document.write('<div align="center"><div align="center" id="'+o.adsExpand_parDiv+'" style="position:relative; width:'+o.adsExpand_width+'px; height:'+o.adsExpand_height+'px; text-align:center; margin:0 auto; z-index:0;">');
		document.write('	<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0" width="'+o.adsExpand_width+'" height="'+o.adsExpand_height+'" id="'+o.adsExpand_baseName+'" align="middle">');
		document.write('	<param name="allowScriptAccess" value="always" />');
		document.write('	<param name="FlashVars" value="'+o.adsExpand_flashVarsBase+'" />');
		document.write('	<param name="movie" value="'+o.adsExpand_srcBase+'" /><param name="quality" value="high" /><param name="wmode" value="'+o.adsExpand_wmodeBase+'" /><param name="bgcolor" value="'+o.adsExpand_bgcolorBase+'" /></object>');		

		if ((version >= 5.5) && (version < 7) && (document.body.filters) && document.getElementsByTagName("select")) {
			document.write('	<div id="'+o.adsExpand_childDiv+'Shim" style="position:absolute;width:'+o.adsExpand_widthEx+'px;height:'+o.adsExpand_heightEx+'px;left:'+o.adsExpand_leftOffset+'px;top:'+o.adsExpand_topOffset+'px; z-index: 99999; display:none"><IFRAME src="" frameBorder="0" scrolling="no" height="100%" width="100%"></IFRAME></div>');
		}
		document.write('<br /><img src="'+o.flashImpTrack+'" border="0" height="1" width="1" name="'+o.impTrack_name+'" id="'+o.impTrack_name+'" style="position:absolute; top:0px; left:0px;" />');
		document.write('</div></div>');

		o.ads_expandHTML = '<div id="'+o.adsExpand_childDiv+'" style="width:'+o.adsExpand_widthEx+'px;height:'+o.adsExpand_heightEx+'px;"><object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0" width="'+o.adsExpand_widthEx+'" height="'+o.adsExpand_heightEx+'" id="'+o.adsExpand_expandName+'" align="middle"><param name="allowScriptAccess" value="always" /><param name="FlashVars" value="'+o.adsExpand_flashVarsExpand+'" /><param name="movie" value="'+o.adsExpand_srcExpand+'" /><param name="quality" value="high" /><param name="wmode" value="'+o.adsExpand_wmodeExpand+'" /><param name="bgcolor" value="#ffffff" /></object></div>';
		
		
	} else {
		document.write('<div align="center"><div align="center" id="'+o.adsExpand_parDiv+'" style="position:relative; width:'+o.adsExpand_width+'px; height:'+o.adsExpand_height+'px; text-align:center; margin:0 auto; z-index:0;">');
		document.write('	<embed src="'+o.adsExpand_srcBase+'" quality="high" wmode="'+o.adsExpand_wmodeBase+'" bgcolor="'+o.adsExpand_bgcolorBase+'" width="'+o.adsExpand_width+'" height="'+o.adsExpand_height+'" name="'+o.adsExpand_baseName+'" align="middle" allowScriptAccess="always" FlashVars="'+o.adsExpand_flashVarsBase+'" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" />');
		document.write('<br /><img src="'+ o.flashImpTrack +'" alt="impTrack" border="0" height="1" width="1" name="'+o.impTrack_name+'" id="'+o.impTrack_name+'" />');
		document.write('</div></div>');

		o.ads_expandHTML = '<div id="'+o.adsExpand_childDiv+'" style="width:'+o.adsExpand_widthEx+'px;height:'+o.adsExpand_heightEx+'px;"><embed src="'+o.adsExpand_srcExpand+'" wmode="'+o.adsExpand_wmodeExpand+'" quality="high" bgcolor="'+o.adsExpand_bgcolorExpand+'" width="'+o.adsExpand_widthEx+'" height="'+o.adsExpand_heightEx+'" name="'+o.adsExpand_expandName+'" align="middle" allowScriptAccess="always" FlashVars="'+o.adsExpand_flashVarsExpand+'" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" /></div>';

	}

	// If Third Party Tracking GIF
	if(o.flashImpTrack3P!="" && o.expandImpTrack3P!=""){
		document.write('<br /><img src="'+ o.flashImpTrack3P +'" border="0" height="1" width="1" name="'+o.impTrack_name3P+'" id="'+o.impTrack_name3P+'" style="position:absolute; top:0px; left:0px;" />');
	}	

	// Write expand panel
	cbsiRunAd();	
	o.runOnLoad(ads_closeClipping);
}


function ads_closeClipping(){

	for(var x=0;x<ads_expObjArray.length;x++){
	
		// Retrieve expand Obj to access all data
		var expandObj = adsExpand_getObj(ads_expObjArray[x].objKey);// Retrieve Base Panel DIV Element to control it

		if ( typeof(expandObj.pdAutoExpand) == "undefined" ) {
			// IE requires special formatting for the clip property
			if(isIE && isWin && !isOpera){	
				// Unclip the Expand object so users can see and interact with it
				document.getElementById(expandObj.adsExpand_childDiv).style.clip="rect(0px 0px 0px 0px)";
			} else {
				// Unclip the Expand object so users can see and interact with it
				document.getElementById(expandObj.adsExpand_childDiv).style.clip="rect(0px, 0px, 0px, 0px)";
			}
		}	
	}
}


// LAUNCH THE EXPAND AD WHEN CALLED
function ads_goAd(o){

	// Version check based upon the values entered above in "Globals"
	var hasReqestedVersion = DetectFlashVer(o.requiredMajorVersion, o.requiredMinorVersion, o.requiredRevision);

	// Check to see if the version meets the requirements for playback
	if (hasReqestedVersion && !ads_inFIF) {
		// if we've detected an acceptable version
		// embed the Flash Content SWF when all tests are passed	
		ads_createExpand(o);
	} else {
		document.write(o.defaultGIF);
	}
}

// RUNTIME CODE
// Check to see if this is an Ajax Friendly IFrame Environment
var ads_inFIF = false;

if ( typeof(inFIF) == "undefined" ) {
    // Action to take if variableName is not defined - NO ACTION
} else {
    // Action to take if variableName *is* defined
    ads_inFIF = true;
}

if(ads_globalCurExpandArray.length!=0){
	// Get Expand Object from Global Array 'ads_expObjArray'
	for(x=0;x<ads_expObjArray.length;x++){
		if(ads_expObjArray[x].objKey==ads_globalCurExpandArray[(ads_globalCurExpandArray.length-1)]){
			ads_goAd(ads_expObjArray[x]);		
		}
	}
}

