import os

from django import template

import ajax_validation

register = template.Library()

VALIDATION_SCRIPT = open(os.path.join(os.path.dirname(ajax_validation.__file__), 'media', 'ajax_validation', 'js', 'jquery-ajax-validation.js')).read()

def include_validation():
    return '''<script type="text/javascript">%s</script>''' % VALIDATION_SCRIPT
register.simple_tag(include_validation)

@@ -88,16 +88,139 @@
 rary()%0A%0A
+VALIDATION_SCRIPT = None%0A%0Adef include_validation():%0A    global VALIDATION_SCRIPT%0A    if VALIDATION_SCRIPT is None:%0A        
 VALIDATI
@@ -366,35 +366,8 @@
 ad()
-%0A%0Adef include_validation():
 %0A   

load the JS script lazily