var new_window

function display_image(image_putch, width, height) {

if (window_available()) { new_window.close() }

//Определение размера окна с помощью атрибутов рисунка

var window_width = width
var window_height = height

//alert (window_width+','+window_height+','+image_putch)

//Создание окна на основе параметров изображения

var window_dimensions = "width=" + window_width + ",height=" + window_height + ",directories=no,resizable=no,scrollbars=no,menubar=no,location=no,status=no,toolbar=no,left=50,top=50"
new_window = window.open("","",window_dimensions)

//Создание кода HTML

new_window.document.writeln('<html>')
new_window.document.writeln('<head>')
new_window.document.writeln('<title><\/title>')

//Использование в качестве заголовка - комментария к фото
new_window.document.title = "RIELA :: Наши объекты"

//Защита от нажатий кнопок на клавиатуре
new_window.document.writeln('<script language="JavaScript"  type="text\/javascript">')

new_window.document.writeln('function press(){')
new_window.document.writeln('alert("Copyright © 2005-2010 г. Все права защищены!")')
new_window.document.writeln('}')

new_window.document.writeln('window.document.onkeydown=press')
new_window.document.writeln('<\/script>')

new_window.document.writeln('<\/head>')

//Проверка существования скрытых границ

new_window.document.writeln
('<body leftmargin="0" topmargin="0" marginwidth="0" marginheight="0" oncopy="return false" oncontextmenu="return false" onselectstart="return false" ondragstart="return false">')

//Создание дескриптора <img> для изображения

new_window.document.writeln
('<img src="' + image_putch + '" onClick=window.close(); alt="' +'Щелчок мышки - закрывает это окно!">')

//Окончание кода HTML
new_window.document.writeln('<\/body>')
new_window.document.writeln('<\/html>')
new_window.document.close()

}

function window_available() {

if (!new_window) {
return false
}

else if (new_window.closed) {
return false
}

else {return true }

}
