/*
  Website Suze May Sho
  Copyright (C) 2008-2009 by Systemantics, Bureau for Informatics

  Lutz Issler
  Mauerstr. 10-12
  52064 Aachen
  GERMANY

  Web:    www.systemantics.net
  Email:  mail@systemantics.net

  Permission granted to use the files associated with this
  website only on your webserver.
*/

var viewed = 0;

$(function () {
	var submenu = $("#submenu").get(0);
	if (submenu) {
		$("#submenu a").click(function () {
			document.cookie = "y="+submenu.scrollTop+"; path=/";
		});
		$("#menu a").click(function () {
			document.cookie = "y=0; path=/";
		});
		// Restore the scroll position
		cookies = document.cookie.split(/;/);
		for (var i=0; i<cookies.length; i++) {
			var cookie = $.trim(cookies[i]).split(/=/);
			if (cookie.length==2 && cookie[0]=="y") {
				submenu.scrollTop = cookie[1];
			}
		}
	}

	$("a[href^=http://]").click(function() {
		var sms = "http://www.suzemaysho.com/";
		if (this.href.substr(0, sms.length)!=sms) {
			window.open(this.href);
			return false;
		}
	});

	$("#image img").click(function() {
		var thumbnails = $("#thumbnails img");
		thumbnails.eq(viewed==thumbnails.length-1 ? 0 : viewed+1).click();
	});
});

function enlargeImage(big) {
	var w = big[1]>screen.width-200 ? screen.width-200 : big[1];
	var h = big[2]>screen.height-200 ? screen.height-200 : big[2];
	window.open('/images/enlarged/'+big[0],'image','directories=no,location=no,menubar=no,resizable=1,scrollbars=yes,status=no,titlebar=yes,toolbar=no,screenX=100,screenY=100,width='+w+',height='+h).focus();
}

var flashvars = {
		autostart: "true",
		repeat: "true",
};
var params = {
		wmode: "opaque"
};

var videoId = 0;

function showVideo(image, video, width, height, caption) {
	videoId++;
	flashvars.displayheight = height;
	flashvars.height = height;
	flashvars.file = video;
	flashvars.image = image;
	flashvars.width = width;
	$('#images').prepend('<div><div id="player'+videoId+'"><img src="'+image+'" alt="" /></div><br />'+caption+'</div>');
	swfobject.embedSWF("/mediaplayer.swf", "player"+videoId, width, height, "8", false, flashvars, params);
}