var data = '<script type="text/javascript">/*<![CDATA[*/if(_sortCheckOK\==undefined||!_sortCheckOK){var _sortCheckOK=true;jQuery(document).ready(function(){jQuery(".checksort") ...... много текста\
</script>'
var tmp = document.createElement('div');
tmp.innerHTML = data;
tmp.firstChild.innerHTML = '';
cleanData = tmp.innerHTML;
alert(cleanData);