
//flash
var flashvars = {swf:"assets/swfs/portfolio.swf",
				fonts:"assets/swfs/fonts.swf",
				css: "css/cortina.css" ,
				xml: "data/cortina.xml"};
var params = {
	wmode:"normal",
	bgcolor:"#000000",
	menu:false
	};
var attributes =  { id:'testObject', name:'testObject' }; // give an id to the flash object


swfobject.embedSWF("assets/swfs/preloader.swf", "flash", "100%", "100%", "9.0.0", "assets/swfs/playerProductInstall.swf", flashvars, params, attributes);	
swfmacmousewheel.registerObject(attributes.id); // mac mousewheel support


// resize script
var minWidth = 1000;
var minHeight = 600;
var isIE = PDH.isIE;
var extraHeight = 0;
var newHeight = 0;
var container;
var browserSize;
var minSet_h = false;
var maxSet_h = false;
var minSet_w = false;
var maxSet_w = false;

function setFluidHeight(){
 	maxSet_h = true;
	minSet_h = false;
	container.height = newHeight + "px";
}

function setFluidWidth(){
	maxSet_w = true;
	minSet_w = false;
	container.width = "100%";		
}

function setMinWidth(){
	container.width = minWidth + "px";
	minSet_w = true;
	maxSet_w = false;
}

function setMinHeight(){
    container.height = minHeight + "px";
	minSet_h = true;
	maxSet_h = false;
}

function addExtraSpace()
{
	return document.getElementById("content").offsetTop + 6;
}

function checkSize()
{	
	browserSize = PDH.Common.getBrowserSize();

	// check height
	if (browserSize.height < minHeight){
		if (!minSet_h){
			setMinHeight();
		}
	} else {
		extraHeight = addExtraSpace();
		newHeight = browserSize.height - extraHeight
		if (isIE){
			var t = setInterval(function(){
				clearInterval(t);
				setFluidHeight()
				}, 200);
		} else {
		   setFluidHeight();
		}
	
	}		
	
	// check width
	if (browserSize.width < minWidth){
		if (!minSet_w){
			setMinWidth();
		}
	} else {
		
		if (isIE){
			var t = setInterval(function(){
				clearInterval(t);					
				setFluidWidth();
				}, 200);
		} else {
		   setFluidWidth();
		}
	
	}		
}

function loaded(){
	container = document.getElementById("content").style;
	window.onresize = function(){
		checkSize();
	}
	checkSize();
}
