if((navigator.userAgent.match(/iPhone/i)) || (navigator.userAgent.match(/iPod/i))) {
	document.write('<style type="text/css">html{-webkit-text-size-adjust:none;}div#fancy_overlay{background:transparent!important;}</style>');
	//document.write('<link rel="apple-touch-icon" href="http://www.mindlesslongboards.com/wp-content/themes/mindless/content/favicon-57.png" type="image/png" />');
}

if (navigator.userAgent.indexOf("Firefox")!=-1) {
	document.write('<style type="text/css">button::-moz-focus-inner { border: 0; }</style>');
}

$(document).ready(function(){
	/* Start Product Pages */	
	// set all the thumbnails initial opacity
	$("a.gallery_thumb").each(function() { $("img", this).animate({"opacity": "0.8"}, 0); });
	
	$("a.thumb_update").hover(fadeGallery);
	
	$("a.thumb_hover").hover(function () { $("img", this).stop(true, true).animate({"bottom": "+=3px", "opacity": "1"}, "fast");
		}, function () {
			$("img", this).stop(true, true).animate({"bottom": "-=3px", "opacity": "0.8"}, "fast");
		}
	);
	/* End Product Pages */	

	/* Start Media Pages */	
	$("a.single_image").fancybox({
		'overlayOpacity': 		0.6, 
		'hideOnContentClick': 	true
	});
	/* End Media Pages */	

});

function fadeGallery() {
	var currentSrc = $("#gallery_image").attr("src");
	currentSrc = basename(currentSrc);
	if (currentSrc != this.rel) {
		var newSrc = "http://www.mindlesslongboards.com/wp-content/files_flutter/" + this.rel;
		var newAlt = this.title;
		$("#gallery_image").stop(true, true).fadeOut(0).attr({ src: newSrc, alt: newAlt });
		$("#gallery_image").stop(true, true).fadeIn("slow");
	}
}

function basename(path) {
    return path.replace(/\\/g,'/').replace( /.*\//, '' );
}

/*
function nonFadeGallery() {
	var newSrc = "http://www.mindlesslongboards.com/wp-content/files_flutter/" + this.rel;
	var newAlt = this.title;
	$("#gallery_image").attr({ src: newSrc, alt: newAlt });
}
*/
