<!-- Begin

function frameWidth()
{
    var browser;

    browser = ( navigator.appName.indexOf( "Microsoft" )!= -1 ) ? "MS" : "Foo";

    if ( browser == "MS" )
        return( Math.round( document.body.offsetWidth * 0.90 ));
    else
        return( Math.round( window.innerWidth * 0.90 ));
}

function frameHeight()
{
    var browser;

    browser = ( navigator.appName.indexOf( "Microsoft" )!= -1 ) ? "MS" : "Foo";

    if ( browser == "MS" )
        return( Math.round( document.body.offsetHeight * 0.80 ));
    else
        return( Math.round( window.innerHeight * 0.80 ));
}

//var isLoaded = 0;
//
//function imageLoaded() 
//{
//    isLoaded = 1;
//}
//
//function XfitImage( URL ) 
//{
//    isLoaded = 0;
//
//    thisImage	  = new Image();	// load image
//    thisImage.src = URL;
//
//    thisImage.load;
//    thisImage.src.load;
//    thisImage.onLoad  = imageLoaded();
//    thisImage.onError = imageLoaded();
//    thisImage.onAbort = imageLoaded();
//
//    while ( !isLoaded );
////    while ( !thisImage.complete );
//
//    if ( thisImage.width > thisImage.height )
//        text = "<img src='" + URL + "' width='"  + frameWidth()  + "'>";
//    else
//        text = "<img src='" + URL + "' height='" + frameHeight() + "'>";
//
//    delete thisImage;
//
//    return( text );
//}

function fitImage( URL, vFlag )
{
//  text  = "<A HREF='" + URL + "' target='_top'>";
    text  = "<A HREF='" + URL + "' target='_blank'>";

    switch ( vFlag )
    {
	case -1:
	    text  = "<img src='" + URL + "' width='" + frameWidth() + "'>";
	    break;

	case  1:
	    text += "<img src='" + URL + "' height='" + frameHeight() + "'></a>";
	    break;

	default:
	    text += "<img src='" + URL + "' width='"  + frameWidth()  + "'></a>";
	    break;
    }

    return( text );
}

//function popupDisplay( URL, TEXT ) 
//{
//    windowprops = "left=50,top=50,width=,height=";
//
//    text = "<html><head><title>Lightning Rose</title></head><body bgcolor='black'text='red'>";
//
//    text += "<center><img src='" + URL + "'>";
//
//    text += "<br>" + TEXT ;
//
//    text += "</center></body></html>";
//
//    preview = window.open("", "preview", windowprops);
//    preview.document.open();
//    preview.document.write(text);
//    preview.document.close();
//}

function displayImage( URL, TEXT, vFlag ) 
{
    text  = "<html><head><title>Lightning Rose</title>";
//  text  = "<LINK REL='SHORTCUT ICON' HREF='../images/main/lr_icon.png'>";
    text  = "</head>";

    text += "<body bgcolor='black' link='black' vlink='black' text='red'>";

    text += "<center><br>" + fitImage( URL, vFlag ) + "<br>" + TEXT ;

    text += "<br><br>(Click on image to see full size in a new window)";
    text += "<br><br><INPUT TYPE='button' VALUE='Back' onClick='history.go(-1)'>";

//    text += "<br><br><A HREF='../index.htm' target='_top'>Lightning Rose Home</A>";

//    text += "<body onblur='self.focus();'>";
    text += "<script language='JavaScript'>window.focus();</script>";

    text += "</center></body></html>";

    window.document.write( text );
    window.document.close();
//    window.focus();
}

function displayImageAsIs( URL, TEXT )
{
    text = "<html><head><title>Lightning Rose</title></head><body bgcolor='black'text='red'>";

    text += "<center><br><img src='" + URL + "'>";

    text += "<br>" + TEXT ;

    text += "<br><br><INPUT TYPE='button' VALUE='Back' onClick='history.go(-1)'>";

    text += "</center></body></html>";

    window.document.write( text );
    window.document.close();
}

//  End -->
