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 load_model_pic ( $object )
{
		var reg1=/.*\/models_pictures\/(.+)/;
		var arr1 = reg1.exec ( document . getElementById ( 'main_model_picture' ) . src );
		var reg2=/.*\/models_pictures\/thumbs\/(.+)/;
		var arr2 = reg2.exec ( $object.src );
		document . getElementById ( 'main_model_picture' ) . src = '/models_pictures/' + arr2[1];
		$object . src = '/models_pictures/thumbs/' + arr1[ 1 ];
		//$object . onclick = 'onclick="load_model_pic(this, '{$model_pictures[i].model_picture}');
}

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 (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() {
}