var wWidth = 1200;
var wHeight = 800;
resize = function (){
	thisObj=this;
	this.timeout;
	this.bg = document.getElementById('bg');
	this.wrapper = document.getElementById('wrapper');
	this.content = document.getElementById('content');
	window.onresize = function(){
		//thisObj.chSize('res');
		thisObj.timeout = window.setTimeout(function(){
			thisObj.chSize();
		}, 100);
	};
}
resize.prototype = {
	chSize:function(type){
		window.clearTimeout(this.timeout);
		this.anpassen();
	},
	getScreenHeight:function(){
		document.documentElement.clientWidth ? wWidth = document.documentElement.clientWidth : wWidth = window.innerWidth;
		document.documentElement.clientHeight ? wHeight = document.documentElement.clientHeight : wHeight = window.innerHeight;
	},
	anpassen:function(elem){
		this.getScreenHeight();
		
		this.bg = document.getElementById('bg');
		if(this.bg==null)
			return false;
		this.wrapper = document.getElementById('wrapper');
		this.content = document.getElementById('content');
		
		this.bg.style.display = 'block';
		this.bg.style.width = wWidth+"px";
		this.bg.style.height = wHeight+"px";
		//this.content.style.height = wHeight+'px';
		//wWidth = Math.max(refObjWidth, wWidth);
		//wHeight = Math.max(refObjHeight, wHeight);
		var screen_w_h = wWidth/wHeight;
		var pic_w = 1200;
		var pic_h = 800;
		var pic_w_h = pic_w/pic_h;
		var scale_w_h;
		if(pic_w_h>=1){
			/*if (pic_w_h == screen_w_h) {
				scale_w_h = Stage.width/pic_w;
			} else if (pic_w_h<screen_w_h) {
				scale_w_h = wWidth/pic_w;
			} else if (pic_w_h>screen_w_h) {*/
				scale_w_h = wHeight/pic_h;
			//}
		}else{
			/*if (pic_w_h == screen_w_h) {
				scale_w_h = wWidth / pic_w;
			}else if (pic_w_h>screen_w_h) {
				scale_w_h = wWidth/pic_w;
			} else if (pic_w_h<screen_w_h) {*/
				scale_w_h = wHeight/pic_h;
			//}
		}
		this.bg.childNodes[0].firstChild.firstChild.style.width = Math.round(scale_w_h*pic_w)+"px";
		this.bg.childNodes[0].firstChild.firstChild.style.height = Math.round(scale_w_h*pic_h)+"px";
		//this.bg.childNodes[0].firstChild.style.left = -(Math.round(scale_w_h*pic_w)-wWidth)/2+'px';
		//this.bg.childNodes[0].firstChild.style.top = -(Math.round(scale_w_h*pic_h)-wHeight)/2+'px';
		
		this.bg.childNodes[1].firstChild.firstChild.style.width = Math.round(scale_w_h*pic_w)+"px";
		this.bg.childNodes[1].firstChild.firstChild.style.height = Math.round(scale_w_h*pic_h)+"px";
		//this.bg.childNodes[1].firstChild.style.left = -(Math.round(scale_w_h*pic_w)-wWidth)/2+'px';
		//this.bg.childNodes[1].firstChild.style.top = -(Math.round(scale_w_h*pic_h)-wHeight)/2+'px';
		
		var c = document.getElementById('content');
		
		if (typeof c != 'undefined') {
			c.style.height = 'auto';
			startHeight = c.offsetHeight;
			if(lURL!='store')
				c.style.height = Math.max(startHeight+10, wHeight) + 'px';
		}
		
		this.resizeTextArea(wWidth, wHeight);
	},
	resizeTextArea:function(w, h){
		var sH = document.getElementById('scrollHead');
		if(sH != null){
			var wt = Math.max(Math.min(w-330, 1500), 500);
			sH.style.width = wt+'px';
		}
	}
}

