protected String compressJavaScript(String source) {
		
		//set default javascript compressor
		if(javaScriptCompressor == null) {
			YuiJavaScriptCompressor yuiJsCompressor = new YuiJavaScriptCompressor();
			yuiJsCompressor.setNoMunge(yuiJsNoMunge);
			yuiJsCompressor.setPreserveAllSemiColons(yuiJsPreserveAllSemiColons);
			yuiJsCompressor.setDisableOptimizations(yuiJsDisableOptimizations);
			yuiJsCompressor.setLineBreak(yuiJsLineBreak);
			
			if(yuiErrorReporter != null) {
				yuiJsCompressor.setErrorReporter(yuiErrorReporter);
			}
			
			javaScriptCompressor = yuiJsCompressor;
		}
		
		//detect CDATA wrapper
		boolean cdataWrapper = false;
		Matcher matcher = cdataPattern.matcher(source);
		if(matcher.matches()) {
			cdataWrapper = true;
			source = matcher.group(1);
		}
		
		String result = javaScriptCompressor.compress(source);
		
		if(cdataWrapper) {
			result = "<![CDATA[" + result + "]]>";
		}

		return result;
		
	}