<!--
var adm_id = 0;
function Adm(kind, src, href, width, height, loop, play, id, style, extfunc, wmode) { 
    this.kind    = kind;
    this.src     = src;
    this.href    = href;
    this.width   = width;
    this.height  = height;
    this.loop    = loop;
    this.play    = play;
    this.id      = id;
    this.style   = style;
	this.boxStyle= '';
    this.extfunc = extfunc;
    this.wmode   = wmode ? wmode : "transparent";
	this.counterUrl = null;    //计数器URL
	if (!this.id){
		this.id = "adm_obj_"+adm_id;
		adm_id++;
	}
}

Adm.adm_f="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,19,0";
Adm.ce = document.all?1:(document.getElementById?0:-1);
Adm.contentWidth = '780px';
Adm.contentAlign = 'center';
Adm.td_left = null;
Adm.td_right = null;

Adm.prototype.output = function (containerId){
	var _adm = this;
	if (this.href && this.counterUrl){
		if (this.counterUrl.indexOf("?") == -1)this.counterUrl+="?";
		else this.counterUrl+="&";
		this.href = this.counterUrl+"url="+encodeURIComponent(this.href);
	}
	switch (this.kind){
	    case "left":
		    this.createLeftRightTable();
			Adm.td_left.innerHTML += this.adm_media();
			Adm.td_left.vAlign = "top";
			break;
	    case "right":
		    this.createLeftRightTable();
			Adm.td_right.innerHTML += this.adm_media();
			Adm.td_right.vAlign = "top";
			break;
	    case "float_left":
			this.myload();
			break;
	    case "popup_mc": //显示在页面中心的覆盖内容的广告
			this.popup_mc();
			break;
	    case "popup_rb": //从右下角升起的广告
			this.popup_rb();
			break;
	    case "normal":
		default:
			var str = '<div style="'+this.boxStyle+'">' + this.adm_media()+'</div>';
			if (containerId)
			{
				$("#"+containerId).append(str);
			}
			else {
				document.write(str);
			}
			break;
	}
}

Adm.prototype.popup_rb = function ()
{
	var obj = this.createAd();
	obj.style.height = this.height;
	js.Dom.setZ(obj, 10000);
	
	this.addClose(obj);

	var _adm = this, w=0, h=0, y=0, first=true, is_hide = false;
	function resize()
	{
		if (w > 0 && h > 0){
			var vp = Adm.getScroll();
			var x = vp.width + vp.left - w - 10;
			var y = vp.height + vp.top;
			if (!first) y-=h+5;
			$(obj).css({left:x, top:y});
			$(obj).show();
		
			if (first){
				$(obj).animate({top: y-h-5}, "slow");				
				jQuery(window).resize(function(){if (!is_hide) resize()});
				jQuery(window).scroll(function(){if (!is_hide) resize()});
				first = false;	
			}
		}
		else {
			w = $(obj).width();
			h = $(obj).height();
			setTimeout(function(){resize();}, 300);
		}
	}

	resize();
}

Adm.prototype.popup_mc = function ()
{
	var obj = this.createAd();
	obj.style.height = this.height;
	js.Dom.setZ(obj, 10000);
	
	this.addClose(obj);
	
	var _adm = this;
	var w=0, h=0, _scroll;
	function resize (obj)
	{
		if (w > 0 && h > 0){
			_scroll = Adm.getScroll();
			var x = Math.floor((_scroll.width - w)/2)+_scroll.left;
			var y = Math.floor((_scroll.height - h)/2)+_scroll.top;
			if (x-_scroll.left<10)x=_scroll.left+10;
			if (y-_scroll.top<10)y=_scroll.top+10;
			
			js.Dom.setXY(obj, x, y);
		}
		else {
			w = $(obj).width();
			h = $(obj).height();
			setTimeout(function(){resize(obj);}, 300);
		}
	}	
	resize(obj);
	
	jQuery(window).resize(function(){if (!obj.is_hide)resize(obj)});
	jQuery(window).scroll(function(){if (!obj.is_hide)resize(obj)});
}

Adm.prototype.addClose = function (obj)
{
    var div=document.createElement("div");
	obj.appendChild(div);
    var text=document.createTextNode("×");
	div.appendChild(text);
	div.style.position = "absolute";
	div.style.right = "5px";
	div.style.top = "5px";
	div.style.cursor = "hand";
	div.style.cursor = "Pointer";
	div.style.fontSize = "14px";
	div.style.border = "1px solid #f5f5f5";
	div.style.backgroundColor = "#333333";
	div.style.color = "#ffffff";
	div.style.padding = "0px 5px 1px 5px";
	js.Dom.setZ(div, 10001);
	js.Event.addEvent(div, 'click', function(){js.Dom.hideObj(obj); obj.is_hide = true; });
}

Adm.prototype.myload = function ()
{
	var obj = this.createAd();
	obj.style.zIndex = "10";

	y = window.screen.width>800 ? 120:120
	x = window.screen.width>800 ? 15:122

	obj.style.top=document.body.scrollTop+document.body.offsetHeight-y;
	obj.style.left=x;
	function leftmove()
	{ 
		obj.style.top=document.body.scrollTop+document.body.offsetHeight-y;
		obj.style.left=x;
		setTimeout(leftmove,50)
	}
	leftmove();
}

Adm.prototype.createAd = function (){
    document.write('<div id="'+this.id+'_div" style="position:absolute;width:'+this.width+'">'+this.adm_media()+'</div>');
	var div = document.getElementById(this.id+'_div');
    return div;
}


Adm.prototype.adm_media = function (){
    var s="";
	if (this.width)var width_text = ' width="'+this.width+'" ';
	if (this.height)var height_text = ' height="'+this.height+'" ';
    if(this.src.toLowerCase().indexOf(".swf")!=-1){
		if (this.href)s+='<button style="'+(this.width?('width:'+this.width+'px;'):'')+(this.height?('height:'+this.height+'px'):'')+'background:transparent;border:0px;padding:0px;cursor:hand" onclick="window.open(\''+this.href+'\',\'\',\'\')">';
		s+='<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="'+Adm.adm_f+'" id="'+this.id+'" '+ width_text + height_text + '>';
		s+='<param name="movie" value="'+this.src+'" />';
		s+='<param name="quality" value="high" />';
        if(this.play)s+='<param name="play" value="'+this.play+'">';
		if(this.wmode!="")s+='<param name="wmode" value="'+this.wmode+'" />';
        if(this.loop)s+='<param name="loop" value="'+this.loop+'">';
		s+='<embed src="'+this.src+'" '+ width_text + height_text + ' id="'+this.id+'" name="'+this.id+'" quality="high" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" ';
		s+=' wmode="opaque" ';
		if(this.loop)s+=' loop="'+this.loop+'" ';
		s+='></embed></object>';
		if (this.href)s+='</button>';
    }
    else if(this.src.toLowerCase().indexOf(".flv")!=-1){
		s='<object id="'+this.id+'" classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" '+ width_text + height_text + '>';
		s+='<param name="movie" value="/mediaplayer.swf" />';
		s+='<param name="quality" value="high" />';
		s+='<param name="wmode" value="opaque" />';
		s+='<param name="allowfullscreen" value="true" />';
		s+='<param name="allowscriptaccess" value="always" />';
		s+='<param name="flashvars" value="repeat=list&autostart=true&shuffle=false&width='+this.width+'&height='+this.height+'&file='+this.src+'&image=/templates/images/video_img.jpg&callback=/video_callback.php" />';
		s+='<embed src="/mediaplayer.swf" '+ width_text + height_text + ' id="'+this.id+'" name="'+this.id+'" quality="high" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" allowfullscreen="true" allowscriptaccess="always"';
		s+=' wmode="opaque" ';
		s+=' flashvars="repeat=list&autostart=true&shuffle=false&width='+this.width+'&height='+this.height+'&file='+this.src+'&image=/templates/images/video_img.jpg&callback=/video_callback.php" ';
		s+='></embed></object>';
    }
    else {
        s="<img ";
        if(this.style)s+=" style='"+this.style+"'";
        if(this.extfunc)s+=" "+this.extfunc+" ";
        s+=" id='"+this.id+"' src='"+this.src+"' border='0' " + width_text + height_text + ">";
		if (this.href)s="<a href='"+this.href+"' target='_blank'>"+s+"</a>";
    }
    return s;
}

Adm.prototype.createLeftRightTable = function (){
	if (!Adm.createLeftRightTable){
		Adm.createLeftRightTable = true;
		
		document.write('<div id="adm_table_div"></div>');
		var div = Amd.findObj("adm_table_div");
		div.style.position = "absolute";
		div.style.width = "100%";
		div.style.top = "100px";
		div.style.left = "0px";
		div.style.zIndex = "-1";
		
		var table = document.createElement("table");
		table.align = "center";
		table.border = "0px";
		table.cellSpacing = "0px";
		table.cellPadding = "0px";
		div.appendChild(table);
		var tb_body = document.createElement("tbody");
		table.appendChild(tb_body);
		tb_row = document.createElement("tr");
		tb_row.align="center"; 
		tb_row.valign="top";
		tb_body.appendChild(tb_row);
		var tb_cell_l = document.createElement("td");
		tb_cell_l.width = '100px'
		tb_row.appendChild(tb_cell_l);
		Adm.td_left = tb_cell_l;
		var tb_cell_c = document.createElement("td");
		tb_cell_c.width = Adm.contentWidth
		tb_row.appendChild(tb_cell_c);
		var tb_cell_r = document.createElement("td");
		tb_cell_r.width = '100px'
		tb_row.appendChild(tb_cell_r);
		Adm.td_right = tb_cell_r;
	}
}

Adm.findObj = function (n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=Adm.findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

Adm.getScroll = function() {
	var d = document, b = d.body;
	var mode = d.compatMode;
	
	var width = self.innerWidth;  // Safari
	var height = self.innerHeight; // Safari, Opera
	if (mode || jQuery.browser.msie) { // IE, Gecko, Opera
		width = (mode == 'CSS1Compat') ? d.documentElement.clientWidth : b.clientWidth;
		if (!jQuery.browser.opera ) height = (mode == 'CSS1Compat') ? d.documentElement.clientHeight : b.clientHeight;
	}
	
	return {
		left: Math.max(d.documentElement.scrollLeft, b.scrollLeft), 
		top: Math.max(d.documentElement.scrollTop, b.scrollTop), 
		width: width, 
		height: height
	};
}
//-->
