I wonder is it legal to register a domain name that contains a company name. For example
cococola.cc (considering that this domain name is available). Can I buy and use any domain names that contain a name of a trademark?
Although there's nothing preventing you from registering a domain name containing another company's name, there are serious ramifications for not doing so:
If a company has trademarked their name (or similar name) in your country, or might file a trademark there based on prior usage of a mark (such as conducting sales there at an earlier date), you'll likely receive a letter from their attorney, followed by a UDRP complaint, and a possible trademark infringement lawsuit as well.
If it appears you registered the domain in "bad faith" without any legitimate interests in it, or with the intent to misdirect or otherwise impact a trademark holder's rights or business, the judgment(s) will surely not be in your favor.
In the example provided,
cococola.cc is not only confusingly similar to - it's an exact match for the mark under which Coca-Cola ™ conducts business world-wide, and no doubt has been trademarked in every major region of the world to protect it against trademark infringements and domain squatting.
Unless you can demonstrate "prior usage", meaning that you had established the name and been conducting business under it prior to the company's first date of usage (not at all likely in the case of "Coca Cola"), or in a completely different business area, you'll surely lose the UDRP case, which are expensive and time-consuming to defend against in world courts such as the World Intellectual Property Organization (WIPO).
Therefore, I would strongly recommend against registering a domain containing a name that was similar or confusingly similar to a trademark under any circumstances that might infringe upon a trademark holder's rights or be construed as "bad faith", unless you're prepared to go to great lengths and expense defending it.
On a personal note, I successfully defended a few UDRP complaints for domains I had registered and been doing business under dating as far back as 1994. One for example was from a trademark holder in a foreign country whom I had never heard of before, and who's trademark there even differed by a letter, and was still pending in my country too. Despite those things, it was still neither a fun or inexpensive process to go through...
Consequently, I always recommend to anyone who is going to significantly invest in a domain name to first do a thorough trademark search in their local country, along with other regions as well. The later is important because you might end up doing business in the same country as a trademark holder (such as selling to customers located there). If a trademark holder also does business in your country, they could establish a date of prior usage there too, which might predate your own.
After establishing that there aren't any similar trademarks in the same geographic and business areas as yours, file for a trademark in your country as soon as you can to establish the priority right for your mark. Do the same in each country in which you think you might conduct business in to protect your rights to the mark there as well, which may result in domain name challenges down the line, like in my case.
Lastly, I'd also recommend using an attorney who specializes in patent and trademark law to both conduct the searches and trademarks filings, as these issues can get very technical.