/* Citrus Samurai JS - Travis Repetto */// Detect if iPhone or iPodvar isIphone = ((navigator.userAgent.indexOf('iPhone') != -1) || (navigator.userAgent.indexOf('iPod') != -1));// Konami Code$.fn.konami=function(callback,code){if(code==undefined)code="38,38,40,40,37,39,37,39,66,65";return this.each(function(){var kkeys=[];$(this).keydown(function(e){kkeys.push(e.keyCode);while(kkeys.length>code.split(',').length){kkeys.shift();}if(kkeys.toString().indexOf(code)>=0){$(this).unbind('keydown',arguments.callee);callback(e);}});});}$(function(){	//if (!$.support.leadingWhitespace) console.log('Your browser is pretty old!');		// iPhone Scroll Address Bar onload	if (isIphone) window.scrollTo(0,1);	// Star Wars Cat	$(document).konami(function(){ $('body').addClass('konami'); });	// External Links Open in New Window	$("a[href^=http]").live("click", function(){ window.open(this.href); return false; });		// Portfolio Thumbnail Click	$(".portfolio-content .thumb-item img").bind("click",function(e){		$(e.target).closest(".portfolio-content").find(".container-fade").fadeOut(300,function(){			$(this).find(".info h5 a").text($(e.target).attr("title")).attr("href", $(e.target).next("div").find(".external").attr("href"));			$(this).find(".info div").html($(e.target).next("div").html());			$(this).find(".screenshot").css("background-image",'url(' + $(e.target).attr("src") + ')');			var largeImage = $(e.target).closest(".portfolio-content").find(".screenshot");			var imageSrc = $(e.target).attr("src").replace("/thumbnails/", "/screenshots/");			var imageTitle = $(e.target).attr("title");			largeImage.click(function(){ $.fancybox({ href: imageSrc, title: imageTitle }); });			$(this).fadeIn(300);		});	});		// Portfolio Tabs	$("#portfolio-3d").hide();	$("#portfolio-web .thumb-item img:first").click();	$("#portfolio-web-link").addClass("selected");	$("#portfolio-web-link").bind("click",function(e){		if (!$(e.target).hasClass("selected")){			$("#portfolio-web .thumb-item img:first").click();			$(e.target).addClass("selected");			$("#portfolio-3d-link").removeClass("selected");			$("#portfolio-3d").hide();			$("#portfolio-web").show();		}	});	$("#portfolio-3d-link").bind("click",function(e){		if (!$(e.target).hasClass("selected")){			$("#portfolio-3d .thumb-item img:first").click();			$(e.target).addClass("selected");			$("#portfolio-web-link").removeClass("selected");			$("#portfolio-web").hide();			$("#portfolio-3d").show();		}	});		// Contact Form Modal	$('.link-email').fancybox({		afterShow: function(){			// jQuery Placeholder			$('input[placeholder], textarea[placeholder]').placeholder();						// Form Submit			$(".submit-button").click(function(){				if($("#name").val() == "" || $("#name").val() == "Your Name"){ $("#name").addClass("error"); }else{ $("#name").removeClass("error"); }				if($("#email").val() == "" || $("#email").val() == "Email Address"){ $("#email").addClass("error"); }else{ $("#email").removeClass("error"); }				if(!(($("#email").val().indexOf(".") > 2) && ($("#email").val().indexOf("@") > 0))){ $("#email").addClass("error"); }else{ $("#email").removeClass("error"); }				if($("#message").val() == "" || $("#message").val() == "How can I help you?"){ $("#message").addClass("error"); }else{ $("#message").removeClass("error"); }				if($(".text").hasClass("error")){					return (false);				} else {					$.ajax({						type: "POST",						url: "contact.php",						data: $('#contact-form').serialize(),						success: function(html) {							console.log($('#contact-form').serialize());							$("#contact").html(html);										// Contact Form Close							$(".contact-close").click(function(){								$.fancybox.close();								return false;							});						}					});					return false;				}			});		}	});	});// Google Analyticsvar _gaq = _gaq || [];_gaq.push(['_setAccount', 'UA-1162892-3']);_gaq.push(['_trackPageview']);(function() {	var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;	ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';	(document.getElementsByTagName('head')[0] || document.getElementsByTagName('body')[0]).appendChild(ga);})();
