// shrink all images
var ws2 = 0;
function sai() {
	//var ws = window.innerWidth ? window.innerWidth : document.body && document.body.offsetWidth ? document.body.offsetWidth : screen.width;
	//var ws2 = ws/2;
	var ws2 = $('#center').width();
	if(!ws2) {
		var ws = window.innerWidth ? window.innerWidth : document.body && document.body.offsetWidth ? document.body.offsetWidth : screen.width;
		var ws2 = ws/2;
	}
//	alert(ws);
//	alert(ws2);
	if (document.images.length) {
		var i = document.images;
		for (var x = 0; x < i.length; x++) {
			if (i[x].width > ws2) {
				if (typeof i[x].ow == 'undefined') {
					i[x].ow = i[x].width;
					i[x].oh = i[x].height;
				}
				i[x].width = i[x].ow / (i[x].ow / (ws2*0.9));
				if (i[x].height == i[x].oh) {
					i[x].height = i[x].height / (i[x].ow / (ws2*0.9));
				}
				if (i[x].parentNode.nodeName != 'A') {
					i[x].onclick = ri;
					i[x].title = i[x].src;
					i[x].className = 'resized';
				}
			}
		}
	}
};
// restore image (element)
function ri(e) {
	var o = window.event ? window.event.srcElement : e.target;
	o.width = o.ow;
	if (o.height != o.oh) {
		o.height = o.oh;
	}
	o.onclick = si;
};
// shrink image (element)
function si(e) {
	var o = window.event ? window.event.srcElement : e.target;
	o.width = o.width / (o.width / (ws2*0.9));
	if (o.height == o.oh) {
		o.height = o.height / (o.ow / (ws2*0.9));
	}
	o.onclick = ri;
};


