It depends. Many commercial sites use freely licensed scripts (open source/ freeware/ etc.), and so it's okay to use them: in most cases, it's part of the license terms that the script can be used by anyone.
In other cases, companies develop (or pay to have built) their own, proprietary scripts. While it's just as easy to find, examine, and rebuild/reuse as an open source script, no, it's not "okay."
So, you need to find out if/how the script is licensed for use.
Now, in practice, there's nothing wrong with learning from scripts you find around the web and using your new knowledge to build something for yourself - but that's not the same as "copying" something or writing something that's more or less identical except for a few options or lines.
Luckily, if you look around long enough, you're likely to find an open-source script that provides the same functionality as any given script that's not publicly usable.
To answer your earlier posts, I think you might be looking for something like a tab content script. Search for it. There's one here on Dynamic Drive; also a pretty cool one at css-tricks. If that's not what you need, please let me know.
Edit:
About your search engine question: in the ajax tab content script (the first one you mentioned), yes, the content would be indexed by search engines. The difference is that the search engine would find the content by following the link (and not by using ajax to load the content), so it would appear as a separate page rather than part of the page a normal user would find it on. In practice, however, that's fine; in fact, it ensures that non-javascript users can still see all your content.
Bookmarks