/*
function simple_window(image_name,width_size,height_size)
*/

function image_window_scroll_title(image_name,image_title)
{ 

/*
width_size		= width_size+20
height_size		= height_size+30
*/

/*
image_title		= "This is the title used for testing and meant to be very very long";
*/

if (image_title == "")	{ image_title = "This is a big picture that you launched" } ;
image_title		= image_title + "..........";
is_Netscape		= 0;
is_IE			= 0;

if (parseInt(navigator.appVersion.charAt(0))>=4)
{
	is_Netscape	= (navigator.appName=="Netscape")?1:0;
	is_IE		= (navigator.appName.indexOf("Microsoft")!=-1)?1:0;
}

/* Create the new window */

new_window		= window.open("","","left=40,top=0,width=175,height=100") 
if (new_window)
{
new_window.focus()
new_window.document.open()

/* Create the <head> HTML code in the new window */

new_window.document.write("<html>")
new_window.document.write("<head>")
new_window.document.write("<title>Please wait</title>")

new_window.document.write("<script language='javascript'>")
new_window.document.write("var w_size;")
new_window.document.write("var h_size;")
new_window.document.write("var title_text='" + image_title + "';");
new_window.document.write("var title_length=" + image_title.length + ";");
new_window.document.write("var current_position=1;");

/* Set browser variables */

new_window.document.write('is_Netscape=0;')
new_window.document.write('is_IE=0;')
new_window.document.write('if (parseInt(navigator.appVersion.charAt(0))>=4)');
new_window.document.write('{');
new_window.document.write('    is_Netscape=(navigator.appName=="Netscape")?1:0;')
new_window.document.write('    is_IE=(navigator.appName.indexOf("Microsoft")!=-1)?1:0;')
new_window.document.write('}');

/* Function to recursively display the title, producing a scrolling effect */

new_window.document.write("function scroll_title ()")
new_window.document.write("{")
new_window.document.write("    temp_title=title_text.substring(current_position, title_length)")
new_window.document.write("              +title_text.substring(0, current_position);")
new_window.document.write("    document.title=temp_title;")
new_window.document.write("    current_position++;")
new_window.document.write("    if (current_position > title_length) { current_position = 0 };")
new_window.document.write("    setTimeout('scroll_title()',150);")
new_window.document.write("}")

/* Main function - reset_window */

new_window.document.write("function reset_window () {")

/* Set window title and scroll it */

new_window.document.write("    scroll_title();")

/* Resize the new window */

new_window.document.write('if (is_IE)');	/* tested OK Jan 20, 2003 */
new_window.document.write('{');
/*  These values work best if the "margin" value is not set in the <body> tag
new_window.document.write("w_size = 30 + (document.images[0].width);")
new_window.document.write("h_size = 65 + (document.images[0].height);")
*/
new_window.document.write("    w_size = 14 + document.images[0].width;")
new_window.document.write("    h_size = 40 + (document.images[0].height);")
new_window.document.write("    window.resizeTo(w_size,h_size);")
new_window.document.write('}');

new_window.document.write('if (is_Netscape)');	/* not tested yet */
new_window.document.write('{');
new_window.document.write('    window.innerWidth=document.images["the_image"].width;');
new_window.document.write('    window.innerHeight=document.images["the_image"].height;');
new_window.document.write('}');

/* End of function reset_window */

new_window.document.write('}');

/* End of <script> in <head> of new window */

new_window.document.write("</scr"+"ipt>")

/* End of <head> in the new window */

new_window.document.write("</head>")

/* Create the <body> HTML code in the new window */

new_window.document.write("<body ") 
new_window.document.write("    onLoad='reset_window()'") 
new_window.document.write("    style='margin:3px;'") 
new_window.document.write("    >") 
new_window.document.write('<img name="the_image" id="the_image" src="' + image_name + '">')

new_window.document.write("</body>")

/* End of <html> in the new window */

new_window.document.write("</html>")
new_window.document.close()
}
else
alert("Failed to open a new window!")
}


