def createStyle(kmlDoc, netcolor, size, labtype='net', op=0):
    """
    Creates a Style Environment with a variable size and colour.
    The last argument selects between two different icon types.
    """
    if labtype == 'event':
        link = 'http://maps.google.com/mapfiles/kml/shapes/caution.png'
        netcolor = 'ff0000ff'
    elif labtype == 'knots':
        link = 'http://maps.google.com/mapfiles/kml/paddle/red-stars-lv.png'
        netcolor = 'ff0000ff'
    elif op > 0:
        link = 'http://maps.google.com/mapfiles/kml/shapes/triangle.png'
        size = str(float(size) * 0.75)
    elif op < 0:
        link = 'http://maps.google.com/mapfiles/kml/shapes/star.png'
        size = str(float(size) * 0.75)
    else:
        link = 'http://maps.google.com/mapfiles/kml/pal4/icon57.png'
    styleElement = kmlDoc.createElement('Style')
    iconstyle = kmlDoc.createElement('IconStyle')
    styleElement.appendChild(iconstyle)
    scale = kmlDoc.createElement('scale')
    scale.appendChild(kmlDoc.createTextNode(size))
    iconstyle.appendChild(scale)
    iconcolor = kmlDoc.createElement('color')
    iconcolor.appendChild(kmlDoc.createTextNode(netcolor))
    iconstyle.appendChild(iconcolor)
    icon = kmlDoc.createElement('Icon')
    iconlink = kmlDoc.createElement('href')
    iconlink.appendChild(kmlDoc.createTextNode(link))
    icon.appendChild(iconlink)
    iconstyle.appendChild(icon)
    return styleElement
