function preview_image_sub(img_src, mid) {
	img = new Image();
	img.src = img_src;
	setTimeout('view_image_sub(img.src, img.width, img.height, '+mid+')', 500);
}
function view_image_sub(img_src, img_width, img_height, mid) {
	text = items_text[mid];
	if (img_width>screen.availWidth-150 || img_width==0) {
		win_width = screen.availWidth-150;
	}
	else {
		win_width = img_width+60;
	}
	if (img_height > screen.availHeight-150 || img_height==0) {
		win_height = screen.availHeight-150;
	}
	else {
		win_height = img_height+155;
	}
	win_top  = Math.abs((screen.availHeight - win_height)/3);
	win_left = Math.abs((screen.availWidth - win_width)/3);
	photoWindow = window.open('', '', 'top='+win_top+',left='+win_left+',width='+win_width+',height='+win_height+',scrollbars');
	photoWindow.document.write('<head><title>'+text['title']+'</title>');
	photoWindow.document.write('<link rel="STYLESHEET" type="text/css" href="/css/main.css">');
	photoWindow.document.write('<link rel="STYLESHEET" type="text/css" href="/css/style.css">');
	photoWindow.document.write('<scr'+'ipt type=text/javascript>');
	photoWindow.document.write('document.onkeypress = function CloseOnEsc(key) {if(document.all) {var keyCode = window.event.keyCode;} else {if (key.which == 0) {window.close(); return;}} if (keyCode == 27) {window.close(); return;}}');
	photoWindow.document.write('</scr'+'ipt>');
	photoWindow.document.write('</head><body><div style="padding: 20px 0 20px 30px;">');
	if (text['title']) photoWindow.document.write('<h1>'+text['title']+'</h1>');
	if (text['worktype']) photoWindow.document.write('<h2>'+text['worktype']+'</h2>');
//	if (text['type']) photoWindow.document.write('<h3>'+text['type']+'</h3>');
//	if (text['descr']) photoWindow.document.write('<p>'+text['descr']+'</p>');
//	if (text['description']) photoWindow.document.write('<p>'+text['description']+'</p>');
	photoWindow.document.write('<p><img src="'+img_src+'"');
	if ((img_width > 1) && (img_height > 1) ) {
		photoWindow.document.write(' width="'+img_width+'" height="'+img_height+'"');
	}
	if (text['imgAlt']) {
		photoWindow.document.write(' alt="'+text['imgAlt']+'"');
	}
	if (text['imgTitle']) {
		photoWindow.document.write(' title="'+text['imgTitle']+'"');
	}
	photoWindow.document.write(' onclick="window.close()"></p>');
//	if (text['description']) photoWindow.document.write('<br><div style="margin: 0 30px 20px 0;">'+text['description']+'</div>');
	if (text['descriptionParent']) photoWindow.document.write('<br><br><p>'+text['descriptionParent']+'</p>');
	photoWindow.document.write('<a href="" onclick="window.close(); return false;" class="red"><img src="/img/close.gif" width="15" height="10" alt="" align="middle">'+closeWindow+'</a>');
	photoWindow.document.write('</div></body></html>');
	photoWindow.document.close();
}
function view_video(video_src, mid) {
	text = items_text[mid];
	win_width = 352+60;
	win_height = 304+255;
	win_top  = Math.abs((screen.availHeight - win_height)/3);
	win_left = Math.abs((screen.availWidth - win_width)/3);
	videoWindow = window.open('', '', 'top='+win_top+',left='+win_left+',width='+win_width+',height='+win_height);
	videoWindow.document.write('<head><title>'+text['title']+'</title>');
	videoWindow.document.write('<link rel="STYLESHEET" type="text/css" href="/css/main.css">');
	videoWindow.document.write('<link rel="STYLESHEET" type="text/css" href="/css/style.css">');
	videoWindow.document.write('<scr'+'ipt type=text/javascript>');
	videoWindow.document.write('document.onkeypress = function CloseOnEsc(key) {if(document.all) {var keyCode = window.event.keyCode;} else {if (key.which == 0) {window.close(); return;}} if (keyCode == 27) {window.close(); return;}}');
	videoWindow.document.write('</scr'+'ipt>');
	videoWindow.document.write('</head><body><div style="padding: 20px 0 0 30px;">');
	if (text['title']) videoWindow.document.write('<h1>'+text['title']+'</h1>');
	if (text['worktype']) videoWindow.document.write('<h2>'+text['worktype']+'</h2>');
//	if (text['type']) videoWindow.document.write('<h3>'+text['type']+'</h3>');
//	if (text['descr']) videoWindow.document.write('<p>'+text['descr']+'</p>');
//	if (text['description']) videoWindow.document.write('<p>'+text['description']+'</p>');
	videoWindow.document.write('<object classid="clsid:02BF25D5-8C17-4B23-BC80-D3488ABDDC6B" width="352" height="304" codebase="http://www.apple.com/qtactivex/qtplugin.cab">');
	videoWindow.document.write('<param name="src" value="'+video_src+'">');
	videoWindow.document.write('<param name="autoplay" value="true">');
	videoWindow.document.write('<param name="bgcolor" value="#000000">');
	videoWindow.document.write('<param name="controller" value="true">');
	videoWindow.document.write('<embed bgcolor="#000000" src="'+video_src+'" width="352" height="304" autoplay="true" controller="true" pluginspage="http://www.apple.com/quicktime/download/"></embed>');
	videoWindow.document.write('</object>');
//	if (text['description']) videoWindow.document.write('<br><p>'+text['description']+'</p>');
	if (text['descriptionParent']) videoWindow.document.write('<br><br><p>'+text['descriptionParent']+'</p>');
	videoWindow.document.write('<div style="margin-top: 10px;"><a href="" onclick="window.close(); return false;" class="red"><img src="/img/close.gif" width="15" height="10" alt="" align="middle">'+closeWindow+'</a></div>');
	videoWindow.document.write('</div></body></html>');
	videoWindow.document.close();
}
function view_audio(audio_src, mid) {
	text = items_text[mid];
	win_width = 352+60;
	win_height = 304+155;
	win_top  = Math.abs((screen.availHeight - win_height)/3);
	win_left = Math.abs((screen.availWidth - win_width)/3);
	videoWindow = window.open('', '', 'top='+win_top+',left='+win_left+',width='+win_width+',height='+win_height);
	videoWindow.document.write('<head><title>'+text['title']+'</title>');
	videoWindow.document.write('<link rel="STYLESHEET" type="text/css" href="/css/main.css">');
	videoWindow.document.write('<link rel="STYLESHEET" type="text/css" href="/css/style.css">');
	videoWindow.document.write('<scr'+'ipt type=text/javascript>');
	videoWindow.document.write('document.onkeypress = function CloseOnEsc(key) {if(document.all) {var keyCode = window.event.keyCode;} else {if (key.which == 0) {window.close(); return;}} if (keyCode == 27) {window.close(); return;}}');
	videoWindow.document.write('</scr'+'ipt>');
	videoWindow.document.write('</head><body>');
//	<embed src="melody.mid" type="audio/x-midi" width="145" height="45" autostart="true" loop="3">
	videoWindow.document.write('<div style="padding: 20px 0 0 30px;">');
	if (text['title']) videoWindow.document.write('<h1>'+text['title']+'</h1>');
	if (text['worktype']) videoWindow.document.write('<h2>'+text['worktype']+'</h2>');
//	if (text['type']) videoWindow.document.write('<h3>'+text['type']+'</h3>');
//	if (text['descr']) videoWindow.document.write('<p>'+text['descr']+'</p>');
//	if (text['description']) videoWindow.document.write('<p>'+text['description']+'</p>');
//	videoWindow.document.write('<center><embed src="'+audio_src+'" autostart="true"></center>');
	videoWindow.document.write('<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,0,0" width="100" height="20" id="music" align="middle">');
	videoWindow.document.write('<param name="allowScriptAccess" value="sameDomain" />');
	videoWindow.document.write('<param name="movie" value="/img/swf/music.swf?aud='+audio_src+'" />');
	videoWindow.document.write('<param name="quality" value="high" />');
	videoWindow.document.write('<param name="bgcolor" value="#ffffff" />');
	videoWindow.document.write('<embed src="/img/swf/music.swf?aud='+audio_src+'" quality="high" bgcolor="#ffffff" width="100" height="20" name="music" align="middle" allowScriptAccess="sameDomain" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" />');
	videoWindow.document.write('</object>');
//	if (text['description']) videoWindow.document.write('<br><p>'+text['description']+'</p>');
	if (text['descriptionParent']) videoWindow.document.write('<br><br><p>'+text['descriptionParent']+'</p>');
	videoWindow.document.write('<div style="margin-top: 10px;"><a href="" onclick="window.close(); return false;" class="red"><img src="/img/close.gif" width="15" height="10" alt="" align="middle">'+closeWindow+'</a></div>');
	videoWindow.document.write('</div></body></html>');
	videoWindow.document.close();
}

function view_video1(video_src, mid) {
	/*text = items_text[mid];
	win_width = 352+60;
	win_height = 304+255;
	win_top  = Math.abs((screen.availHeight - win_height)/3);
	win_left = Math.abs((screen.availWidth - win_width)/3);
	videoWindow = window.open('', '', 'top='+win_top+',left='+win_left+',width='+win_width+',height='+win_height);
	videoWindow.document.write('<head><title></title>');
	videoWindow.document.write('<link rel="STYLESHEET" type="text/css" href="/css/main.css">');
	videoWindow.document.write('<link rel="STYLESHEET" type="text/css" href="/css/style.css">');
	videoWindow.document.write('<scr'+'ipt type=text/javascript>');
	videoWindow.document.write('document.onkeypress = function CloseOnEsc(key) {if(document.all) {var keyCode = window.event.keyCode;} else {if (key.which == 0) {window.close(); return;}} if (keyCode == 27) {window.close(); return;}}');
	videoWindow.document.write('</scr'+'ipt>');
	videoWindow.document.write('</head><body><div style="padding: 20px 0 0 30px;">');
	videoWindow.document.write('<object classid="clsid:02BF25D5-8C17-4B23-BC80-D3488ABDDC6B" width="352" height="304" codebase="http://www.apple.com/qtactivex/qtplugin.cab">');
	videoWindow.document.write('<param name="src" value="'+video_src+'">');
	videoWindow.document.write('<param name="autoplay" value="true">');
	videoWindow.document.write('<param name="bgcolor" value="#000000">');
	videoWindow.document.write('<param name="controller" value="true">');
	videoWindow.document.write('<embed bgcolor="#000000" src="'+video_src+'" width="352" height="304" autoplay="true" controller="true" pluginspage="http://www.apple.com/quicktime/download/"></embed>');
	videoWindow.document.write('</object>');
//	if (text['description']) videoWindow.document.write('<br><p>'+text['description']+'</p>');
	videoWindow.document.write('</div></body></html>');
	videoWindow.document.close();*/
	text = items_text[mid];
	win_width = 352+60;
	win_height = 304+255;
	win_top  = Math.abs((screen.availHeight - win_height)/3);
	win_left = Math.abs((screen.availWidth - win_width)/3);
	videoWindow = window.open('', '', 'top='+win_top+',left='+win_left+',width='+win_width+',height='+win_height);
	videoWindow.document.write('<head><title>'+text['title']+'</title>');
	videoWindow.document.write('<link rel="STYLESHEET" type="text/css" href="/css/main.css">');
	videoWindow.document.write('<link rel="STYLESHEET" type="text/css" href="/css/style.css">');
	videoWindow.document.write('<scr'+'ipt type=text/javascript>');
	videoWindow.document.write('document.onkeypress = function CloseOnEsc(key) {if(document.all) {var keyCode = window.event.keyCode;} else {if (key.which == 0) {window.close(); return;}} if (keyCode == 27) {window.close(); return;}}');
	videoWindow.document.write('</scr'+'ipt>');
	videoWindow.document.write('</head><body><div style="padding: 20px 0 0 30px;">');
	if (text['title']) videoWindow.document.write('<h1>'+text['title']+'</h1>');
	if (text['worktype']) videoWindow.document.write('<h2>'+text['worktype']+'</h2>');
//	if (text['type']) videoWindow.document.write('<h3>'+text['type']+'</h3>');
//	if (text['descr']) videoWindow.document.write('<p>'+text['descr']+'</p>');
//	if (text['description']) videoWindow.document.write('<p>'+text['description']+'</p>');
	videoWindow.document.write('<object classid="clsid:02BF25D5-8C17-4B23-BC80-D3488ABDDC6B" width="352" height="304" codebase="http://www.apple.com/qtactivex/qtplugin.cab">');
	videoWindow.document.write('<param name="src" value="'+video_src+'">');
	videoWindow.document.write('<param name="autoplay" value="true">');
	videoWindow.document.write('<param name="bgcolor" value="#000000">');
	videoWindow.document.write('<param name="controller" value="true">');
	videoWindow.document.write('<embed bgcolor="#000000" src="'+video_src+'" width="352" height="304" autoplay="true" controller="true" pluginspage="http://www.apple.com/quicktime/download/"></embed>');
	videoWindow.document.write('</object>');
//	if (text['description']) videoWindow.document.write('<br><p>'+text['description']+'</p>');
	if (text['descriptionParent']) videoWindow.document.write('<br><br><p>'+text['descriptionParent']+'</p>');
	videoWindow.document.write('<div style="margin-top: 10px;"><a href="" onclick="window.close(); return false;" class="red"><img src="/img/close.gif" width="15" height="10" alt="" align="middle">'+closeWindow+'</a></div>');
	videoWindow.document.write('</div></body></html>');
	videoWindow.document.close();

}
function view_audio1(audio_src, mid) {
	text = items_text[mid];
	win_width = 352+60;
	win_height = 304+155;
	win_top  = Math.abs((screen.availHeight - win_height)/3);
	win_left = Math.abs((screen.availWidth - win_width)/3);
	videoWindow = window.open('', '', 'top='+win_top+',left='+win_left+',width='+win_width+',height='+win_height);
	videoWindow.document.write('<head><title></title>');
	videoWindow.document.write('<link rel="STYLESHEET" type="text/css" href="/css/main.css">');
	videoWindow.document.write('<link rel="STYLESHEET" type="text/css" href="/css/style.css">');
	videoWindow.document.write('<scr'+'ipt type=text/javascript>');
	videoWindow.document.write('document.onkeypress = function CloseOnEsc(key) {if(document.all) {var keyCode = window.event.keyCode;} else {if (key.which == 0) {window.close(); return;}} if (keyCode == 27) {window.close(); return;}}');
	videoWindow.document.write('</scr'+'ipt>');
	videoWindow.document.write('</head><body>');
	videoWindow.document.write('<div style="padding: 20px 0 0 30px;">');
	videoWindow.document.write('<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,0,0" width="100" height="20" id="music" align="middle">');
	videoWindow.document.write('<param name="allowScriptAccess" value="sameDomain" />');
	videoWindow.document.write('<param name="movie" value="/img/swf/music.swf?aud='+audio_src+'" />');
	videoWindow.document.write('<param name="quality" value="high" />');
	videoWindow.document.write('<param name="bgcolor" value="#ffffff" />');
	videoWindow.document.write('<embed src="/img/swf/music.swf?aud='+audio_src+'" quality="high" bgcolor="#ffffff" width="100" height="20" name="music" align="middle" allowScriptAccess="sameDomain" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" />');
	videoWindow.document.write('</object>');
	videoWindow.document.write('<div style="margin-top: 10px;"><a href="" onclick="window.close(); return false;" class="red"><img src="/img/close.gif" width="15" height="10" alt="" align="middle">'+closeWindow+'</a></div>');
	videoWindow.document.write('</div></body></html>');
	videoWindow.document.close();
}


function view_image_sub1(img_src, img_width, img_height, mid) {
	text = items_text[mid];
	if (img_width>screen.availWidth-150 || img_width==0) {
		win_width = screen.availWidth-150;
	}
	else {
		win_width = img_width+60;
	}
	if (img_height > screen.availHeight-150 || img_height==0) {
		win_height = screen.availHeight-150;
	}
	else {
		win_height = img_height+155;
	}
	win_top  = Math.abs((screen.availHeight - win_height)/3);
	win_left = Math.abs((screen.availWidth - win_width)/3);
	photoWindow = window.open('', '', 'top='+win_top+',left='+win_left+',width='+win_width+',height='+win_height+',scrollbars');
	photoWindow.document.write('<head><title></title>');
	photoWindow.document.write('<link rel="STYLESHEET" type="text/css" href="/css/main.css">');
	photoWindow.document.write('<link rel="STYLESHEET" type="text/css" href="/css/style.css">');
	photoWindow.document.write('<scr'+'ipt type=text/javascript>');
	photoWindow.document.write('document.onkeypress = function CloseOnEsc(key) {if(document.all) {var keyCode = window.event.keyCode;} else {if (key.which == 0) {window.close(); return;}} if (keyCode == 27) {window.close(); return;}}');
	photoWindow.document.write('</scr'+'ipt>');
	photoWindow.document.write('</head><body><div style="padding: 20px 0 20px 30px;">');
	photoWindow.document.write('<p><img src="'+img_src+'"');
	if ((img_width > 1) && (img_height > 1) ) {
		photoWindow.document.write('width="'+img_width+'" height="'+img_height+'" alt=""');
	}
	photoWindow.document.write(' onclick="window.close()"></p>');
	photoWindow.document.write('<a href="" onclick="window.close(); return false;" class="red"><img src="/img/close.gif" width="15" height="10" alt="" align="middle">'+closeWindow+'</a>');
	photoWindow.document.write('</div></body></html>');
	photoWindow.document.close();
}

function preview_image_sub1(img_src, mid) {
	img = new Image();
	img.src = img_src;
	setTimeout('view_image_sub1(img.src, img.width, img.height, '+mid+')', 500);
}
