expanding_ad.exec=function(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="1" height="1" 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+'&clickTag='+expanding_ad[ad_id].clickTag+'&extraCTs='+expanding_ad[ad_id].extraCTs+'">';
		swfdrop+='</object>';  
	}else{
		swfdrop+='<embed height="1" width="1" 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+'&clickTag='+expanding_ad[ad_id].clickTag+'&extraCTs='+expanding_ad[ad_id].extraCTs+'">';
		swfdrop+='</embed>';
	}
	swfdrop+='</div></div>';
	document.write(swfdrop);
	if(!isIE){
		var target=ea_gFM(ad_id);
		var evt=document.createEvent("MouseEvents");
		evt.initMouseEvent("mouseover", true, true, window, 0, 0, 0, 0, 0, false, false, false, false, 0, null);
		target.dispatchEvent(evt);
	}
};

function ea_gFM(movieName){
	var isIE=navigator.userAgent.indexOf("MSIE")!=-1;
	return(isIE)?window[movieName]:document[movieName];
}

function exp_ad_dothesize(){
	for(var a in expanding_ad){
		if(a!='exec' && a!='current_ad_id' && a!='z_index'){
			ea_gFM(expanding_ad[a].ad_id).exp_ad_getsizes(expanding_ad[a].ad_id)
		}
	}
}

function newUrl(url){
	window.open(url,'_blank');
}

var toSetNew=(toSetNew!='')?toSetNew:'';

function exp_ad_getSizeFromFlash(str){
	var param = str.split('*');
	var params = param.length;
	var ad_id = param[param.length-2].split('=')[1];
	for(var a=0;a<params;a++){
		var this_param = param[a].split('=')[0];
		var this_param_val = param[a].split('=')[1];
		expanding_ad[ad_id][this_param] = this_param_val;
	}
	var wrap=document.getElementById('expandingAd_wrapper_'+expanding_ad[ad_id].ad_id);
	wrap.style.width=expanding_ad[ad_id].unex_width+'px';
	wrap.style.height=expanding_ad[ad_id].unex_height+'px';
	wrap.style.position='relative';
	//wrap.style.margin='0 auto';
	wrap.style.textAlign='left';
	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.height=expanding_ad[ad_id].unex_height+'px';
	con.style.width=expanding_ad[ad_id].unex_width+'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;
	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){
	ea_gFM(ad_id).style.position="relative";
	ea_gFM(ad_id).style.width=expanding_ad[ad_id].ex_width+'px';
	ea_gFM(ad_id).style.height=expanding_ad[ad_id].ex_height+'px';
	if(state=='open'){
		ea_gFM(ad_id).style.left='0px';
		ea_gFM(ad_id).style.top='0px';
	}else{
		if(expanding_ad[ad_id].unex_x>0){
			var ml=0-expanding_ad[ad_id].unex_x;
			ea_gFM(ad_id).style.left=ml+'px';
		}
		if(expanding_ad[ad_id].unex_y>0){
			var mt=0-expanding_ad[ad_id].unex_y;
			ea_gFM(ad_id).style.top=mt+'px';
		}
	}
	ea_gFM(ad_id).style.display='block';
}

function exp_ad_mouseFlashState(bool,ad_id){
	if(bool){
		document.getElementById('expandingAd_'+expanding_ad[ad_id].ad_id).style.width=expanding_ad[ad_id].ex_width+'px';
		document.getElementById('expandingAd_'+expanding_ad[ad_id].ad_id).style.height=expanding_ad[ad_id].ex_height+'px';
		if(expanding_ad[ad_id].unex_x>0){
			var ml=0-expanding_ad[ad_id].unex_x;
			document.getElementById('expandingAd_'+expanding_ad[ad_id].ad_id).style.marginLeft=ml+'px';
		}
		if(expanding_ad[ad_id].unex_y>0){
			var mt=0-expanding_ad[ad_id].unex_y;
			document.getElementById('expandingAd_'+expanding_ad[ad_id].ad_id).style.marginTop=mt+'px';
		}
		exp_ad_adjustMovie('open',expanding_ad[ad_id].ad_id);
	}else{
		document.getElementById('expandingAd_'+expanding_ad[ad_id].ad_id).style.width=expanding_ad[ad_id].unex_width+'px';
		document.getElementById('expandingAd_'+expanding_ad[ad_id].ad_id).style.height=expanding_ad[ad_id].unex_height+'px';
		document.getElementById('expandingAd_'+expanding_ad[ad_id].ad_id).style.marginTop='';
		document.getElementById('expandingAd_'+expanding_ad[ad_id].ad_id).style.marginLeft='';
		exp_ad_adjustMovie('close',expanding_ad[ad_id].ad_id);
	}
}

expanding_ad.exec(expanding_ad.current_ad_id);
