var rs;
var can;
var rq;
var head;

resize = function(elems){
	var thisObj = this;
	this._elems = elems;
	
	this._wWidth = 1024;
	this._wHeight = 768;
	
	$(window).addEvent('resize', function(){
		thisObj.timeout = window.setTimeout(function(){
			thisObj.getSize();
			thisObj.chSize();
			if(typeof can=='object')
				can.getImgs();
			if(typeof gal=='object')
				gal.resize();
		}, 300);
		thisObj.getSize();
		thisObj.chSize();
	});
	
	this._refresh;
}
resize.prototype = {
	getSize:function(){
		this._wWidth = DOOMLIB.getPageWidth();
		this._wHeight = DOOMLIB.getPageHeight();
	},
	chSize:function(type){
		window.clearTimeout(this._refresh);
		this.set(this._elems);
		this.scrollable();
	},
	set:function(elems){
		for(var v in elems){
			$(elems[v]).setStyle('width', (this._wWidth)+'px');
			$(elems[v]).setStyle('height', (this._wHeight)+'px');
		}
	},
	scrollable:function(){
		var cent = hasClass('centastar')[0];
		var subMenue = hasClass('centerMenSub')[0];
		var list = hasClass('alignTop', 'div');
		for(var i=0;i<list.length;i++){
			if(typeof cent!='undefined'){
				var height = 150;
				if(typeof subMenue!='undefined'){
					height=180;
				}
				$(list[i]).setStyle('top', height+'px');
				var noPadd = hasClass('noPadding')[0];
				if(noPadd==list[i])
					padding = 27;
				else
					padding = 57;

				$(list[i]).setStyle('height', this._wHeight-padding-DOOMLIB.getPageY(list[i])+'px');
			}else
				$(list[i]).setStyle('height', this._wHeight-57-DOOMLIB.getPageY(list[i])+'px');
		}
	}
}
function hasClass(name, type){
	var r = [];
	var re = new RegExp("(^|\\s)"+name+"(\\s|$)");
	var e = document.getElementsByTagName(type || "*");
	
	for(var j=0;j<e.length;j++){
		if(re.test(e[j].className)) r.push(e[j]);
	}
	return r;
}
