﻿resize = function() {
	var minH = 616;
	var minW = 1240;
	var h = 610;
	var w = 1240;
	var o = 'auto';
	var stageW =  $(window).width();
	var stageH = $(window).height();
	if(stageW>minW && stageH>minH) {
		o = 'hidden';
	}
	if(stageH>minH) {
		h = stageH;
	}
	if(stageW>minW) {
		w = stageW;
	}
	$('html').css({'overflow':o});
	$('#page').css({'width':w+"px",'height':h+"px"});
}

startCheckResize = function() {
	if(!runningCheckResize) {
		runningCheckResize = true;
		store = {oldWidth:$(window).width(),oldHeight:$(window).height()}
		intervalID = window.setInterval(checkResize,300);
	}
}

checkResize = function() {
	var newWidth = $(window).width();
	var newHeight = $(window).height();
	if(newWidth==store.oldWidth && newHeight==store.oldHeight) {
		resize();
		resize();
		clearInterval(intervalID);
		runningCheckResize = false;
	} else {
		store.oldWidth = newWidth;
		store.oldHeight = newHeight;
	}
}

$(document).ready(function () {
	if(swfobject.getFlashPlayerVersion().major>6) {
		swfobject.embedSWF("public/swf/website.swf", "flashContent", '100%', '100%', "9.0.0",  'public/swf/expressInstall.swf', flashvar, {menu: 'false', wmode: 'opaque'}, {id: 'flashObject'});
		runningCheckResize = false;
		resize();
		resize();
		$(window).resize(startCheckResize);
	}
});

trackNull = function(url) {
	//serve per annullare il tracking automatico di SWFAddress
}

trackPage = function(url) {
	//console.log("testTracker: "+url);
	_gaq.push(['_trackPageview', url]);
}

trackEvent = function(category, action, label) {
	//console.log(category +" "+ action+" "+ label);
	_gaq.push(['_trackEvent', category, action, label]);
}

