﻿var _scrollTop = false;

function preload(arrayOfImages)
{
	$(arrayOfImages).each(function ()
	{
		(new Image()).src = this;
	});
}
$(document).ready(function ()
{
	preload(['/media/print/bigo_large.jpg',
		'/media/print/chicocellars_large.jpg',
		'/media/print/jeweleryspread_large.jpg',
		'/media/print/laservision_large.jpg',
		'/media/print/miadoracover_large.jpg', 
		'/media/print/mission_large.jpg',
		'/media/print/retronews_large.jpg',
		'/media/print/wellness_large.jpg']);

	/*******NAVIGATION******************/
	$("div.nav_item, div.nav_item_over").live("mouseover", function ()
	{
		//hide all sub_items
		$(".sub_items").hide();

		var id = $(this).attr("id");
		$(this).addClass("nav_item_over");
		var position = $(this).position();

		$("#" + id + "_sub").css({ "top": (position.top + 56) + "px", "left": position.left + "px" }).fadeIn("fast");
	});

	var timer = null;
	$(".nav_item").live("mouseout", function ()
	{
		var id = $(this).attr("id");
		if ($("#" + id + "_sub").length == 0)
		{
			$("#" + id).removeClass("nav_item_over");
		}
		else
		{
			timer = setTimeout(function ()
			{
				$("#" + id + "_sub").hide();
				$("#" + id).removeClass("nav_item_over");
			}, 200);
		}
	});

	$(".sub_items").live("mouseover", function ()
	{
		clearTimeout(timer);
	});

	$(".sub_items").live("mouseout", function ()
	{
		var id = $(this).attr("id");
		timer = null;
		timer = setTimeout(function ()
		{
			$("#" + id).hide();
			var parentID = id.split("_")[0];
			$("#" + parentID).removeClass("nav_item_over");
		}, 200);
	});



	/*********************************media -work section*************************/
	$("#flashContainer #close_overlay").live("click", function ()
	{
		closeOverlay(_type);
	});

	$('.inline').colorbox({
		arrowKey: false,
		inline: true,
		onOpen: function ()
		{
			var printName = $(this).attr('rel');
			loadProjectDetails(printName + '.jpg');
			$('div#inline_content div#large_image')
						.html('<img src="/media/print/' + printName + '_large.jpg" alt="' + printName + '" style="margin: auto;" />');
		}
	});

	$('.tv-item .project-image-tv, .tv-item-featured .project-image-tv-featured').hover(function ()
	{
		$(this).css('background-position', 'bottom');
	}, function ()
	{
		$(this).css('background-position', 'top');
	});
});

function loadProjectDetails(name)
{
	var title = "";
	var description = "";
	var print = false;

	switch (name.split('.')[0])
	{
	/*************************************** VIDEOS *************************************************/
		case "Ape 1":
			title = "Ape 1";
			description = "Nothing breaks through the clutter of car advertising like an orangutan. Kids went ape over the free pet orangutan with every test drive. The music bed sets the tone.  ";
			break;
		case "Ape 2":
			title = "Ape 2";
			description = "We purchased stock footage for our \"star\", wrote copy to fit his (or her?) gestures and hired a talented voice over artist. This campaign lasted for years and was supported with print ads, direct mailings and billboards.";
			break;
		case "Animated Genie":
			title = "Animated Genie";
			description = "I hired a motion graphics/editor right out of Expressions College of Digital Art who had a buddy still in school specializing in animation design. The rookie nailed it. It took forever to find a license-free music bed worthy of that dance.  ";
			break
		case "Cash One Striking Gold":
			title = "Striking Gold";
			description = "Bay Area media, as you would expect, is expensive. Cash 1 wanted a series of short, high-impact spots they could run more frequently. This is one of the more memorable 15-second spots from the campaign. Ouch! ";
			break;
		case "Cash One Gas Swap":
			title = "Gas Swap";
			description = "Everyone can relate to high gas prices. So we came up with a scenario that never, ever crossed your mind. Right?";
			break;
		case "Central Chev Toy Car":
			title = "Toy Car";
			description = "Phil, the Dad in this spot was a natural. This was his first take. It's a silly example of a simple idea well executed. We shot it at my old house in the Bay Area. ";
			break;
		case "YTI Silver Man":
			title = "Silver Man";
			description = "I got to know a real Silver Man while I was working near Union Square in San Francisco. Nice enough guy. I must have wanted to be Silver Man for a day. Why else would I agree to be coated in silvery slime?";
			break;
		case "YTI Can Move":
			title = "YTI Can";
			description = "This is a straight-forward direct-response TV spot that worked exceptionally well for the client. We know, because different 800 numbers were dropped in at the end. Unique numbers allow the leads to be tracked by station, by time, by length of call, etc…";
			break;
		case "Yoga People Care":
			title = "Yoga People Care";
			description = "NeatoVideo.com's first project was to proudly produce a 30 second TV PSA for Yoga People Care who hosted a yoga-in-the-park fund raising event. All of the money raised went to the St. Baldricks Foundation to support children who are fighting cancer. ";
			break;
		case "Petes Pizza":
			title = "Mailboxes";
			description = "This commercial for Pete's Pizza has cheesy special effects, which was exactly what we were going for. The pizza delivery guy through the fish-eye lens looks familiar. ";
			break;
		case "MCI Rad Tech":
			title = "Radiology";
			description = "The talented Landis Hardy shot this spot in Sacramento. Dr. Bross is clearly fake concerned because that’s his nephew, Skyler Rand, who’s been fake injured.";
			break;
		case "NHI_Julia":
			title = "Massage Therapy";
			description = "National Holistic InstituteCreating a compelling testimonial is an art in and of itself. After making about 5000 of them, I eventually got the hang of it.";
			break;
		//---------------------------------------
		case "ECPI 1X30":
			title = "ECPI";
			description = "Game Designers - Simulation and Game Programming. Sell the dream. Game designers want to work on fun projects in a cool location. We found a great place across the street from Pixar and recycled some of our B-roll to serve as projects. ";
			break;
		case "Becker Demo":
			title = "Demo Reel";
			description = "Becker Media specialized in career college advertising, which can become a pretty stale category with all the rules and regulations. Jon Cooksey our in-house motion graphic/editor extraordinaire managed to make a hip and energetic presentation that shows we understand the target audience. ";
			break;
		case "Keiser Culinary":
			title = "Culinary Arts";
			description = "The words and the visuals go together so well I get hungry every time I watch this spot. Well not really. One day, they’ll have a device next to your video player that emits scents. Really. ";
			break;
		case "Keiser Massage Therapy":
			title = "Massage Therapy";
			description = "A series of simple animated stills are enough to sell the essence of a career in massage therapy. There’s no hard-sell voice over, which makes the spot stand out like a whisper. It tanked. (Fortunately it didn’t cost much to make.) ";
			break;
		case "Cash One Mobsters":
			title = "Mobsters";
			description = "One more from the Cash 1 bookend campaign. Not only do I play the coward, I did the voice over AND am the dancing fire-genie! Golly what a day.";
			break;
		/*******************************************************************************************************/ 


		/*********************************** PRINT *************************************************************/
		case "bigo":
			title = "Hoops";
			description = "Oversized board. Great location. No budget restrictions. Doesn't happen often but when it does the result better be spectacular. <br/>Big O Tires continues to run  variations of this billboard to this day.";
			print = true;
			break;
		case "chicocellars":
			title = "Wine Label Series";
			description = "I did this job shortly after graduating from Chico State University in Northern California. Known for it’s beer (Sierra Nevada) and not for wine, I was pleased with this design series. I’m much, much older now and am learning to love wine so if you have a winery… Let’s do lunch!";
			print = true;
			break;
		case "laservision":
			title = "Focus";
			description = "I'm a big fan of billboards because they force you to reduce. Simple solutions are often the most impactful.";
			print = true;
			break;
		case "miadoracover":
			title = "Catalog Cover";
			description = "Working with designer jewelry and super models sounds much more glamorous than it really is. Wait a sec. Strike that. It actually wasn’t bad at all once we figured out the lighting.";
			print = true;
			break;
		case "jeweleryspread":
			title = "Catalog Spread";
			description = "PhotoShop transformed the way jewelry is shot, re-touched and printed. It works well on people too–even super models look better with some digital adjustments.";
			print = true;
			break;
		case "retronews":
			title = "Newspaper Ads";
			description = "Bob Beyn came up with a retro theme to promote a local hard rock radio station. Telling the target audience (young men 18-24) to stay away - it’s bad for you, was brilliant. We ran full-page ads in the alternative newspaper that read like comic strips. ";
			print = true;
			break;
		case "mission":
			title = "Mission Santa In&eacute;s";
			description = "I’m a big fan of M.C. Escher. Once I saw the entrance to this establishment I started to see the solution in my head right away. I’ve always liked the way Sid Silverstein and Dr. Seuss draw stairs, too.";
			print = true;
			break;
		case "wellness":
			title = "Interwellness";
			description = "As you can see, I like to make two-dimensional art appear 3-D. Interwellness developed and marketed a tiered program for health based on balancing our emotional, physical and spiritual attributes. Unfortunately, they went out of business before we could do more work for them. ";
			print = true;
			break;
		/***************************************************************************************************/

		/***************************************** RADIO ***************************************************/
		case "Fun":
			title = "Rainbow";
			description = "Another spot from the 'teaser' campaign. I am the son of a hippie mother. That’s probably how I cam up with this character.The harp that comes out of nowhere as she introduces herself makes me smile. Sometimes I wish I had theme music and sound effects to make life more interesting. I could use a laugh track too. ";
			break;
		case "YouDoThisYouDoThat":
			title = "Riccardo";
			description = '"Yesterday" came to Paul McCartney in a dream. When he awoke, he put pen to paper and didn\'t change a single note. "Riccardo" is my "Yesterday".  I fell asleep thinking about how to promote Jumpin\' Java coffee and awoke with this silly character in my head. I scribbled down what I heard in my dream and the client didn\'t change a singe word.(Okay the client did change a few words, but the rest of the story is true.)  Somehow, I must be a man-of-style too.';
			break;
		case "TheFutureBelongsToYou":
			title = "Juan Vision";
			description = "We developed a 'teaser' radio campaign to promote a new TV station. Juan Vision is one of the psychics attending a convention who has visions of this new 'thing' coming to town. The commercial you hear in your head is often different than what gets produced. In this case, I was blown away with what they did with my words. For me, writing for radio is like going to your favorite store with a fat gift card from rich relative.";
			break;
		case "ItsBeenSaid":
			title = "Shwami Ishtar";
			description = "Accents have always fascinated me. As a kid I was always practicing accents and doing imitations. In junior high I was the geek who carried around a list of the impressions I could do. I would ask my classmates to pick a number between 1 and 19 and then summon up the character. I got beat up a lot. ";
			break;
		case "GrowingUp":
			title = "First Northern Bank";
			description = "Some things like taxes and bank mergers never change. Although this commercial was produced in Sacramento around 1995, the message still rings true today.  Phil Sillas sings the jingle. I went to high school with Phil in Davis, California. He was always winning the talent shows and hanging out with all the pretty girls. Dang. I wish I could sing. ";
			break;
		case "TheBankOfTheFuture":
			title = "Pete's Pizza";
			description = "A great jingle helped newcomer Pete's Pizza carve out market share quickly. This spot broke when California Pizza and other restaurants were re-thinking pizza, sometimes not for the better. I worked at Rico’s Pizza in Chico for four of my five-and-a-half years in college. I love pizza! One bite of Pete’s and it was easy to get inspired. " 
			+ "Again, hats off to Phil and Swing Street for their musical talents. ";
			break;
		case "Big O Tires - Bored Family":
			title = "Bored Family";
			description = "Elizibeth Nunziato is an exceptional actress and voice talent I had the pleasure of working with in Sacramento. She played the Portuguese house-keeper in \"Phenomenom\", with Forrest Whitaker and John Travolta. From serious to seriously funny, Elizibeth can do it all. ";
			break;
		case "ETD Foods - Killer Chiller":
			title = "Killer Chiller";
			description = "Somehow the name \"Killer Chiller\", got me thinking about killer whales. When I think about whales, I think about the album my mother brought home in 1972 called, \"Songs of the Humpback Whale\". When I think about \"Songs of the Humpback Whale\" I remember how far our dog cocked his head as he barked at the speakers and ran directly into the sliding glass doors.";
			break;
		case "FN Bank - Sympathy Cards":
			title = "Sympathy Cards";
			description = "I think I wrote this spot so I could be in a radio commercial with Elizibeth Nunziato. And now when I hear it, I wonder why I wanted to play a clerk in a greeting card store? This spot was produced by Steve Bradford. Apparently, bank acquisitions and mergers have been going for quite a while. ";
			break;
		case "Q58 - On The Road":
			title = "On the Road";
			description = "This is the final spot from the Q58 teaser campaign. Here, all the psychics we spoke with previously, are reunited on Winnebago continuing their quest for \"The Q\", which turns out to be a new TV station. Bongo Bob productions did the sound track for this campaign.";
			break;
		case "The Box Store - In My Day":
			title = "The Box Store";
			description = "I’m a big fan of Dana Carvey. He did this character on SNL called \"Grumpy old Man\" who would occasionally visit Dennis Miller on Weekend Update. I channeled this character when penning this spot. \"Why we were line-standing-finger-crossing-box-stuffing-friggin' idiots - and we LOVED it..\" Now that’s fun copy. ";
			break;
		case "CDI Beep":
			title = "Beep";
			description = "I had this spot produced in Vancouver B.C. with local talent so that the Canadian accent would be right. I love Canada. We shot some testimonials at a CDI campus and every one was so nice. The sound engineeer did fall asleep once, but these things happen. The ferry ride between Victoria and Vancouver is unbelievably beautiful. I'm determined to re-visit that part of the world as soon as possible. ";
			break;
	}
	if (print)
	{
		$("div#inline_content div.project_title").html(title);
		$("div#inline_content div.project_description").html(description);
	}
	else
	{
		$("div#flashContainer div.project_title").html(title);
		$("div#flashContainer div.project_description").html(description);
	}
}
var _type = 'audio';
function loadAudio(audioName)
{
	$("#flashContainer #close_overlay").unbind('click');
	$("#flashContent").hide();
	$("#audioContent").show().html("").css({ "height": "150px" });
	var position = $("#content").position();
	$("#overlay").css({ "top": position.top + "px", "left": position.left + "px" }).fadeIn("fast", function ()
	{
		$("body,html").animate({ scrollTop: 100 }, 'slow');
		$("#audioContent").html('<audio src="/media/audio/' + audioName + '" controls preload="auto" autobuffer autoplay="true" style="margin-top: 50px; width: 675px;" />');
	});

	loadProjectDetails(audioName);
	_type = 'audio';
}

function loadFlash(movieName)
{
	$("#flashContainer #close_overlay").unbind('click');
	$("#audioContent").hide();
	$("#flashContent").show().html("").css({ "height": "500px" });
	var position = $("#content").position();
	$("#overlay").css({ "top": position.top + "px", "left": position.left + "px" }).fadeIn("fast", function ()
	{
		$("body,html").animate({ scrollTop: 100 }, 'slow');
		var flashvars = {
			url: 'videos/' + movieName
		};
		var params = {};
		params.menu = "false";
		params.quality = "high";
		params.wmode = "transparent";
		params.autoPlay = "true";
		var attributes = {};
		swfobject.embedSWF("/media/videoPlayer.swf", "flashContent", "800", "500", "9.0.0", false, flashvars, params, attributes);
	});

	loadProjectDetails(movieName);

	_type = 'flash';
}

function closeOverlay(type)
{
	if (type == 'flash')
	{
		$("#overlay").fadeOut("fast", function ()
		{
			if (_scrollTop == true)
			{
				$("body,html").animate({ scrollTop: $('div.tv-item:first').position().top - 70 }, 'slow');
			}
			$("#flashContainer object").remove();
			$("#audioContent").before($('<div id="flashContent"></div>'));
		});
	}
	if (type == 'audio')
	{
		$("#overlay").fadeOut("fast", function ()
		{
			if (_scrollTop == true)
			{
				$("body,html").animate({ scrollTop: $('div.radio-item:first').position().top - 70 }, 'slow');
			}
			$("#audioContent").html("");
		});
	}
}
