У вас jquery подключена?
<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.5.2/jquery.min.js"></script>
<script type="text/javascript">
function setCookie(name, value, expiredays, path, domain, secure) {
if (expiredays) {
var exdate=new Date();
exdate.setDate(exdate.getDate()+expiredays);
var expires = exdate.toGMTString();
}
document.cookie = name + "=" + escape(value) +
((expiredays) ? "; expires=" + expires : "") +
((path) ? "; path=" + path : "") +
((domain) ? "; domain=" + domain : "") +
((secure) ? "; secure" : "");
}
function getCookie(name) {
var cookie = " " + document.cookie;
var search = " " + name + "=";
var setStr = null;
var offset = 0;
var end = 0;
if (cookie.length > 0) {
offset = cookie.indexOf(search);
if (offset != -1) {
offset += search.length;
end = cookie.indexOf(";", offset)
if (end == -1) {
end = cookie.length;
}
setStr = unescape(cookie.substring(offset, end));
}
}
return setStr;
}
function block_now(id) {
if(getCookie(id) == 1) {
$('#' + id).stop().slideUp();
setCookie(id, 0, 90, "/");
} else {
$('#' + id).stop().slideDown();
setCookie(id, 1, 90, "/");
}
}
function block_start(id) {
var cookie_stat = getCookie(id);
if((cookie_stat == 1) || (!cookie_stat)){
display = '';
} else {
display = 'none';
}
document.getElementById(id).style.display = display;
}
</script>
<table>
<tr onClick="block_now('blok_1')" style="cursor:pointer;">
<th>Заголовок блока</th>
</tr>
<tr>
<td>
<div id="blok_1">
Содержимое блока <br>
Содержимое блока <br>
Содержимое блока <br>
Содержимое блока <br>
Содержимое блока
</div>
</td>
</tr>
</table>
<script>
block_start("blok_1");
</script>