I have a "growing" div container on a page and for some reason this code is executing really slowly
http://kseego.com/e_cal.php
that is the demo of it
the code running it is
function ecal_date_toggle(ecal_day){
if(in_array(ecal_day,ecal_dates_open)){
document.getElementById('ecal_day_'+ecal_day).innerHTML="";
document.getElementById('ecal_day_'+ecal_day).style.display='none';
ecal_dates_open[ecal_day] = 0;
}
else{
maker_date = new Date(ecal_day.substr(0,4)+","+ecal_day.substr(4,2)+","+ecal_day.substr(6));
maker_date = new Date(ecal_day.substr(0,4)+","+ecal_day.substr(4,2)+","+ecal_day.substr(6));
ecal_dates_open[ecal_day] = ecal_day;
var box = "<div id='ecal_day_"+ecal_day+"' class='ecal_dates'>"+maker_date+" <input type='text' name='ecal_date_start[ecal_day]' value='start time' /><input type='text' name='ecal_date_end[ecal_day]' value='end time' /><img src='/images/icons/delete.png' alt='delete' onclick='cal_date_toggle(ecal_day);' />";
document.getElementById('ecal_date_toggle').innerHTML=document.getElementById('ecal_date_toggle').innerHTML+box;
}
}
basically it checks to see if a div is added, if so then destroy the content in it and set it to off, otherwise write the new div and add it on to the bigger box.
any suggestions would be useful.