﻿
function WindowOpenImage(url, width, height)
{
    var w;
    var d;
    var NS = (document.layers) ? 1 : 0;

    w = window.open("", 'ImageWindow', 'scrollbars,resizable,height=' + height + ',width=' + width + ',top=0' );

    w.document.open();

     if (NS) 
     {
         w.innerWidth = width;
         w.innerHeight = height;
     } 
    // else 
    // {
        // w.document.body.clientWidth = width;
        // w.document.body.clientHeight = height;
    //}

    w.document.write('<HTML><HEAD><TITLE>Image</TITLE></HEAD>');
    w.document.write('<BODY BACKGROUND="./images/DiamondW/blueGreen.gif">');
    w.document.write('');
    w.document.write('<DIV ALIGN=CENTER>');
    w.document.write('<IMG SRC=' + url + '>');
    w.document.write('<P>');

    w.document.write('<FORM METHOD=POST>');
    w.document.write('<INPUT TYPE="button" VALUE="Close" onClick="self.close()">');
    w.document.write('</FORM>');

    w.document.write('</DIV>');
    w.document.write('</BODY></HTML>');
    w.document.close();
}

function WindowOpenImageInfo(date, equipment, film)
{
    var w;
    var d;

    w = window.open("", 'ImageWindow', 'scrollbars,resizable,height=200,width=300,top=0' );

    w.document.open();

    w.document.write('<HTML><HEAD><TITLE>Image</TITLE></HEAD>');
    w.document.write('<BODY BACKGROUND="./images/DiamondW/blueGreen.gif">');
    w.document.write('');
    w.document.write('<H1>Image Information</H1>');

    w.document.write('<TABLE>');
    w.document.write('  <TR VALIGN=TOP>');
    w.document.write('    <TD>Date: <TD>' + date);
    w.document.write('  <TR VALIGN=TOP>');
    w.document.write('    <TD>Equipment: <TD>' + equipment);
    w.document.write('  <TR VALIGN=TOP>');
    w.document.write('    <TD>Film: <TD>' + film);
    w.document.write('</TABLE>');
    
    w.document.write('<P>');

    w.document.write('<DIV ALIGN=CENTER>');
    w.document.write('<FORM METHOD=POST>');
    w.document.write('<INPUT TYPE="button" VALUE="Close" onClick="self.close()">');
    w.document.write('</FORM>');
    w.document.write('</DIV>');

    w.document.write('</BODY></HTML>');

    // close the window
    w.document.close();

}

function kill()
{
	parent.window.close();
}

window.onload = window.focus;
window.onerror = stopError;

function stopError()
{
	return true;
}



// ------------------------------------------------------------------------------
// WindowShowImage - display an image in a new popup window
// ------------------------------------------------------------------------------
function WindowShowImage(url, width, height)
{
//    var w;
//   var d;
//    var NS = (document.layers) ? 1 : 0;
    w = window.open(url, 'ImageWindow', 'scrollbars,resizable,height=' + height + ',width=' + width + ',top=0' );
}


// ------------------------------------------------------------------------------
//                  trim
// Trim leading/trailing whitespace off string
// ------------------------------------------------------------------------------
function trim(str)  { return str.replace(/^\s+|\s+$/g, ''); }


// ------------------------------------------------------------------------------
// validateEmail - make sure the e-mail looks like something reasonable...
// ------------------------------------------------------------------------------
function validateEmail (email)
{
	var email_pattern = /^[a-zA-Z0-9_.-]+@[a-zA-Z0-9-]+.[a-zA-Z0-9-.]+$/;

	var tfld = trim(email);  // value of field with whitespace trimmed off
	return (email_pattern.test(tfld)) ;
}
