var iwOpacity = 0.65;
var iwBackground = '#000';
var iwWidth = '5000';
var iwHeight = '10000';

function closeInlineWindow()
{
	var myWindow = document.getElementById('opacity');
	myWindow.style.display = 'none';
	var myContent = document.getElementById('inline_window');
	myContent.style.display = 'none';
	myContent.innerHTML = '';
}

function showInlineWindow(script, params)
{
	if (!document.getElementById('opacity'))
	{
		myDoc = document.getElementsByTagName('body')[0];
		myDiv = document.createElement('div');
		myDiv.id = 'opacity';
		myDoc.appendChild(myDiv);
	}
	if (!document.getElementById('inline_window'))
	{
		myDoc = document.getElementsByTagName('body')[0];
		myDiv = document.createElement('div');
		myDiv.id = 'inline_window';
		myDoc.appendChild(myDiv);
	}
	if (document.getElementById('inline_window'))
	{
		var myWindow = document.getElementById('opacity');
		with (myWindow) {
			style.width = document.getElementsByTagName('html')[0].scrollWidth + 'px';
			style.height = document.getElementsByTagName('html')[0].scrollHeight + 'px';
			style.backgroundColor = iwBackground;
			style.zIndex = 90;
			style.position = 'absolute';
			style.display = 'block';
			style.top = '0px';
			style.left = '0px';
		}
		setOpacity(myWindow, iwOpacity);
		var myContent = document.getElementById('inline_window');
		styleInlineWindow(myContent);
		sendRequest(script, params, myContent.id);
		//window.scrollTo(0, 0);
	}
	else alert('Das Element zur Anzeige des Inline-Windows steht nicht zur Verfügung!');
}

function styleInlineWindow(element)
{
	var height = 350;
	var width = 600;
    window.scrollTo(0,0);
	
    var loadingP = document.createElement('p');
	loadingP.style.textAlign = 'center';
    /*
    var loadingImg = document.createElement('img');
	loadingImg.src = '../custom/bilder/icons/ajax-loader.gif';
	//loadingImg.style.paddingTop = (height/3)+'px';
	loadingP.appendChild(loadingImg);
    */
	with (element)
	{
		style.zIndex = 99;
        //style.padding = '10px';
        //style.backgroundColor = '#FFF';
		style.position = 'absolute';
		//style.width = width+'px';
		//style.height = height+'px';
		/*style.backgroundColor = '#F2F2F2';*/
		style.top = '100px';
//		style.left = '20px';
//		style.left = (document.getElementsByTagName('html')[0].scrollWidth/2) - (width/2) + 'px';
		style.left = (document.getElementsByTagName('html')[0].scrollWidth/2) - 500 + 'px';
		style.color = '#666';
		style.padding = '15px';
		style.display = 'block';
		appendChild(loadingP);
	}
	//progressButton();
}
function progressButton()
{
	var myImg = document.createElement('img');
	myImg.src = '../custom/bilder/icons/ajax-loader.gif';
	//myImg.alt = 'schliessen';
	myImg.border = '0';
	//myImg.onclick='closeInlineWindow();';
	document.getElementById('inline_window').appendChild(myImg);
//	document.getElementsByTagName('body')[0].appendChild(myImg);
}
function setOpacity(element, opacity)
{
	if (navigator.appName == "Microsoft Internet Explorer")
		element.style.filter = 'alpha(opacity='+(opacity * 10)+')';
	else
		element.style.opacity = opacity;
}
function resizeOpacity()
{
	var myWindow = document.getElementById('opacity');
	with (myWindow) {
		style.width = document.getElementsByTagName('html')[0].scrollWidth + 'px';
		style.height = document.getElementsByTagName('html')[0].scrollHeight*2 + 'px';
	}
}
function resizeAction()
{
	resizeOpacity();
}
window.onresize = resizeAction;