window.params = {
	flash: null,
	footer: null,
	wrapper: null,
	scrollFixer: null,
	ADJUST: null,
	MINIMUM_WIDTH: 1024,
	MINIMUM_HEIGHT: 580
}
jQuery(document).ready(function(){
	window.params.flash = document.getElementById("FlashContent");
	window.params.footer = document.getElementById("footer");
	window.params.wrapper = document.getElementById("wrapper");

	// header.height + fotter.height
	window.params.ADJUST = window.params.footer.offsetHeight + window.params.wrapper.offsetHeight;

	// Unbind adidas stuff
	jQuery(window).unbind();
	window.onresize = onWindowResize;
	window.onresize();

});

function onWindowResize(e){
	resizeTechfit();
}

function resizeTechfit(dontAskFlash){
	
	// width-height
	var h = jQuery(window).height();
	var w = jQuery(window).width();
	
	var flash = window.params.flash;
	
	/* -- */
	var footerheight = jQuery('#footer').height() + parseInt(jQuery('#footer').css('paddingTop'), 10) + parseInt(jQuery('#footer').css('paddingBottom'), 10);
	var wrapper = jQuery('#wrapper').height();
	var flashheight = h - wrapper - footerheight;
	
	var _Content = jQuery('#content');
	
	// mini height

	if (flashheight < window.params.MINIMUM_HEIGHT) {
		flash.style.height = window.params.MINIMUM_HEIGHT + "px";
	} else {
		flash.style.height = flashheight + "px";
	}
	
	// min width
	if (w < window.params.MINIMUM_WIDTH) {
	
		// Set minwidth
		flash.style.width = window.params.MINIMUM_WIDTH + "px";
		jQuery('#wrapper').width(window.params.MINIMUM_WIDTH);
		jQuery('#footer').width(window.params.MINIMUM_WIDTH);
	} else {
	
		// Set fullwidth
		flash.style.width = "100%";
		jQuery('#wrapper').width("100%");
		jQuery('#footer').width("100%");
	}
	if(jQuery.browser.msie){
		if (jQuery('embed, object').size() > 0) {
			if (jQuery('.fullFlash').size() > 0) {
				if (flashheight > window.params.MINIMUM_HEIGHT) {		
					jQuery('#FlashContent, #flashcontent').css('height', parseInt(flashheight) + 'px');
					jQuery('embed, object').attr('height', parseInt(flashheight));
					moveFooter();
				}
				else {
					jQuery('#FlashContent, #flashcontent').css('height', window.params.MINIMUM_HEIGHT + 'px');
					jQuery('embed, object').attr('height', window.params.MINIMUM_HEIGHT);
					moveFooter();
				}
			}
		}
	}
}

