function getWindowData(n,i) {
	var ifr=document.getElementById(i).contentWindow.document || document.getElementById(i).contentDocument;
	var widthViewport,heightViewport,xScroll,yScroll,widthTotal,heightTotal;
	if (typeof window.frames[n].innerWidth != 'undefined') {
		widthViewport= window.frames[n].innerWidth;
		heightViewport= window.frames[n].innerHeight;
	} else if (typeof ifr.documentElement != 'undefined' && typeof ifr.documentElement.clientWidth !='undefined' && ifr.documentElement.clientWidth != 0) {
		widthViewport=ifr.documentElement.clientWidth;
		heightViewport=ifr.documentElement.clientHeight
	} else {
		widthViewport= ifr.getElementsByTagName('body')[0].clientWidth;
		heightViewport=ifr.getElementsByTagName('body')[0].clientHeight;
	}
    xScroll=window.frames[n].pageXOffset || (ifr.documentElement.scrollLeft+ifr.body.scrollLeft);
    yScroll=window.frames[n].pageYOffset || (ifr.documentElement.scrollTop+ifr.body.scrollTop);
    widthTotal=Math.max(ifr.documentElement.scrollWidth,ifr.body.scrollWidth,widthViewport);
    heightTotal=Math.max(ifr.documentElement.scrollHeight,ifr.body.scrollHeight,heightViewport);
    return [widthViewport,heightViewport,xScroll,yScroll,widthTotal,heightTotal];
} 

function resizeIframe(ID,NOMBRE) {
	document.getElementById(ID).height=null;
	document.getElementById(ID).width=null;
	//window.location='#';
	var m=getWindowData(NOMBRE,ID);
	document.getElementById(ID).height=(m[5]+10);
	document.getElementById(ID).width=740;
}

function addEvent(obj, evType, fn, useCapture) {
	if (obj.addEventListener) {
		obj.addEventListener(evType, fn, useCapture);
	} else if (obj.attachEvent) {
		obj.attachEvent("on"+evType, fn);
	} else {
		obj['on'+evType]=fn;
	}
}

function loadsource() { 
	var defaultPage = "news.php";
	var query = window.location.search.substring(1);
	var pos = query.indexOf('=');
	if (pos > 0) {
		var frameSource = query.substring(pos+1);
		window.frames["contenido"].location = frameSource;
	} else {
		window.frames["contenido"].location = defaultPage;
	}
}

window.onload=function() {
	loadsource();
	resizeIframe('contenido','contenido');
	addEvent(document.getElementById('contenido'), 'load', function(){resizeIframe('contenido','contenido');}, false);
}