You're only setting a value for cookieminutes in the top section of the if statement, so any references in the else section will be null.
Try this:
function getcookie()
{
var start = document.cookie.indexOf("expires");
var cookiedate;
cookiedate = new Date();
cookieminutes = cookiedate.getMinutes();
if(start==-1)
{
document.write("Start equal to -1");
document.cookie="expires="+cookiedate+",path=0,domain=0";
}
else
{
document.write("Start not equal to -1");
var date = new Date();
var minutes = date.getMinutes();
document.write("The difference is "+minutes);
document.write("
Cookie minutes is "+cookieminutes);
return (minutes-cookieminutes);
}
}