function $(id){return document.getElementById(id);}

load_ad()
function load_ad(){
	if($("ad_left") && $("ad_right")){
		var _ad_left = new DivFloat('ad_left');
		_ad_left.startFloat();
		var _ad_right = new DivFloat('ad_right');
		_ad_right.startFloat();
		return;
	}
	setTimeout("load_ad()", 200);
}



function i(ur,w,h){
	document.write('<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,29,0" width="'+w+'" height="'+h+'"> ');
	document.write('<param name="movie" value="' + ur + '">');
	document.write('<param name="quality" value="high"> ');
	document.write('<param name="wmode" value="transparent"> '); 
	document.write('<param name="menu" value="false"> ');
	document.write('<embed src="' + ur + '" quality="high" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" width="'+w+'" height="'+h+'"></embed> ');
	document.write('</object> ');
}

function wDate(id){
	var today = new Date();
	var yy=today.getFullYear();
	var mm=today.getMonth()+1;
	var dd=today.getDate();
	var isnDays=new Array("星期日","星期一","星期二","星期三","星期四","星期五","星期六","星期日");
	if(mm<10){mm="0"+mm}
	if(dd<10){dd="0"+dd}
	$(id).innerHTML = "今天是：" + yy + "年" + mm + "月" + dd + "日&nbsp;" + isnDays[today.getDay()] + "&nbsp;";
}

function bookmark(title){
	var url="http://"+document.location.hostname+"/";
	if(window.sidebar){
		window.sidebar.addPanel(title, url,"");
	}else if(window.opera && window.print){
		var mbm = document.createElement('a');
		mbm.setAttribute('rel','sidebar');
		mbm.setAttribute('href',url);
		mbm.setAttribute('title',title);
		mbm.click();
	}else if(document.all){
		window.external.AddFavorite( url, title);
	}
}

function show_list(obj, f, id){
	if(f){
		var xy = getPosition(obj);
		$("list_"+id).style.left = xy.x + "px";
		xy = getPosition($("links"));
		$("list_"+id).style.top = xy.y + 38 + "px";
		$("list_"+id).style.display = "";
	} else{
		$("list_"+id).style.display = "none";
	}
}

function getPosition(e){
    var x = e.offsetLeft;
    var y = e.offsetTop;
    while(e = e.offsetParent)
    {
        x += e.offsetLeft;
        y += e.offsetTop;
    }
    return {"x": x, "y": y};
}


function DivFloat(id){
	this.interval = 0;
	this.div = $(id);
	this.dom = (document.compatMode == 'CSS1Compat' ? document.documentElement : document.body);
	this.render = function() {
		if(this.dom.clientWidth>1024){
			switch(id){
			case "ad_left":
				this.div.style.left = $("links").offsetLeft-this.div.offsetWidth - 5 + 'px';
				break;
			case "ad_right":
				this.div.style.left = $("links").offsetLeft + $("links").clientWidth + 5 + 'px';
				break;
			}
		} else{
			switch(id){
			case "ad_left":
				this.div.style.left = 0;
				break;
			case "ad_right":
				this.div.style.left = this.dom.offsetWidth - this.div.offsetWidth + 'px';
				break;
			}
			
		}
		//this.div.style.top = this.dom.scrollTop-this.div.offsetHeight+this.dom.clientHeight - 200 + 'px';
		this.div.style.top = this.dom.scrollTop + parseInt(this.dom.clientHeight/2) - parseInt(this.div.offsetHeight) + 'px';
	}
	this.startFloat = function(objName){
		 this.interval = setInterval(function(o){return function(){o.render();}}(this), 10);
	}
	this.stopFloat = function(){
	  window.clearInterval(this.interval);
	}
}
function adClose(){
	$("ad_left").style.display = "none";
	$("ad_right").style.display = "none";
}
