function checkWindow (Redakansicht)
{
var windowName = window.name;

if (Redakansicht == 'false' && windowName.indexOf('RedakWindow') != -1)
{
 //alert("wechseln")
 OpenUserMode(-1)
}
}

function OpenRedakMode(editor,newWindow)
{

if (newWindow == -1)
	{
		var windowName = window.name

		if (windowName.indexOf('RedakWindow') == -1)
		{
			win1 = window.open(global_SessionMe + '?redak=1&editor=' + editor ,'RedakWindow' + global_SessionID,'width='+ (screen.availWidth-200) +',height=' + (screen.availheight - 200) + ',status=yes,resizable=yes');
			win1.moveTo (0,0);
			win1.resizeTo ( screen.availWidth,screen.availheight);


			window.opener=null;
			window.close();
		}
		else
		{
		try{
		document.location.href = global_SessionMe + '?redak=1&editor=' + editor ;
		}catch(e){}
		}
	}
else
	{
		try{
		document.location.href = global_SessionMe + '?redak=1&editor=' + editor ;
		}catch(e){}
	}
}

function OpenUserMode(newWindow)
{
if (newWindow == -1)
	{
	
	win1 = window.open(global_SessionMe + '?redak=0','Userwindow' + global_SessionID,'');
	win1.moveTo (0,0);
	win1.resizeTo ( screen.availWidth,screen.availheight);

	window.opener=null;
	top.frames.close();
	}
else
	{
	
		try
		{
		document.location.href = global_SessionMe + '?redak=0';
		}
		catch(e){}
		
	}
}

function printMe(printType,link)
{
	if (printType == 'app')
	{
		if (link == 'pdf')
		{
		document.getElementById('out_Content_pdf').value = document.getElementById('appContent').innerHTML;
		document.getElementById('out_Title_pdf').value = document.title;

		try{document.getElementById('out_add_Content_pdf').value = document.getElementById('add_appContent').innerHTML;}
		catch(e){}

		try{document.getElementById('out_Site_Content_pdf').value = document.getElementById('add_SiteContent').innerHTML;}
		catch(e){}

		document.getElementById('pdf_submit').submit();
		}
		
		if (link == 'print')
		{
		window.open('','PrinterWindow','width=600,height=700,left=0,top=0,resizable=yes,scrollbars=yes');
		document.getElementById('out_Content_print').value = document.getElementById('appContent').innerHTML;
		document.getElementById('out_Title_print').value = document.title;

		try{document.getElementById('out_Site_Content_print').value = document.getElementById('add_SiteContent').innerHTML;}
		catch(e){}

		try{document.getElementById('out_add_Content_print').value = document.getElementById('add_appContent').innerHTML;}
		catch(e){}

		document.getElementById('print_submit').target = 'PrinterWindow';
		document.getElementById('print_submit').submit();
		}
	}
	else
	{
	window.open(link,'PrinterWindow','width=600,height=700,left=0,top=0,resizable=yes,scrollbars=yes');
	}
}
function findAndReplace(myText, find, replace) {
    var result = myText.split(find).join(replace);
    return result;
}

function setIFrameHeight(thisIFrame)
{ 
   thisIFrame.style.height = thisIFrame.document.body.scrollHeight;
}

function setIFrameWidth(thisIFrame)
{ 
   thisIFrame.style.width = thisIFrame.document.body.scrollWidth;
}

// Set autoclose true to have the window close automatically
// Set autoclose false to allow multiple popup windows
var AutoClose = false;
// Do not edit below this line...
// ================================
if (parseInt(navigator.appVersion.charAt(0))>=4){
	var isIE=(navigator.appName.indexOf("Microsoft")!=-1)?1:0;}
	var optWindow='resizable=yes,scrollbars=no,width=700,height=700,left=100,top=100';
	function popImage(imageURL,imageTitle){
		imgWin=window.open('about:blank','popup',optWindow);
		
		with (imgWin.document){
			writeln('<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">')
			writeln('<html><head><title>Loading...</title><style>body{margin:0px;}</style>');writeln('<sc'+'ript>');
			writeln('var isIE;');
			writeln('if (parseInt(navigator.appVersion.charAt(0))>=4){isIE=(navigator.appName.indexOf("Microsoft")!=-1)?1:0;}');
			writeln('function reSizeToImage(){');
			
			writeln('width=(document.images[0].width );');
			writeln('height=(document.images[0].height);');
			
			writeln('if (isIE){');
			writeln('window.resizeTo(100,100)')
			writeln('window.resizeTo(width+ 10,height+100-document.documentElement.clientHeight);}');
			writeln('else{');       
			writeln('window.innerWidth=width;');
			writeln('window.innerHeight=height;}}');
			writeln('function doTitle(){document.title="'+imageTitle+'";}');
			writeln('</sc'+'ript>');
			if (!AutoClose) writeln('</head><body bgcolor=000000 scroll="no" onload="reSizeToImage();doTitle();self.focus()">')
			else writeln('</head><body bgcolor=FFFFFF scroll="no" onload="reSizeToImage();doTitle();self.focus()" onblur="self.close()">');
			writeln('<div id="imgContainer" style="height:auto;"><img name="George" src='+imageURL+' style="display:block"></div></body></html>');
			close();		
		}
}










	function popImagebak(imageURL,imageTitle)
		{
		imgWin=window.open('about:blank','popup',optWindow);
		
		with (imgWin.document)
			{
			writeln('<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">')
			writeln('<html><head><title>Loading...</title><style>body{margin:0px;}</style>');
			writeln('<sc'+'ript>');
			writeln('var isNN=(navigator.appName=="Netscape")?1:0;	var isIE=(navigator.appName.indexOf("Microsoft")!=-1)?1:0;}')
			writeln('function reSizeToImage(){');
			writeln('var windowHeight = document.images[0].height;')
			writeln('var windowWidth = document.images[0].width;');
			writeln('alert(windowWidth+"-" +windowHeight);')
			writeln('if (isIE)(window.resizeTo(windowWidth,windowHeight);)')
			writeln('else{window.innerWidth = windowWidth;window.innerHeight = windowHeight}')
			writeln('}')

			//writeln('window.resizeTo(windowWidth,windowHeight);}');
			/*writeln('if (isIE){');writeln('window.resizeTo(100,100);');
			writeln('width=(document.images[0].width + 10);');
			writeln('height=(document.images[0].height+ 50);');
			writeln('window.resizeTo(width,height);}');
			*/
			//writeln('if (isNN){');       
			//writeln('window.innerWidth=document.images["George"].width;');
			//			writeln('window.innerHeight=document.images["George"].height;}}');
			//writeln('window.innerHeight=document.images["George"].height;}');
			writeln('function doTitle(){document.title="'+imageTitle+'";}');
			writeln('</sc'+'ript>');
			if (!AutoClose) writeln('</head><body bgcolor=000000 scroll="no" onload="reSizeToImage();doTitle();self.focus()">')
			else writeln('</head><body bgcolor=FFFFFF scroll="no" onload="reSizeToImage();doTitle();self.focus()" onblur="self.close()">');
			writeln('<img name="George" src='+imageURL+' style="display:block"></body></html>');
			close();		
		}
		}
