function NewWindow(w,v,s,d){eval("window.open('"+v+"','"+w+"','height="+s+",width="+d+",left="+(screen.width - s)/2+",top="+(screen.height - d)/2+",status=no,location=no,toolbar=no,directories=no,menubar=no,scrollbars=yes');");}
function togglediv(id) {
	if (document.getElementById) { // DOM3 = IE5, NS6
		if (document.getElementById(id).style.display != 'none') document.getElementById(id).style.display = 'none';
		else document.getElementById(id).style.display = 'block';
	}
	else {
		if (document.layers) { // Netscape 4
			if (document.id.display != 'none') document.id.display = 'none';
			else document.id.display = 'block';
		}
		else { // IE 4
			if (document.all.id.style.display != 'none') document.all.id.style.display = 'none';
			else document.all.id.style.display = 'block';
		}
	}
}

	nN = navigator.appName;

    function fsearch(str) {
        if(document.fform.myradio[0].checked) {
            open('http://yandex.ru/sitesearch?text=' + str + '&site=' + document.location.hostname);
        } else {
            open('http://yandex.ru/sitesearch?text=' + str);
        }
    }

    function MouseUpHandler(e) {
        if(nN == 'Netscape' || nN == 'Opera') {
            if(document.getSelection()) {
                str = document.getSelection();

                newstr = str.replace(/\n+/g, ' ');
                str = newstr.replace(/\ +/g, ' ');

                if(str.length > 100){
                    var i;
                    i = 0;
                    str = str.slice(0, 100);
                    i = str.lastIndexOf(' ');

                    if(i > 0){
                        str = str.slice(0, i);
                    }
                }

                document.fform.strf.value = str;
            }
        } else if(nN == 'Microsoft Internet Explorer') {
            if(document.selection.createRange()) {
                var range = document.selection.createRange();
                var str = range.text;
            }

            if(str) {
                str = str.replace(/\ +/g, " ");
                document.fform.strf.value = str;
            }
        }
        return true;
    }

    if(window.Event) {
        document.captureEvents(Event.MOUSEUP);
    }

    document.onmouseup = MouseUpHandler;