+if exists("javaScript_fold")
+ syntax match jsFunction /\<function\>/
+ syntax match jsFuncFoldStart /\([=:^]\s*\)\@<=\<function\>\(\s*\w*\s*\)\@=/ nextgroup=jsFuncFoldParen skipwhite fold
+ syntax region jsFuncFoldParen start="(" end=")" contained nextgroup=jsFuncBlock skipwhite contains=@jsAll,jsParen fold
+ syntax region jsFuncFoldBlock start="{" end="}\([\s;]*$\)\@=" skipwhite contains=ALL contained fold
+
+ syntax sync match jsSync grouphere jsFuncFoldBlock "\<function\>"
+ syntax sync match jsSync grouphere NONE "^}"
+
+ setlocal foldmethod=syntax
+ setlocal foldtext=getline(v:foldstart)
+else
+ syntax keyword jsFunction function
+endif
+