main = {
	init: function(){
		if(this._INIT == null){
			this._INIT = true;
			this.flashMinH = 700;
			this.minS = {w:990,h:this.flashMinH};
			this.maxS = {w:999999,h:999999};
		}
	}
}
main.init();

function ajustFlashSize(){
	var minS = main.minS;
	minS.h = (main.flashMinH > main.minS.h) ? main.flashMinH : main.minS.h;
	var maxS = main.maxS;
	var winS = getWindowSize();
	var tS = {w:"100%", h:"100%"};
	if(winS.w < minS.w) tS.w = minS.w + "px";
	if(winS.h < minS.h) tS.h = minS.h + "px";
	if(winS.w > maxS.w) tS.w = maxS.w + "px";
	if(winS.h > maxS.h) tS.h = maxS.h + "px";
	var tE = findObj("flashcontent");
	tE.style.width = tS.w;
	tE.style.height = tS.h;
}

function setHeight(mH){
	main.minS.h = mH;
	var winS = getWindowSize();
	if(winS.h > mH) mH = "100%";
	var tE = findObj("flashcontent");
	tE.style.height = mH;
}
function setFlashMinH(mH){	
	main.flashMinH = mH;
}

//-----
function getWindowSize() {
	var myWidth = 0, myHeight = 0;
	if( typeof( window.innerWidth ) == 'number' ) {
		//Non-IE
		myWidth = window.innerWidth;
		myHeight = window.innerHeight;
		myWidthB = document.documentElement.clientWidth;
		if(myWidth != myWidthB || (myWidth-myWidthB)<50)myWidth = myWidthB;
	} else if( document.documentElement && ( document.documentElement.clientWidth || document.documentElement.clientHeight ) ) {
		//IE 6+ in 'standards compliant mode'
		myWidth = document.documentElement.clientWidth;
		myHeight = document.documentElement.clientHeight;
	} else if( document.body && ( document.body.clientWidth || document.body.clientHeight ) ) {
		//IE 4 compatible
		myWidth = document.body.clientWidth;
		myHeight = document.body.clientHeight;
	}
	return {w:myWidth,h:myHeight};
}
function findObj(theObj, theDoc){
	var p, i, foundObj;  
	if(!theDoc) theDoc = document;
	if( (p = theObj.indexOf("?")) > 0 && parent.frames.length){
		theDoc = parent.frames[theObj.substring(p+1)].document;
		theObj = theObj.substring(0,p);
	}
	if(!(foundObj = theDoc[theObj]) && theDoc.all) foundObj = theDoc.all[theObj];
	for (i=0; !foundObj && i < theDoc.forms.length; i++) 
		foundObj = theDoc.forms[i][theObj];
	for(i=0; !foundObj && theDoc.layers && i < theDoc.layers.length; i++) 
		foundObj = findObj(theObj,theDoc.layers[i].document);
	if(!foundObj && document.getElementById) foundObj = document.getElementById(theObj);  
	return foundObj;
}

function trace(v){
	if(window.console!=null){
		window.console.log(v);	
	}
}
