var new_win

function preview(url, width, height, title, alt) {
if (new_win_open()) {
new_win.close()
}

var append

function replace_string (find_string, replace_string) {

var temp_string = this
var left_string
var right_string
var start_location
var replace_location = temp_string.indexOf (find_string)
while (replace_location != -1) {
left_string = temp_string.left(replace_location)
right_string = temp_string.substring(replace_location + find_string.length)
temp_string = left_string + replace_string + right_string
start_location = replace_location + replace_string.length
replace_location = temp_string.indexOf (find_string, start_location)
}
return temp_string

}

function extract_left (total_chars) {
return this.substring(0, total_chars)
string.prototype.left = extract_left
string.prototype.replace = replace_string
}

var my_string = (alt)
var replaced_string = my_string.replace ("<br>", " " )

var append
if (my_string.indexOf ("<br>") != -1) {append = 35
}
else {append = 18
}

height = height + append
win_par = "width=" + (width) + ",height=" + (height)

htm = "<html><head><meta http-equiv='Content-Type' content='text/html; charset=windows-1252'>"
htm += "<title>" + title + "</title><style type=text/css>"
htm += "body{margin:0;background:#000000;text-align:center;font-family:Arial;font-size:8pt;font-weight:bold;color:#FFFFFF;}"
htm += "</style></head><body><img src='" + url + "' alt='"+ replaced_string +"'>"
htm += "<br>"+ alt +"</body></html>"

new_win = window.open("", "new_win", win_par)
new_win.document.open()
new_win.document.write(htm)
new_win.document.close()

function new_win_open() {

if (!new_win) {
return false
}

else if (new_win.closed) {
return false
}

else {
return true
}

}

}