Im having problemas getting/setting cookies. On local side I can do it but only I cant....

I set a cookie at http://example.com/folder/index.html

and I cant read it at for example http://example.com/folder/otherfolder/file

This does NOT work:

            function setCookie(c_name,value,exdays)
                var exdate=new Date();
                exdate.setDate(exdate.getDate() + exdays);
                var c_value=escape(value) + ((exdays==null) ? "" : "; expires="+exdate.toUTCString());
                document.cookie=c_name + "=" + c_value;


This does WORK

            nombrecorte+this.getParameterByName("idProd")+'='+document.getElementById('nombrecorte').value+'; domain=.'+domain+'; expires='+dia.toGMTString()+'; path=/';   

But only like I said, local. Never online.

What could be the problem? Any more information needed?