expanding_ad.exec=function(ad_id){
	//alert(ad_id);
	var isIE=navigator.userAgent.indexOf("MSIE")!=-1;
	expanding_ad.z_index=(expanding_ad.z_index)?expanding_ad.z_index-1:Math.round(Math.random()*1000000);
	var swfdrop='<div id="expandingAd_wrapper_'+ad_id+'" style="z-index:'+expanding_ad.z_index+'"><div id="expandingAd_'+ad_id+'">';
	if(isIE){
		swfdrop+='<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,0,0" width="300" height="250" id="'+ad_id+'">';
		swfdrop+='<param name="movie" value="'+expanding_ad[ad_id].creative+'"/>';
		swfdrop+='<param name="quality" value="high"/>';
		swfdrop+='<param name="bgcolor" value="#ffffff"/>';
		swfdrop+='<param name="play" value="true"/>';
		swfdrop+='<param name="loop" value="true"/>';
		swfdrop+='<param name="wmode" value="transparent"/>';
		swfdrop+='<param name="devicefont" value="false"/>';
		swfdrop+='<param name="menu" value="false"/>';
		swfdrop+='<param name="allowfullscreen" value="false"/>';
		swfdrop+='<param name="allowScriptAccess" value="always"/>';
		swfdrop+='<param name="flashvars" value="ad_id='+ad_id+'&configPath='+expanding_ad[ad_id].configUrl+'&clickTag='+expanding_ad[ad_id].clickTag+'&extraCTs='+expanding_ad[ad_id].extraCTs+'">';
		swfdrop+='</object>';  
	}else{
		swfdrop+='<embed height="250" width="300" type="application/x-shockwave-flash" salign="" align="middle" allowscriptaccess="always" allowfullscreen="false" menu="false" name="'+ad_id+'" id="'+ad_id+'" bgcolor="#ffffff" devicefont="false" wmode="transparent" loop="true" play="true" pluginspage="http://www.macromedia.com/go/getflashplayer" quality="high" src="'+expanding_ad[ad_id].creative+'" flashvars="ad_id='+ad_id+'&configPath='+expanding_ad[ad_id].configUrl+'&clickTag='+expanding_ad[ad_id].clickTag+'&extraCTs='+expanding_ad[ad_id].extraCTs+'">';
		swfdrop+='</embed>';
	}
	swfdrop+='</div></div>';
	document.write(swfdrop);
	setDivSize();
};

function ea_gFM(movieName){
	var isIE=navigator.userAgent.indexOf("MSIE")!=-1;
	return(isIE)?window[movieName]:document[movieName];
}

function newUrl(url){
	window.open(url,'_blank');
}

var toSetNew=(toSetNew!='')?toSetNew:'';

function setDivSize(){
	//alert("setDivSize();");
	var wrap=document.getElementById('expandingAd_wrapper_'+expanding_ad[ad_id].ad_id);
	wrap.style.width=300+'px';
	wrap.style.height=250+'px';
	wrap.style.position='relative';
	//wrap.style.margin='0 auto';
	wrap.style.textAlign='right';
	var con=document.getElementById('expandingAd_'+expanding_ad[ad_id].ad_id);
	if(location.href.match('show_expand')){
		//con.style.border="2px solid #f09";
	}
	con.style.width=300+'px';
	con.style.height=250+'px';
	con.style.overflow='hidden';
	con.style.position='absolute';
	document.getElementById(expanding_ad[ad_id].ad_id).style.display='none';
	var isIE=navigator.userAgent.indexOf("MSIE")!=-1;
	var ieee=expanding_ad[ad_id].ad_id;
	var autoExp=expanding_ad[ad_id].auto;
	
	/*ea_gFM(ad_id).style.position="relative";
	ea_gFM(ad_id).style.width=300+'px';
	ea_gFM(ad_id).style.height=250+'px';
	ea_gFM(ad_id).style.display='block';*/
	
	exp_ad_mouseFlashState(true, ad_id)
	
	if(isIE){
		toSetNew=setInterval(function(){ieFire(ieee)},10);
	}else{
		if(!autoExp){
			exp_ad_adjustMovie('close',expanding_ad[ad_id].ad_id);
		}else{
			exp_ad_adjustMovie('open',expanding_ad[ad_id].ad_id);
			exp_ad_mouseFlashState(true,expanding_ad[ad_id].ad_id);
		}
	}
}

function ieFire(ad_id){
	if(document.readyState=='interactive' || document.readyState=='loaded' || document.readyState=='complete'){
		clearInterval(toSetNew);
		var autoExp=expanding_ad[ad_id].auto;
		if(!autoExp){
			exp_ad_adjustMovie('close',ad_id);
		}else{
			exp_ad_adjustMovie('open',ad_id);
			exp_ad_mouseFlashState(true,ad_id);
		}
	}
}

function exp_ad_adjustMovie(state,ad_id){
	if(state=='open'){
		ea_gFM(ad_id).style.width=500+'px';
		ea_gFM(ad_id).style.height=250+'px';
		ea_gFM(ad_id).style.left='-200px';
		
	}else{
		ea_gFM(ad_id).style.width=300+'px';
		ea_gFM(ad_id).style.height=250+'px';
	}
}

function exp_ad_mouseFlashState(bool,ad_id){
	//alert("exp_ad_mouseFlashState('" + bool + "," + ad_id + "');");
	if(bool){
		document.getElementById('expandingAd_'+expanding_ad[ad_id].ad_id).style.width=500+'px';
		document.getElementById('expandingAd_'+expanding_ad[ad_id].ad_id).style.height=250+'px';
		document.getElementById('expandingAd_'+expanding_ad[ad_id].ad_id).style.marginLeft='-200px';
		exp_ad_adjustMovie('open',expanding_ad[ad_id].ad_id);
	}else{
		document.getElementById('expandingAd_'+expanding_ad[ad_id].ad_id).style.width=300+'px';
		document.getElementById('expandingAd_'+expanding_ad[ad_id].ad_id).style.height=250+'px';
		document.getElementById('expandingAd_'+expanding_ad[ad_id].ad_id).style.marginLeft='0px';
		exp_ad_adjustMovie('close',expanding_ad[ad_id].ad_id);
	}
}

expanding_ad.exec(expanding_ad.current_ad_id);

