function w_open (url)
{
	wn = 'wname' + Math.round (Math.random () * 10000);
	settings = 'toolbar=yes,location=yes,directories=yes,status=yes,menubar=yes,scrollbars=yes,resizable=yes,left=0,top=0,width=' +screen.availWidth +',height=' +screen.availHeight +'';
	openedWindow = window.open (url, wn, settings);
	if (openedWindow.opener == null) openedWindow.opener = self;
	openedWindow.focus();
}

function openImage ( $image, $title )
{
		document . body . innerHTML += '<img src="'+$image+'" onload="test(this, \''+$image+'\', \''+$title+'\');" style="display: none;"/>';
}

function test ( $sender, $image, $title )
{
		img = new Image ( );
		img . src = $image;
		$width = img . width + 10;
		$height = img.height + 10;
		//$title = $title;
		$sender . parentNode . removeChild ( $sender );
		
		$settings = 'toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=no,left='+((screen.availWidth - $width) / 2 )+',top='+((screen.availHeight - $height) / 2 )+',width='+$width+',height=' + $height;
		openedWindow = window.open ('about:blank', '', $settings);
		openedWindow.document.writeln ( '<html><head><title>'+$title+'</title></head><body style="margin: 0px 0px 0px 0px; height: 0px 0px 0px 0px;"><table border="0" cellpadding="0" cellspacing="0" width="100%" height="100%"><tbody><tr><td align="center"><img id="pic" src="'+$image+'"/></td></tr></tbody></table></body></html>' );
}


function test ( $sender, $image, $title )
{
		img = new Image ( );
		img . src = $image;
		$width = img . width + 10;
		$height = img.height + 10;
		//$title = $title;
		$sender . parentNode . removeChild ( $sender );
		
		$settings = 'toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=no,left='+((screen.availWidth - $width) / 2 )+',top='+((screen.availHeight - $height) / 2 )+',width='+$width+',height=' + $height;
		openedWindow = window.open (null, '', $settings);
		openedWindow.document.writeln ( '<html><head><title>'+$title+'</title></head><body style="margin: 0px 0px 0px 0px; height: 0px 0px 0px 0px;"><table border="0" cellpadding="0" cellspacing="0" width="100%" height="100%"><tbody><tr><td align="center"><img id="pic" src="'+$image+'"/></td></tr></tbody></table></body></html>' );
		//$width = openedWindow.document.getElementById ( 'pic' ) . offsetWidth + padding;
		//$height = openedWindow.document.getElementById ( 'pic' ) . offsetHeight + padding;
		//openedWindow . resizeTo ( $width + padding, $height + padding );
}

function w_resize() {
	if (navigator.userAgent == "Safari")
	{
	window.onresize=w_resize;
	table_top.style.width=990;
	table_top.style.width=document.width;
	} 
}

function checkPeriod(target) {
			var cls = target.className.split(' ');
			var inps = document.getElementById('number_checkboxes').getElementsByTagName('input');
			for (var i = 0; i < inps.length; i++) {
				var matched = true;
				var ci = inps[i];
				for (var j = 0; j < cls.length; j++) {
					if (!ci.className.match(new RegExp('(^|\\s+)'+cls[j]+'(\\s+|$)'))) {
						matched = false;
					}
				}
				if (matched) {
					ci.checked = target.checked;
				}
			}
		}