hi, i've placed an autosave code (which i've got in the internet) in an HTML area (property is constant) then when I access the page where the code has been included, I've encountered an IE error which states:

Char: 41

Error: Expected '{'



here's the code being used:

<script type="text/javascript">
pollingInterval = 5000;
threadLock = false;
saveMessage = "saved"


function timeoutHandler(){
clearTimeout(SaveTimeout);
SaveTimeout = setTimeout("autosave()",pollingInterval);
}
function autosave(){
var changes = checkFormChanged(document.%formname);

if (changes && !threadLock) {
threadLock = true;

if ("%page" == "EP_APPR_BASE1")
$('input[@name=ICAction]').attr({value: 'EP_BTN_LINK_WRK_EP_STORE_PB'});
else
$('input[@name=ICAction]').attr({value: 'EP_BTN_LINK_WRK_EP_STORE_PB$19$'});

update_defaults(document.%formname);

var params = $('form[@name=%formname]').fastSerialize();
$.ajax({ type: "POST",
url: $('form[@name=%formname]').attr("action"),
data: $.param( params ),
dataType: "xml",
success:
function(msg, msg2)
{
$('input[@name=ICChanged]').attr({value: '0'});

var searchFor = "'ICStateNum' value='";
var stateNumStart = msg.responseText.indexOf(searchFor) + searchFor.length;
var stateNumEnd = msg.responseText.indexOf("'", stateNumStart);
var newState = msg.responseText.substr(stateNumStart, stateNumEnd - stateNumStart);
$('input[@name=ICStateNum]').attr({value: newState});
display_notification();

SaveTimeout = setTimeout ( "autosave()", pollingInterval );

var SearchFor = null;
var stateNumStart = null;
var stateNumEnd = null;
threadLock = false;
}
});
}
else
{
SaveTimeout = setTimeout ( "autosave()", pollingInterval);
};
};
function display_notification(){
var topValue = window.pageYOffset;
if (! topValue )
topValue = document.documentElement.scrollTop;
if (! topValue )
topValue = document.body.scrollTop;
var topValue = topValue.toString() + "px";
notification.css({top: topValue});
$("body").append(notification);
notification.fadeIn("fast",
function(){
setTimeout("fade_notification()", 2000);
});
topValue = null;
};
function fade_notification(){
notification.fadeOut("slow",
function(){
notification.remove();
}
);
};
function start_autosave(){
if ("%PAGE" == "EP_APPR_MAIN1" || "%PAGE" == "EP_APPR_BASE1")

if ($('input[@name=ICChanged]').val() != 0){
SaveTimeout = setTimeout ( "autosave()", 1);
}
else
{
SaveTimeout = setTimeout ( "autosave()", pollingInterval );
}
$('body').keypress(timeoutHandler);

submitAction_%Formname = function(form, name){

form = $('form')[0];
$('body').css({cursor: "wait"});
function submit_the_form()
{
form.ICAction.value=name;
form.ICXPos.value=getScrollX();
form.ICYPos.value=getScrollY();
processing_%Formname(1,3000);
form.ICResubmit.value=nResubmit;
form.submit();
nResubmit++;
}
function check_for_lock()
{
if (threadLock){
setTimeout("submitAction_%Formname('" + %formname + "','" + name + "')",250);
}
else{
submit_the_form();
}
}
check_for_lock();
};
};
function addLoadEvent(func) {
var oldonload = window.onload;
if (typeof window.onload != function()) {
window.onload = func;
} else {
window.onload = function() {
oldonload();
func();
}
}
};

if ("%page" == "EP_APPR_MAIN1" || "%page" == "EP_APPR_BASE1")
{
addLoadEvent(start_autosave);
};
</script>



thanks,
blackheart_22