window.onload = setScreenClass;
window.onresize = setScreenClass;
// Following transition classes will be declared:
//
// classname screenwidth
// ------------------------------------------
// pda_v 240px
// pda_h 320px
// ultralow 320px - 640px
// screen_lo 640px - 800px
// screen_med 800px - 1024px
// screen_hi 1024px - 1280px
// screen_wide > 1280px
function getSizes() {
	
}
function setScreenClass() {
	var w =  document.body.clientWidth || innerWidth;
	var h = document.body.clientHeight || innerHeight;
	var W =  document.body.clientWidth || outerWidth;
	var H = document.body.clientHeight || outerHeight;
	var Sw = screen.width;
	var Sh = screen.height;
	// var cls = ( fmt<=800 ) ? 'screen_low':(fmt>800&&fmt<=1024)?'screen_med':(fmt>1024&&fmt<=1280)?'screen_high':'screen_wide';
	// document.getElementById('count').innerHTML=fmt+'px -> '+cls;
	// document.body.className=cls;
	//document.getElementById('scroller').style.width = 0.429*fmt;
	if (document.getElementById('xscroller')) {
		document.getElementById('xscroller').style.height = (document.getElementById('left_col').offsetHeight - document.getElementById('header').offsetHeight)*0.85 + 'px';
		document.getElementById('content').style.height = (document.getElementById('left_col').offsetHeight - document.getElementById('header').offsetHeight)*0.9 + 'px';
		CSBfleXcroll('xscroller');
	}
	if (document.getElementById('resize_photoes')) {
		var our_div = document.getElementById('resize_photoes');
		var our_width = document.getElementById('resize_photoes_c').offsetWidth;
		var our_height = H;
		document.getElementById('resize_photoes').style.height = our_height + 'px';
		var imgs = our_div.getElementsByTagName('IMG');
		for (var i = 0; i < imgs.length; i++) {
			imgs[i].style.width = our_width+'px';
			//imgs[i].src = imgs[i].title;
			imgs[i].src = '/lib/templates/image.php?name='+imgs[i].title+'&width='+our_width;
		}
	}
	if (document.getElementById('resize_photoes2')) {
		var our_div = document.getElementById('resize_photoes2');
		
		var our_width = Math.floor(w/7) + 16;
		
		var imgs = our_div.getElementsByTagName('IMG');
		for (var i = 0; i < imgs.length; i++) {
			imgs[i].style.width = our_width+'px';
			imgs[i].src = '/lib/templates/image.php?name='+imgs[i].title+'&width='+our_width;
		}
	}
	if (document.getElementById('galery_big')) {
		var our_big_pic = document.getElementById('galery_big');
		var myParent = our_big_pic.parentNode.parentNode.parentNode;
		var galery_width = Math.floor(myParent.offsetWidth/90)*90 - 10;
		//var galery_width = Math.floor(our_big_pic.parentNode.parentNode.offsetWidth/90)*90 -10;
		
		
		our_big_pic.style.width = galery_width + 'px';
		our_big_pic.parentNode.style.width = galery_width + 'px';
		our_big_pic.parentNode.parentNode.style.width = (Number(galery_width) + 25) +  'px';
		
		our_big_pic.src = '/lib/templates/image.php?name='+$($(our_big_pic).parentNode).getElementsByClassName('url_pic_big')[0].innerHTML+'&width='+galery_width;
	}
}
function open_sp(id) {
	var divs = document.getElementsByTagName('DIV');
	for (var i = 0; i < divs.length; i++) {
		if (divs[i].className == 'n_win_cont') {
			if (divs[i].id == id) {
				divs[i].style.display = 'block';
			} else {
				divs[i].style.display = 'none';
			}
		}
	}
}
function close_win(obj) {
	obj.parentNode.parentNode.style.display = 'none';
}
