
window.onresize=function() {
	Load(1);
}
function keptarLoad() {
	window.frames["keptarFrame"].document.getElementsByTagName('table')[0].width=window.document.getElementById('mainDiv').offsetWidth+'px';
}
function FramesWidth(param) {
	window.frames["mainFrame"].width=(inWidth(window)-170)+'px';
	window.frames["keptarFrame"].width=inWidth(window)+'px';
	window.document.getElementById('mainFrameDiv').style.left='170px';
	window.document.getElementById('menuFrameId').width='170px';
	window.document.getElementById('mainFrameId').width = (window.document.getElementById('mainDiv').offsetWidth-inWidth(window.frames['menuFrame']))+'px';
	window.document.getElementById('keptarFrameId').width = window.document.getElementById('mainDiv').offsetWidth+'px';
	if( param > 0 ) {
		window.frames["keptarFrame"].document.getElementsByTagName('table')[0].width=window.document.getElementById('mainDiv').offsetWidth+'px';
	}
}

function Load(param) {
	FramesWidth(param);
    meFrame = window.frames['menuFrame']; 
    keFrame = window.frames['keptarFrame'];
	maFrame = window.frames['mainFrame'];
	var backgroundRight = 'url(img/sac0116_brown.jpg)'
	var backgroundLeft  = 'url(img/sac0116_brown_bal.jpg)'
	var origPathname = maFrame.location.pathname.substr(0, keFrame.location.pathname.indexOf('right.htm'));

	var htmls = new Array()
	htmls.push(origPathname+'body_hor.htm');
//	htmls.push(origPathname+'body_hor.htm');
	for(var i=0; i<htmls.length; ++i) {
		if(maFrame.location.pathname==htmls[i] || getStyle(maFrame, maFrame.document.getElementsByTagName('body')[0],'background-image').indexOf('pasztell_bg') >= 0) {
			backgroundRight = 'url(img/sac0116_pasztell.jpg)';
			backgroundLeft  = 'url(img/sac0116_pasztell_bal.jpg)'
			break;
		}
	}
	if(!maFrame.document.getElementById('indaright')) {
		var bodyOld = maFrame.document.documentElement.childNodes[1];
		var bodyChildNodes = bodyOld.childNodes;
		var divIndaRight = bodyOld.ownerDocument.createElement('div');
		divIndaRight.setAttribute('id', 'indaright');
		var divIndaLeft = bodyOld.ownerDocument.createElement('div');
		divIndaLeft.setAttribute('id', 'indaleft');
		for(var i=0; i<bodyChildNodes.length; ) {
			divIndaLeft.appendChild(bodyChildNodes[i]);
		}
		var bodyNew = bodyOld.ownerDocument.createElement('body');
		divIndaRight.appendChild(divIndaLeft); 
		bodyNew.appendChild(divIndaRight); 
		bodyOld.parentNode.replaceChild( bodyNew, bodyOld );
		maFrame.document.getElementById('indaright').style.backgroundImage    = backgroundRight;
		maFrame.document.getElementById('indaright').style.backgroundRepeat   = 'no-repeat';
		maFrame.document.getElementById('indaright').style.backgroundPosition = 'top right';
		maFrame.document.getElementById('indaleft' ).style.backgroundImage    = backgroundLeft;
		maFrame.document.getElementById('indaleft' ).style.backgroundRepeat   = 'no-repeat';
		maFrame.document.getElementById('indaleft' ).style.backgroundPosition = 'top left';
	}
	margin = Math.round(inWidth(maFrame)*0.05);
	if(_isMshtml) {
		maFrame.document.getElementById('indaleft').style.paddingTop = Math.round(margin/2)+'px';
	}
	if(_isGecko || _isOpera) {
		maFrame.document.getElementById('indaleft').style.paddingTop = '1px';
	}
//}
		setMargin(maFrame);
		bodyLoad();    // ez előtt kell következnie a setMargin()-nak
		window.scrollTo(0,0);
}	
function bodyLoad() {
    meFrame = window.frames['menuFrame'];
    keFrame = window.frames['keptarFrame'];
	maFrame = window.frames['mainFrame'];

	meHeight = meFrame.document.getElementById('mainDiv').scrollHeight;
	maHeight = maFrame.document.getElementById('indaright').scrollHeight;
	newHeight = Math.max(maHeight,meHeight,inHeight(window)-160);
	window.document.getElementById('mainFrameId' ).style.height = newHeight+'px';
	window.document.getElementById('menuFrameId' ).style.height = newHeight+'px';
}

function setMargin(win) {
	if( !maFrame.document.getElementById('kendok') ) {
		margin = Math.round(inWidth(win)*0.05);
		win.document.getElementById('indaleft').style.paddingLeft  = margin+'px';
		win.document.getElementById('indaleft').style.paddingRight = margin+'px';
	}
}


