BEVERLY HILLS – AMC’s “Mad Men” may be the best new TV series so far this year, but it took more than a few years to get from the imagination of creator Matthew Weiner to your living room.

Weiner was a writer-producer on such comedies as “Becker” in the late 1990s – and wasn’t feeling particularly fulfilled. So while he ground out episodes of “Becker” during the day, he started to flesh out an idea for a new series at night: a show that would look at the world of advertising in 1960, the dawn of the modern media age.

After Weiner eventually left “Becker,” he asked his agents to send the script that would become “Mad Men” (which debuts at 10 p.m. Thursday on AMC) to David Chase, creator of “The Sopranos,” in hopes Chase might co-produce the show. Instead, Chase hired Weiner to write for the seminal HBO drama. (His work would eventually include “Blue Comet,” the “Sopranos’ ” memorable penultimate episode last month.)

Eventually, “Mad Men” resurfaced as “The Sopranos” reached its end. HBO passed on the show, but executives at AMC – not known for original series – fell into love with it.

“To tell you the truth, I didn’t know what was going to happen with the show,” Weiner says. “Then the people at AMC came to me and said, `We love your work. We want to give you complete creative freedom. We want to do quality.’ After that, you don’t really go home and say, `God, I wish HBO will call.’ “

There’s no question HBO’s loss is AMC’s gain – and a big gain at that. The series is a funny, knowing, sometimes dark, sometimes romantic take on the time just before the power of advertising was fully realized.

The job of selling America is interesting enough – a scene in Thursday’s opener involving spin control on the “new” research about the effects of smoking is wicked – but “Mad Men” is also very much the way the characters go about the job. Even though it is set in an America of just four decades ago, the world of “Mad Men” almost seems like an alien planet, loaded with smoking, drinking (at all hours of the day), corporate sexual harassment and enough dialogue that is now considered politically incorrect to make you cringe.

At one point, Don Draper (Jon Hamm of “The Division”), the top creative gun at the advertising agency of Sterling Cooper, is asked if the company had ever hired a Jew. His reply: “Not on my watch.”

“I looked at these guys, at this world, these men who were overpaid and drank too much and smoked too much, and were glib and cynical and bit the hand that fed them all the time, and showed up late and had no respect for authority, and I thought, `These are my heroes,’ ” Weiner says with the same wry humor that marks the series.

Yet, the show never loses its touches with the contradictions of the day and the very human side of its characters. Draper – who would not have looked out of place with Frank Sinatra’s Rat Pack – is a complex man, as is his boss Roger Sterling (played with panache by John Slattery of “Desperate Housewives”). The women are equally intriguing, particularly Peggy (Elisabeth Moss of “The West Wing”), who is Draper’s new assistant.

And any number of the issues “Mad Men” raises still resonate today.

Many people “can remember a time when they didn’t have a computer,” Weiner says. “That doesn’t mean that you were a different kind of person back then. My approach to the past is that the human experience doesn’t change. The rules change, the behavior changes, but what we like and what we don’t like, what we fear, all of our feelings are the same.”

What gives “Mad Men” an additional kick is that the viewers at home know what’s coming. They know how the 1960s will reshape America, how things will change so dramatically so quickly.

It must have been a great temptation for Weiner to write in a lot of winks and nods to what’s to come. There are some, including a nice riff on Richard Nixon’s 1960 presidential campaign and the casting of Robert Morse – who came to fame as the star of “How to Succeed In Business Without Really Trying,” the quintessential 1960s musical about corporate scheming – as one of the owners of the firm.

But, Weiner says, “we don’t do that too often, and we try not to wink too much. And I try to make it rooted in the situation of that time. That’s really been the plan. And it’s a temptation that I try and resist.”

What you won’t be able to resist – if you give it a shot – is “Mad Men.” In a summer flush with fine new and

A transit village with apartments, retailers, restaurants and a hotel is rising in Milpitas next to The Great Mall, close to light rail and the under-construction BART station. It’s one of several Silicon Valley projects sprouting up near transit.