
var gAutoPrint = false; // Flag for whether or not to automatically call the print function

function printscreen(name,aid)
{
	if (document.layers){
	//Netscape 4 specific code
		pre = 'document.';
		post1 = '';
	}
	if (document.getElementById){
		//Netscape 6 specific code
		pre = 'document.getElementById("';
		post1 = '")';
	}
	if (document.all){
		//IE4+ specific code
		pre = 'document.all.';
		post1 = '';		
	}

	var myLayer = null;
	if(document.getElementById('centrecontent') != null)
		myLayer = eval(pre + 'centrecontent' + post1);
	else myLayer = eval(pre + 'printdiv' + post1);
		
	today = new Date();
	var strDateTime = today.getDate() + "." + (today.getMonth()+1) + "." + today.getFullYear() + ", " + today.toLocaleTimeString() + " Uhr";
	
	var parameter = "menubar=yes,toolbar=yes,scrollbars=yes,statusbar=no,location=no,resizable=yes,width=750px,height=520px";
	var printWin = window.open("","printSpecial",parameter);
	
	var text = "";
	if(aid == "1")
		text += "<table width=100%><tr><td class=printheader style=\"padding-bottom:4px\" valign=bottom><img src=\"grafik/Landtaglogo_druck.jpg\" border=\"0\">&nbsp;<b>Parliament of the Principality of Liechtenstein</b></td></tr><tr><td align=right style=\"font-size:10px\">"+strDateTime.substr(0,strDateTime.length-4)+"</td></table><br>";
	else text += "<table width=100%><tr><td class=printheader style=\"padding-bottom:4px\" valign=bottom><img src=\"grafik/Landtaglogo_druck.jpg\" border=\"0\">&nbsp;<b>"+name+"</b></td></tr><tr><td align=right style=\"font-size:10px\">"+strDateTime+"</td></table><br>";
	text += myLayer.innerHTML.replace(/<< back/,"").replace(/&lt;&lt; back/,"");
	text = text.replace(/<a/,"<a style='disable:true'").replace(/<A/,"<a style='disable:true'");
	text = text.replace("<IMG style=\"LEFT: -26px; POSITION: relative; TOP: -50px\" src=\"Grafik/oben_links.gif\" align=left border=0>","");
	text = text.replace("<IMG style=\"LEFT: 26px; POSITION: relative; TOP: -50px\" src=\"Grafik/oben_rechts.gif\" align=right border=0>","");
	text = text.replace("<TD class=txtsize vAlign=center><a style='disable:true' id=lbtextsize href=\"javascript:__doPostBack('lbtextsize','')\">Text verkleinern</A></TD>","");
	text = text.replace("<TD class=txtsize vAlign=center><a style='disable:true' id=lbtextsize href=\"javascript:__doPostBack('lbtextsize','')\">","<td><a style='color:white'>");
	text = text.replace("IconPfeil.gif\" ","IconPfeil.gif\" style=\"display:none\" ");
	text = text.replace("<LINK href=\"thronreden/thronreden.css\" type=text/css rel=stylesheet>","");
	
	text = text.replace("<IMG src=\"./grafik/print.gif\" border=0>","");
	text = replaceAll( text, "onclick=\"","onclick = \"return false;");

	printWin.document.open();	
	if(aid == "1")
		printWin.document.write("<html><head><link href='landtag.css' rel='stylesheet' type='text/css'></link><script src='print.js' type='text/javascript'></script><link href='Schriftgroesse/big.css' rel='stylesheet' type='text/css'></link></head><style> body {background-color:white;text-align:left;} div {overflow:visible;} .scroll{overflow:visible;} .highlight{color:black;background-color:white;}</style><body><div class='text'><form onsubmit='return false;'>" + text + "</form></div><br><table width=100%><tr><td class=printheader style=\"font-size:10px;padding-bottom:4px\">" + document.URL + "</td></tr><tr><td align=right style=\"font-size:10px;margin-top:0px\">&copy; 2005 <FONT class=titel><SPAN class=text_fett>Parliament of the Principality of Liechtenstein</td></tr></table></body></html>");
	else printWin.document.write("<html><head><link href='landtag.css' rel='stylesheet' type='text/css'></link><script src='print.js' type='text/javascript'></script><link href='Schriftgroesse/big.css' rel='stylesheet' type='text/css'></link></head><style> body {background-color:white;text-align:left;} div {overflow:visible;} .scroll{overflow:visible;} .highlight{color:black;background-color:white;}</style><body><div class='text'><form onsubmit='return false;'>" + text + "</form></div><br><table width=100%><tr><td class=printheader style=\"font-size:10px;padding-bottom:4px\">" + document.URL + "</td></tr><tr><td align=right style=\"font-size:10px;margin-top:0px\">&copy; 2005 <FONT class=titel><SPAN class=text_fett>Der Landtag des F&uuml;rstentums Liechtenstein</td></tr></table></body></html>");
	printWin.document.close();
	if (gAutoPrint)
		printWin.print();
}

function replaceAll( str, from, to ) {
    var idx = str.indexOf(from);

	var i = 0;
    while (idx > -1 && i<100) {
		i++;
        str = str.replace(from, to); 
        idx = str.indexOf(from);
    }
    return str;
}


var ua = navigator.userAgent.toLowerCase();
var browseHeight = 0;

function Fensterhoehe() {
  var myWidth = 0, myHeight = 0;
  if( typeof( window.innerWidth ) == 'number' ) {
    //Non-IE
    myHeight = window.innerHeight;
  } else if( document.documentElement &&
      ( document.documentElement.clientHeight ) ) {
    //IE 6+ in 'standards compliant mode'
    myHeight = document.documentElement.clientHeight;
  } else if( document.body &&  document.body.clientHeight ) {
    //IE 4 compatible
    myHeight = document.body.clientHeight;
  }
  
  return myHeight;
}


// This function sets the height of the table
// so that the table fits into the window without scrollbars
function setHeight()
{
	scr_h = Fensterhoehe();
	
	if (document.layers){
	//Netscape 4 specific code
		pre = 'document.';
		post = '';
		post1 = '';
	}
	if (document.getElementById){
		//Netscape 6 specific code
		pre = 'document.getElementById("';
		post = '").style';
		post1 = '")';
	}
	if (document.all){
		//IE4+ specific code
		pre = 'document.all.';
		post = '.style';
		post1 = '';		
	}

	// scr_h - value > 0 ==> scrollbar; scr_h - value < 0 ==> loch
	if(browseHeight != scr_h - 120)
	{			
		//src_h - 194
		browseHeight = scr_h - 120;
			
		if(browseHeight < 1) browseHeight=1;
		
		if(ua.indexOf('opera') != -1)
		{
			browseHeight = browseHeight-100;
		}
		
		if(eval(pre + 'footertop' + post1) != null)
		{
			var myNews = eval(pre + 'footertop' + post);
			if(browseHeight > 34)
				myNews.height = browseHeight - 34 +"px";
			else myNews.height = 0+"px";
		}	
		
		if(eval(pre + 'scrolldiv' + post1) != null)
		{
			var myNews = eval(pre + 'scrolldiv' + post);
			if(browseHeight > 24)
				myNews.height = browseHeight - 24+"px";
			else myNews.height = 0+"px";
		}	
		if(eval(pre + 'suchescroll' + post1) != null)
		{
			var myNews = eval(pre + 'suchescroll' + post);
			if(browseHeight > 64)
				myNews.height = browseHeight - 64+"px";
			else myNews.height = 0+"px";
		}		
		if(eval(pre + 'sitemapscroll' + post1) != null)
		{
			var myNews = eval(pre + 'sitemapscroll' + post);
			if(browseHeight > 48)
				myNews.height = browseHeight - 48+"px";
			else myNews.height = 0+"px";
		}	
		if(eval(pre + 'litscroll' + post1) != null)
		{
			var myNews = eval(pre + 'litscroll' + post);
			if(browseHeight > 96)
				myNews.height = browseHeight - 96+"px";
			else myNews.height = 0+"px";
		}		
		if(eval(pre + 'newsmenu' + post1) != null)
		{
			var myNews = eval(pre + 'newsmenu' + post);
			if(browseHeight > 24)
				myNews.height = browseHeight - 24+"px";
			else myNews.height = 0+"px";
		}		
		if(eval(pre + 'newsinhalt' + post1) != null)
		{
			var myNews = eval(pre + 'newsinhalt' + post);
			if(browseHeight > 24)
				myNews.height = browseHeight - 24+"px";
			else myNews.height = 0+"px";
		}		
		if(eval(pre + 'litunterscroll' + post1) != null)
		{
			var myNews = eval(pre + 'litunterscroll' + post);
			if(browseHeight > 137)
				myNews.height = browseHeight - 137+"px";
			else myNews.height = 0+"px";
		}			
		if(eval(pre + 'agendascroll' + post1) != null)
		{
			var myNews = eval(pre + 'agendascroll' + post);
			if(browseHeight > 80)
				myNews.height = browseHeight - 80+"px";
			else myNews.height = 0+"px";
		}	
		if(eval(pre + 'outer' + post1) != null)
		{
			var myNews = eval(pre + 'outer' + post);
			if(browseHeight > 480)
			{
				myNews.overflow = "hidden";
				myNews.height = browseHeight + 120 +"px";
			}
			else 
			{
				myNews.overflow = "visible";
				myNews.height = browseHeight + 120 +"px";
			}
		}	
		
		if(eval(pre + 'previewDiv' + post1) != null)
		{
			var myNews = eval(pre + 'previewDiv' + post);
			if(browseHeight > 113)
					myNews.height = browseHeight - 113+"px";	
			else myNews.height = 0+"px";
		}
		if(eval(pre + 'imageDiv' + post1) != null)
		{
			var myNews = eval(pre + 'imageDiv' + post);
			if(browseHeight > 64)
				myNews.height = browseHeight - 64+"px";	
			else myNews.height = 0+"px";
		}
	}	
	if(ua.indexOf('netscape') == -1)
		var Id = window.setTimeout("setHeight();",300);
	else 
		var Id = window.setTimeout("setHeight();",10000);
}

function enableScrolling()
{
	if(navigator.userAgent.toLowerCase().indexOf("mozilla") > -1){
		if (document.body.addEventListener) {
			var divs = document.getElementsByTagName('DIV');
			for (var d in divs) {
				if (divs[d].className && divs[d].className == 'scroll') { 
					try {
						divs[d].addEventListener('DOMMouseScroll', scrollMe, false);
					} catch (ex) {}
				}
			}
		}
	}

}

function scrollMe(event)
{
    var st = event.currentTarget.scrollTop + (event.detail * 12);
	event.currentTarget.scrollTop = st < 0 ? 0 : st;
	event.preventDefault();
}

