Javascript problem with a clause?

Hello everyone,

i’m here because i need some help, i have this little function here :
function wysiwyg_tools_plus_theme_toggleAccordion… {
eventId = eventId.substring(eventId.length-1, eventId.length);
$(‘#acc-’ + eventId).toggle(‘fast’);
which i use for accordions, the problem is, if the eventId is for example 1 the result will be 1, but if the eventId is 12, the result will be 2, and i need the complete number to display…can i do something else to this code? For example if i put any if clause, if the eventIdlength == 1 then { } else {}

I am newbie in javascript…