    var charIndex = -1;
    var stringLength = 0;
    var inputText;

function doWin(){
	content = document.getElementById('notepad').innerHTML;

	var a = (((content.replace(/(<([^>]+)>)/ig,"")).replace(/&lt;/ig,"<")).replace(/&gt;/ig,">")).replace(/&nbsp;/ig," ");

	if (a.substr(a.length-1)=="|") a = a.substr(0,a.length-1);
	//levágjuk az utolsó karaktert, ha az |

	var myWin=window.open("","myWin","menubar=no,scrollbars=yes,resizeable=yes,statusbar=no,left=30px,top=40px,height=600px,width=800px");
	myWin.document.write(a);
	myWin.document.close();
	}

    function writeContent(init, idjel){
	if (!idjel) idjel=0;
    	if(init){
    		inputText = document.getElementById("contentToWrite").innerHTML;
		if (inputText.length%2==1) inputText = inputText + " ";
		// na vazze rájöttem: páros karakterszám KÖTELEZŐ!

		zoom.style.position = "absolute";
		zoom.style.top = -1000;
		zoom.style.left = -1000;
		document.getElementById("zoom").innerHTML = "<a href='javascript:doWin()'><img src='images/zoom.gif' border=0 /></a>";
    	}
        if(charIndex==-1){
            charIndex = 0;
            stringLength = inputText.length;
        }
        var initString = document.getElementById("notepad").innerHTML;
		initString = initString.replace(/<SPAN.*$/gi,"");
        
        var theChar = inputText.charAt(charIndex);

	//alert(theChar.charCodeAt(0));
	if (theChar=="[") theChar="<";
	if (theChar=="]") theChar=">";
	if (theChar.charCodeAt(0)==215) theChar="<BR>";	
	if (theChar.charCodeAt(0)==164) theChar="&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;";
	if (theChar=="<") theChar="<font color=#800000><";
	if (theChar==">") theChar="></font>";
	if (theChar=="\"") { idjel++; if (idjel%2==1) theChar="\"<font color=#0000ff>"; else theChar="</font>\""; }

        initString = initString + theChar + "<SPAN id='blink'>|</SPAN>";
        document.getElementById("notepad").innerHTML = initString;

        charIndex = charIndex/1 +1;
		if(charIndex%2==1){
             document.getElementById('blink').style.display='none';
        }else{
             document.getElementById('blink').style.display='inline';
        }
                
        if(charIndex<=stringLength){
            setTimeout('writeContent(false, "'+idjel+'")',10);
        }else{

		obj = document.getElementById('notepad');
		w = parseInt(obj.style.width); 
		h = parseInt(obj.style.height);
		l = obj.offsetLeft;
		t = obj.offsetTop;

		var ver = navigator.appVersion;
		var zx=(ver.indexOf("MSIE") != -1)?4:-8;
		var zy=(ver.indexOf("MSIE") != -1)?4:-8;

		zoom.style.position = "absolute";
		zoom.style.left = (parseInt(l+w-80-zx));
		zoom.style.top = (parseInt(t+h-63-zy));

		blinkSpan();

        }  
    }
    
    var currentStyle = 'inline';
    function blinkSpan(){
    	if(currentStyle=='inline'){
    		currentStyle='none';
    	}else{
    		currentStyle='inline';
    	}
    	document.getElementById('zoom').style.display = currentStyle;
    	setTimeout('blinkSpan()',500);
    	
    }
