var swAnimationTime = 0.4; // seconds
swAnimationTime = swAnimationTime*1000;

function showSizeWizard(options)
{
	if(typeof options == 'undefined') options = {};
	if(typeof options.useAnimation == 'undefined') options.useAnimation = true;
	if(typeof options.showId == 'undefined') options.showId = ''; else options.showId = '&showId='+options.showId;
	var frameWidth = 740;
	var frameHeight = 467;
	
	var shadowLeftOffset = 25;
	var shadowTopOffset = 18;

var useAnimationTime = options.useAnimation ? swAnimationTime : 0;
	
	if(typeof allModals != 'undefined'){ // hide all other modal windows
		allModals.hideAll(false);
	}
	
	if($.browser.msie) {
		$("input.formhider").addClass("hideform");$("select.formhider").addClass("hideform");
	}
	
	var swFrame = 'swFrame';
	var swWindow = 'swWindow';
	var swShadow = 'swShadow';
	if( $('#swWindow').length <= 0 )
	{
		var prodlink = '#outerFooter'; // always put just after #outerFooter now because of cross sells with more than one product in different tabs would keep it hidden sometimes
		$(prodlink).after('<div id="'+swWindow+'" class="swWindow" style="display:none"><div class="swHeader"><a href="#" onclick="hideSizeWizard(\'\', false, '+options.useAnimation+'); return false;">Close</a></div><div id="'+swFrame+'" class="swFrame"><iframe frameborder="0" scrolling="no" src="/77kids/browse/size_wizard.jsp" width="'+frameWidth+'" height="'+frameHeight+'"></iframe></div></div><div id="'+swShadow+'" class="swShadow" style="display:none"></div>');

	}
	var viewport = getViewportDimensions();
	var frameTop = (viewport[1]/2-(frameHeight+16)/2)+$(window).scrollTop();
	var frameLeft = (viewport[0]/2-(frameWidth)/2);
	$('#swWindow').css({top:frameTop+'px', left:frameLeft+'px'});
	$('#swShadow').css({top:(frameTop-shadowTopOffset)+'px', left:(frameLeft-shadowLeftOffset)+'px'});
	
	$('#swWindow').show(useAnimationTime, function(){
		$('#swShadow').show();
		
	});
	
}

function hideSizeWizard(killFrame, useAnimation)
{
	if(typeof useAnimation == 'undefined') useAnimation = true;
	if(typeof killFrame == 'undefined') killFrame = false;
	var useAnimationTime = useAnimation ? esAnimationTime : 0;
	$('#swShadow').hide();
	if(killFrame)
	{
		$('#swWindow').hide(useAnimationTime, function(){ $('#swFrame').remove(); } );
		if(!useAnimation) $('#swFrame').remove(); // callback doesn't always seem to fire when animation time is set to zero so make sure this is called in non-animation mode
	}
	else $('#swWindow').hide(useAnimationTime);
	
	if(typeof allModals != 'undefined'){ // hide all other modal windows
		allModals.showAll(false);
	}
	
	if($.browser.msie) {
		$("input.formhider").removeClass("hideform");$("select.formhider").removeClass("hideform");
	}
}

