var activeTab;

$(document).ready(function() {
		var properties = new SWFObject("/lib/flash/Properties.swf?b", "properties-viewer", 680, 440, 8, "#f0ebd6");
		properties.addParam("wmode", "transparent");
		properties.write("properties");

		$(".property-nav .tab li").click(function() {
			thisMovie("properties-viewer").showProperty($(this).attr("alt"));
			return false;
		}).hover(function() {
			$(this).addClass("hover");
		}, function() {
			$(this).removeClass("hover");
		});

		$(".property-nav .tabs a").click(function() {
			var tab = $(this).attr("href").substr(1);
			if (activeTab) {
				$(activeTab).children("img").replaceSrc(/\-on/, "-off");
			}
			activeTab = this;
			$(activeTab).children("img").replaceSrc(/\-off/, "-on");
			$(".property-nav .tab").hide();
			$("#by-"+tab).show();
			return false;
		});/*.hover(function() {
			if (this != activeTab) {
				var tab = $(this).attr("href").substr(1);
				$(this).children("img").replaceSrc(/\-off/, "-on");
				$(activeTab).children("img").replaceSrc(/\-on/, "-off");
			}
		}, function() {
			if (this != activeTab) {
				var tab = $(this).attr("href").substr(1);
				$(this).children("img").replaceSrc(/\-on/, "-off");
				$(activeTab).children("img").replaceSrc(/\-off/, "-on");
			}
		});*/
		$("a[@href='#type']").click();
});

jQuery.fn.replaceSrc = function(replace, w) {
	var src = $(this).attr("src").replace(replace, w);
	return $(this).attr("src", src);
}

function thisMovie(swf) {
	if(navigator.appName.indexOf("Microsoft") != -1) {
		return window[swf];
	} else {
		return document[swf];
	}
};
