function addVideo(name, width, height, hdversion)
{
	var so = new SWFObject('/flvplayer.swf','mpl', width, height, '9');
	so.addParam('allowfullscreen','true');
	so.addParam('allowscriptaccess','always');
	so.addParam('wmode','opaque');
	so.addParam('bgcolor','555555');
	so.addVariable('file', '/vids/' + name);
	// Text
	so.addVariable('frontcolor','2f43b3');
	// Volume, progress, rollovers
	so.addVariable('lightcolor','c10031');
	// Controls background
	so.addVariable('backcolor','fbfbfb');
	// Movie area background
	so.addVariable('screencolor','000000');
	so.addVariable('skin','/stylish.swf');
	if (typeof hdversion != "undefined" && hdversion != '')
	{
		so.addVariable('plugins', '/hd.swf');
		so.addVariable('hd.file', '/vids/' + hdversion);
	}
	//so.addVariable('stretching','none');
	so.write('video');
}

var tab_active = new Image();
tab_active.src = '/skins/ewt/tabs.png';
var tab_inactive = new Image();
tab_inactive.src = '/skins/ewt/tabs_inactive.png';

$(document).ready(function(){
	$("#footer").css({opacity : "0.85"});
	$("#skinselector").find("select").change(function(){
		$(this).unbind("change");
		$("#skinselector form").submit();
	});
	$("form").submit(function(){
		$(this).find(":submit").attr("disabled","disabled");
	});
	$("#footer ul").append($('<li>Modern Skin &copy; <a href="http://worms2d.info/People/OutofOrder">OoO</a> 2010</li>').addClass("skinsig").hide()).parent().mouseenter(function(){ $(".skinsig").fadeIn(1600); });
	if ($(".extra").length > 0)
		$(".comm div:first-child").hover(function(){
			var divOffset = $(this).offset();
			$('<div></div>').css({ zIndex : "100", border : "1px solid gray", background : "black", color : "white", padding : "1em", fontSize : "0.9em", display : "none", position : "fixed"}).addClass("suddenPopup").text($(this).siblings('.extra').text()).appendTo("body").fadeIn("fast").offset(function(){ return { top : divOffset.top + 25 , left : divOffset.left - ($(this).width() / 2) }; }).hover(function(){ $(this).stop(true,false); }, function(){ $(this).fadeOut("normal"); });
		}, function(){
			$(".suddenPopup").fadeOut("normal", function(){ $(this).remove(); });
		});
	$("#searchInput").keyup(function(){
		if ($(this).val().toLowerCase() == "holy hand grenade" || $(this).val().toLowerCase() == "hhg"){$('<div></div>').css({ background : "black", width : "100%", height : "100%", position : "fixed", display : "none", zIndex : "100", textAlign : "center" }).click(function(){$(this).remove();}).append($('<object width="480" height="385"><param name="movie" value="http://www.youtube.com/v/xOrgLj9lOwk&fs=1&autoplay=1&"></param><param name="allowFullScreen" value="true"></param><param name="allowscriptaccess" value="always"></param><embed src="http://www.youtube.com/v/xOrgLj9lOwk&fs=1&autoplay=1&" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" width="480" height="385"></embed></object>')).prependTo('body').fadeIn("slow");$(this).unbind("keyup");}
		if ($(this).val().toLowerCase() == "admin") window.location = "/admin";
	}).val("");
	if ( window.location.hash == "#comments" )
		$("html").animate({ scrollTop : $("#comments").offset().top }, 10);
	$("#comment_nick").focus(function(){ if ($(this).val() == 'Your Nickname') $(this).val(""); });
	$("#comment_text").focus(function(){ if ($(this).val() == 'Type your comment here') $(this).val(""); });
	$("#affiliate img").click(function(){ $(this).parent().append($("<br /><textarea cols='50' rows='2'><a href='http://wormtube.worms2d.info/'><img border='0' src='http://wormtube.worms2d.info/banners/WTbanner.png' alt='WormTube Worms Video Database' /></a></textarea>")).end().unbind("click"); $(this).parent().find("textarea").select();});
	var oddeven = 0;
	$("#admin").css({ position : "relative", zIndex : 0 }).mouseenter(function(){ $(this).animate({ left : ( oddeven % 2 ? "+" : "-" )+"=350" }, 120); oddeven++; });
});

function hideDescriptions()
{
	$(document).ready(function(){
		$(".movie_desc_show").click(function(){
			$(this).hide().nextAll(".movie_desc_hidden").fadeIn();
			return false;
		});
	});
}