import sys

global write
global writebr

def write(text):
    pass
def writebr(text):
    pass


data = ""

def write_web(text):
    global data
    data += text
    JS(" write.element.innerHTML = write.data; ")

def writebr_web(text):
    write(text + "<br />\n")

def init_web():
    JS(""" write.element = $doc.createElement("div");
           $doc.body.appendChild(write. element); """)

def write_std(text):
    sys.stdout.write(text)

def writebr_std(text):
    sys.stdout.write(text + "\n")

if sys.platform in ['mozilla', 'ie6', 'opera', 'oldmoz', 'safari']:

    init_web()
    global write
    global writebr
    write = write_web
    writebr = writebr_web

else:

    global write
    global writebr
    write = write_std
    writebr = writebr_std


@@ -9,36 +9,8 @@
 ys%0A%0A
-global write%0Aglobal writebr%0A
 %0Adef
@@ -32,16 +32,17 @@
    pass%0A
+%0A
 def writ
@@ -533,17 +533,16 @@
 fari'%5D:%0A
-%0A
     init
@@ -552,44 +552,8 @@
 b()%0A
-    global write%0A    global writebr%0A
     
@@ -600,51 +600,13 @@
 web%0A
-%0A
 else:
-%0A%0A    global write%0A    global writebr
 %0A   

remove globals write and writebr