(function($) {
	// private variables
	var oSettings = {};
	//
	// default settings
	$.tatarataa = {
		 id: "TATARATAA!"
		,version: "1.0.0"
		,about: "Sjeiti's Image List Viewer"
		,defaults: {
			 debug:	true
		}
		// public functions
		,foo: function(bar) {
		}
	};
	// init
	$(function() {
		$.fn.tatarataa();
	});
	//
	// call
	$.fn.extend({
		tatarataa: function(_settings) {
			oSettings = $.extend({}, $.tatarataa.defaults, _settings);
			trace($.tatarataa.id+" "+$.tatarataa.version,true);
			$.each($.browser, function(i, val) {
				trace(i+": "+val);
			});
			//
			// anchors external hyperlink references
			$("a[rel=external]").attr("target","_blank");
			//
			// image stuff
			var aH2 = $("h2");
			var aLi = $("ul.silv>li");
			if (aLi.length>3) {
				$("ul.silv").silviewer({width:aH2.length>0?(aH2.width()+2):"100%"});
			}
			//
			var sId = $("body").attr("id");
			trace("sId: "+sId);
			switch (sId.split("_")[0]) {
				case "overons": initOverons(); break;
				case "case": case "cases": initCases(); break;
			}
		}
	});
	
	///////////////////////////////////////////////////////////
	// initOverons
	function initOverons() {
		trace("initOverons");
		if (swfobject.getFlashPlayerVersion().major>=9) {
			var sId = "wordsoup";
			var oFlsV = {xml:"overons.xml"};
			$("body").prepend("<div class=\"swf\"><span id=\"content_"+sId+"\">asdfqwer</span></div>");
			$("#content>ul").remove();
			var oParam = {
				 menu: "false"
				,bgcolor: "#000000"
				,wmode:	"transparent"
				,enablejs: "false"
			};
			var oAttr = {
				 id: sId
				,name: sId
			};
			swfobject.embedSWF("swf/wordsoup.swf", "content_"+sId, "640","480", "9.0.0", "style/expressInstall.swf", oFlsV, oParam, oAttr);
			$("div.words").remove();
		}
	}
	///////////////////////////////////////////////////////////

	///////////////////////////////////////////////////////////
	// initCases
	function initCases() {
		trace("initCases");
		//$("#content").prepend("<br style=\"clear:both;\" />");
		$("#content").prepend($("ul#casemenu"));
		$("#content>h2").after($(".backtocases"));
	}
	///////////////////////////////////////////////////////////

	// rnd
	function rnd(i) {
		return Math.round(Math.random()*i);
	}

	// trace
	function trace(o,v) {
		if ((v||oSettings.debug)&&window.console&&window.console.log) {
			if (typeof(o)=="string")	window.console.log(o);
			else						for (var prop in o) window.console.log(prop+":\t"+String(o[prop]).split("\n")[0]);
		}
	}
})(jQuery);

var v = function v(e) {
	var v = 1;
}
