function MoveMrPartyPack()
{
	if(document.getElementById("mrPartyPack"))
	{
		var newPosition = f_clientWidth() -183;
		if(newPosition < 820) newPosition = 820
		
		document.getElementById("mrPartyPack").style.left = newPosition +'px'
	}
}

function TemplateResize()
{
	MoveMrPartyPack();	
}

function TemplateOnLoad()
{
	MoveMrPartyPack();	
}

$(document).ready(function() {
	var loading = function () {
		$('body').append('<div id="modal1" style="position:absolute; z-index: 100;top:0; left:0;background:#000;filter:alpha(opacity=65);-moz-opacity: 0.65;opacity: 0.65;"/>');
		$('#modal1').css('width',$(document).width() + 'px').css('height',$(document).height() + 'px').click(function(e){e.preventDefault()});
		$('body').append('<div id="modal2" style="text-align:center; z-index: 101; background:#FFF; padding: 50px;position:absolute">Loading...<br/><img src="/templates/clickcostumes/images/loader.gif"/>');
		var top = $(window).height() / 2 + $(window).scrollTop() - $('#modal2').innerHeight() / 2;
		var left = $(window).width() / 2 + $(window).scrollLeft() - $('#modal2').innerWidth() / 2;
		$('#modal2').css('top', top + 'px').css('left', left + 'px');
	};
	$('a').click(function(e) {
		if ($(e.target).attr('target') == undefined || $(e.target).attr('target') == '') {
			if (e.target.href && e.target.href.indexOf('javascript') != 0) {
				window.setTimeout(loading,1000);
			}
		}
	});
});
