(function() {
	function getStyle(obj, attribute) {
		return obj.currentStyle ? obj.currentStyle[attribute] : document.defaultView.getComputedStyle(obj, null)[attribute]
	};
	//if (typeof addEvent != 'function') {
		function addEvent(obj,type,fn){
   			if(obj.attachEvent){
				obj.attachEvent('on'+type,function(){
					fn.call(obj);
        		})
			}else{
        		obj.addEventListener(type,fn,false);
			}
		}
	//}

	function enterAndLeave(ev, obj) {
		var E = ev || window.event;
		if (E.type != 'mouseover' && E.type != 'mouseout') {
			return flase
		}
		var theTarget = null;
		if (E.relatedTarget) {
			theTarget = E.relatedTarget
		} else {
			if (E.type == 'mouseover') {
				thisTarget = E.toElement
			} else {
				thisTarget = E.fromElement
			}
		}
		while (theTarget && theTarget != obj) {
			theTarget = theTarget.parentNode
		}
		return (theTarget != obj)
	}
	var pl = null;
	var eo = null;
	var co = null;
	var io = null;
	var nm = null;
	var eo_start_H, io_start_H, otherH, io_new_H;

	function ToParentHeight() {
		io = parent.document.getElementById('extraFrameLi');
		if (io != null) {
			io_start_H = parseInt(document.getElementById('news_li').offsetHeight) + 14; //14：newsMore高度
			io.style.height = io_start_H + 'px';
		}
		//document.getElementById('news_li_box').innerHTML += '<div id="follow_news">' + document.getElementById('follow').innerHTML.replace(/^[\s\n\r]*<\!\-\-|\-\->[\s\n\r]*$/g, '') + '</div>';
		document.getElementById('news_li_box').insertAdjacentHTML('beforeend', '<div id="follow_news">' + document.getElementById('follow').innerHTML.replace(/^[\s\n\r]*<\!\-\-|\-\->[\s\n\r]*$/g, '') + '</div>');
			
		if (ib = parent.document.getElementById('extra_box')) {
			ib.style.backgroundImage = 'none'
		}
		nm = document.getElementById('newsMore');
		//document.documentElement.onmouseover = function(event) {
		addEvent(document.documentElement, 'mouseover', function(event) {
			ShowN(event, this);
		});
	}
	function ShowN(e, dom) {
		if (nm != null) {
			nm.style.display = 'none';
		}
		//if (enterAndLeave(e, dom)) {
			pl = pl != null ? pl : parent.document.getElementById('left');
			eo = eo != null ? eo : parent.document.getElementById('extra');
			co = co != null ? co : parent.document.getElementById('column_extra');
			if (eo != null && co != null) {
				var pNewImgIfr = parent.document.getElementById('extraFrameImg');
				var pNewImgIfrH = pNewImgIfr != null ? (parseInt(pNewImgIfr.offsetHeight) + parseInt(getStyle(pNewImgIfr, 'marginBottom'))) : 0;
				otherH = !isNaN(otherH) && otherH > 0 ? otherH : (parseInt(parent.document.getElementById('extra_title').offsetHeight) + 
																parseInt(getStyle(parent.document.getElementById('extra_title'), 'marginBottom')) + 
																parseInt(getStyle(eo, 'marginBottom')) + 
																parseInt(getStyle(co, 'marginBottom')) + 
																pNewImgIfrH);

				eo_start_H = !isNaN(eo_start_H) && eo_start_H > 0 ? eo_start_H : parseInt(eo.offsetHeight);
				var lH = parseInt(pl.offsetHeight);
				io_new_H = !isNaN(io_new_H) && io_new_H > 0 ? io_new_H : lH - otherH - 2; //不知道2是什么原因，否则底下溢出
				eo.style.height = eo_start_H + 'px';
				eo.style.position = 'relative';
				io.style.height = io_new_H + 'px';
				co.style.position = 'absolute';
				co.style.top = 0;
				co.style.left = 0;
				co.style.zIndex = 10;
				addEvent(document.documentElement, 'mouseout', function(e) {
					//if (enterAndLeave(e, this)) {
						co.style.position = 'static';
						io.style.height = io_start_H + 'px';
						if (nm != null) {
							nm.style.display = 'block';
						}
					//}
				});
			}
		//}
	};

	addEvent(window, 'load', ToParentHeight);

})();