var i=0;
var ie=(document.all)?1:0;
var ns=(document.layers)?1:0;

function initStyleElements() /* Styles for Buttons Init */
	{
		var c = document.pad;
		if (ie)
			{
				//c.text.style.backgroundColor="";
				c.compileIt.style.backgroundColor="";
				c.compileIt.style.cursor="hand";
				c.select.style.backgroundColor="";
				c.select.style.cursor="hand";
				c.view.style.backgroundColor="";
				c.view.style.cursor="hand";
				c.retur.style.backgroundColor="";
				c.retur.style.cursor="hand";
				c.clear.style.backgroundColor="";
				c.clear.style.cursor="hand";
			}
		else return;
	}

/* Buttons Enlightment of "Compilation" panel */
function LightOn(what)
	{
		if (ie) what.style.backgroundColor = '';
		else return;
	}
function FocusOn(what)
	{
		if (ie) what.style.backgroundColor = '';
		else return;
	}
function LightOut(what)
	{
		if (ie) what.style.backgroundColor = '';
		else return;
	}
function FocusOff(what)
	{
		if (ie) what.style.backgroundColor = '';
		else return;
	}
function generate()
	{
		code = document.pad.text.value;
		if (code)
			{
				document.pad.text.value='Verschlüsselung läuft!';
				setTimeout("compile()",1000);
			}
		else alert('Bitte erst den entsprechenden Quelltext eingeben bzw. Kopieren!')
	}
function compile()
	{
		document.pad.text.value='';
		compilation=escape(code);
		document.pad.text.value="<script>\n<!--\ndocument.write(unescape(\""+compilation+"\"));\n//-->\n<\/script>";
		i++;
		if (i=1) alert("Seite verschlüsselt 1 Sec.!");
		else alert("Seite verschlüsselt "+i+" Sec.!");
	}
function selectCode()
	{
		if(document.pad.text.value.length>0)
			{
				document.pad.text.focus();
				document.pad.text.select();
			}
		else alert('Es ist kein Text vorhanden!')
	}
function preview() /* Preview for the "Compilation" */
	{
		if(document.pad.text.value.length>0)
			{
				pr=window.open("","Preview","scrollbars=1,menubar=1,status=1,width=700,height=320,left=50,top=110");
				pr.document.write(document.pad.text.value);
			}
		else alert('Es ist nichts vorhanden!')
	}
function uncompile() /* Decompiling a "Compilation" */
	{
		if (document.pad.text.value.length>0)
			{
				source=unescape(document.pad.text.value);
				document.pad.text.value=""+source+"";
			}
		else alert('Zuerst muß der entsprechende Quellcode verschlüsselt werden!')
	}
