window.focus();

var minWidth = 1000;
var minHeight = 580;
var flashId = 'flashcontent';
var rs_height_delay;
var userAgent = navigator.userAgent.toLowerCase();
var fuck_safari = false;
if (userAgent.indexOf('macintosh')!=-1 && userAgent.indexOf('safari')!=-1) {
	fuck_safari = true;
}

window.onresize = function(){
	setMinSize(flashId,minWidth,minHeight);
}
window.onload = function(){
	setMinSize(flashId,minWidth,minHeight);
}

function setObj(idName){
	return document.all ? document.all(idName) : document.getElementById ? document.getElementById(idName) : document.layers[idName];
}

function setMinHeightValue (new_height){
	if (Math.round(new_height) != minHeight) {
		minHeight = Math.round(new_height);
		//alert('new_height1= ' + minHeight);
		if(fuck_safari){
			var Obj = setObj(flashId);
			if (Obj.style) { 
				Obj.style.height = '100%'; 
			}
			Obj.height = '100%';
			if (Obj.style) {
				Obj.style.width = '100%';
			}
			Obj.width = '100%';
			rs_height_delay = window.setTimeout("resizeTimeoutFunction()", 10);			
		}else{
			setMinSize(flashId,minWidth,minHeight);	
		}
	}
}
function resizeTimeoutFunction () {
	setMinSize(flashId,minWidth,minHeight);
}
function setMinWidthValue (new_width){
	if (Math.round(new_width) != minWidth) {
		minWidth = Math.round(new_width);
		alert('new_width1= ' + minWidth);
		setMinSize(flashId,minWidth,minHeight);
	}
}

function setMinSize(id, minWidth, minHeight) {
	if(rs_height_delay != null){
		window.clearTimeout(rs_height_delay);
	}
	if (!id || !minWidth || !minHeight) { return; }
	var Obj = setObj(id);
	if (Obj) {
		if (getWindowHeight() <= minHeight) {
			if (Obj.style) { Obj.style.height = minHeight+'px'; }
			Obj.height = minHeight;
		} else {
			if (Obj.style) { Obj.style.height = '100%'; }
			Obj.height = '100%';
		}
		if (getWindowWidth() <= minWidth) {
			if (Obj.style) { Obj.style.width = minWidth+'px'; }
			Obj.width = minWidth;
		} else {
			if (Obj.style) { Obj.style.width = '100%'; }
			Obj.width = '100%';
		}
	}
}

function getWindowWidth(){
	if(window.innerWidth) return window.innerWidth;
	if(document.documentElement && document.documentElement.clientWidth){
		return document.documentElement.clientWidth;
	}
	else if(document.body && document.body.clientWidth){
		return document.body.clientWidth;
	}
	return 0;
}


function getWindowHeight(){
	if(window.innerHeight) return window.innerHeight;
	if(document.documentElement && document.documentElement.clientHeight){
		return document.documentElement.clientHeight;
	}
	else if(document.body && document.body.clientHeight){
	return document.body.clientHeight;
	}
	return 0;
}

var realSizeWidth =getWindowWidth();
var realSizeHeight = getWindowHeight();

if(!!realSizeWidth < minWidth)ratedWidth = realSizeWidth;
if(!!realSizeHeight < minHeight)ratedHeight = realSizeHeight;

if(realSizeWidth<minWidth){
	ratedWidth = minWidth;
}else{
	ratedWidth = "100%";
}

if(realSizeHeight<minHeight){
	ratedHeight = minHeight;
}else{
	ratedHeight = "100%";
}